├── .gitignore
├── .idea
├── caches
│ ├── build_file_checksums.ser
│ └── gradle_models.ser
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── libs
│ └── commonstylelibrary-1.01.aar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── yanghaoyi
│ │ └── presentation
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── yanghaoyi
│ │ │ └── presentation
│ │ │ ├── model
│ │ │ ├── SearchModel.java
│ │ │ └── data
│ │ │ │ └── SearchResultData.java
│ │ │ ├── presenter
│ │ │ ├── ContentPresenter.java
│ │ │ ├── MapPresenter.java
│ │ │ ├── PresentationPresenter.java
│ │ │ ├── SearchPresenter.java
│ │ │ └── event
│ │ │ │ ├── MapEvent.java
│ │ │ │ └── SearchEvent.java
│ │ │ └── view
│ │ │ ├── IContentView.java
│ │ │ ├── IMapView.java
│ │ │ ├── ISearchView.java
│ │ │ ├── activity
│ │ │ └── MainActivity.java
│ │ │ ├── compoent
│ │ │ └── FloatButton.java
│ │ │ ├── impl
│ │ │ ├── ContentViewImpl.java
│ │ │ ├── MapViewImpl.java
│ │ │ └── SearchViewImpl.java
│ │ │ ├── page
│ │ │ ├── MapFrameLayout.java
│ │ │ └── SearchFrameLayout.java
│ │ │ ├── presentation
│ │ │ └── SecondScreenPresentation.java
│ │ │ └── service
│ │ │ └── MultiScreenService.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── framelayout_map.xml
│ │ ├── framelayout_search.xml
│ │ ├── linearlayout_float_button.xml
│ │ └── presentation_search.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ └── map_bg.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── yanghaoyi
│ └── presentation
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── navisdk
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── autoai
│ │ └── navisdk
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── autoai
│ │ │ └── navisdk
│ │ │ ├── MapManager.java
│ │ │ ├── enu
│ │ │ └── MapEvent.java
│ │ │ └── listener
│ │ │ └── MapEventListener.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── autoai
│ └── navisdk
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.yanghaoyi.presentation"
7 | minSdkVersion 15
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 |
20 | repositories {
21 | flatDir {
22 | // aar目录
23 | dirs 'libs'
24 | }
25 | }
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(include: ['*.jar'], dir: 'libs')
30 | implementation 'com.android.support:appcompat-v7:28.0.0'
31 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
32 | //通用样式aar
33 | implementation(name: 'commonstylelibrary-1.01', ext: 'aar')
34 | implementation 'com.google.code.gson:gson:2.7'
35 | implementation 'org.greenrobot:eventbus:3.0.0'
36 | testImplementation 'junit:junit:4.12'
37 | implementation project(':navisdk')
38 | }
39 |
--------------------------------------------------------------------------------
/app/libs/commonstylelibrary-1.01.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/libs/commonstylelibrary-1.01.aar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/yanghaoyi/presentation/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.yanghaoyi.presentation", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/model/SearchModel.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.model;
2 |
3 | import com.yanghaoyi.presentation.model.data.SearchResultData;
4 |
5 | /**
6 | * @author : YangHaoYi on 2019/4/3017:23.
7 | * Email : yang.haoyi@qq.com
8 | * Description :搜索数据中心
9 | * Change : YangHaoYi on 2019/4/3017:23.
10 | * Version : V 1.0
11 | */
12 | public class SearchModel {
13 |
14 | /**
15 | * 转换搜索数据
16 | * @return 搜索结果
17 | * **/
18 | public SearchResultData doNearbySearch(){
19 | SearchResultData resultData = new SearchResultData();
20 | resultData.setCode(0);
21 | resultData.setDescription("请求成功");
22 | SearchResultData.PayloadData payloadData = new SearchResultData.PayloadData();
23 | payloadData.setTitle("市图书馆");
24 | payloadData.setAddress("辽宁省沈阳市沈河区青年大街205号");
25 | payloadData.setNotice("市图书馆");
26 | payloadData.setLat("41.765923");
27 | payloadData.setLng("123.442674");
28 | return resultData;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/model/data/SearchResultData.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.model.data;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/4/3017:23.
5 | * Email : yang.haoyi@qq.com
6 | * Description :搜索结果数据Bean
7 | * Change : YangHaoYi on 2019/4/3017:23.
8 | * Version : V 1.0
9 | */
10 | public class SearchResultData {
11 |
12 | private int code;
13 | private String description;
14 | private PayloadData data;
15 |
16 | public static class PayloadData{
17 | private String title;
18 | private String address;
19 | private String notice;
20 | private String lat;
21 | private String lng;
22 |
23 | public String getTitle() {
24 | return title;
25 | }
26 |
27 | public void setTitle(String title) {
28 | this.title = title;
29 | }
30 |
31 | public String getAddress() {
32 | return address;
33 | }
34 |
35 | public void setAddress(String address) {
36 | this.address = address;
37 | }
38 |
39 | public String getNotice() {
40 | return notice;
41 | }
42 |
43 | public void setNotice(String notice) {
44 | this.notice = notice;
45 | }
46 |
47 | public String getLat() {
48 | return lat;
49 | }
50 |
51 | public void setLat(String lat) {
52 | this.lat = lat;
53 | }
54 |
55 | public String getLng() {
56 | return lng;
57 | }
58 |
59 | public void setLng(String lng) {
60 | this.lng = lng;
61 | }
62 | }
63 |
64 | public int getCode() {
65 | return code;
66 | }
67 |
68 | public void setCode(int code) {
69 | this.code = code;
70 | }
71 |
72 | public String getDescription() {
73 | return description;
74 | }
75 |
76 | public void setDescription(String description) {
77 | this.description = description;
78 | }
79 |
80 | public PayloadData getData() {
81 | return data;
82 | }
83 |
84 | public void setData(PayloadData data) {
85 | this.data = data;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/ContentPresenter.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/5/510:32.
5 | * Email : yang.haoyi@qq.com
6 | * Description :
7 | * Change : YangHaoYi on 2019/5/510:32.
8 | * Version : V 1.0
9 | */
10 | public class ContentPresenter {
11 |
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/MapPresenter.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter;
2 |
3 | import com.autoai.navisdk.MapManager;
4 | import com.autoai.navisdk.enu.MapEvent;
5 | import com.autoai.navisdk.listener.MapEventListener;
6 | import com.yanghaoyi.presentation.view.IMapView;
7 |
8 | /**
9 | * @author : YangHaoYi on 2019/4/3010:54.
10 | * Email : yang.haoyi@qq.com
11 | * Description :地图页逻辑控制中心
12 | * Change : YangHaoYi on 2019/4/3010:54.
13 | * Version : V 1.0
14 | */
15 | public class MapPresenter {
16 |
17 | /** 地图视图View接口 **/
18 | private IMapView mapView;
19 |
20 | public MapPresenter(IMapView mapView) {
21 | this.mapView = mapView;
22 | }
23 |
24 | /** 放大地图 **/
25 | public void zoomIn(){
26 | MapManager.getInstance().zoomIn(new MapEventListener() {
27 | @Override
28 | public void onMapEvent(MapEvent event, Object data) {
29 | mapView.zoomInFinish();
30 | }
31 | });
32 | }
33 |
34 | /** 缩小地图 **/
35 | public void zoomOut(){
36 | MapManager.getInstance().zoomOut(new MapEventListener() {
37 | @Override
38 | public void onMapEvent(MapEvent event, Object data) {
39 | mapView.zoomOutFinish();
40 | }
41 | });
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/PresentationPresenter.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter;
2 |
3 | import android.app.Activity;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.ServiceConnection;
8 | import android.os.IBinder;
9 |
10 | import com.yanghaoyi.presentation.view.service.MultiScreenService;
11 |
12 |
13 | /**
14 | * @author : YangHaoYi on 2019/4/30.
15 | * Email : yang.haoyi@qq.com
16 | * Description :离屏逻辑控制中心
17 | * Change : YangHaoYi on 2019/4/30.
18 | * Version : V 1.0
19 | */
20 | public class PresentationPresenter {
21 |
22 | private MultiScreenService multiScreenService;
23 | private ServiceConnection serviceConnection = new ServiceConnection() {
24 | @Override
25 | public void onServiceConnected(ComponentName name, IBinder service) {
26 | multiScreenService = ((MultiScreenService.MultiScreenBinder) service).getService();
27 | //显示第二块屏幕
28 | multiScreenService.showSearchPresentation();
29 | }
30 |
31 | @Override
32 | public void onServiceDisconnected(ComponentName name) {
33 | //恢复置空
34 | multiScreenService = null;
35 | }
36 | };
37 |
38 | public void openSearchPresentation(Activity activity){
39 | Intent intent = new Intent(activity,MultiScreenService.class);
40 | activity.bindService(intent,serviceConnection, Context.BIND_AUTO_CREATE);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/SearchPresenter.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter;
2 |
3 | import com.yanghaoyi.presentation.model.SearchModel;
4 | import com.yanghaoyi.presentation.view.ISearchView;
5 |
6 | /**
7 | * @author : YangHaoYi on 2019/4/3010:54.
8 | * Email : yang.haoyi@qq.com
9 | * Description :搜索逻辑控制中心
10 | * Change : YangHaoYi on 2019/4/3010:54.
11 | * Version : V 1.0
12 | */
13 | public class SearchPresenter {
14 |
15 | /** 搜索数据Model **/
16 | private SearchModel searchModel;
17 | /** 搜索View接口 **/
18 | private ISearchView searchView;
19 |
20 | public SearchPresenter(ISearchView searchView) {
21 | this.searchView = searchView;
22 | searchModel = new SearchModel();
23 | }
24 |
25 | /** 执行搜索 **/
26 | public void nearbySearch(){
27 | searchView.showSearchResult(searchModel.doNearbySearch());
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/event/MapEvent.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter.event;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/5/814:17.
5 | * Email : yang.haoyi@qq.com
6 | * Description :
7 | * Change : YangHaoYi on 2019/5/814:17.
8 | * Version : V 1.0
9 | */
10 | public class MapEvent {
11 |
12 | public static final int ZOOM_IN = 1;
13 | public static final int TO_SEARCH = 2;
14 |
15 | private int code;
16 |
17 | public int getCode() {
18 | return code;
19 | }
20 |
21 | public void setCode(int code) {
22 | this.code = code;
23 | }
24 |
25 |
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/presenter/event/SearchEvent.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.presenter.event;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/5/814:17.
5 | * Email : yang.haoyi@qq.com
6 | * Description :
7 | * Change : YangHaoYi on 2019/5/814:17.
8 | * Version : V 1.0
9 | */
10 | public class SearchEvent {
11 |
12 | public static final int DO_SEARCH = 1;
13 | public static final int BACK = 2;
14 |
15 |
16 | private int code;
17 |
18 | public int getCode() {
19 | return code;
20 | }
21 |
22 | public void setCode(int code) {
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/IContentView.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/5/510:27.
5 | * Email : yang.haoyi@qq.com
6 | * Description :根页面view接口
7 | * Change : YangHaoYi on 2019/5/510:27.
8 | * Version : V 1.0
9 | */
10 | public interface IContentView {
11 |
12 | /** 展示搜索页 **/
13 | void showSearchPage();
14 | /** 退回地图页 **/
15 | void backToMap();
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/IMapView.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/4/3011:04.
5 | * Email : yang.haoyi@qq.com
6 | * Description :地图view接口
7 | * Change : YangHaoYi on 2019/4/3011:04.
8 | * Version : V 1.0
9 | */
10 | public interface IMapView {
11 |
12 | /** 放大地图 **/
13 | void zoomInFinish();
14 | /** 缩小地图 **/
15 | void zoomOutFinish();
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/ISearchView.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view;
2 |
3 | import com.yanghaoyi.presentation.model.data.SearchResultData;
4 |
5 | /**
6 | * @author : YangHaoYi on 2019/4/3017:25.
7 | * Email : yang.haoyi@qq.com
8 | * Description :搜索View接口
9 | * Change : YangHaoYi on 2019/4/3017:25.
10 | * Version : V 1.0
11 | */
12 | public interface ISearchView {
13 | /** 显示搜索结果 **/
14 | void showSearchResult(SearchResultData resultData);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.FragmentActivity;
5 | import android.view.View;
6 | import android.widget.FrameLayout;
7 | import android.widget.TextView;
8 |
9 | import com.yanghaoyi.presentation.R;
10 | import com.yanghaoyi.presentation.presenter.PresentationPresenter;
11 | import com.yanghaoyi.presentation.view.compoent.FloatButton;
12 | import com.yanghaoyi.presentation.view.page.MapFrameLayout;
13 | import com.yanghaoyi.presentation.view.page.SearchFrameLayout;
14 |
15 | /**
16 | * @author : YangHaoYi on 2019/1/2.
17 | * Email : yang.haoyi@qq.com
18 | * Description :多屏显示示例
19 | * Change : YangHaoYi on 2019/1/2.
20 | * Version : V 1.0
21 | */
22 | public class MainActivity extends FragmentActivity implements View.OnClickListener,
23 | MapFrameLayout.MapCallBackListener, SearchFrameLayout.SearchCallBack {
24 |
25 | /** 展示第二块屏幕按钮 **/
26 | private TextView tvShowPresentation;
27 | /** Presentation逻辑控制中心 **/
28 | private PresentationPresenter presentationPresenter;
29 | /** 页面根布局 **/
30 | private FrameLayout fmActivityContent;
31 | /** 地图页 **/
32 | private MapFrameLayout mapFrameLayout;
33 | /** 搜索页 **/
34 | private SearchFrameLayout searchFrameLayout;
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_main);
40 | init();
41 | }
42 |
43 | /** 初始化 **/
44 | private void init(){
45 | initView();
46 | initEvent();
47 | }
48 |
49 | /** 初始化视图 **/
50 | private void initView(){
51 | tvShowPresentation = findViewById(R.id.tvShowPresentation);
52 | fmActivityContent = findViewById(R.id.fmActivityContent);
53 | initPage();
54 | }
55 |
56 | /** 初始化页面 **/
57 | private void initPage(){
58 | mapFrameLayout = new MapFrameLayout(this);
59 | mapFrameLayout.setMapCallBackListener(this);
60 | fmActivityContent.addView(mapFrameLayout);
61 | FloatButton floatButton = new FloatButton(this);
62 | fmActivityContent.addView(floatButton);
63 | }
64 |
65 | /** 初始化事件 **/
66 | private void initEvent(){
67 | presentationPresenter = new PresentationPresenter();
68 | tvShowPresentation.setOnClickListener(this);
69 | }
70 |
71 | @Override
72 | public void onClick(View v) {
73 | switch (v.getId()){
74 | case R.id.tvShowPresentation:
75 | presentationPresenter.openSearchPresentation(MainActivity.this);
76 | break;
77 | default:
78 | break;
79 | }
80 | }
81 |
82 | /** 地图页面回调 **/
83 | @Override
84 | public void mapCallBackContent(MapFrameLayout.MapEvent event, Object data) {
85 | switch (event){
86 | case Search:
87 | if(null == searchFrameLayout){
88 | searchFrameLayout = new SearchFrameLayout(this);
89 | searchFrameLayout.setSearchBackListener(this);
90 | fmActivityContent.addView(searchFrameLayout);
91 | }else {
92 | fmActivityContent.addView(searchFrameLayout);
93 | }
94 | break;
95 | case Other:
96 | break;
97 | default:
98 | break;
99 | }
100 | }
101 |
102 | /** 搜索页面回调 **/
103 | @Override
104 | public void searchCallBackContent(SearchFrameLayout.SearchEvent event, Object data) {
105 | switch (event){
106 | case Back:
107 | fmActivityContent.removeView(searchFrameLayout);
108 | searchFrameLayout = null;
109 | break;
110 | case Other:
111 | break;
112 | default:
113 | break;
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/compoent/FloatButton.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.compoent;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.yanghaoyi.presentation.R;
10 | import com.yanghaoyi.presentation.presenter.event.MapEvent;
11 | import com.yanghaoyi.presentation.presenter.event.SearchEvent;
12 |
13 | import org.greenrobot.eventbus.EventBus;
14 |
15 | /**
16 | * @author : YangHaoYi on 2019/5/811:31.
17 | * Email : yang.haoyi@qq.com
18 | * Description :
19 | * Change : YangHaoYi on 2019/5/811:31.
20 | * Version : V 1.0
21 | */
22 | public class FloatButton extends LinearLayout implements View.OnClickListener {
23 |
24 | private Context context;
25 | private TextView tvPresentationZoomIn;
26 | private TextView tvPresentationToSearch;
27 | private TextView tvPresentationDoSearch;
28 | private TextView tvPresentationSearchBack;
29 |
30 |
31 | public FloatButton(Context context) {
32 | super(context);
33 | this.context = context;
34 | init();
35 | }
36 |
37 | private void init(){
38 | initView();
39 | initEvent();
40 | }
41 |
42 | private void initView(){
43 | LayoutInflater.from(context).inflate(R.layout.linearlayout_float_button,this);
44 | tvPresentationZoomIn = findViewById(R.id.tvPresentationZoomIn);
45 | tvPresentationToSearch = findViewById(R.id.tvPresentationToSearch);
46 | tvPresentationDoSearch = findViewById(R.id.tvPresentationDoSearch);
47 | tvPresentationSearchBack = findViewById(R.id.tvPresentationSearchBack);
48 | }
49 |
50 | private void initEvent(){
51 | tvPresentationZoomIn.setOnClickListener(this);
52 | tvPresentationToSearch.setOnClickListener(this);
53 | tvPresentationDoSearch.setOnClickListener(this);
54 | tvPresentationSearchBack.setOnClickListener(this);
55 | }
56 |
57 | @Override
58 | public void onClick(View v) {
59 | switch (v.getId()){
60 | case R.id.tvPresentationZoomIn:
61 | MapEvent mapEvent = new MapEvent();
62 | mapEvent.setCode(MapEvent.ZOOM_IN);
63 | EventBus.getDefault().post(mapEvent);
64 | break;
65 | case R.id.tvPresentationToSearch:
66 | MapEvent toSearch = new MapEvent();
67 | toSearch.setCode(MapEvent.TO_SEARCH);
68 | EventBus.getDefault().post(toSearch);
69 | break;
70 | case R.id.tvPresentationDoSearch:
71 | SearchEvent searchEvent = new SearchEvent();
72 | searchEvent.setCode(SearchEvent.DO_SEARCH);
73 | EventBus.getDefault().post(searchEvent);
74 | break;
75 | case R.id.tvPresentationSearchBack:
76 | SearchEvent back = new SearchEvent();
77 | back.setCode(SearchEvent.BACK);
78 | EventBus.getDefault().post(back);
79 | break;
80 | default:
81 | break;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/impl/ContentViewImpl.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.impl;
2 |
3 | import android.content.Context;
4 | import android.widget.FrameLayout;
5 |
6 | import com.yanghaoyi.presentation.view.IContentView;
7 |
8 | /**
9 | * @author : YangHaoYi on 2019/5/510:28.
10 | * Email : yang.haoyi@qq.com
11 | * Description :根页面实现View
12 | * Change : YangHaoYi on 2019/5/510:28.
13 | * Version : V 1.0
14 | */
15 | public class ContentViewImpl implements IContentView {
16 |
17 | /** 上下文 **/
18 | private Context context;
19 | /** 根布局 **/
20 | private FrameLayout fmContent;
21 |
22 | public ContentViewImpl(Context context, FrameLayout fmContent) {
23 | this.context = context;
24 | this.fmContent = fmContent;
25 | }
26 |
27 | @Override
28 | public void showSearchPage() {
29 |
30 | }
31 |
32 | @Override
33 | public void backToMap() {
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/impl/MapViewImpl.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.impl;
2 |
3 | import android.content.Context;
4 | import android.widget.FrameLayout;
5 | import android.widget.TextView;
6 |
7 | import com.yanghaoyi.presentation.R;
8 | import com.yanghaoyi.presentation.view.IMapView;
9 |
10 | /**
11 | * @author : YangHaoYi on 2019/4/3011:09.
12 | * Email : yang.haoyi@qq.com
13 | * Description :地图实现View
14 | * Change : YangHaoYi on 2019/4/3011:09.
15 | * Version : V 1.0
16 | */
17 | public class MapViewImpl implements IMapView {
18 |
19 | /** 上下文 **/
20 | private Context context;
21 | /** 提示信息 **/
22 | private TextView tvNotice;
23 |
24 |
25 | public MapViewImpl(Context context,TextView tvNotice) {
26 | this.context = context;
27 | this.tvNotice = tvNotice;
28 | }
29 |
30 | /** 放大地图 **/
31 | @Override
32 | public void zoomInFinish() {
33 | tvNotice.setText(context.getResources().getString(R.string.zoom_in_success));
34 | }
35 |
36 | /** 缩小地图 **/
37 | @Override
38 | public void zoomOutFinish() {
39 | tvNotice.setText(context.getResources().getString(R.string.zoom_out_success));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/impl/SearchViewImpl.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.impl;
2 |
3 | import android.widget.TextView;
4 |
5 | import com.google.gson.Gson;
6 | import com.yanghaoyi.presentation.model.data.SearchResultData;
7 | import com.yanghaoyi.presentation.view.ISearchView;
8 |
9 | /**
10 | * @author : YangHaoYi on 2019/5/59:41.
11 | * Email : yang.haoyi@qq.com
12 | * Description :搜索结果实现View
13 | * Change : YangHaoYi on 2019/5/59:41.
14 | * Version : V 1.0
15 | */
16 | public class SearchViewImpl implements ISearchView {
17 |
18 | /** 搜索结果展示 **/
19 | private TextView tvSearchResult;
20 |
21 | public SearchViewImpl(TextView tvSearchResult) {
22 | this.tvSearchResult = tvSearchResult;
23 | }
24 |
25 | /**
26 | * 展示搜索结果
27 | * @param resultData 搜索结果数据bean
28 | * **/
29 | @Override
30 | public void showSearchResult(SearchResultData resultData) {
31 | Gson gson = new Gson();
32 | String result = gson.toJson(resultData);
33 | tvSearchResult.setText(result);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/page/MapFrameLayout.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.page;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.FrameLayout;
7 | import android.widget.TextView;
8 |
9 | import com.yanghaoyi.presentation.R;
10 | import com.yanghaoyi.presentation.presenter.MapPresenter;
11 | import com.yanghaoyi.presentation.view.IMapView;
12 | import com.yanghaoyi.presentation.view.impl.MapViewImpl;
13 |
14 | /**
15 | * @author : YangHaoYi on 2019/4/3010:18.
16 | * Email : yang.haoyi@qq.com
17 | * Description :地图页
18 | * Change : YangHaoYi on 2019/4/3010:18.
19 | * Version : V 1.0
20 | */
21 | public class MapFrameLayout extends FrameLayout implements View.OnClickListener {
22 |
23 | /** 上下文 **/
24 | private Context context;
25 | /** 操作提示 **/
26 | private TextView tvMapNotice;
27 | /** 放大地图按钮 **/
28 | private TextView tvMapZoomIn;
29 | /** 缩小地图按钮 **/
30 | private TextView tvMapZoomOut;
31 | /** 跳转搜索页 **/
32 | private TextView tvToSearchPage;
33 | /** 地图视图接口 **/
34 | private IMapView mapView;
35 | /** 地图逻辑控制中心 **/
36 | private MapPresenter mapPresenter;
37 | /** 地图事件回调 **/
38 | private MapCallBackListener mapCallBackListener;
39 |
40 | public MapFrameLayout(Context context) {
41 | super(context);
42 | this.context = context;
43 | init();
44 | }
45 |
46 | /** 初始化 **/
47 | private void init(){
48 | initView();
49 | initEvent();
50 | }
51 |
52 | /** 初始化视图 **/
53 | private void initView(){
54 | LayoutInflater.from(context).inflate(R.layout.framelayout_map, this);
55 | tvMapNotice = findViewById(R.id.tvMapNotice);
56 | tvMapZoomIn = findViewById(R.id.tvMapZoomIn);
57 | tvMapZoomOut = findViewById(R.id.tvMapZoomOut);
58 | tvToSearchPage = findViewById(R.id.tvToSearchPage);
59 | mapView = new MapViewImpl(context,tvMapNotice);
60 | }
61 |
62 | /** 初始化事件 **/
63 | private void initEvent(){
64 | tvMapZoomIn.setOnClickListener(this);
65 | tvMapZoomOut.setOnClickListener(this);
66 | tvToSearchPage.setOnClickListener(this);
67 | mapPresenter = new MapPresenter(mapView);
68 | }
69 |
70 | @Override
71 | public void onClick(View v) {
72 | switch (v.getId()){
73 | case R.id.tvMapZoomIn:
74 | mapPresenter.zoomIn();
75 | break;
76 | case R.id.tvMapZoomOut:
77 | mapPresenter.zoomOut();
78 | break;
79 | case R.id.tvToSearchPage:
80 | mapCallBackListener.mapCallBackContent(MapEvent.Search,null);
81 | break;
82 | default:
83 | break;
84 | }
85 | }
86 |
87 | /** 设置地图事件回调 **/
88 | public void setMapCallBackListener(MapCallBackListener mapCallBackListener) {
89 | this.mapCallBackListener = mapCallBackListener;
90 | }
91 |
92 | /** 地图事件回调 **/
93 | public interface MapCallBackListener{
94 | void mapCallBackContent(MapEvent event,Object data);
95 | }
96 |
97 | /** 地图事件 **/
98 | public enum MapEvent{
99 | Search,
100 | Other
101 | }
102 |
103 |
104 | /** EventBus模拟点击 */
105 | public void performZoomIn(){
106 | tvMapZoomIn.performClick();
107 | }
108 | public void performToSearch(){
109 | tvToSearchPage.performClick();
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/page/SearchFrameLayout.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.page;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.FrameLayout;
7 | import android.widget.TextView;
8 |
9 | import com.yanghaoyi.presentation.R;
10 | import com.yanghaoyi.presentation.presenter.SearchPresenter;
11 | import com.yanghaoyi.presentation.view.ISearchView;
12 | import com.yanghaoyi.presentation.view.impl.SearchViewImpl;
13 |
14 | /**
15 | * @author : YangHaoYi on 2019/4/3010:18.
16 | * Email : yang.haoyi@qq.com
17 | * Description :搜索页
18 | * Change : YangHaoYi on 2019/4/3010:18.
19 | * Version : V 1.0
20 | */
21 | public class SearchFrameLayout extends FrameLayout implements View.OnClickListener {
22 |
23 | /** 上下文 **/
24 | private Context context;
25 | /** 返回按钮 **/
26 | private TextView tvSearchBack;
27 | /** 搜索按钮 **/
28 | private TextView tvSearchDoSearch;
29 | /** 搜索结果 **/
30 | private TextView tvSearchResult;
31 |
32 | /** 搜索View接口 **/
33 | private ISearchView searchView;
34 | /** 搜索逻辑中心 **/
35 | private SearchPresenter searchPresenter;
36 | /** 搜索事件回调 **/
37 | private SearchCallBack searchCallBack;
38 |
39 |
40 | public SearchFrameLayout(Context context) {
41 | super(context);
42 | this.context = context;
43 | init();
44 | }
45 |
46 | /** 初始化 **/
47 | private void init(){
48 | initView();
49 | initEvent();
50 | }
51 |
52 | /** 初始化视图 **/
53 | private void initView(){
54 | LayoutInflater.from(context).inflate(R.layout.framelayout_search, this);
55 | tvSearchBack = findViewById(R.id.tvSearchBack);
56 | tvSearchDoSearch = findViewById(R.id.tvSearchDoSearch);
57 | tvSearchResult = findViewById(R.id.tvSearchResult);
58 | searchView = new SearchViewImpl(tvSearchResult);
59 | }
60 |
61 | /** 初始化事件 **/
62 | private void initEvent(){
63 | tvSearchBack.setOnClickListener(this);
64 | tvSearchDoSearch.setOnClickListener(this);
65 | searchPresenter = new SearchPresenter(searchView);
66 | }
67 |
68 |
69 | @Override
70 | public void onClick(View v) {
71 | switch (v.getId()){
72 | case R.id.tvSearchBack:
73 | searchCallBack.searchCallBackContent(SearchEvent.Back,null);
74 | break;
75 | case R.id.tvSearchDoSearch:
76 | searchPresenter.nearbySearch();
77 | break;
78 | default:
79 | break;
80 | }
81 | }
82 |
83 | /** 设置地图事件回调 **/
84 | public void setSearchBackListener(SearchCallBack searchCallBack) {
85 | this.searchCallBack = searchCallBack;
86 | }
87 |
88 | /** 搜索事件回调 **/
89 | public interface SearchCallBack{
90 | void searchCallBackContent(SearchEvent event, Object data);
91 | }
92 |
93 | /** 搜索事件 **/
94 | public enum SearchEvent{
95 | Back,
96 | Other
97 | }
98 |
99 |
100 | /** EventBus模拟点击 */
101 | public void performDoSearch(){
102 | tvSearchDoSearch.performClick();
103 | }
104 |
105 | public void performBack(){
106 | tvSearchBack.performClick();
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/presentation/SecondScreenPresentation.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.presentation;
2 |
3 | import android.app.Presentation;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.util.Log;
7 | import android.view.Display;
8 | import android.widget.FrameLayout;
9 |
10 | import com.yanghaoyi.presentation.R;
11 | import com.yanghaoyi.presentation.presenter.event.MapEvent;
12 | import com.yanghaoyi.presentation.presenter.event.SearchEvent;
13 | import com.yanghaoyi.presentation.view.page.MapFrameLayout;
14 | import com.yanghaoyi.presentation.view.page.SearchFrameLayout;
15 |
16 | import org.greenrobot.eventbus.EventBus;
17 | import org.greenrobot.eventbus.Subscribe;
18 |
19 | /**
20 | * @author : YangHaoYi on 2019/1/2.
21 | * Email : yang.haoyi@qq.com
22 | * Description :双屏异显辅助屏幕
23 | * Change : YangHaoYi on 2019/1/2.
24 | * Version : V 1.0
25 | */
26 | public class SecondScreenPresentation extends Presentation implements MapFrameLayout.MapCallBackListener,
27 | SearchFrameLayout.SearchCallBack {
28 |
29 | /** TAG **/
30 | private static final String TAG = "Presentation";
31 | /** 根布局 **/
32 | private FrameLayout fmContent;
33 | /** 地图页 **/
34 | private MapFrameLayout mapFrameLayout;
35 | /** 搜索页 **/
36 | private SearchFrameLayout searchFrameLayout;
37 |
38 |
39 | public SecondScreenPresentation(Context outerContext, Display display) {
40 | super(outerContext, display);
41 | }
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.presentation_search);
47 | init();
48 | }
49 |
50 | private void init(){
51 | initView();
52 | initEvent();
53 | }
54 |
55 | private void initView(){
56 | fmContent = findViewById(R.id.fmContent);
57 | initPage();
58 | }
59 |
60 | private void initPage(){
61 | mapFrameLayout = new MapFrameLayout(getContext());
62 | mapFrameLayout.setMapCallBackListener(this);
63 | fmContent.addView(mapFrameLayout);
64 | searchFrameLayout = new SearchFrameLayout(getContext());
65 | }
66 |
67 |
68 | private void initEvent(){
69 | windowWidthAndHeightTest();
70 | }
71 |
72 | private void windowWidthAndHeightTest(){
73 | int height = getContext().getResources().getDisplayMetrics().heightPixels;
74 | int width = getContext().getResources().getDisplayMetrics().widthPixels;
75 | Log.d(TAG,"height_is"+height+" width_is:"+width);
76 | System.out.println("SearchPresentation________height_is"+height+" width_is:"+width);
77 | }
78 |
79 | @Override
80 | public void mapCallBackContent(MapFrameLayout.MapEvent event, Object data) {
81 | switch (event){
82 | case Search:
83 | if(null == searchFrameLayout){
84 | searchFrameLayout = new SearchFrameLayout(getContext());
85 | searchFrameLayout.setSearchBackListener(this);
86 | fmContent.addView(searchFrameLayout);
87 | }else {
88 | searchFrameLayout.setSearchBackListener(this);
89 | fmContent.addView(searchFrameLayout);
90 | }
91 | break;
92 | default:
93 | break;
94 | }
95 | }
96 |
97 | /** 搜索页面回调 **/
98 | @Override
99 | public void searchCallBackContent(SearchFrameLayout.SearchEvent event, Object data) {
100 | switch (event){
101 | case Back:
102 | fmContent.removeView(searchFrameLayout);
103 | searchFrameLayout = null;
104 | break;
105 | case Other:
106 | break;
107 | default:
108 | break;
109 | }
110 | }
111 |
112 |
113 | /** EventBus模拟点击 */
114 |
115 | /** EventBus注册 */
116 | @Override
117 | public void show() {
118 | super.show();
119 | if(!EventBus.getDefault().isRegistered(this)){
120 | EventBus.getDefault().register(this);
121 | }
122 | }
123 |
124 | /** EventBus解注册 */
125 | @Override
126 | public void dismiss() {
127 | EventBus.getDefault().unregister(this);
128 | super.dismiss();
129 | }
130 |
131 | /** 地图Event事件 */
132 | @Subscribe
133 | public void onMapEvent(MapEvent mapEvent){
134 | switch (mapEvent.getCode()){
135 | case MapEvent.ZOOM_IN:
136 | mapFrameLayout.performZoomIn();
137 | break;
138 | case MapEvent.TO_SEARCH:
139 | mapFrameLayout.performToSearch();
140 | break;
141 | default:
142 | break;
143 | }
144 | }
145 |
146 | /** 搜索Event事件 */
147 | @Subscribe
148 | public void onSearchEvent(SearchEvent searchEvent){
149 | switch (searchEvent.getCode()){
150 | case SearchEvent.DO_SEARCH:
151 | searchFrameLayout.performDoSearch();
152 | break;
153 | case SearchEvent.BACK:
154 | searchFrameLayout.performBack();
155 | break;
156 | default:
157 | break;
158 | }
159 | }
160 |
161 |
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yanghaoyi/presentation/view/service/MultiScreenService.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation.view.service;
2 |
3 | import android.app.Service;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.hardware.display.DisplayManager;
7 | import android.os.Binder;
8 | import android.os.IBinder;
9 | import android.view.Display;
10 | import android.view.WindowManager;
11 |
12 | import com.yanghaoyi.presentation.view.presentation.SecondScreenPresentation;
13 |
14 | /**
15 | * @author : YangHaoYi on 2019/4/3011:04.
16 | * Email : yang.haoyi@qq.com
17 | * Description :离屏渲染服务
18 | * Change : YangHaoYi on 2019/4/3011:04.
19 | * Version : V 1.0
20 | */
21 | public class MultiScreenService extends Service{
22 |
23 | /** 屏幕管理器 **/
24 | private DisplayManager mDisplayManager;
25 | /** 屏幕数组 **/
26 | private Display[] displays;
27 | /** 第二块屏 **/
28 | private SecondScreenPresentation presentation;
29 |
30 |
31 | @Override
32 | public IBinder onBind(Intent intent) {
33 | return new MultiScreenBinder();
34 | }
35 |
36 | @Override
37 | public void onCreate() {
38 | super.onCreate();
39 | initPresentation();
40 | }
41 |
42 | /** 初始化第二块屏幕 **/
43 | private void initPresentation(){
44 | if(null==presentation){
45 | mDisplayManager = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE);
46 | displays = mDisplayManager.getDisplays();
47 | if(displays.length > 1){
48 | // displays[1]是副屏
49 | presentation = new SecondScreenPresentation(this, displays[1]);
50 | presentation.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
51 |
52 | }
53 | }
54 | }
55 |
56 | /** 显示第二块屏 **/
57 | public void showSearchPresentation(){
58 | presentation.show();
59 | }
60 |
61 |
62 | public class MultiScreenBinder extends Binder{
63 | public MultiScreenService getService(){
64 | return MultiScreenService.this;
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/framelayout_map.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
32 |
33 |
37 |
38 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/framelayout_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
14 |
18 |
19 |
23 |
24 |
28 |
29 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/linearlayout_float_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
23 |
24 |
31 |
32 |
36 |
37 |
44 |
48 |
49 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/presentation_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
13 |
14 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/map_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-mdpi/map_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #1FA67B
7 | #FFFFFF
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 多屏互动
3 | 成功放大地图
4 | 成功缩小地图
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/yanghaoyi/presentation/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.yanghaoyi.presentation;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YangHaoyi/MultiScreenDemo/7847ed9a77dadef359face5a31c9c47708177ec1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jan 02 16:29:34 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/navisdk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/navisdk/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | implementation 'com.android.support:appcompat-v7:28.0.0'
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34 | }
35 |
--------------------------------------------------------------------------------
/navisdk/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/navisdk/src/androidTest/java/com/autoai/navisdk/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.autoai.navisdk;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.autoai.navisdk.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/navisdk/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/navisdk/src/main/java/com/autoai/navisdk/MapManager.java:
--------------------------------------------------------------------------------
1 | package com.autoai.navisdk;
2 |
3 | import com.autoai.navisdk.enu.MapEvent;
4 | import com.autoai.navisdk.listener.MapEventListener;
5 |
6 | /**
7 | * @author : YangHaoYi on 2019/4/3010:59.
8 | * Email : yang.haoyi@qq.com
9 | * Description :
10 | * Change : YangHaoYi on 2019/4/3010:59.
11 | * Version : V 1.0
12 | */
13 | public class MapManager {
14 |
15 | private static final MapManager instance = new MapManager();
16 |
17 | public static MapManager getInstance() {
18 | return instance;
19 | }
20 |
21 | public void zoomIn(MapEventListener mapEventListener){
22 | mapEventListener.onMapEvent(MapEvent.ZOOM_IN_FINISH,null);
23 | }
24 |
25 | public void zoomOut(MapEventListener mapEventListener){
26 | mapEventListener.onMapEvent(MapEvent.ZOOM_OUT_FINSIH,null);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/navisdk/src/main/java/com/autoai/navisdk/enu/MapEvent.java:
--------------------------------------------------------------------------------
1 | package com.autoai.navisdk.enu;
2 |
3 | /**
4 | * @author : YangHaoYi on 2019/4/3011:02.
5 | * Email : yang.haoyi@qq.com
6 | * Description :
7 | * Change : YangHaoYi on 2019/4/3011:02.
8 | * Version : V 1.0
9 | */
10 | public enum MapEvent {
11 |
12 | ZOOM_IN_FINISH,
13 | ZOOM_OUT_FINSIH;
14 | }
15 |
--------------------------------------------------------------------------------
/navisdk/src/main/java/com/autoai/navisdk/listener/MapEventListener.java:
--------------------------------------------------------------------------------
1 | package com.autoai.navisdk.listener;
2 |
3 | import com.autoai.navisdk.enu.MapEvent;
4 |
5 | /**
6 | * @author : YangHaoYi on 2019/4/3011:01.
7 | * Email : yang.haoyi@qq.com
8 | * Description :
9 | * Change : YangHaoYi on 2019/4/3011:01.
10 | * Version : V 1.0
11 | */
12 | public interface MapEventListener {
13 | void onMapEvent(MapEvent event, Object data);
14 | }
15 |
--------------------------------------------------------------------------------
/navisdk/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NaviSDK
3 |
4 |
--------------------------------------------------------------------------------
/navisdk/src/test/java/com/autoai/navisdk/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.autoai.navisdk;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':navisdk'
2 |
--------------------------------------------------------------------------------