version:1.2

fix:
update:完善快捷控制,监听home键
This commit is contained in:
2022-10-26 09:30:28 +08:00
parent 8781c84051
commit 418ccdee18
9 changed files with 655 additions and 54 deletions

View File

@@ -93,6 +93,8 @@ public class ControlActivity extends AppCompatActivity {
ConstraintLayout cl_battery;
@BindView(R.id.cl_flashlight)
ConstraintLayout cl_flashlight;
@BindView(R.id.cl_location)
ConstraintLayout cl_location;
private ContentResolver crv;
@@ -518,8 +520,10 @@ public class ControlActivity extends AppCompatActivity {
private void getFlashlight() {
if (isFlashlightEnabled()) {
tv_flashlight_switch.setText("");
cl_flashlight.setBackground(getDrawable(R.drawable.control_background_item));
} else {
tv_flashlight_switch.setText("");
cl_flashlight.setBackground(getDrawable(R.drawable.control_background_item_dis));
}
cl_flashlight.setOnClickListener(new View.OnClickListener() {
@Override
@@ -528,10 +532,12 @@ public class ControlActivity extends AppCompatActivity {
Settings.Secure.putInt(crv, Settings.Secure.FLASHLIGHT_ENABLED, 0);
sendBroadcast(new Intent(ACTION_FLASHLIGHT_CHANGED));
tv_flashlight_switch.setText("");
cl_flashlight.setBackground(getDrawable(R.drawable.control_background_item_dis));
} else {
Settings.Secure.putInt(crv, Settings.Secure.FLASHLIGHT_ENABLED, 1);
sendBroadcast(new Intent(ACTION_FLASHLIGHT_CHANGED));
tv_flashlight_switch.setText("");
cl_flashlight.setBackground(getDrawable(R.drawable.control_background_item));
}
}
});
@@ -602,6 +608,8 @@ public class ControlActivity extends AppCompatActivity {
});
}
private LocationClient locationClient;
private void getLocation() {
BDLocation bdLocation = AmapManager.getInstance().getNowMapLocation();
if (bdLocation != null) {
@@ -615,7 +623,19 @@ public class ControlActivity extends AppCompatActivity {
} else {
tv_location.setText("定位失败");
}
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
startLocation();
cl_location.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startLocation();
}
});
}
private void startLocation() {
if (locationClient == null) {
locationClient = AmapManager.getInstance().getLocationClient();
}
locationClient.stop();
locationClient.start();
locationClient.registerLocationListener(new BDAbstractLocationListener() {