Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.eagle.core.function.hmi">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
|
||||
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
|
||||
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
@@ -39,6 +56,7 @@
|
||||
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
|
||||
android:enabled="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTop"
|
||||
android:resizeableActivity="false"
|
||||
android:resumeWhilePausing="true"
|
||||
@@ -119,6 +137,16 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mogo.eagle.core.function.main.AppListActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask">
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN"/>-->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER"/>-->
|
||||
<!-- </intent-filter>-->
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="MAP_SDK_VERSION111111"
|
||||
android:value="${MAP_SDK_VERSION}" />
|
||||
|
||||
@@ -87,10 +87,6 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
)
|
||||
}
|
||||
|
||||
override fun updateMfStatus(tag: String, status: Boolean) {
|
||||
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
|
||||
}
|
||||
|
||||
/**
|
||||
* 不展示顶部弹窗,其它保留
|
||||
*/
|
||||
|
||||
@@ -629,6 +629,33 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
tbV2NFromCar.isChecked = FunctionBuildConfig.isV2NFromCar
|
||||
//v2n车端预警
|
||||
tbV2NFromCar.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isV2NFromCar = isChecked
|
||||
if (!FunctionBuildConfig.isV2NFromCar) {
|
||||
tbV2NFromCar.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
tbDrawAiCloudFusion.isChecked = FunctionBuildConfig.isDrawAiCloudFusion
|
||||
//云端感知绘制
|
||||
tbDrawAiCloudFusion.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isDrawAiCloudFusion = isChecked
|
||||
if (!FunctionBuildConfig.isDrawAiCloudFusion) {
|
||||
tbDrawAiCloudFusion.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
tbDrawRomaMode.isChecked = FunctionBuildConfig.isRomaMode
|
||||
//roma
|
||||
tbDrawRomaMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isRomaMode = isChecked
|
||||
if (!FunctionBuildConfig.isRomaMode) {
|
||||
tbDrawRomaMode.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
//重启工控机所有节点
|
||||
btnIpcReboot.onClick {
|
||||
CallerAutoPilotControlManager.sendIpcReboot()
|
||||
|
||||
@@ -175,11 +175,7 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
tbObu.isChecked = CallerObuApiManager.isConnected()
|
||||
tbObu.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.1.199")
|
||||
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.8.199")
|
||||
}
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.1.199")
|
||||
} else {
|
||||
//断开链接
|
||||
CallerObuApiManager.disConnectObu()
|
||||
|
||||
@@ -77,8 +77,11 @@ class PncActionsView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
var actions: String? = null
|
||||
planningActionMsg.actionMsg?.let { it ->
|
||||
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
|
||||
|
||||
try {
|
||||
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
|
||||
} catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
|
||||
&& mTrafficLightResult != null
|
||||
|
||||
@@ -4,7 +4,13 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
|
||||
/**
|
||||
* 魔戒蓝牙控件
|
||||
@@ -14,10 +20,38 @@ class BlueToothView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr) {
|
||||
) : RelativeLayout(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
|
||||
|
||||
companion object{
|
||||
private const val TAG = "BlueToothView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_blue_tooth, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val isBluetoothConnect =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
|
||||
if (isBluetoothConnect) {
|
||||
mofangStatus(true)
|
||||
}
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun mofangStatus(status: Boolean) {
|
||||
super.mofangStatus(status)
|
||||
if (status) {
|
||||
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
|
||||
} else {
|
||||
mofangView.setImageResource(R.drawable.blue_tooth)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,14 +7,12 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
@@ -39,11 +37,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewStatusBarRight.addView(BatteryGroupView(this.context))
|
||||
val isBluetoothConnect =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
|
||||
if (isBluetoothConnect) {
|
||||
updateMfStatus("MoFangManager", true)
|
||||
}
|
||||
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
@@ -106,14 +99,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateMfStatus(tag: String, status: Boolean) {
|
||||
if (status) {
|
||||
viewMofangStatus.setImageResource(R.drawable.icon_bluetooth_p)
|
||||
} else {
|
||||
viewMofangStatus.setImageResource(R.drawable.blue_tooth)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
viewStatusBarTag.setTextColor(color)
|
||||
|
||||
@@ -11,7 +11,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.main.AppListActivity
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_version_name.view.*
|
||||
@@ -44,6 +46,12 @@ class VersionNameView @JvmOverloads constructor(
|
||||
showCurrentPadVersion()
|
||||
showCurrentMapVersion()
|
||||
}
|
||||
|
||||
// 调试入口,应对M1、M2没有安装Launcher的情况
|
||||
setOnLongClickListener {
|
||||
ActivityUtils.startActivity(AppListActivity::class.java)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.eagle.core.function.main
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.main.adapter.AppListAdapter
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import kotlinx.android.synthetic.main.activity_app_list.*
|
||||
|
||||
|
||||
/**
|
||||
* 系统应用列表,调试使用,暂不对外显示开放,只通过隐藏后门进入
|
||||
*/
|
||||
class AppListActivity : AppCompatActivity(), AppListAdapter.OnItemClickedListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
BarUtils.hideStatusBarAndSticky(this.window)
|
||||
window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
||||
)
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_app_list)
|
||||
|
||||
val linearLayoutManager = GridLayoutManager(this, 6) //第二个参数为网格的列数
|
||||
recyclerViewAppList.layoutManager = linearLayoutManager
|
||||
|
||||
recyclerViewAppList.itemAnimator = DefaultItemAnimator()
|
||||
val appListAdapter =
|
||||
AppListAdapter(this)
|
||||
recyclerViewAppList.adapter = appListAdapter
|
||||
}
|
||||
|
||||
override fun onItemClicked(appListAdapter: AppListAdapter, position: Int) {
|
||||
ActivityUtils.startLauncherActivity(appListAdapter.getItem(position).packageName)
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
decorView.clipToPadding = false
|
||||
var statusBarView = decorView.findViewWithTag<View>("status_bar")
|
||||
if (statusBarView == null) {
|
||||
statusBarView = StatusBarView(this)
|
||||
statusBarView = statusBar
|
||||
statusBarView.setTag("status_bar")
|
||||
}
|
||||
val statusBarLP = FrameLayout.LayoutParams(
|
||||
@@ -117,10 +117,10 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改statusBar 重写实现,需要继承 StatusBarView,xml中基础系统控件不要修改其id,拿来即用
|
||||
* 修改statusBar重新赋值
|
||||
* @return StatusBarView
|
||||
*/
|
||||
protected val statusBarView: StatusBarView
|
||||
protected val statusBar: View
|
||||
get() = StatusBarView(this)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -353,30 +353,4 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 由于应用是单页面的,所以采用Fragment将各模块的UI进行分割解耦合
|
||||
*
|
||||
* @param newFragment 功能UI
|
||||
* @param tagName UI绑定的Tag
|
||||
* @param containerId 要加入的资源ID
|
||||
*/
|
||||
private fun addFragment(newFragment: Fragment, tagName: String, containerId: Int) {
|
||||
var fragment = supportFragmentManager.findFragmentByTag(tagName)
|
||||
if (fragment == null) {
|
||||
fragment = newFragment
|
||||
}
|
||||
if (fragment == null) {
|
||||
e(
|
||||
SceneConstant.M_HMI + TAG,
|
||||
"add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(
|
||||
applicationContext, containerId
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(containerId, fragment, tagName)
|
||||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -91,6 +92,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ActivityUtils.setDefaultL(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,14 +55,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
return;
|
||||
}
|
||||
start = System.currentTimeMillis();
|
||||
connectAmiIp();
|
||||
// Crash 日志收集
|
||||
initCrashConfig();
|
||||
initLogConfig();
|
||||
initTipToast();
|
||||
initModules();
|
||||
//查询是否有版本的更新
|
||||
queryAppUpgrade();
|
||||
if (ProcessUtils.isMainProcess(this)) {
|
||||
initOverviewDb();
|
||||
if (DebugConfig.isDebug()) {
|
||||
@@ -71,7 +68,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
clearMessageBoxTable();
|
||||
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
|
||||
}
|
||||
upgradeProgressListener();
|
||||
CallerDevaToolsManager.INSTANCE.updateUpgradeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,15 +77,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void queryAppUpgrade() {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerDevaToolsManager.INSTANCE.queryAppUpgrade();
|
||||
}
|
||||
},9000);
|
||||
}
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private void clearMessageBoxTable() {
|
||||
new Thread(() -> {
|
||||
@@ -121,52 +109,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void upgradeProgressListener() {
|
||||
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
// builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系
|
||||
builder.setContentTitle("下载");
|
||||
builder.setContentText("正在下载");
|
||||
final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
CallerDevaToolsUpgradeListenerManager.INSTANCE.addListener(TAG, new IMogoDevaToolsUpgradeListener() {
|
||||
@Override
|
||||
public void onStart(@Nullable String url) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause(@Nullable String url) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(@Nullable String url, int length) {
|
||||
builder.setProgress(100, length,false);
|
||||
manager.notify(0x3, builder.build());
|
||||
//下载进度提示
|
||||
builder.setContentText("已下载" + length + "%");
|
||||
CallerHmiManager.INSTANCE.updateStatusBarDownloadView(true, "download", length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished(@Nullable String url) {
|
||||
builder.setContentText("已下载" + 100 + "%");
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
manager.cancel(0x3);
|
||||
CallerHmiManager.INSTANCE.updateStatusBarDownloadView(false, "download", 100);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@Nullable String url, @Nullable String errorMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initKoom() {
|
||||
KoomInitTask.INSTANCE.init(this);
|
||||
}
|
||||
@@ -197,14 +139,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接ami
|
||||
*/
|
||||
private void connectAmiIp() {
|
||||
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
|
||||
// AmiClientManager.getInstance().setObuIp(ipAddress);
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
|
||||
// OBU 模块
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.mogo.eagle.core.function.main.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AppListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private OnItemClickedListener mOnItemClickedListener;
|
||||
|
||||
public interface OnItemClickedListener {
|
||||
void onItemClicked(AppListAdapter appListAdapter, int position);
|
||||
}
|
||||
|
||||
public static class AppViewHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView iconIv;
|
||||
public TextView nameTv;
|
||||
|
||||
public AppViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
iconIv = (ImageView) itemView.findViewById(R.id.list_item_app_icon_iv);
|
||||
nameTv = (TextView) itemView.findViewById(R.id.list_item_app_name_tv);
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> showApps = new ArrayList<>();
|
||||
|
||||
public AppListAdapter(OnItemClickedListener onItemClickedListener) {
|
||||
// 设置被允许展示的APP
|
||||
showApps.add("com.android.settings");
|
||||
|
||||
mOnItemClickedListener = onItemClickedListener;
|
||||
mApps = new ArrayList<>();
|
||||
for (AppUtils.AppInfo appInfo : AppUtils.getAppsInfo()) {
|
||||
if (!appInfo.isSystem()) {
|
||||
mApps.add(appInfo);
|
||||
} else {
|
||||
if (showApps.contains(appInfo.getPackageName())) {
|
||||
mApps.add(appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<AppUtils.AppInfo> mApps;
|
||||
|
||||
public AppUtils.AppInfo getItem(int position) {
|
||||
return mApps.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mApps.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_app_list, parent, false);
|
||||
return new AppViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
AppViewHolder itemViewHolder = (AppViewHolder) holder;
|
||||
itemViewHolder.iconIv.setImageDrawable(mApps.get(position).getIcon());
|
||||
itemViewHolder.nameTv.setText(mApps.get(position).getName());
|
||||
itemViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickedListener != null) {
|
||||
mOnItemClickedListener.onItemClicked(AppListAdapter.this, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView 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:id="@+id/recyclerViewAppList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/main_splash_bg"
|
||||
android:clipToPadding="false"
|
||||
android:padding="20dp"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:spanCount="6"
|
||||
tools:itemCount="11"
|
||||
tools:listitem="@layout/item_app_list" />
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_item_app_icon_iv"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:src="@drawable/icon_ad" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_app_name_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:singleLine="true"
|
||||
android:text="应用名称"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="30dp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -5,10 +5,11 @@
|
||||
android:layout_height="@dimen/dp_54">
|
||||
|
||||
<ImageView
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/blue_tooth"
|
||||
android:id="@+id/mofangView"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/blue_tooth"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -242,6 +242,42 @@
|
||||
android:textOn="关闭感知优化模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbV2NFromCar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启车端V2N预警"
|
||||
android:textOn="关闭车端V2N预警"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDrawAiCloudFusion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启云端感知绘制"
|
||||
android:textOn="关闭云端感知绘制"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDrawRomaMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启漫游模式"
|
||||
android:textOn="关闭漫游模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbMojie"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_35" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
@@ -36,8 +37,7 @@
|
||||
android:layout_marginStart="@dimen/dp_18" />
|
||||
|
||||
<!--魔方连接状态-->
|
||||
<ImageView
|
||||
android:id="@+id/viewMofangStatus"
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/blue_tooth"
|
||||
|
||||
Reference in New Issue
Block a user