mt8735平台上添加 “虚拟按键” 设置选项

      医疗YS客户需要在我们的mt8735系统平台上,能够控制下方的导航栏的显示/不显示,那么就需要添加“虚拟按键”设置选项,同时也将该添加更新到mt8735系统平台的其他项目中。

(1)医疗YS客户所说的导航栏(最下方红色框框部分)

 

(2)添加后的虚拟按键效果:
   
(3)能不能软件控制“虚拟按键”,则需要写一个测试APP,APP 可通过广播控制:"android.intent.action.NAVIGATION_BAR"  putExtra : "enable" true -> 开,false -> 关.
测试软件界面:
   
(4)测试软件源码:
  1. package com.raindi.navigationctrl;

  2. import android.content.Intent;
  3. import android.provider.Settings;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.widget.CompoundButton;
  7. import android.widget.Switch;

  8. public class MainActivity extends AppCompatActivity {

  9.     String action = "android.intent.action.NAVIGATION_BAR";
  10.     Switch mSwitch;
  11.     Intent intent = new Intent();
  12.     @Override
  13.     protected void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.activity_main);

  16.         intent.setAction(action);
  17.         mSwitch = (Switch)findViewById(R.id.switch_id);

  18.         int status = Settings.System.getInt(this.getContentResolver(),"navigation_bar_switch", 0);
  19.         if (status == 0){
  20.             mSwitch.setChecked(false);
  21.         }else {
  22.             mSwitch.setChecked(true);
  23.         }
  24.         mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  25.             @Override
  26.             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  27.                 if (isChecked){
  28.                     intent.putExtra("enable",true);
  29.                 }else {
  30.                     intent.putExtra("enable",false);
  31.                 }
  32.                 MainActivity.this.sendBroadcast(intent);
  33.             }
  34.         });
  35.     }
  36. }

(5)“虚拟按键”在mt8735系统中添加与mt6735(AP7350)系统上添加的步骤类似,添加过程参考了TimKing--AP7350 系统添加 虚拟按键 开关设置选项

猜你喜欢

转载自blog.csdn.net/m0_37526672/article/details/80348452