[change] 添加路由器管理页面,完善长时间后台运行权限申请
This commit is contained in:
@@ -309,22 +309,23 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void onBack() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("退出提示")
|
||||
.setMessage("是否配置页面")
|
||||
.setNegativeButton("取消",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
})
|
||||
.setPositiveButton("确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
finish();
|
||||
// new AlertDialog.Builder(this)
|
||||
// .setTitle("退出提示")
|
||||
// .setMessage("是否配置页面")
|
||||
// .setNegativeButton("取消",
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// dialog.cancel();
|
||||
// }
|
||||
// })
|
||||
// .setPositiveButton("确认",
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// finish();
|
||||
// }
|
||||
// }).show();
|
||||
}
|
||||
|
||||
//返回键处理
|
||||
|
||||
@@ -89,6 +89,9 @@ import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
|
||||
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission;
|
||||
import com.zhidao.support.adas.high.other.permission.OnAdasPermissionListener;
|
||||
import com.zhidao.support.adas.high.other.router.RouterActivity;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
@@ -282,7 +285,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
tvConnectState = findViewById(R.id.tv_connect_state);
|
||||
ipcIp = findViewById(R.id.ipc_ip);
|
||||
localIp = findViewById(R.id.local_ip);
|
||||
|
||||
findViewById(R.id.btn_router).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouterActivity.newInstance(MainActivity.this, false);
|
||||
}
|
||||
});
|
||||
|
||||
role.setSelected(BuildConfig.IS_CLIENT);
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
@@ -527,21 +535,25 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
});
|
||||
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// String str = "后台运行:" + (AdasManager.getInstance().isPermissionLongBackgroundRunning(this) ? "<font color='red'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
// background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
// background.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
//// Permission.requestAddDataSaverWhite(MainActivity.this);
|
||||
//// AdasManager.getInstance().requestIgnoreBatteryOptimizations(MainActivity.this);
|
||||
// AdasManager.getInstance().showPermissionLongBackgroundRunningDialog(MainActivity.this);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// background.setVisibility(View.GONE);
|
||||
// }
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
String str = "后台运行:" + (BackgrounderPermission.getInstance().isPermissionLongBackgroundRunning(this) ? "<font color='red'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
background.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
BackgrounderPermission.getInstance().showPermissionLongBackgroundRunningDialog(MainActivity.this);
|
||||
}
|
||||
});
|
||||
BackgrounderPermission.getInstance().setListener(new OnAdasPermissionListener() {
|
||||
@Override
|
||||
public void onBackgrounderPermission(boolean isAllow) {
|
||||
String str = "后台运行:" + (isAllow ? "<font color='red'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
background.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showListPopupWindow() {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/icon_dev_status_net_disable" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_dev_status_net_enable" />
|
||||
|
||||
</selector>
|
||||
@@ -283,6 +283,14 @@
|
||||
android:layout_marginStart="-42dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/selector_history_ip" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_router"
|
||||
android:layout_width="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="18dp"
|
||||
android:src="@drawable/selector_router" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user