添加左侧面板实现
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -35,6 +35,7 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-debug" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-noop" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-guide" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-main" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-map" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-media" />
|
||||
|
||||
@@ -217,10 +217,16 @@ dependencies {
|
||||
releaseImplementation rootProject.ext.dependencies.gpssimulatornoop
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
// 事件面板分渠道引用
|
||||
d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
|
||||
d8xxImplementation rootProject.ext.dependencies.moduleventpanel
|
||||
e8xxImplementation rootProject.ext.dependencies.moduleventpanel
|
||||
f8xxImplementation rootProject.ext.dependencies.moduleventpanel
|
||||
// 左侧面板分渠道引用
|
||||
d82xImplementation rootProject.ext.dependencies.moduleleftpanel
|
||||
d8xxImplementation rootProject.ext.dependencies.moduleleftpanel
|
||||
e8xxImplementation rootProject.ext.dependencies.moduleleftpanel
|
||||
f8xxImplementation rootProject.ext.dependencies.moduleleftpanel
|
||||
} else {
|
||||
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
|
||||
// launcherImplementation project(':modules:mogo-module-main')
|
||||
@@ -234,10 +240,16 @@ dependencies {
|
||||
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
// 事件面板分渠道引用
|
||||
d82xImplementation project(':modules:mogo-module-event-panel-noop')
|
||||
d8xxImplementation project(':modules:mogo-module-event-panel')
|
||||
e8xxImplementation project(':modules:mogo-module-event-panel')
|
||||
f8xxImplementation project(':modules:mogo-module-event-panel')
|
||||
// 左侧面板分渠道引用
|
||||
d82xImplementation project(':modules:mogo-module-left-panel')
|
||||
d8xxImplementation project(':modules:mogo-module-left-panel')
|
||||
e8xxImplementation project(':modules:mogo-module-left-panel')
|
||||
f8xxImplementation project(':modules:mogo-module-left-panel')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants;
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -63,6 +64,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule(EventPanelConstants.PATH_NAME,
|
||||
EventPanelConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(LeftPanelConst.PATH_NAME,
|
||||
LeftPanelConst.MODULE_NAME));
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
||||
|
||||
@@ -162,6 +162,8 @@ ext {
|
||||
//事件面板
|
||||
moduleventpanel : "com.mogo.module:module-event-panel:${MOGO_MODULE_EVENT_PANEL_VERSION}",
|
||||
// 事件面板空实现
|
||||
moduleventpanelnoop : "com.mogo.module:module-event-panel-noop:${MOGO_MODULE_EVENT_PANEL_VERSION}"
|
||||
moduleventpanelnoop : "com.mogo.module:module-event-panel-noop:${MOGO_MODULE_EVENT_PANEL_VERSION}",
|
||||
// 左侧面板
|
||||
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}"
|
||||
]
|
||||
}
|
||||
@@ -58,6 +58,8 @@ MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.11
|
||||
|
||||
MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
|
||||
|
||||
MOGO_MODULE_LEFT_PANEL_VERSION = 1.2.1.10-SNAPSHOT
|
||||
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
|
||||
1
modules/mogo-module-left-panel/.gitignore
vendored
Normal file
1
modules/mogo-module-left-panel/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
58
modules/mogo-module-left-panel/build.gradle
Normal file
58
modules/mogo-module-left-panel/build.gradle
Normal file
@@ -0,0 +1,58 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
compileOnly rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
compileOnly project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
modules/mogo-module-left-panel/consumer-rules.pro
Normal file
0
modules/mogo-module-left-panel/consumer-rules.pro
Normal file
3
modules/mogo-module-left-panel/gradle.properties
Normal file
3
modules/mogo-module-left-panel/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-left-panel
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-left-panel/proguard-rules.pro
vendored
Normal file
21
modules/mogo-module-left-panel/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.zhidao.mogo.module.left.panel.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.left.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
object LeftPanelConst {
|
||||
const val MODULE_NAME = "MODULE_LEFT_PANEL"
|
||||
const val PATH_NAME = "/left/panel"
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.location.MogoLocation
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst.PATH_NAME
|
||||
import com.zhidao.mogo.module.left.panel.fragment.SimpleSpeedFragment
|
||||
|
||||
|
||||
/**
|
||||
* 适配1+16增加的位于左侧的面板页provider
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = PATH_NAME)
|
||||
class LeftPanelProvider:IMogoModuleProvider {
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
Logger.d(MODULE_NAME, "左侧面板模块初始化===")
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return SimpleSpeedFragment()
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zhidao.mogo.module.left.panel.fragment
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.zhidao.mogo.module.left.panel.R
|
||||
import com.zhidao.mogo.module.left.panel.presenter.SimpleSpeedPresenter
|
||||
import kotlinx.android.synthetic.main.module_left_panel_simple_speed.*
|
||||
|
||||
/**
|
||||
* 临时车速界面的fragment
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class SimpleSpeedFragment: MvpFragment<SimpleSpeedFragment, SimpleSpeedPresenter>() {
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_left_panel_simple_speed
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
}
|
||||
|
||||
override fun createPresenter(): SimpleSpeedPresenter {
|
||||
return SimpleSpeedPresenter(this)
|
||||
}
|
||||
|
||||
fun refreshSpeed(speed: Int) {
|
||||
tvModuleLeftPanelSpeed.text = speed.toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhidao.mogo.module.left.panel.presenter
|
||||
|
||||
import android.os.Handler
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.location.MogoLocation
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
|
||||
import com.zhidao.mogo.module.left.panel.fragment.SimpleSpeedFragment
|
||||
import java.lang.Thread.sleep
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* 临时左侧车速逻辑的presenter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class SimpleSpeedPresenter(view: SimpleSpeedFragment) : Presenter<SimpleSpeedFragment>(view) {
|
||||
private val handler = Handler()
|
||||
private var mogoApis: IMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.context) as IMogoServiceApis
|
||||
init {
|
||||
// 注册相关回调,监测速度变化
|
||||
mogoApis.registerCenterApi.registerMogoLocationListener(MODULE_NAME) {
|
||||
handler.post {
|
||||
mView.refreshSpeed(it.speed.toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/tvModuleLeftPanelSpeed"
|
||||
android:text="50"
|
||||
android:gravity="center"
|
||||
android:textSize="40sp"
|
||||
android:textColor="#fff"
|
||||
android:background="#000" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,6 @@ dependencies {
|
||||
api rootProject.ext.dependencies.mogoconnection
|
||||
api rootProject.ext.dependencies.moduleextensions
|
||||
api rootProject.ext.dependencies.mogomoduleback
|
||||
// implementation rootProject.ext.dependencies.moduleventpanel
|
||||
} else {
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
@@ -66,7 +65,6 @@ dependencies {
|
||||
api project(':foudations:mogo-connection')
|
||||
api project(':modules:mogo-module-extensions')
|
||||
api project(':modules:mogo-module-back')
|
||||
// implementation project(':modules:mogo-module-event-panel')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected View mEntrance;
|
||||
protected FrameLayout mFloatingLayout;
|
||||
protected FrameLayout mCoverUpLayout;
|
||||
protected FrameLayout mLeftPanelLayout;
|
||||
protected View mLeftShadowFrame;
|
||||
private boolean mIsHomeKeyDown = false;
|
||||
|
||||
@@ -80,6 +81,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
||||
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
|
||||
mLeftPanelLayout = findViewById(R.id.module_main_id_left_panel_fragment_container);
|
||||
|
||||
// 避免事件穿透导致地图被滑动
|
||||
mLeftShadowFrame.setOnClickListener( view -> {
|
||||
@@ -183,6 +185,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
|
||||
MogoModulesManager.getInstance().loadLeftPanelModule(R.id.module_main_id_left_panel_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,4 +65,10 @@ public interface MogoModulesHandler {
|
||||
* @param containerId
|
||||
*/
|
||||
void loadEventPanelModule(int containerId);
|
||||
|
||||
/**
|
||||
* 加载左侧面板
|
||||
* @param containerId
|
||||
*/
|
||||
void loadLeftPanelModule(int containerId);
|
||||
}
|
||||
|
||||
@@ -139,6 +139,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadLeftPanelModule(int containerId) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_LEFT_PANEL)
|
||||
.navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/module_main_apps_fragment_container_padding" />
|
||||
|
||||
<!-- 左侧浮层,布局位置目前只考虑了1+16独立app情况 -->
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/module_main_id_entrance_fragment_container_marginLeft"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/module_main_id_left_panel_fragment_container" />
|
||||
|
||||
<!--快捷操作浮层-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_entrance_fragment_container"
|
||||
|
||||
@@ -191,5 +191,15 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_OBU = "/obu/api";
|
||||
|
||||
/**
|
||||
* 事件面板
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_EVENT_PANEL = "/event/panel";
|
||||
|
||||
/**
|
||||
* 左侧面板
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_LEFT_PANEL = "/left/panel";
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
include ':modules:mogo-module-left-panel'
|
||||
include ':modules:mogo-module-event-panel-noop'
|
||||
include ':modules:mogo-module-event-panel'
|
||||
include ':modules:mogo-module-obu'
|
||||
|
||||
Reference in New Issue
Block a user