[change]测试程序加接口
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
@@ -54,6 +55,11 @@
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.HelpActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -2,14 +2,38 @@ package com.zhidao.adas.client.base;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.Gravity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.zhidao.adas.client.ui.MainActivity;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
private BaseHandler mBaseHandler;
|
||||
private Toast toast;
|
||||
|
||||
protected void showToastCenter(String msg) {
|
||||
showToastCenter(msg, Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
protected void showToastCenter(String msg, int duration) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
toast = null;
|
||||
}
|
||||
toast = Toast.makeText(BaseActivity.this, "", duration); //如果有居中显示需求
|
||||
toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
toast.setText(msg);
|
||||
toast.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
|
||||
public class HelpActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_help);
|
||||
showToastCenter("点击屏幕任意位置,退出帮助页面");
|
||||
}
|
||||
|
||||
public void onBack(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import static com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
@@ -382,6 +383,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
showLocalIP();
|
||||
}
|
||||
});
|
||||
title.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
startActivity(new Intent(MainActivity.this, HelpActivity.class));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tvIp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -811,27 +819,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
|
||||
|
||||
private Toast toast;
|
||||
|
||||
public void showToastCenter(String msg) {
|
||||
showToastCenter(msg, Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
public void showToastCenter(String msg, int duration) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
toast = null;
|
||||
}
|
||||
toast = Toast.makeText(MainActivity.this, "", duration); //如果有居中显示需求
|
||||
toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
toast.setText(msg);
|
||||
toast.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initAdas() {
|
||||
|
||||
BIN
app_ipc_monitoring/src/main/res/drawable/help.png
Normal file
BIN
app_ipc_monitoring/src/main/res/drawable/help.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 370 KiB |
10
app_ipc_monitoring/src/main/res/layout/activity_help.xml
Normal file
10
app_ipc_monitoring/src/main/res/layout/activity_help.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="onBack"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/help"
|
||||
tools:context=".ui.HelpActivity" />
|
||||
|
||||
Reference in New Issue
Block a user