├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── BaiduLBS_AndroidSDK_Lib.aar ├── lint.xml ├── map_key ├── release │ ├── app-release.apk │ └── output.json └── src │ ├── debug │ └── res │ │ └── values │ │ └── google_maps_api.xml │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── index.html │ ├── java │ │ └── com │ │ │ └── engineer │ │ │ ├── StatusBarUtil.kt │ │ │ ├── google │ │ │ └── GoogleMapsActivity.kt │ │ │ └── panorama │ │ │ ├── MainActivity.kt │ │ │ ├── PanoDemoApplication.java │ │ │ ├── bean │ │ │ ├── HotCityPanoBean.java │ │ │ └── PanoramaBean.java │ │ │ ├── interfaces │ │ │ └── SimplePanoListener.kt │ │ │ ├── ui │ │ │ ├── BaseFullScreenActivity.kt │ │ │ ├── FullActivity.kt │ │ │ ├── ListMapViewActivity.kt │ │ │ ├── ListPanoViewActivity.kt │ │ │ ├── MapViewActivity.java │ │ │ ├── MultiPanoViewActivity.kt │ │ │ ├── PanoPagerActivity.kt │ │ │ └── PanoViewActivity.java │ │ │ └── util │ │ │ ├── DeviceUtil.java │ │ │ ├── FileUtil.java │ │ │ ├── NotificationHelper.java │ │ │ ├── SavePhotoTask.java │ │ │ ├── ScreenView.java │ │ │ └── SystemExt.kt │ └── res │ │ ├── anim │ │ ├── pop_hidden_animation.xml │ │ └── pop_show_animation.xml │ │ ├── drawable-xxxhdpi │ │ ├── baidupano_floortab_arrow.9.png │ │ ├── baidupano_floortab_line.9.png │ │ ├── baidupano_indoor_exit.webp │ │ ├── baidupano_photo_default.9.png │ │ ├── button_down.9.png │ │ ├── button_on.9.png │ │ ├── checkout_pano_arrow.webp │ │ ├── ic_launcher.png │ │ ├── icon_marka.webp │ │ ├── icon_markb.webp │ │ ├── icon_markc.webp │ │ ├── pano_image_background.webp │ │ ├── pano_image_background_tip.webp │ │ ├── splash.webp │ │ ├── street_arrow.webp │ │ ├── wsdk_checkout_pano_arrow.webp │ │ ├── wsdk_pano_image_background.webp │ │ └── wsdk_pano_image_background_tip.webp │ │ ├── drawable │ │ ├── baidupano_shape_photocase.xml │ │ ├── baidupano_shape_photocase_selc.xml │ │ ├── baidupano_shape_phototxt_bg.xml │ │ ├── button_style.xml │ │ ├── ic_baseline_view_list_24.xml │ │ ├── ic_crop_black_24dp.xml │ │ ├── ic_format_list_bulleted_black_24dp.xml │ │ └── ic_more_vert_black_24dp.xml │ │ ├── layout │ │ ├── activity_full.xml │ │ ├── activity_google_maps.xml │ │ ├── activity_list_pano_view.xml │ │ ├── activity_main.xml │ │ ├── activity_mapview.xml │ │ ├── activity_multi_pano_view.xml │ │ ├── activity_pano_pager.xml │ │ ├── baidupano_photoalbum_container.xml │ │ ├── baidupano_singlephoto_layout.xml │ │ ├── list_item.xml │ │ ├── list_item_mapview.xml │ │ ├── pager_pano_item.xml │ │ ├── pano_overlay.xml │ │ ├── panodemo.xml │ │ └── panodemo_main.xml │ │ ├── values │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── network_security_config.xml │ └── release │ └── res │ └── values │ └── google_maps_api.xml ├── baidu_map_sdk ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── libs │ ├── BaiduLBS_android.aar │ ├── NaviTts.aar │ ├── arm64-v8a │ │ ├── libBDSpeechDecoder_V1.so │ │ ├── libBaiduMapSDK_base_v7_0_0.so │ │ ├── libBaiduMapSDK_map_for_navi_v7_0_0.so │ │ ├── libapp_BaiduNaviApplib.so │ │ ├── libapp_BaiduPanoramaAppLib.so │ │ ├── libbd_etts.so │ │ ├── libcrypto.so │ │ ├── libgnustl_shared.so │ │ ├── libindoor.so │ │ ├── liblocSDK8a.so │ │ └── libssl.so │ ├── armeabi-v7a │ │ ├── libBDSpeechDecoder_V1.so │ │ ├── libBaiduMapSDK_base_v7_0_0.so │ │ ├── libBaiduMapSDK_map_for_navi_v7_0_0.so │ │ ├── libapp_BaiduNaviApplib.so │ │ ├── libapp_BaiduPanoramaAppLib.so │ │ ├── libbd_etts.so │ │ ├── libcrypto.so │ │ ├── libgnustl_shared.so │ │ ├── libindoor.so │ │ ├── liblocSDK8a.so │ │ └── libssl.so │ ├── armeabi │ │ ├── libBaiduMapSDK_base_v7_0_0.so │ │ ├── libBaiduMapSDK_map_for_navi_v7_0_0.so │ │ ├── libapp_BaiduPanoramaAppLib.so │ │ ├── libcrypto.so │ │ ├── libgnustl_shared.so │ │ ├── libindoor.so │ │ ├── liblocSDK8a.so │ │ └── libssl.so │ ├── javapoet-1.9.0.jar │ ├── onsdk_all.aar │ ├── x86 │ │ ├── libBaiduMapSDK_base_v7_0_0.so │ │ ├── libBaiduMapSDK_map_for_navi_v7_0_0.so │ │ ├── libapp_BaiduPanoramaAppLib.so │ │ ├── libcrypto.so │ │ ├── libgnustl_shared.so │ │ ├── libindoor.so │ │ ├── liblocSDK8a.so │ │ └── libssl.so │ └── x86_64 │ │ ├── libBaiduMapSDK_base_v7_0_0.so │ │ ├── libBaiduMapSDK_map_for_navi_v7_0_0.so │ │ ├── libapp_BaiduPanoramaAppLib.so │ │ ├── libcrypto.so │ │ ├── libgnustl_shared.so │ │ ├── libindoor.so │ │ ├── liblocSDK8a.so │ │ └── libssl.so ├── proguard-navi.pro ├── proguard-rules.pro └── src │ └── main │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .idea/ 7 | .DS_Store 8 | /build 9 | /captures 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidPanoramaSample 2 | 仿百度地图街景页面,MapView显示在PanoView 上一层 3 | 4 | 5 | [ChinaMapView](https://github.com/NoEndToLF/ChinaMapView) -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | //apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | signingConfigs { 7 | debug { 8 | keyAlias 'map_key' 9 | keyPassword '123456' 10 | storeFile file("$rootDir/app/map_key") 11 | storePassword '123456' 12 | } 13 | release { 14 | keyAlias 'map_key' 15 | keyPassword '123456' 16 | storeFile file("$rootDir/app/map_key") 17 | storePassword '123456' 18 | } 19 | } 20 | namespace 'com.engineer.panorama' 21 | compileSdk 34 22 | 23 | defaultConfig { 24 | applicationId "com.engineer.panorama" 25 | minSdkVersion 21 26 | targetSdkVersion 34 27 | } 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | signingConfig = signingConfigs.release 32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 33 | } 34 | debug { 35 | signingConfig = signingConfigs.debug 36 | } 37 | } 38 | compileOptions { 39 | targetCompatibility = 1.8 40 | sourceCompatibility = 1.8 41 | } 42 | kotlinOptions { 43 | jvmTarget = "1.8" 44 | } 45 | } 46 | 47 | dependencies { 48 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 49 | 50 | implementation 'com.nex3z:flow-layout:1.3.1' 51 | implementation fileTree(include: ['*.jar'], dir: 'libs') 52 | implementation 'com.github.bumptech.glide:glide:4.16.0' 53 | implementation 'com.alibaba:fastjson:1.2.69' 54 | 55 | implementation 'com.github.tbruyelle:rxpermissions:0.10.2' 56 | implementation 'androidx.appcompat:appcompat:1.6.1' 57 | implementation 'com.google.android.material:material:1.12.0' 58 | implementation "io.reactivex.rxjava2:rxjava:2.2.21" 59 | implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' 60 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 61 | 62 | implementation "androidx.viewpager2:viewpager2:1.1.0" 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 64 | implementation 'com.google.android.gms:play-services-maps:18.2.0' 65 | implementation project(path: ':baidu_map_sdk') 66 | } 67 | -------------------------------------------------------------------------------- /app/libs/BaiduLBS_AndroidSDK_Lib.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/libs/BaiduLBS_AndroidSDK_Lib.aar -------------------------------------------------------------------------------- /app/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/map_key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/map_key -------------------------------------------------------------------------------- /app/release/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/release/app-release.apk -------------------------------------------------------------------------------- /app/release/output.json: -------------------------------------------------------------------------------- 1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] -------------------------------------------------------------------------------- /app/src/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | AIzaSyA2WkUCrKgrXQZhel7SiB0B3bBGCmdjOe4 24 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | 39 | 47 | 50 | 51 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 74 | 75 | 76 | 79 | 80 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /app/src/main/assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 14 | 显示/隐藏导航控件 15 | 16 | 17 |
18 |
19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/StatusBarUtil.kt: -------------------------------------------------------------------------------- 1 | package com.engineer 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.os.Build 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.view.Window 10 | import android.view.WindowManager 11 | import com.engineer.panorama.util.DeviceUtil 12 | 13 | object StatusBarUtil { 14 | 15 | fun translucentStatusBar(activity: Activity) { 16 | val window = activity.window 17 | 18 | // navigation_bar 不透明 19 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION) 20 | // 全屏 21 | 22 | // 全屏 23 | window.decorView.systemUiVisibility = 24 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 25 | 26 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 27 | // StatusBar 去除颜色 28 | cleanStatusBarBackgroundColor(activity) 29 | } else { 30 | // Content 填充 & StatusBar 颜色叠加 31 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) 32 | } 33 | 34 | // 35 | val contentView = window.findViewById(Window.ID_ANDROID_CONTENT) 36 | val contentChild = contentView.getChildAt(0) 37 | contentChild?.fitsSystemWindows =false 38 | } 39 | 40 | private fun cleanStatusBarBackgroundColor(activity: Activity) { 41 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 42 | val window = activity.window 43 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) 44 | window.statusBarColor = Color.TRANSPARENT 45 | } 46 | } 47 | 48 | /** 49 | * 设置 StatusBar 的文本颜色为黑色 50 | * 51 | * @link 52 | */ 53 | fun setStatusBarLightMode(activity: Activity, lightMode: Boolean) { 54 | DeviceUtil.setMIUIStatusBarLightMode(activity, lightMode) 55 | DeviceUtil.setFlymeStatusBarLightMode(activity, lightMode) 56 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 57 | val decorView = activity.window.decorView 58 | var flag = decorView.systemUiVisibility 59 | if (lightMode) { 60 | flag = flag or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 61 | } else { 62 | flag = flag and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() 63 | } 64 | decorView.systemUiVisibility = flag 65 | } 66 | } 67 | 68 | fun getStatusBarHeight(context: Context):Int { 69 | val resourceId = context.resources 70 | .getIdentifier("status_bar_height", "dimen", "android") 71 | return context.resources.getDimensionPixelSize(resourceId) 72 | } 73 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/google/GoogleMapsActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.google 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.engineer.panorama.R 6 | 7 | import com.google.android.gms.maps.CameraUpdateFactory 8 | import com.google.android.gms.maps.GoogleMap 9 | import com.google.android.gms.maps.OnMapReadyCallback 10 | import com.google.android.gms.maps.SupportMapFragment 11 | import com.google.android.gms.maps.model.LatLng 12 | import com.google.android.gms.maps.model.MarkerOptions 13 | 14 | class GoogleMapsActivity : AppCompatActivity(), OnMapReadyCallback { 15 | 16 | private lateinit var mMap: GoogleMap 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContentView(R.layout.activity_google_maps) 21 | // Obtain the SupportMapFragment and get notified when the map is ready to be used. 22 | val mapFragment = supportFragmentManager 23 | .findFragmentById(R.id.map) as SupportMapFragment 24 | mapFragment.getMapAsync(this) 25 | } 26 | 27 | /** 28 | * Manipulates the map once available. 29 | * This callback is triggered when the map is ready to be used. 30 | * This is where we can add markers or lines, add listeners or move the camera. In this case, 31 | * we just add a marker near Sydney, Australia. 32 | * If Google Play services is not installed on the device, the user will be prompted to install 33 | * it inside the SupportMapFragment. This method will only be triggered once the user has 34 | * installed Google Play services and returned to the app. 35 | */ 36 | override fun onMapReady(googleMap: GoogleMap) { 37 | mMap = googleMap 38 | 39 | // Add a marker in Sydney and move the camera 40 | val sydney = LatLng(-34.0, 151.0) 41 | mMap.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney")) 42 | mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)) 43 | } 44 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama 2 | 3 | import android.content.Intent 4 | import android.graphics.Color 5 | import android.os.Bundle 6 | import android.view.Gravity 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.widget.Button 10 | import android.widget.FrameLayout 11 | import android.widget.FrameLayout.LayoutParams 12 | import android.widget.TextView 13 | import androidx.appcompat.app.AppCompatActivity 14 | import androidx.core.view.setMargins 15 | import com.engineer.google.GoogleMapsActivity 16 | import com.engineer.panorama.ui.FullActivity 17 | import com.engineer.panorama.ui.ListMapViewActivity 18 | import com.engineer.panorama.ui.ListPanoViewActivity 19 | import com.engineer.panorama.ui.MapViewActivity 20 | import com.engineer.panorama.ui.MultiPanoViewActivity 21 | import com.engineer.panorama.ui.PanoPagerActivity 22 | import com.engineer.panorama.util.dp 23 | 24 | 25 | class MainActivity : AppCompatActivity() { 26 | 27 | override fun onCreate(savedInstanceState: Bundle?) { 28 | super.onCreate(savedInstanceState) 29 | setContentView(R.layout.activity_main) 30 | 31 | findViewById(R.id.map).setOnClickListener { 32 | startActivity(Intent(this, MapViewActivity::class.java)) 33 | } 34 | 35 | findViewById(R.id.full_screen).setOnClickListener { 36 | startActivity(Intent(this, FullActivity::class.java)) 37 | } 38 | 39 | findViewById(R.id.map_list).setOnClickListener { 40 | startActivity(Intent(this, ListMapViewActivity::class.java)) 41 | } 42 | 43 | findViewById(R.id.pano_list).setOnClickListener { 44 | startActivity(Intent(this, ListPanoViewActivity::class.java)) 45 | } 46 | 47 | findViewById(R.id.pano_pager).setOnClickListener { 48 | startActivity(Intent(this, PanoPagerActivity::class.java)) 49 | } 50 | 51 | findViewById(R.id.multi_pano).setOnClickListener { 52 | startActivity(Intent(this, MultiPanoViewActivity::class.java)) 53 | } 54 | 55 | findViewById(R.id.google_map).setOnClickListener { 56 | startActivity(Intent(this, GoogleMapsActivity::class.java)) 57 | } 58 | 59 | val textView = TextView(this) 60 | textView.text = "100.dp = ${100.dp}" 61 | val k = LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) 62 | k.setMargins(10.dp) 63 | 64 | val k1 = FrameLayout(this) 65 | k1.setBackgroundColor(Color.GREEN) 66 | val kk = FrameLayout.LayoutParams(10.dp, 10.dp) 67 | 68 | val area = FrameLayout(this) 69 | area.setBackgroundColor(Color.MAGENTA) 70 | val pp = FrameLayout.LayoutParams(100.dp, 100.dp) 71 | pp.gravity = Gravity.END or Gravity.BOTTOM 72 | 73 | area.addView(k1, kk) 74 | area.addView(textView, k) 75 | addContentView(area, pp) 76 | 77 | 78 | val exit = Button(this) 79 | exit.text = "exit" 80 | exit.setOnClickListener { finish() } 81 | val p = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) 82 | p.marginEnd = 100.dp 83 | p.bottomMargin = 100.dp 84 | p.gravity = Gravity.END or Gravity.BOTTOM 85 | addContentView(exit, p) 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/PanoDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.util.Log; 6 | import android.widget.Toast; 7 | 8 | import com.baidu.lbsapi.BMapManager; 9 | import com.baidu.lbsapi.MKGeneralListener; 10 | import com.baidu.mapapi.SDKInitializer; 11 | 12 | public class PanoDemoApplication extends Application { 13 | private static final String TAG = "PanoDemoApplication"; 14 | private static PanoDemoApplication mInstance = null; 15 | public BMapManager mBMapManager = null; 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | mInstance = this; 21 | SDKInitializer.initialize(this); 22 | initEngineManager(this); 23 | } 24 | 25 | public void initEngineManager(Context context) { 26 | if (mBMapManager == null) { 27 | mBMapManager = new BMapManager(context); 28 | } 29 | 30 | if (!mBMapManager.init(new MyGeneralListener())) { 31 | Toast.makeText(PanoDemoApplication.getInstance().getApplicationContext(), "BMapManager 初始化错误!", 32 | Toast.LENGTH_LONG).show(); 33 | } 34 | } 35 | 36 | public static PanoDemoApplication getInstance() { 37 | return mInstance; 38 | } 39 | 40 | // 常用事件监听,用来处理通常的网络错误,授权验证错误等 41 | static class MyGeneralListener implements MKGeneralListener { 42 | 43 | @Override 44 | public void onGetPermissionState(int iError) { 45 | Log.d(TAG, "onGetPermissionState() called with: iError = [" + iError + "]"); 46 | // 非零值表示key验证未通过 47 | if (iError != 0) { 48 | // 授权Key错误: 49 | Toast.makeText(PanoDemoApplication.getInstance().getApplicationContext(), 50 | "请在AndoridManifest.xml中输入正确的授权Key,并检查您的网络连接是否正常!error: " + iError, Toast.LENGTH_LONG).show(); 51 | } else { 52 | Toast.makeText(PanoDemoApplication.getInstance().getApplicationContext(), "key认证成功", Toast.LENGTH_LONG) 53 | .show(); 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/bean/HotCityPanoBean.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.bean; 2 | 3 | /** 4 | * Created by rookie on 2016/8/31. 5 | */ 6 | public class HotCityPanoBean { 7 | private double latitude,longitude; 8 | private String pid,name; 9 | 10 | public double getLatitude() { 11 | return latitude; 12 | } 13 | 14 | public void setLatitude(double latitude) { 15 | this.latitude = latitude; 16 | } 17 | 18 | public double getLongitude() { 19 | return longitude; 20 | } 21 | 22 | public void setLongitude(double longitude) { 23 | this.longitude = longitude; 24 | } 25 | 26 | public String getPid() { 27 | return pid; 28 | } 29 | 30 | public void setPid(String pid) { 31 | this.pid = pid; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/bean/PanoramaBean.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by rookie on 2016/8/31. 7 | */ 8 | public class PanoramaBean { 9 | 10 | /** 11 | * Admission : GS(2015)2210 12 | * Date : 20160125 13 | * DeviceHeight : 2.32 14 | * FileTag : pano_cfg 15 | * Heading : 4.78 16 | * ID : 09002200011601251135086222K 17 | * ImgLayer : [{"BlockX":2,"BlockY":1,"ImgFormat":"jpg","ImgLevel":1},{"BlockX":4,"BlockY":2,"ImgFormat":"jpg","ImgLevel":2},{"BlockX":8,"BlockY":4,"ImgFormat":"jpg","ImgLevel":3},{"BlockX":16,"BlockY":8,"ImgFormat":"jpg","ImgLevel":4}] 18 | * LayerCount : 4 19 | * Links : [{"CPointX":1295771406,"CPointY":483289453,"DIR":177,"PID":"09002200011601251135064362K","RID":"60910a-aa1e-ab69-ac1a-94c658","Type":"street","X":1295771457,"Y":483288360}] 20 | * Mode : day 21 | * MoveDir : 4.776 22 | * NorthDir : 265.22 23 | * Obsolete : 0 24 | * Pitch : -0.245 25 | * PoiDir : null 26 | * Provider : 9 27 | * Rname : 旧鼓楼外大街 28 | * Roads : [{"ID":"575750-8882-e57f-532f-473358","IsCurrent":1,"Name":"旧鼓楼外大街","Panos":[{"DIR":178,"Order":0,"PID":"0100220000130809125921503J2","Type":"street","X":1295770947,"Y":483291330},{"DIR":0,"Order":1,"PID":"09002200011601251135086222K","Type":"street","X":1295771476,"Y":483289392}],"Width":550},{"ID":"60910a-aa1e-ab69-ac1a-94c658","IsCurrent":0,"Name":"旧鼓楼外大街","Width":550}] 29 | * Roll : 0.264 30 | * SwitchID : [] 31 | * Time : 201601 32 | * TimeLine : [{"ID":"09002200011601251135086222K","IsCurrent":1,"Time":"day","TimeDir":"","TimeLine":"201601","Year":"2016"},{"ID":"0100220000130809125918584J2","IsCurrent":0,"Time":"day","TimeDir":"obsolete","TimeLine":"201308","Year":"2013"}] 33 | * Type : street 34 | * UserID : 35 | * Version : 0 36 | * Z : 39.36 37 | * format_v : 0 38 | * panoinfo : null 39 | * plane : 40 | * procdate : 20160621 41 | * X : 12957714 42 | * RX : 12957717 43 | * Y : 4832893 44 | * RY : 4832894 45 | */ 46 | 47 | private String Admission; 48 | private String Date; 49 | private double DeviceHeight; 50 | private String FileTag; 51 | private double Heading; 52 | private String ID; 53 | private int LayerCount; 54 | private String Mode; 55 | private double MoveDir; 56 | private double NorthDir; 57 | private int Obsolete; 58 | private double Pitch; 59 | private Object PoiDir; 60 | private int Provider; 61 | private String Rname; 62 | private double Roll; 63 | private String Time; 64 | private String Type; 65 | private String UserID; 66 | private String Version; 67 | private double Z; 68 | private String format_v; 69 | private Object panoinfo; 70 | private String plane; 71 | private String procdate; 72 | private int X; 73 | private int RX; 74 | private int Y; 75 | private int RY; 76 | /** 77 | * BlockX : 2 78 | * BlockY : 1 79 | * ImgFormat : jpg 80 | * ImgLevel : 1 81 | */ 82 | 83 | private List ImgLayer; 84 | /** 85 | * CPointX : 1295771406 86 | * CPointY : 483289453 87 | * DIR : 177 88 | * PID : 09002200011601251135064362K 89 | * RID : 60910a-aa1e-ab69-ac1a-94c658 90 | * Type : street 91 | * X : 1295771457 92 | * Y : 483288360 93 | */ 94 | 95 | private List Links; 96 | /** 97 | * ID : 575750-8882-e57f-532f-473358 98 | * IsCurrent : 1 99 | * Name : 旧鼓楼外大街 100 | * Panos : [{"DIR":178,"Order":0,"PID":"0100220000130809125921503J2","Type":"street","X":1295770947,"Y":483291330},{"DIR":0,"Order":1,"PID":"09002200011601251135086222K","Type":"street","X":1295771476,"Y":483289392}] 101 | * Width : 550 102 | */ 103 | 104 | private List Roads; 105 | private List SwitchID; 106 | /** 107 | * ID : 09002200011601251135086222K 108 | * IsCurrent : 1 109 | * Time : day 110 | * TimeDir : 111 | * TimeLine : 201601 112 | * Year : 2016 113 | */ 114 | 115 | private List TimeLine; 116 | 117 | public String getAdmission() { 118 | return Admission; 119 | } 120 | 121 | public void setAdmission(String Admission) { 122 | this.Admission = Admission; 123 | } 124 | 125 | public String getDate() { 126 | return Date; 127 | } 128 | 129 | public void setDate(String Date) { 130 | this.Date = Date; 131 | } 132 | 133 | public double getDeviceHeight() { 134 | return DeviceHeight; 135 | } 136 | 137 | public void setDeviceHeight(double DeviceHeight) { 138 | this.DeviceHeight = DeviceHeight; 139 | } 140 | 141 | public String getFileTag() { 142 | return FileTag; 143 | } 144 | 145 | public void setFileTag(String FileTag) { 146 | this.FileTag = FileTag; 147 | } 148 | 149 | public double getHeading() { 150 | return Heading; 151 | } 152 | 153 | public void setHeading(double Heading) { 154 | this.Heading = Heading; 155 | } 156 | 157 | public String getID() { 158 | return ID; 159 | } 160 | 161 | public void setID(String ID) { 162 | this.ID = ID; 163 | } 164 | 165 | public int getLayerCount() { 166 | return LayerCount; 167 | } 168 | 169 | public void setLayerCount(int LayerCount) { 170 | this.LayerCount = LayerCount; 171 | } 172 | 173 | public String getMode() { 174 | return Mode; 175 | } 176 | 177 | public void setMode(String Mode) { 178 | this.Mode = Mode; 179 | } 180 | 181 | public double getMoveDir() { 182 | return MoveDir; 183 | } 184 | 185 | public void setMoveDir(double MoveDir) { 186 | this.MoveDir = MoveDir; 187 | } 188 | 189 | public double getNorthDir() { 190 | return NorthDir; 191 | } 192 | 193 | public void setNorthDir(double NorthDir) { 194 | this.NorthDir = NorthDir; 195 | } 196 | 197 | public int getObsolete() { 198 | return Obsolete; 199 | } 200 | 201 | public void setObsolete(int Obsolete) { 202 | this.Obsolete = Obsolete; 203 | } 204 | 205 | public double getPitch() { 206 | return Pitch; 207 | } 208 | 209 | public void setPitch(double Pitch) { 210 | this.Pitch = Pitch; 211 | } 212 | 213 | public Object getPoiDir() { 214 | return PoiDir; 215 | } 216 | 217 | public void setPoiDir(Object PoiDir) { 218 | this.PoiDir = PoiDir; 219 | } 220 | 221 | public int getProvider() { 222 | return Provider; 223 | } 224 | 225 | public void setProvider(int Provider) { 226 | this.Provider = Provider; 227 | } 228 | 229 | public String getRname() { 230 | return Rname; 231 | } 232 | 233 | public void setRname(String Rname) { 234 | this.Rname = Rname; 235 | } 236 | 237 | public double getRoll() { 238 | return Roll; 239 | } 240 | 241 | public void setRoll(double Roll) { 242 | this.Roll = Roll; 243 | } 244 | 245 | public String getTime() { 246 | return Time; 247 | } 248 | 249 | public void setTime(String Time) { 250 | this.Time = Time; 251 | } 252 | 253 | public String getType() { 254 | return Type; 255 | } 256 | 257 | public void setType(String Type) { 258 | this.Type = Type; 259 | } 260 | 261 | public String getUserID() { 262 | return UserID; 263 | } 264 | 265 | public void setUserID(String UserID) { 266 | this.UserID = UserID; 267 | } 268 | 269 | public String getVersion() { 270 | return Version; 271 | } 272 | 273 | public void setVersion(String Version) { 274 | this.Version = Version; 275 | } 276 | 277 | public double getZ() { 278 | return Z; 279 | } 280 | 281 | public void setZ(double Z) { 282 | this.Z = Z; 283 | } 284 | 285 | public String getFormat_v() { 286 | return format_v; 287 | } 288 | 289 | public void setFormat_v(String format_v) { 290 | this.format_v = format_v; 291 | } 292 | 293 | public Object getPanoinfo() { 294 | return panoinfo; 295 | } 296 | 297 | public void setPanoinfo(Object panoinfo) { 298 | this.panoinfo = panoinfo; 299 | } 300 | 301 | public String getPlane() { 302 | return plane; 303 | } 304 | 305 | public void setPlane(String plane) { 306 | this.plane = plane; 307 | } 308 | 309 | public String getProcdate() { 310 | return procdate; 311 | } 312 | 313 | public void setProcdate(String procdate) { 314 | this.procdate = procdate; 315 | } 316 | 317 | public int getX() { 318 | return X; 319 | } 320 | 321 | public void setX(int X) { 322 | this.X = X; 323 | } 324 | 325 | public int getRX() { 326 | return RX; 327 | } 328 | 329 | public void setRX(int RX) { 330 | this.RX = RX; 331 | } 332 | 333 | public int getY() { 334 | return Y; 335 | } 336 | 337 | public void setY(int Y) { 338 | this.Y = Y; 339 | } 340 | 341 | public int getRY() { 342 | return RY; 343 | } 344 | 345 | public void setRY(int RY) { 346 | this.RY = RY; 347 | } 348 | 349 | public List getImgLayer() { 350 | return ImgLayer; 351 | } 352 | 353 | public void setImgLayer(List ImgLayer) { 354 | this.ImgLayer = ImgLayer; 355 | } 356 | 357 | public List getLinks() { 358 | return Links; 359 | } 360 | 361 | public void setLinks(List Links) { 362 | this.Links = Links; 363 | } 364 | 365 | public List getRoads() { 366 | return Roads; 367 | } 368 | 369 | public void setRoads(List Roads) { 370 | this.Roads = Roads; 371 | } 372 | 373 | public List getSwitchID() { 374 | return SwitchID; 375 | } 376 | 377 | public void setSwitchID(List SwitchID) { 378 | this.SwitchID = SwitchID; 379 | } 380 | 381 | public List getTimeLine() { 382 | return TimeLine; 383 | } 384 | 385 | public void setTimeLine(List TimeLine) { 386 | this.TimeLine = TimeLine; 387 | } 388 | 389 | public static class ImgLayerBean { 390 | private int BlockX; 391 | private int BlockY; 392 | private String ImgFormat; 393 | private int ImgLevel; 394 | 395 | public int getBlockX() { 396 | return BlockX; 397 | } 398 | 399 | public void setBlockX(int BlockX) { 400 | this.BlockX = BlockX; 401 | } 402 | 403 | public int getBlockY() { 404 | return BlockY; 405 | } 406 | 407 | public void setBlockY(int BlockY) { 408 | this.BlockY = BlockY; 409 | } 410 | 411 | public String getImgFormat() { 412 | return ImgFormat; 413 | } 414 | 415 | public void setImgFormat(String ImgFormat) { 416 | this.ImgFormat = ImgFormat; 417 | } 418 | 419 | public int getImgLevel() { 420 | return ImgLevel; 421 | } 422 | 423 | public void setImgLevel(int ImgLevel) { 424 | this.ImgLevel = ImgLevel; 425 | } 426 | } 427 | 428 | public static class LinksBean { 429 | private int CPointX; 430 | private int CPointY; 431 | private int DIR; 432 | private String PID; 433 | private String RID; 434 | private String Type; 435 | private double X; 436 | private double Y; 437 | 438 | public int getCPointX() { 439 | return CPointX; 440 | } 441 | 442 | public void setCPointX(int CPointX) { 443 | this.CPointX = CPointX; 444 | } 445 | 446 | public int getCPointY() { 447 | return CPointY; 448 | } 449 | 450 | public void setCPointY(int CPointY) { 451 | this.CPointY = CPointY; 452 | } 453 | 454 | public int getDIR() { 455 | return DIR; 456 | } 457 | 458 | public void setDIR(int DIR) { 459 | this.DIR = DIR; 460 | } 461 | 462 | public String getPID() { 463 | return PID; 464 | } 465 | 466 | public void setPID(String PID) { 467 | this.PID = PID; 468 | } 469 | 470 | public String getRID() { 471 | return RID; 472 | } 473 | 474 | public void setRID(String RID) { 475 | this.RID = RID; 476 | } 477 | 478 | public String getType() { 479 | return Type; 480 | } 481 | 482 | public void setType(String Type) { 483 | this.Type = Type; 484 | } 485 | 486 | public double getX() { 487 | return X; 488 | } 489 | 490 | public void setX(double X) { 491 | this.X = X; 492 | } 493 | 494 | public double getY() { 495 | return Y; 496 | } 497 | 498 | public void setY(double Y) { 499 | this.Y = Y; 500 | } 501 | } 502 | 503 | public static class RoadsBean { 504 | private String ID; 505 | private int IsCurrent; 506 | private String Name; 507 | private int Width; 508 | /** 509 | * DIR : 178 510 | * Order : 0 511 | * PID : 0100220000130809125921503J2 512 | * Type : street 513 | * X : 1295770947 514 | * Y : 483291330 515 | */ 516 | 517 | private List Panos; 518 | 519 | public String getID() { 520 | return ID; 521 | } 522 | 523 | public void setID(String ID) { 524 | this.ID = ID; 525 | } 526 | 527 | public int getIsCurrent() { 528 | return IsCurrent; 529 | } 530 | 531 | public void setIsCurrent(int IsCurrent) { 532 | this.IsCurrent = IsCurrent; 533 | } 534 | 535 | public String getName() { 536 | return Name; 537 | } 538 | 539 | public void setName(String Name) { 540 | this.Name = Name; 541 | } 542 | 543 | public int getWidth() { 544 | return Width; 545 | } 546 | 547 | public void setWidth(int Width) { 548 | this.Width = Width; 549 | } 550 | 551 | public List getPanos() { 552 | return Panos; 553 | } 554 | 555 | public void setPanos(List Panos) { 556 | this.Panos = Panos; 557 | } 558 | 559 | public static class PanosBean { 560 | private int DIR; 561 | private int Order; 562 | private String PID; 563 | private String Type; 564 | private int X; 565 | private int Y; 566 | 567 | public int getDIR() { 568 | return DIR; 569 | } 570 | 571 | public void setDIR(int DIR) { 572 | this.DIR = DIR; 573 | } 574 | 575 | public int getOrder() { 576 | return Order; 577 | } 578 | 579 | public void setOrder(int Order) { 580 | this.Order = Order; 581 | } 582 | 583 | public String getPID() { 584 | return PID; 585 | } 586 | 587 | public void setPID(String PID) { 588 | this.PID = PID; 589 | } 590 | 591 | public String getType() { 592 | return Type; 593 | } 594 | 595 | public void setType(String Type) { 596 | this.Type = Type; 597 | } 598 | 599 | public int getX() { 600 | return X; 601 | } 602 | 603 | public void setX(int X) { 604 | this.X = X; 605 | } 606 | 607 | public int getY() { 608 | return Y; 609 | } 610 | 611 | public void setY(int Y) { 612 | this.Y = Y; 613 | } 614 | } 615 | } 616 | 617 | public static class TimeLineBean { 618 | private String ID; 619 | private int IsCurrent; 620 | private String Time; 621 | private String TimeDir; 622 | private String TimeLine; 623 | private String Year; 624 | 625 | public String getID() { 626 | return ID; 627 | } 628 | 629 | public void setID(String ID) { 630 | this.ID = ID; 631 | } 632 | 633 | public int getIsCurrent() { 634 | return IsCurrent; 635 | } 636 | 637 | public void setIsCurrent(int IsCurrent) { 638 | this.IsCurrent = IsCurrent; 639 | } 640 | 641 | public String getTime() { 642 | return Time; 643 | } 644 | 645 | public void setTime(String Time) { 646 | this.Time = Time; 647 | } 648 | 649 | public String getTimeDir() { 650 | return TimeDir; 651 | } 652 | 653 | public void setTimeDir(String TimeDir) { 654 | this.TimeDir = TimeDir; 655 | } 656 | 657 | public String getTimeLine() { 658 | return TimeLine; 659 | } 660 | 661 | public void setTimeLine(String TimeLine) { 662 | this.TimeLine = TimeLine; 663 | } 664 | 665 | public String getYear() { 666 | return Year; 667 | } 668 | 669 | public void setYear(String Year) { 670 | this.Year = Year; 671 | } 672 | } 673 | } 674 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/interfaces/SimplePanoListener.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.interfaces 2 | 3 | import com.baidu.lbsapi.panoramaview.PanoramaViewListener 4 | 5 | /** 6 | * Created on 2020/8/15. 7 | * @author rookie 8 | */ 9 | open class SimplePanoListener : PanoramaViewListener { 10 | override fun onCustomMarkerClick(p0: String?) { 11 | 12 | } 13 | 14 | override fun onLoadPanoramaBegin() { 15 | 16 | } 17 | 18 | override fun onLoadPanoramaEnd(p0: String?) { 19 | 20 | } 21 | 22 | override fun onMessage(p0: String?, p1: Int) { 23 | 24 | } 25 | 26 | override fun onDescriptionLoadEnd(p0: String?) { 27 | 28 | } 29 | 30 | override fun onLoadPanoramaError(p0: String?) { 31 | 32 | } 33 | 34 | override fun onMoveStart() { 35 | 36 | } 37 | 38 | override fun onMoveEnd() { 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/BaseFullScreenActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import android.os.Bundle 4 | import android.view.Gravity 5 | import android.view.ViewGroup.LayoutParams 6 | import android.widget.Button 7 | import android.widget.FrameLayout 8 | import androidx.appcompat.app.AppCompatActivity 9 | import com.engineer.StatusBarUtil 10 | import com.engineer.panorama.util.dp 11 | 12 | abstract class BaseFullScreenActivity : AppCompatActivity() { 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | setContentView(provideLayout()) 17 | StatusBarUtil.translucentStatusBar(this) 18 | addExitButton() 19 | } 20 | 21 | abstract fun provideLayout(): Int 22 | 23 | private fun addExitButton() { 24 | val button = Button(this) 25 | button.text = "exit" 26 | button.setOnClickListener { finish() } 27 | val p = FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) 28 | p.marginEnd = 15.dp 29 | p.topMargin = 65.dp 30 | p.gravity = Gravity.END 31 | addContentView(button, p) 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/FullActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import com.engineer.panorama.R 4 | 5 | class FullActivity : BaseFullScreenActivity() { 6 | 7 | override fun provideLayout(): Int { 8 | return R.layout.activity_full 9 | } 10 | } -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/ListMapViewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.appcompat.app.AppCompatActivity 8 | import androidx.recyclerview.widget.LinearLayoutManager 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.baidu.mapapi.map.MapStatusUpdateFactory 11 | import com.baidu.mapapi.map.TextureMapView 12 | import com.baidu.mapapi.model.LatLng 13 | import com.engineer.panorama.R 14 | 15 | 16 | class ListMapViewActivity : BaseFullScreenActivity() { 17 | private var datas: ArrayList = ArrayList() 18 | private lateinit var adapter: MyAdapter 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | 22 | val list = findViewById(R.id.list) 23 | list.layoutManager = LinearLayoutManager(this) 24 | adapter = MyAdapter(datas) 25 | list.adapter = adapter 26 | 27 | refresh() 28 | } 29 | 30 | override fun provideLayout(): Int { 31 | return R.layout.activity_list_pano_view 32 | } 33 | 34 | private fun refresh() { 35 | 36 | 37 | val GEO_BEIJING = LatLng(39.945, 116.404) 38 | for (i in 0..10) { 39 | val delta = i / 10f 40 | val data = LatLng(GEO_BEIJING.latitude + delta, GEO_BEIJING.longitude + delta) 41 | datas.add(data) 42 | } 43 | adapter.notifyDataSetChanged() 44 | } 45 | 46 | 47 | private inner class MyAdapter(var datas: ArrayList) : RecyclerView.Adapter() { 48 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyHolder { 49 | val view = LayoutInflater.from(parent.context).inflate(R.layout.list_item_mapview, parent, false) 50 | 51 | return MyHolder(view) 52 | } 53 | 54 | override fun onBindViewHolder(holder: MyHolder, position: Int) { 55 | val status = MapStatusUpdateFactory.newLatLng(datas[position]) 56 | holder.mapview.map.setMapStatus(status) 57 | } 58 | 59 | 60 | override fun getItemCount(): Int { 61 | return datas.size 62 | } 63 | 64 | 65 | inner class MyHolder(view: View) : RecyclerView.ViewHolder(view) { 66 | val mapview = view.findViewById(R.id.map_item) 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/ListPanoViewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.SurfaceView 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.webkit.WebView 9 | import android.widget.Toast 10 | import androidx.appcompat.app.AppCompatActivity 11 | import androidx.recyclerview.widget.LinearLayoutManager 12 | import androidx.recyclerview.widget.RecyclerView 13 | import com.baidu.lbsapi.panoramaview.PanoramaView 14 | import com.engineer.panorama.R 15 | 16 | class ListPanoViewActivity : BaseFullScreenActivity() { 17 | private var datas: ArrayList = ArrayList() 18 | private lateinit var adapter: MyAdapter 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | 22 | val list = findViewById(R.id.list) 23 | list.layoutManager = LinearLayoutManager(this) 24 | adapter = MyAdapter(datas) 25 | list.adapter = adapter 26 | 27 | refresh() 28 | } 29 | 30 | override fun provideLayout(): Int { 31 | return R.layout.activity_list_pano_view 32 | } 33 | 34 | private fun refresh() { 35 | datas.add("1400220012180629140838219UZ") 36 | datas.add("0802150001151204150545865UZ") 37 | datas.add("09002200001503210057381717E") 38 | datas.add("1802100000140610112407862IN") 39 | datas.add("1400030012180614003743111UZ") 40 | datas.add("09002500001505030202473035X") 41 | datas.add("0900600012170406114723000IN") 42 | datas.add("0901740000071126021842800IN") 43 | datas.add("1402430012180315162159339UZ") 44 | adapter.notifyDataSetChanged() 45 | } 46 | 47 | private fun getSurfaceView(panoramaView: PanoramaView?): SurfaceView? { 48 | var mSurfaceView: SurfaceView? = null 49 | if (panoramaView != null && panoramaView.childCount > 0) { 50 | val temp = panoramaView.getChildAt(0) 51 | if (temp is SurfaceView) { 52 | mSurfaceView = temp 53 | Toast.makeText(this, "success", Toast.LENGTH_SHORT).show() 54 | } 55 | } 56 | return mSurfaceView 57 | } 58 | 59 | private inner class MyAdapter(var datas: ArrayList) : RecyclerView.Adapter() { 60 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyHolder { 61 | val view = LayoutInflater.from(parent.context).inflate(R.layout.list_item, parent, false) 62 | 63 | return MyHolder(view) 64 | } 65 | 66 | override fun onBindViewHolder(holder: MyHolder, position: Int) { 67 | 68 | val LOCAL_URL = "https://www.baidu.com" 69 | holder.panoview.loadUrl(LOCAL_URL) 70 | } 71 | 72 | 73 | override fun getItemCount(): Int { 74 | return datas.size 75 | } 76 | 77 | 78 | inner class MyHolder(view: View) : RecyclerView.ViewHolder(view) { 79 | val panoview = view.findViewById(R.id.panorama_item) 80 | val settings = panoview.settings 81 | 82 | init { 83 | settings.javaScriptEnabled = true 84 | settings.domStorageEnabled = true 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/MapViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.widget.ImageView; 10 | 11 | import com.baidu.lbsapi.model.BaiduPanoData; 12 | import com.baidu.lbsapi.panoramaview.PanoramaRequest; 13 | import com.baidu.mapapi.map.BaiduMap; 14 | import com.baidu.mapapi.map.BitmapDescriptor; 15 | import com.baidu.mapapi.map.BitmapDescriptorFactory; 16 | import com.baidu.mapapi.map.InfoWindow; 17 | import com.baidu.mapapi.map.MapStatus; 18 | import com.baidu.mapapi.map.MapStatusUpdate; 19 | import com.baidu.mapapi.map.MapStatusUpdateFactory; 20 | import com.baidu.mapapi.map.MapView; 21 | import com.baidu.mapapi.map.MarkerOptions; 22 | import com.baidu.mapapi.map.OverlayOptions; 23 | import com.baidu.mapapi.model.LatLng; 24 | import com.bumptech.glide.Glide; 25 | import com.engineer.StatusBarUtil; 26 | import com.engineer.panorama.R; 27 | 28 | import io.reactivex.Observable; 29 | import io.reactivex.ObservableOnSubscribe; 30 | import io.reactivex.android.schedulers.AndroidSchedulers; 31 | import io.reactivex.functions.Consumer; 32 | import io.reactivex.schedulers.Schedulers; 33 | 34 | /** 35 | * Created by rookie on 2016/6/21. 36 | */ 37 | public class MapViewActivity extends BaseFullScreenActivity { 38 | private Context mContext; 39 | 40 | private MapView mMapView; 41 | private BaiduMap mBaiduMap; 42 | //添加Marker 43 | private LatLng point; 44 | //构建Marker图标 45 | private BitmapDescriptor bitmap; 46 | //构建MarkerOption,用于在地图上添加Marker 47 | private OverlayOptions option; 48 | 49 | private final String baseUrl = "http://pcsv1.map.bdimg.com/scape/?qt=pdata&pos=0_0&z=0&sid="; 50 | 51 | 52 | /** 53 | * 假设我们当前的位置在此 54 | */ 55 | private final double latitude = 39.963175; 56 | private final double longitude = 116.400244; 57 | 58 | //添加自定义View至mapView 59 | private View view; 60 | private ImageView pic; 61 | 62 | @Override 63 | protected void onCreate(Bundle savedInstanceState) { 64 | super.onCreate(savedInstanceState); 65 | // setContentView(R.layout.activity_mapview); 66 | mContext = this; 67 | StatusBarUtil.INSTANCE.setStatusBarLightMode(this,true); 68 | mMapView = (MapView) findViewById(R.id.bmapView); 69 | 70 | 71 | mBaiduMap = mMapView.getMap(); 72 | //定义Maker坐标点 73 | point = new LatLng(latitude, longitude); 74 | //定义地图状态 75 | final MapStatus mMapStatus = new MapStatus.Builder() 76 | .target(point) 77 | .zoom(18) 78 | .build(); 79 | //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化 80 | MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus); 81 | //改变地图状态 82 | mBaiduMap.setMapStatus(mMapStatusUpdate); 83 | 84 | //构建Marker图标 85 | bitmap = BitmapDescriptorFactory 86 | .fromResource(R.drawable.icon_markc); 87 | 88 | //构建MarkerOption,用于在地图上添加Marker 89 | option = new MarkerOptions() 90 | .position(point) 91 | .icon(bitmap); 92 | //在地图上添加Marker,并显示 93 | mBaiduMap.addOverlay(option); 94 | 95 | 96 | view = LayoutInflater.from(mContext).inflate(R.layout.pano_overlay, null); 97 | pic = (ImageView) view.findViewById(R.id.panoImageView); 98 | 99 | 100 | view.setOnClickListener(v -> { 101 | Intent intent = new Intent(mContext, PanoViewActivity.class); 102 | intent.putExtra("latitude", latitude); 103 | intent.putExtra("longitude", longitude); 104 | startActivity(intent); 105 | }); 106 | 107 | 108 | showMiniWindow(); 109 | 110 | 111 | } 112 | 113 | @SuppressLint("CheckResult") 114 | private void showMiniWindow() { 115 | Observable.create((ObservableOnSubscribe) emitter -> { 116 | PanoramaRequest request = PanoramaRequest.getInstance(mContext); 117 | BaiduPanoData locationPanoData = request.getPanoramaInfoByLatLon(longitude, latitude); 118 | //开发者可以判断是否有外景(街景) 119 | if (locationPanoData.hasStreetPano()) { 120 | String url = baseUrl + locationPanoData.getPid(); 121 | emitter.onNext(url); 122 | } 123 | }).subscribeOn(Schedulers.io()) 124 | .observeOn(AndroidSchedulers.mainThread()) 125 | .subscribe(new Consumer() { 126 | @Override 127 | public void accept(String s) throws Exception { 128 | Glide.with(mContext).load(s).into(pic); 129 | InfoWindow mInfoWindow = new InfoWindow(view, point, -57); 130 | //显示InfoWindow 131 | mBaiduMap.showInfoWindow(mInfoWindow); 132 | } 133 | }, new Consumer() { 134 | @Override 135 | public void accept(Throwable throwable) throws Exception { 136 | throwable.printStackTrace(); 137 | } 138 | }); 139 | } 140 | 141 | @Override 142 | protected void onDestroy() { 143 | super.onDestroy(); 144 | //在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理 145 | mMapView.onDestroy(); 146 | } 147 | 148 | @Override 149 | protected void onResume() { 150 | super.onResume(); 151 | //在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理 152 | mMapView.onResume(); 153 | } 154 | 155 | @Override 156 | protected void onPause() { 157 | super.onPause(); 158 | //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理 159 | mMapView.onPause(); 160 | } 161 | 162 | @Override 163 | public int provideLayout() { 164 | return R.layout.activity_mapview; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/MultiPanoViewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import android.os.Bundle 4 | import android.widget.Toast 5 | import androidx.appcompat.app.AppCompatActivity 6 | import com.baidu.lbsapi.panoramaview.PanoramaView 7 | import com.engineer.panorama.R 8 | 9 | class MultiPanoViewActivity : BaseFullScreenActivity() { 10 | private lateinit var panorama1: PanoramaView 11 | private lateinit var panorama2: PanoramaView 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | 15 | panorama1 = findViewById(R.id.panorama1) 16 | panorama2 = findViewById(R.id.panorama2) 17 | panorama1.setPanorama("0100220000130817164838355J5") 18 | panorama2.setPanorama("0300220000131105191740485IN") 19 | 20 | Toast.makeText(this, "show two panorama view same time failed ", Toast.LENGTH_LONG).show() 21 | } 22 | 23 | override fun provideLayout(): Int { 24 | return R.layout.activity_multi_pano_view 25 | } 26 | 27 | override fun onPause() { 28 | super.onPause() 29 | panorama1.onPause() 30 | panorama2.onPause() 31 | } 32 | 33 | override fun onResume() { 34 | super.onResume() 35 | panorama1.onResume() 36 | panorama2.onResume() 37 | } 38 | 39 | override fun onDestroy() { 40 | panorama1.destroy() 41 | panorama2.destroy() 42 | super.onDestroy() 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/PanoPagerActivity.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui 2 | 3 | import android.graphics.Color 4 | import android.graphics.PixelFormat 5 | import android.os.Bundle 6 | import android.util.Log 7 | import android.view.* 8 | import android.widget.TextView 9 | import androidx.appcompat.app.AppCompatActivity 10 | import androidx.fragment.app.Fragment 11 | import androidx.fragment.app.FragmentActivity 12 | import androidx.recyclerview.widget.RecyclerView 13 | import androidx.viewpager2.adapter.FragmentStateAdapter 14 | import androidx.viewpager2.widget.ViewPager2 15 | import com.baidu.lbsapi.panoramaview.PanoramaView 16 | import com.baidu.mapapi.model.LatLng 17 | import com.engineer.panorama.R 18 | import com.engineer.panorama.interfaces.SimplePanoListener 19 | 20 | class PanoPagerActivity : BaseFullScreenActivity() { 21 | 22 | override fun onCreate(savedInstanceState: Bundle?) { 23 | super.onCreate(savedInstanceState) 24 | window.setFlags( 25 | WindowManager.LayoutParams.FLAG_FULLSCREEN, 26 | WindowManager.LayoutParams.FLAG_FULLSCREEN 27 | ) 28 | 29 | setView() 30 | } 31 | 32 | override fun provideLayout(): Int { 33 | return R.layout.activity_pano_pager 34 | } 35 | 36 | private fun setView() { 37 | val list = getDatas() 38 | // val adapter = MyAdapter(list) 39 | val view_pager = findViewById(R.id.view_pager) 40 | 41 | val adapter = MyFragmentAdapter(list, this) 42 | view_pager.offscreenPageLimit = 1 43 | view_pager.orientation = ViewPager2.ORIENTATION_VERTICAL 44 | view_pager.adapter = adapter 45 | } 46 | 47 | private fun getDatas(): ArrayList { 48 | val list = ArrayList() 49 | var latLng = LatLng(39.963175, 116.400244) 50 | list.add(latLng) 51 | latLng = LatLng(39.947246, 116.390471) 52 | list.add(latLng) 53 | latLng = LatLng(39.902095, 116.32608) 54 | list.add(latLng) 55 | latLng = LatLng(39.871534, 116.384147) 56 | list.add(latLng) 57 | return list 58 | } 59 | 60 | class MyFragmentAdapter( 61 | private var datas: List, 62 | activity: FragmentActivity 63 | ) : FragmentStateAdapter(activity) { 64 | override fun getItemCount(): Int { 65 | return datas.size 66 | } 67 | 68 | override fun createFragment(position: Int): Fragment { 69 | return CardFragment.create(datas[position]) 70 | } 71 | 72 | } 73 | 74 | class CardFragment : Fragment() { 75 | val TAG = "CardFragment" 76 | private lateinit var panoView: PanoramaView 77 | 78 | override fun onCreateView( 79 | inflater: LayoutInflater, 80 | container: ViewGroup?, 81 | savedInstanceState: Bundle? 82 | ): View? { 83 | Log.d(TAG, "onCreateView() called"); 84 | val view = inflater.inflate(R.layout.pager_pano_item, container, false) 85 | panoView = view.findViewById(R.id.pano) 86 | return view 87 | } 88 | 89 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 90 | Log.d(TAG, "onViewCreated() called"); 91 | super.onViewCreated(view, savedInstanceState) 92 | val latLng: LatLng? = arguments?.getParcelable("data") 93 | latLng?.apply { 94 | panoView.setPanorama(longitude, latitude) 95 | panoView.setPanoramaViewListener(object : SimplePanoListener() { 96 | override fun onMoveStart() { 97 | try { 98 | super.onMoveStart() 99 | } catch (e: Exception) { 100 | Log.e("zyq", "error is ${e.message}") 101 | } 102 | } 103 | }) 104 | } 105 | } 106 | 107 | override fun onResume() { 108 | Log.d(TAG, "onResume() called"); 109 | super.onResume() 110 | panoView.onResume() 111 | } 112 | 113 | override fun onPause() { 114 | Log.d(TAG, "onPause() called"); 115 | super.onPause() 116 | panoView.onPause() 117 | } 118 | 119 | override fun onDestroyView() { 120 | Log.d(TAG, "onDestroyView() called"); 121 | super.onDestroyView() 122 | panoView.destroy() 123 | } 124 | 125 | override fun onDestroy() { 126 | Log.d(TAG, "onDestroy() called"); 127 | super.onDestroy() 128 | 129 | } 130 | 131 | companion object { 132 | 133 | /** Creates a Fragment for a given [Card] */ 134 | fun create(card: LatLng): CardFragment { 135 | val fragment = CardFragment() 136 | val bundle = Bundle() 137 | bundle.putParcelable("data", card) 138 | fragment.arguments = bundle 139 | return fragment 140 | } 141 | } 142 | } 143 | 144 | 145 | class MyAdapter(private var datas: List) : RecyclerView.Adapter() { 146 | 147 | override fun onBindViewHolder(holder: PagerHolder, position: Int) { 148 | holder.text.text = "pos_$position" 149 | holder.pano.setPanorama(datas[position].longitude, datas[position].latitude) 150 | } 151 | 152 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PagerHolder { 153 | val view = LayoutInflater.from(parent.context) 154 | .inflate(R.layout.pager_pano_item, parent, false) 155 | return PagerHolder(view) 156 | } 157 | 158 | override fun getItemCount(): Int { 159 | return datas.size 160 | } 161 | 162 | inner class PagerHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { 163 | val text = itemView.findViewById(R.id.text) 164 | val pano = itemView.findViewById(R.id.pano) 165 | val surfaceView = pano.getChildAt(0) 166 | 167 | init { 168 | 169 | // pano.onResume() 170 | if (surfaceView is SurfaceView) { 171 | Log.e("zyq", "$surfaceView") 172 | surfaceView.setZOrderOnTop(true) 173 | surfaceView.holder.setFormat(PixelFormat.TRANSPARENT) 174 | surfaceView.setBackgroundColor(Color.parseColor("#00000000")) 175 | } 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/ui/PanoViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.ui; 2 | 3 | import android.Manifest; 4 | import android.animation.Animator; 5 | import android.animation.AnimatorListenerAdapter; 6 | import android.animation.ValueAnimator; 7 | import android.annotation.SuppressLint; 8 | import android.content.Intent; 9 | import android.graphics.Bitmap; 10 | import android.os.Build; 11 | import android.os.Bundle; 12 | import android.os.Environment; 13 | import android.os.Handler; 14 | import android.os.Looper; 15 | import android.os.Message; 16 | import android.util.Log; 17 | import android.view.PixelCopy; 18 | import android.view.SurfaceView; 19 | import android.view.View; 20 | import android.view.animation.Animation; 21 | import android.view.animation.AnimationUtils; 22 | import android.view.animation.LinearInterpolator; 23 | import android.widget.FrameLayout; 24 | import android.widget.RelativeLayout; 25 | import android.widget.TextView; 26 | import android.widget.Toast; 27 | 28 | import androidx.recyclerview.widget.RecyclerView; 29 | 30 | import com.alibaba.fastjson.JSON; 31 | import com.baidu.lbsapi.panoramaview.PanoramaView; 32 | import com.baidu.lbsapi.panoramaview.PanoramaViewListener; 33 | import com.baidu.lbsapi.tools.CoordinateConverter; 34 | import com.baidu.lbsapi.tools.Point; 35 | import com.baidu.mapapi.map.BaiduMap; 36 | import com.baidu.mapapi.map.BitmapDescriptor; 37 | import com.baidu.mapapi.map.BitmapDescriptorFactory; 38 | import com.baidu.mapapi.map.MapStatus; 39 | import com.baidu.mapapi.map.MapStatusUpdate; 40 | import com.baidu.mapapi.map.MapStatusUpdateFactory; 41 | import com.baidu.mapapi.map.MapView; 42 | import com.baidu.mapapi.map.MarkerOptions; 43 | import com.baidu.mapapi.map.OverlayOptions; 44 | import com.baidu.mapapi.model.LatLng; 45 | import com.engineer.StatusBarUtil; 46 | import com.engineer.panorama.R; 47 | import com.engineer.panorama.bean.HotCityPanoBean; 48 | import com.engineer.panorama.bean.PanoramaBean; 49 | import com.engineer.panorama.util.ScreenView; 50 | import com.tbruyelle.rxpermissions2.RxPermissions; 51 | 52 | import java.io.File; 53 | import java.io.FileOutputStream; 54 | import java.io.IOException; 55 | 56 | /** 57 | * 全景Demo主Activity 58 | */ 59 | public class PanoViewActivity extends BaseFullScreenActivity { 60 | 61 | private static final String LTAG = "BaiduPanoSDKDemo"; 62 | 63 | private PanoramaView mPanoView; 64 | private TextView textTitle; 65 | 66 | private double latitude = 39.963175; 67 | private double longitude = 116.400244; 68 | 69 | 70 | //地图 71 | private MapView mMapView = null; 72 | private BaiduMap mBaiduMap = null; 73 | //定义操作动作 74 | private final int ACTION_DRAG = 0; 75 | private final int ACTION_CLICK = 1; 76 | 77 | //title是否可见 78 | private boolean titleVisible = true; 79 | //title显示隐藏动画 80 | private Animation animationShow, animationHide; 81 | 82 | 83 | private MyHandler handler; 84 | 85 | //添加Marker 86 | private LatLng point; 87 | //构建Marker图标 88 | private BitmapDescriptor bitmap; 89 | //构建MarkerOption,用于在地图上添加Marker 90 | private OverlayOptions option; 91 | 92 | private String name, pid; 93 | 94 | private ScreenView mScreenView; 95 | 96 | private SurfaceView mSurfaceView; 97 | 98 | private RelativeLayout mToolbbar; 99 | 100 | private ValueAnimator valueAnimator; 101 | 102 | @Override 103 | public void onCreate(Bundle savedInstanceState) { 104 | super.onCreate(savedInstanceState); 105 | // requestWindowFeature(Window.FEATURE_NO_TITLE); 106 | 107 | // setContentView(R.layout.panodemo_main); 108 | 109 | if (getIntent() != null) { 110 | latitude = getIntent().getDoubleExtra("latitude", 0); 111 | longitude = getIntent().getDoubleExtra("longitude", 0); 112 | name = "name"; 113 | pid = "4373943294879844934"; 114 | } 115 | 116 | initView(); 117 | FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToolbbar.getLayoutParams(); 118 | params.topMargin = StatusBarUtil.INSTANCE.getStatusBarHeight(this); 119 | mToolbbar.setLayoutParams(params); 120 | testPano(); 121 | } 122 | 123 | 124 | private void initView() { 125 | textTitle = (TextView) findViewById(R.id.panodemo_main_title); 126 | mPanoView = (PanoramaView) findViewById(R.id.panorama); 127 | 128 | 129 | mPanoView.setPanoramaImageLevel(PanoramaView.ImageDefinition.ImageDefinitionHigh); 130 | 131 | mMapView = (MapView) findViewById(R.id.bmapView); 132 | mBaiduMap = mMapView.getMap(); 133 | 134 | // sv = (GLSurfaceView) mMapView.getChildAt(0); 135 | // sv.setZOrderMediaOverlay(true); 136 | 137 | mMapView.showScaleControl(false); 138 | mMapView.showZoomControls(false); 139 | 140 | //定义Maker坐标点 141 | point = new LatLng(latitude, longitude); 142 | //构建Marker图标 143 | bitmap = BitmapDescriptorFactory 144 | .fromResource(R.drawable.icon_marka); 145 | 146 | 147 | //定义地图状态 148 | MapStatus mMapStatus = new MapStatus.Builder() 149 | .target(point) 150 | .zoom(18) 151 | .build(); 152 | //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化 153 | 154 | 155 | MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus); 156 | //改变地图状态 157 | mBaiduMap.setMapStatus(mMapStatusUpdate); 158 | 159 | mToolbbar = findViewById(R.id.toolbar); 160 | animationShow = AnimationUtils.loadAnimation(this, R.anim.pop_show_animation); 161 | animationHide = AnimationUtils.loadAnimation(this, R.anim.pop_hidden_animation); 162 | 163 | findViewById(R.id.crop).setOnClickListener(v -> requestPermission()); 164 | findViewById(R.id.menu).setOnClickListener(v -> { 165 | startActivity(new Intent(this, ListPanoViewActivity.class)); 166 | finish(); 167 | } 168 | ); 169 | findViewById(R.id.list).setOnClickListener(v -> { 170 | startActivity(new Intent(this, ListMapViewActivity.class)); 171 | finish(); 172 | }); 173 | 174 | FrameLayout cover = findViewById(R.id.black_cover); 175 | FrameLayout layoutContent = findViewById(R.id.content_layout); 176 | RecyclerView recyclerView = findViewById(R.id.bottom_list); 177 | findViewById(R.id.scale).setOnClickListener(v -> { 178 | Toast.makeText(PanoViewActivity.this, 179 | "scale", Toast.LENGTH_SHORT).show(); 180 | recyclerView.animate().translationY(0).start(); 181 | layoutContent.animate().scaleX(0.8f).start(); 182 | layoutContent.animate().scaleY(0.8f).start(); 183 | cover.animate().alpha(1f).setListener(new AnimatorListenerAdapter() { 184 | @Override 185 | public void onAnimationEnd(Animator animation) { 186 | super.onAnimationEnd(animation); 187 | cover.setVisibility(View.VISIBLE); 188 | 189 | } 190 | }).start(); 191 | 192 | 193 | }); 194 | 195 | cover.setOnClickListener(v -> { 196 | Toast.makeText(PanoViewActivity.this, 197 | "cover", Toast.LENGTH_SHORT).show(); 198 | recyclerView.animate().translationY(1000).start(); 199 | layoutContent.animate().scaleX(1f).start(); 200 | layoutContent.animate().scaleY(1f).start(); 201 | cover.setVisibility(View.GONE); 202 | // cover.animate().alpha(0f).setListener(new AnimatorListenerAdapter() { 203 | // @Override 204 | // public void onAnimationEnd(Animator animation) { 205 | // super.onAnimationEnd(animation); 206 | // 207 | // cover.setOnClickListener(null); 208 | // } 209 | // }).start(); 210 | }); 211 | 212 | 213 | if (mPanoView != null && mPanoView.getChildCount() > 0) { 214 | if (mPanoView.getChildAt(0) instanceof SurfaceView) { 215 | mSurfaceView = (SurfaceView) mPanoView.getChildAt(0); 216 | 217 | Toast.makeText(this, "success", Toast.LENGTH_SHORT).show(); 218 | } 219 | 220 | } 221 | 222 | } 223 | 224 | private void crop1() { 225 | final Bitmap bitmap = Bitmap.createBitmap(mPanoView.getWidth(), mPanoView.getHeight(), Bitmap.Config.ARGB_8888); 226 | 227 | 228 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 229 | 230 | PixelCopy.request(mSurfaceView, bitmap, copyResult -> { 231 | Log.e("xxx", "copyResult==" + copyResult); 232 | saveBitmap(bitmap); 233 | 234 | }, new Handler(Looper.getMainLooper())); 235 | } 236 | } 237 | 238 | 239 | public void saveBitmap(Bitmap bitmap) { 240 | if (bitmap == null) { 241 | Toast.makeText(this, "bitmap is null", Toast.LENGTH_SHORT).show(); 242 | return; 243 | } 244 | 245 | String savePath; 246 | File filePic; 247 | if (Environment.getExternalStorageState().equals( 248 | Environment.MEDIA_MOUNTED)) { 249 | savePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + File.separator; 250 | } else { 251 | Log.e("xxx", "saveBitmap: 1return"); 252 | return; 253 | } 254 | 255 | 256 | try { 257 | filePic = new File(savePath + System.currentTimeMillis() + ".jpg"); 258 | if (!filePic.exists()) { 259 | filePic.getParentFile().mkdirs(); 260 | filePic.createNewFile(); 261 | } 262 | FileOutputStream fos = new FileOutputStream(filePic); 263 | bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); 264 | fos.flush(); 265 | fos.close(); 266 | } catch (IOException e) { 267 | e.printStackTrace(); 268 | Log.e("xxx", "saveBitmap: 2return"); 269 | return; 270 | } 271 | Log.e("xxx", "saveBitmap: " + filePic.getAbsolutePath()); 272 | } 273 | 274 | 275 | private void testPano() { 276 | handler = new MyHandler(); 277 | 278 | mPanoView.setShowTopoLink(true); 279 | 280 | 281 | 282 | 283 | // 测试回调函数,需要注意的是回调函数要在setPanorama()之前调用,否则回调函数可能执行异常 284 | mPanoView.setPanoramaViewListener(new PanoramaViewListener() { 285 | 286 | @Override 287 | public void onLoadPanoramaBegin() { 288 | Log.i(LTAG, "onLoadPanoramaStart..."); 289 | } 290 | 291 | @Override 292 | public void onLoadPanoramaEnd(String json) { 293 | // Log.e(LTAG, "onLoadPanoramaEnd : " + json); 294 | // startAuto(); 295 | } 296 | 297 | @Override 298 | public void onLoadPanoramaError(String error) { 299 | // Log.e(LTAG, "onLoadPanoramaError : " + error); 300 | 301 | } 302 | 303 | @Override 304 | public void onDescriptionLoadEnd(String json) { 305 | 306 | PanoramaBean panoramaBean = JSON.parseObject(json, PanoramaBean.class); 307 | 308 | Point pointll = CoordinateConverter.MCConverter2LL(panoramaBean.getX(), panoramaBean.getY()); 309 | 310 | HotCityPanoBean hotCityPanoBean = new HotCityPanoBean(); 311 | hotCityPanoBean.setPid(pid); 312 | hotCityPanoBean.setName(name); 313 | hotCityPanoBean.setLatitude(pointll.y); 314 | hotCityPanoBean.setLongitude(pointll.x); 315 | 316 | 317 | Log.e(LTAG, "onDescriptionLoadEnd : " + hotCityPanoBean.getLatitude() + ", " 318 | + hotCityPanoBean.getLongitude() + "\n" 319 | + hotCityPanoBean.getName() + ", " 320 | + hotCityPanoBean.getPid()); 321 | 322 | 323 | } 324 | 325 | @Override 326 | public void onMessage(String msgName, int msgType) { 327 | // Log.e(LTAG, "msgName--->" + msgName + ", msgType--->" + msgType); 328 | switch (msgType) { 329 | case 8213: 330 | //旋转 331 | // Log.e(PanoViewActivity.class.getSimpleName(), "now,the heading is " + mPanoView.getPanoramaHeading()); 332 | Message message = new Message(); 333 | message.what = ACTION_DRAG; 334 | message.arg1 = (int) mPanoView.getPanoramaHeading(); 335 | handler.sendMessage(message); 336 | break; 337 | case 12302: 338 | //点击 339 | // Log.e(PanoViewActivity.class.getSimpleName(), "clicked"); 340 | Message msg = new Message(); 341 | msg.what = ACTION_CLICK; 342 | handler.sendMessage(msg); 343 | break; 344 | default: 345 | break; 346 | } 347 | 348 | 349 | } 350 | 351 | @Override 352 | public void onCustomMarkerClick(String key) { 353 | 354 | } 355 | 356 | @Override 357 | public void onMoveStart() { 358 | 359 | } 360 | 361 | @Override 362 | public void onMoveEnd() { 363 | 364 | } 365 | }); 366 | mPanoView.setPanorama(longitude, latitude); 367 | 368 | } 369 | 370 | private void startAuto() { 371 | if (valueAnimator == null) { 372 | runOnUiThread(() -> { 373 | valueAnimator = ValueAnimator.ofFloat(0, 360); 374 | valueAnimator.addUpdateListener(animation -> { 375 | float value = (float) animation.getAnimatedValue(); 376 | Log.e("zz", "value==" + value); 377 | mPanoView.setPanoramaHeading(value); 378 | }); 379 | valueAnimator.setDuration(36000); 380 | valueAnimator.setInterpolator(new LinearInterpolator()); 381 | valueAnimator.start(); 382 | }); 383 | } 384 | 385 | 386 | } 387 | 388 | @Override 389 | public int provideLayout() { 390 | return R.layout.panodemo_main; 391 | } 392 | 393 | 394 | private class MyHandler extends Handler { 395 | 396 | 397 | @Override 398 | public void handleMessage(Message msg) { 399 | super.handleMessage(msg); 400 | 401 | switch (msg.what) { 402 | case ACTION_CLICK: 403 | if (titleVisible) { 404 | titleVisible = false; 405 | mToolbbar.startAnimation(animationHide); 406 | // textTitle.setVisibility(View.GONE); 407 | } else { 408 | titleVisible = true; 409 | mToolbbar.startAnimation(animationShow); 410 | // textTitle.setVisibility(View.VISIBLE); 411 | 412 | } 413 | 414 | break; 415 | case ACTION_DRAG: 416 | float heading = (float) msg.arg1; 417 | 418 | mBaiduMap.clear(); 419 | 420 | //构建MarkerOption,用于在地图上添加Marker 421 | option = new MarkerOptions() 422 | .position(point) 423 | .rotate(360 - heading) 424 | .icon(bitmap); 425 | //在地图上添加Marker,并显示 426 | mBaiduMap.addOverlay(option); 427 | break; 428 | default: 429 | break; 430 | } 431 | } 432 | 433 | 434 | } 435 | 436 | 437 | @Override 438 | protected void onDestroy() { 439 | mPanoView.destroy(); 440 | super.onDestroy(); 441 | //在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理 442 | mMapView.onDestroy(); 443 | if (valueAnimator != null && valueAnimator.isRunning()) { 444 | valueAnimator.end(); 445 | valueAnimator.removeAllUpdateListeners(); 446 | valueAnimator = null; 447 | } 448 | } 449 | 450 | @Override 451 | protected void onResume() { 452 | super.onResume(); 453 | //在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理 454 | mMapView.onResume(); 455 | } 456 | 457 | @Override 458 | protected void onPause() { 459 | super.onPause(); 460 | //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理 461 | mMapView.onPause(); 462 | } 463 | 464 | 465 | @SuppressLint("CheckResult") 466 | private void requestPermission() { 467 | RxPermissions rxPermissions = new RxPermissions(this); 468 | rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE) 469 | .subscribe(aBoolean -> { 470 | if (aBoolean) { 471 | crop1(); 472 | } 473 | }); 474 | } 475 | } 476 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/DeviceUtil.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util; 2 | 3 | import android.app.Activity; 4 | import android.view.WindowManager; 5 | 6 | import java.lang.reflect.Field; 7 | import java.lang.reflect.Method; 8 | 9 | public class DeviceUtil { 10 | 11 | private static volatile Class sMiuiClazz; 12 | private static volatile Field sMiuiField1; 13 | private static volatile Method sMiuiField2; 14 | private static boolean sMiuiError = false; 15 | 16 | /** 17 | * MIUI 系统中设置 StatusBar 的文本颜色为黑色 18 | */ 19 | public static boolean setMIUIStatusBarLightMode(Activity activity, boolean lightmode) { 20 | if (sMiuiError) return false; 21 | 22 | boolean result = false; 23 | try { 24 | int darkModeFlag = 0; 25 | if (sMiuiClazz == null) { 26 | synchronized (DeviceUtil.class) { 27 | if (sMiuiClazz == null) { 28 | sMiuiClazz = Class.forName("android.view.MiuiWindowManager$LayoutParams"); 29 | sMiuiField1 = sMiuiClazz.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE"); 30 | sMiuiField2 = activity.getWindow().getClass() 31 | .getMethod("setExtraFlags", int.class, int.class); 32 | } 33 | } 34 | } 35 | 36 | darkModeFlag = sMiuiField1.getInt(sMiuiClazz); 37 | sMiuiField2.invoke(activity.getWindow(), lightmode ? darkModeFlag : 0, darkModeFlag); 38 | result = true; 39 | } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException ignored) { 40 | sMiuiError = true; 41 | } catch (Exception ignored) { 42 | } 43 | return result; 44 | } 45 | 46 | private static volatile Field sFlymeField1; 47 | private static volatile Field sFlymeField2; 48 | private static boolean sFlymeError = false; 49 | 50 | /** 51 | * Flyme 系统中设置 StatusBar 的文本颜色为黑色 52 | */ 53 | public static boolean setFlymeStatusBarLightMode(Activity activity, boolean lightmode) { 54 | if (sFlymeError) return false; 55 | 56 | boolean result = false; 57 | try { 58 | if (sFlymeField1 == null) { 59 | synchronized (DeviceUtil.class) { 60 | if (sFlymeField1 == null) { 61 | sFlymeField1 = WindowManager.LayoutParams.class 62 | .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON"); 63 | sFlymeField2 = WindowManager.LayoutParams.class 64 | .getDeclaredField("meizuFlags"); 65 | sFlymeField1.setAccessible(true); 66 | sFlymeField2.setAccessible(true); 67 | } 68 | } 69 | } 70 | 71 | WindowManager.LayoutParams lp = activity.getWindow().getAttributes(); 72 | 73 | int bit = sFlymeField1.getInt(null); 74 | int value = sFlymeField2.getInt(lp); 75 | if (lightmode) { 76 | value |= bit; 77 | } else { 78 | value &= ~bit; 79 | } 80 | sFlymeField2.setInt(lp, value); 81 | activity.getWindow().setAttributes(lp); 82 | result = true; 83 | } catch (NoSuchFieldException ignored) { 84 | sFlymeError = true; 85 | } catch (Exception ignored) { 86 | } 87 | return result; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.os.Environment; 7 | 8 | import java.io.File; 9 | import java.io.FileNotFoundException; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.io.OutputStream; 14 | 15 | /** 16 | * Created by rookie on 2016/11/10. 17 | *

18 | * 文件读取工具类 19 | */ 20 | 21 | 22 | public class FileUtil { 23 | /** 24 | * 保存bitmap到本地 25 | * 26 | * @param bitmap 27 | * @param name 28 | * @return 29 | */ 30 | public static String savaBitmap2SDcard(Context context, Bitmap bitmap, String name) { 31 | 32 | String result = ""; 33 | File fileDir = new File(Environment.getExternalStorageDirectory() + File.separator + "DCIM" + File.separator + "Camera" + File.separator); 34 | if (!fileDir.exists()) { 35 | fileDir.mkdir(); 36 | } 37 | String filename = name + ".jpg"; 38 | File file = new File(fileDir, filename); 39 | FileOutputStream outputStream = null; 40 | try { 41 | outputStream = new FileOutputStream(file); 42 | bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); 43 | outputStream.flush(); 44 | result = file.getAbsolutePath(); 45 | } catch (FileNotFoundException e) { 46 | e.printStackTrace(); 47 | } catch (IOException e) { 48 | e.printStackTrace(); 49 | } finally { 50 | if (outputStream != null) { 51 | try { 52 | outputStream.close(); 53 | } catch (IOException e) { 54 | e.printStackTrace(); 55 | } 56 | } 57 | } 58 | return result; 59 | } 60 | 61 | /** 62 | * 获取bitmap 63 | * 64 | * @param filename 65 | * @return 66 | */ 67 | public static Bitmap getBitmapFormSDcard(String filename) { 68 | Bitmap bitmap; 69 | String filepath = Environment.getExternalStorageDirectory() + File.separator + "Screenshots" + File.separator + filename; 70 | bitmap = BitmapFactory.decodeFile(filepath); 71 | return bitmap; 72 | } 73 | 74 | 75 | /** 76 | * 从本地assets 文件读取 json 文件,模拟网络请求结果 77 | * 78 | * @return 79 | */ 80 | public static String getLocalResponse(Context mContext, String FileName) { 81 | 82 | String result = ""; 83 | 84 | try { 85 | InputStream inputStream = mContext.getAssets().open(FileName); 86 | StringBuffer sb = new StringBuffer(); 87 | int len = -1; 88 | byte[] buffer = new byte[1024]; 89 | while ((len = inputStream.read(buffer)) != -1) { 90 | sb.append(new String(buffer, 0, len)); 91 | } 92 | inputStream.close(); 93 | result = sb.toString(); 94 | } catch (IOException e) { 95 | e.printStackTrace(); 96 | } 97 | 98 | return result; 99 | } 100 | 101 | /** 102 | * 保存String 到手机存储 103 | * 104 | * @param str 105 | * @param fileName 106 | * @return 107 | */ 108 | public static boolean saveStrToSDCard(String str, String fileName) { 109 | boolean success = false; 110 | if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { 111 | String path = Environment.getExternalStorageDirectory() + File.separator + fileName; 112 | 113 | File file = new File(path); 114 | try { 115 | OutputStream os = new FileOutputStream(file); 116 | byte[] b = str.getBytes(); 117 | os.write(b); 118 | os.close(); 119 | success = true; 120 | } catch (FileNotFoundException e) { 121 | e.printStackTrace(); 122 | } catch (IOException e) { 123 | e.printStackTrace(); 124 | } 125 | 126 | } 127 | 128 | 129 | return success; 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/NotificationHelper.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util; 2 | 3 | import android.app.NotificationChannel; 4 | import android.app.NotificationManager; 5 | import android.app.PendingIntent; 6 | import android.content.Context; 7 | import android.graphics.Color; 8 | import android.provider.Settings; 9 | import androidx.core.app.NotificationCompat; 10 | 11 | import com.engineer.panorama.R; 12 | 13 | 14 | /** 15 | * @author: Rookie 16 | * @date: 2018-08-26 17 | * @desc 18 | */ 19 | public class NotificationHelper { 20 | 21 | private Context mContext; 22 | private NotificationManager mNotificationManager; 23 | private NotificationCompat.Builder mBuilder; 24 | public static final String NOTIFICATION_CHANNEL_ID = "10001"; 25 | 26 | public NotificationHelper(Context context) { 27 | mContext = context; 28 | } 29 | 30 | /** 31 | * Create and push the notification 32 | */ 33 | public void createNotification(String title, String message, PendingIntent resultPendingIntent) { 34 | /**Creates an explicit intent for an Activity in your app**/ 35 | 36 | mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); 37 | 38 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { 39 | int importance = NotificationManager.IMPORTANCE_HIGH; 40 | NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "NOTIFICATION_CHANNEL_NAME", importance); 41 | notificationChannel.enableLights(true); 42 | notificationChannel.setLightColor(Color.RED); 43 | notificationChannel.enableVibration(true); 44 | notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400}); 45 | mNotificationManager.createNotificationChannel(notificationChannel); 46 | 47 | } 48 | 49 | mBuilder = new NotificationCompat.Builder(mContext, NOTIFICATION_CHANNEL_ID); 50 | mBuilder.setSmallIcon(R.drawable.ic_launcher); 51 | mBuilder.setContentTitle(title) 52 | .setContentText(message) 53 | .setAutoCancel(true) 54 | .setSound(Settings.System.DEFAULT_NOTIFICATION_URI) 55 | .setContentIntent(resultPendingIntent) 56 | .setWhen(System.currentTimeMillis()) 57 | .setTicker("下载图片成功") 58 | .setOngoing(false); 59 | 60 | assert mNotificationManager != null; 61 | mBuilder.setChannelId(NOTIFICATION_CHANNEL_ID); 62 | 63 | 64 | assert mNotificationManager != null; 65 | mNotificationManager.notify(0 , mBuilder.build()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/SavePhotoTask.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util; 2 | 3 | import android.app.PendingIntent; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.net.Uri; 7 | import android.os.AsyncTask; 8 | import android.os.Build; 9 | import android.os.Environment; 10 | import androidx.core.content.FileProvider; 11 | import android.text.TextUtils; 12 | import android.widget.Toast; 13 | 14 | 15 | import com.engineer.panorama.util.NotificationHelper; 16 | 17 | import java.io.File; 18 | import java.io.FileOutputStream; 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.io.OutputStream; 22 | import java.net.HttpURLConnection; 23 | import java.net.URL; 24 | import java.text.SimpleDateFormat; 25 | import java.util.Date; 26 | import java.util.Locale; 27 | 28 | /** 29 | * Created by engineer on 2017/8/20. 30 | */ 31 | 32 | public class SavePhotoTask extends AsyncTask { 33 | 34 | private Context mContext; 35 | 36 | 37 | public SavePhotoTask(Context context) { 38 | mContext = context; 39 | } 40 | 41 | @Override 42 | protected void onPostExecute(String filepath) { 43 | super.onPostExecute(filepath); 44 | 45 | 46 | if (!TextUtils.isEmpty(filepath)) { 47 | 48 | 49 | Toast.makeText(mContext, "保存图片成功", Toast.LENGTH_SHORT).show(); 50 | 51 | 52 | Intent mIntent = new Intent(); 53 | mIntent.setAction(Intent.ACTION_VIEW); 54 | Uri contentUri; 55 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 56 | // 将文件转换成content://Uri的形式 57 | contentUri = FileProvider.getUriForFile(mContext, mContext.getPackageName() + ".fileprovider", new File(filepath)); 58 | // 申请临时访问权限 59 | mIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); 60 | } else { 61 | contentUri = Uri.fromFile(new File(filepath)); 62 | } 63 | 64 | mIntent.setDataAndType(contentUri, "image/*"); 65 | // startActivity(mIntent); 66 | PendingIntent mPendingIntent = PendingIntent.getActivity(mContext 67 | , 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT); 68 | 69 | new NotificationHelper(mContext).createNotification("点击查看", "图片保存在: " + filepath, mPendingIntent); 70 | } else { 71 | Toast.makeText(mContext, "保存图片失败", Toast.LENGTH_SHORT).show(); 72 | } 73 | } 74 | 75 | @Override 76 | protected void onPreExecute() { 77 | super.onPreExecute(); 78 | 79 | } 80 | 81 | 82 | 83 | 84 | @Override 85 | protected String doInBackground(String... params) { 86 | 87 | try { 88 | 89 | String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()); 90 | String fileName = "IMG_" + timeStamp + ".jpg"; 91 | File localFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + fileName); 92 | OutputStream mOutputStream = new FileOutputStream(localFile); 93 | URL url = new URL(params[0]); 94 | HttpURLConnection mConnection = (HttpURLConnection) url.openConnection(); 95 | InputStream mInputStream = mConnection.getInputStream(); 96 | int len; 97 | byte[] buffer = new byte[1024]; 98 | while ((len = mInputStream.read(buffer)) != -1) { 99 | mOutputStream.write(buffer, 0, len); 100 | } 101 | mOutputStream.flush(); 102 | mInputStream.close(); 103 | mOutputStream.close(); 104 | return localFile.getAbsolutePath(); 105 | } catch (IOException e) { 106 | e.printStackTrace(); 107 | return ""; 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/ScreenView.java: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.graphics.RectF; 9 | import android.view.SurfaceHolder; 10 | 11 | import com.baidu.pano.platform.comapi.map.InnerPanoramaView; 12 | 13 | /** 14 | * @author: Rookie 15 | * @since: 2018-11-25 16 | */ 17 | public abstract class ScreenView extends InnerPanoramaView implements SurfaceHolder.Callback, Runnable { 18 | 19 | private SurfaceHolder mSurfaceHolder; 20 | private Thread mThread; 21 | 22 | public ScreenView(Context context) { 23 | super(context); 24 | mSurfaceHolder = this.getHolder(); 25 | mSurfaceHolder.addCallback(this); 26 | } 27 | 28 | @Override 29 | public void surfaceCreated(SurfaceHolder holder) { 30 | mThread = new Thread(this); 31 | } 32 | 33 | @Override 34 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { 35 | } 36 | 37 | @Override 38 | public void surfaceDestroyed(SurfaceHolder holder) { 39 | 40 | } 41 | 42 | public void start() { 43 | if (mThread != null) { 44 | mThread.start(); 45 | } 46 | } 47 | 48 | @Override 49 | public void run() { 50 | Canvas canvas = mSurfaceHolder.lockCanvas(); 51 | doDraw(canvas); 52 | mSurfaceHolder.unlockCanvasAndPost(canvas); 53 | } 54 | 55 | private void doDraw(Canvas canvas) { 56 | Paint mPaint = new Paint(); 57 | mPaint.setColor(Color.BLUE); 58 | canvas.drawRect(new RectF(100, 100, 1000, 550), mPaint); 59 | } 60 | 61 | //调用该方法将doDraw绘制的图案绘制在自己的canvas上 62 | public Bitmap getBitmap() { 63 | Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); 64 | Canvas canvas = new Canvas(bitmap); 65 | doDraw(canvas); 66 | return bitmap; 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/engineer/panorama/util/SystemExt.kt: -------------------------------------------------------------------------------- 1 | package com.engineer.panorama.util 2 | 3 | import android.content.Context 4 | import android.content.res.Configuration 5 | import android.content.res.Resources 6 | 7 | /** 8 | * Created on 2020/9/5. 9 | * @author rookie 10 | */ 11 | 12 | 13 | val Number.dp get() = (toInt() * Resources.getSystem().displayMetrics.density).toInt() 14 | 15 | val Number.sp get() = (toInt() * Resources.getSystem().displayMetrics.scaledDensity) 16 | 17 | fun T.easy(block: (T) -> R, ifNull: () -> Unit) { 18 | if (this != null) { 19 | block(this) 20 | } else { 21 | ifNull() 22 | } 23 | } 24 | 25 | 26 | fun Context.getNightMode(): Int { 27 | return this.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK 28 | } 29 | 30 | val screenWidth = Resources.getSystem().displayMetrics.widthPixels 31 | val screenHeight = Resources.getSystem().displayMetrics.heightPixels -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_hidden_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_show_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baidupano_floortab_arrow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/baidupano_floortab_arrow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baidupano_floortab_line.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/baidupano_floortab_line.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baidupano_indoor_exit.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/baidupano_indoor_exit.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baidupano_photo_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/baidupano_photo_default.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/button_down.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/button_down.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/button_on.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/button_on.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/checkout_pano_arrow.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/checkout_pano_arrow.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icon_marka.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/icon_marka.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icon_markb.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/icon_markb.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icon_markc.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/icon_markc.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/pano_image_background.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/pano_image_background.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/pano_image_background_tip.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/pano_image_background_tip.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/splash.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/splash.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/street_arrow.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/street_arrow.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/wsdk_checkout_pano_arrow.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/wsdk_checkout_pano_arrow.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/wsdk_pano_image_background.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/wsdk_pano_image_background.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/wsdk_pano_image_background_tip.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/REBOOTERS/AndroidPanoramaSample/8ea1812c78dffdd18f50b49c030789a510ac60f3/app/src/main/res/drawable-xxxhdpi/wsdk_pano_image_background_tip.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/baidupano_shape_photocase.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baidupano_shape_photocase_selc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baidupano_shape_phototxt_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_view_list_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_crop_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_format_list_bulleted_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_more_vert_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_full.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_google_maps.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_list_pano_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 |