Add check activity

This commit is contained in:
martindhy
2021-07-04 13:08:03 +08:00
parent 19b53e6e87
commit 347f2cbc71
17 changed files with 106 additions and 111 deletions

2
.idea/gradle.xml generated
View File

@@ -43,6 +43,7 @@
<option value="$PROJECT_DIR$/modules/mogo-module-apps" />
<option value="$PROJECT_DIR$/modules/mogo-module-authorize" />
<option value="$PROJECT_DIR$/modules/mogo-module-back" />
<option value="$PROJECT_DIR$/modules/mogo-module-check" />
<option value="$PROJECT_DIR$/modules/mogo-module-common" />
<option value="$PROJECT_DIR$/modules/mogo-module-extensions" />
<option value="$PROJECT_DIR$/modules/mogo-module-guide" />
@@ -91,7 +92,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

2
.idea/misc.xml generated
View File

@@ -8,7 +8,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -1,26 +0,0 @@
package com.amap.navi.mogo_module_adas;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.amap.navi.mogo_module_adas.test", appContext.getPackageName());
}
}

View File

@@ -1,17 +0,0 @@
package com.amap.navi.mogo_module_adas;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -44,6 +44,7 @@ dependencies {
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation 'com.google.android.material:material:1.2.1'
annotationProcessor rootProject.ext.dependencies.aroutercompiler

View File

@@ -2,4 +2,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.check">
<application>
<activity
android:name=".CheckActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
</application>
</manifest>

View File

@@ -0,0 +1,27 @@
package com.mogo.module.check
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_check.*
/**
* 检测页面
*/
class CheckActivity : AppCompatActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, CheckActivity::class.java)
context.startActivity(starter)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_check)
btnBack.setOnClickListener { finish() }
}
}

View File

@@ -3,7 +3,7 @@ package com.mogo.module.check;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.service.check.ICheckProvider;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.logger.Logger;
@@ -16,12 +16,20 @@ import com.mogo.utils.logger.Logger;
* wikihttp://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
*/
@Route(path = MogoServicePaths.PATH_CHECK)
public class CheckProvider implements IProvider {
private static final String TAG = "CheckProvider";
public class CheckProvider implements ICheckProvider {
private static final String TAG = "CheckProvider";
private Context mContext;
@Override
public void init(Context context) {
Logger.d(TAG, "初始化 CheckProvider 模块");
mContext = context;
}
@Override
public void startCheckActivity(Context context) {
if (context != null) {
CheckActivity.Companion.start(context);
}
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CheckActivity">
<Button
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="返回"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="检测页面"
android:textSize="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1 @@
<resources></resources>

View File

@@ -178,6 +178,9 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
mPresenter.checkPermission(this);
// 启动检测页面
MogoApisHandler.getInstance().getApis().getCheckProvider().startCheckActivity(this);
}
private void init() {

View File

@@ -1,26 +0,0 @@
package com.mogo.module.blackbox;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.mogo.module.blackbox.test", appContext.getPackageName());
}
}

View File

@@ -1,17 +0,0 @@
package com.mogo.module.blackbox;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -1,20 +0,0 @@
package com.mogo.module.blackbox;
import com.mogo.module.v2x.utils.TimeConstants;
import com.mogo.module.v2x.utils.TimeUtils;
import org.junit.Test;
public class TimeUtilsTest {
@Test
public void getTimeSpan() {
// 获取 ACC ON 时间
String accOnTime = "2020-06-08 14:44:04";
// 获取 ACC OFF 时间
String accOFFTime = "2020-06-08 14:40:49";
// 比较开关机时间如果acc of 比 acc on 时间还要靠近说明acc on 时间记录有问题,需要更新同步
long timeSpan = TimeUtils.getTimeSpan(accOnTime, accOFFTime, TimeConstants.MIN);
System.out.println("开关机时间间隔:" + timeSpan);
}
}

View File

@@ -7,6 +7,7 @@ import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.auth.IMogoAuthManager;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.check.ICheckProvider;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.connection.IMogoWebSocketManager;
import com.mogo.service.datamanager.IMogoDataManager;
@@ -326,6 +327,11 @@ public interface IMogoServiceApis extends IProvider {
*/
IMogoSmallMapProvider getSmallMapProviderApi();
/**
* 检测接口
*/
ICheckProvider getCheckProvider();
/*
*V2X
* */

View File

@@ -0,0 +1,15 @@
package com.mogo.service.check;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* 检测接口
*/
public interface ICheckProvider extends IProvider {
/**
* 启动检测模块
*/
void startCheckActivity(Context context);
}

View File

@@ -11,6 +11,7 @@ import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.auth.IMogoAuthManager;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.check.ICheckProvider;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.connection.IMogoWebSocketManager;
import com.mogo.service.datamanager.IMogoDataManager;
@@ -264,6 +265,11 @@ public class MogoServiceApis implements IMogoServiceApis {
return getApiInstance(IMogoSmallMapProvider.class, MogoServicePaths.PATH_SMALL_MAP);
}
@Override
public ICheckProvider getCheckProvider() {
return getApiInstance(ICheckProvider.class, MogoServicePaths.PATH_CHECK);
}
@Override
public IV2XProvider getV2XListenerManager() {
return getApiInstance(IV2XProvider.class, MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING);