diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7c42d08..d30fc9c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -38,6 +38,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/base/ui/BaseActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/base/ui/BaseActivity.java
index 33aca8c..6984268 100644
--- a/app/src/main/java/cc/niushuai/project/devcontrol/base/ui/BaseActivity.java
+++ b/app/src/main/java/cc/niushuai/project/devcontrol/base/ui/BaseActivity.java
@@ -1,8 +1,6 @@
package cc.niushuai.project.devcontrol.base.ui;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@@ -91,8 +89,14 @@ public abstract class BaseActivity extends AppCompatActivity {
* @author niushuai
* @date: 2022/10/19 14:47
*/
- protected void activityButtonMoreSetClickListener(BaseActivity activity, Class extends BaseActivity> clazz, Map withData) {
- findViewById(R.id.activity_title_more_set).setOnClickListener(view -> ActivityUtil.startActivity(activity, clazz, withData));
+ protected void activityButtonMoreSetClickListener(boolean display, BaseActivity activity, Class extends BaseActivity> clazz, Map withData) {
+
+ View moreSetView = findViewById(R.id.activity_title_more_set);
+ if (!display) {
+ moreSetView.setVisibility(View.GONE);
+ return;
+ }
+ moreSetView.setOnClickListener(view -> ActivityUtil.startActivity(activity, clazz, withData));
}
}
diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchActivity.java
index 864f324..46d67bc 100644
--- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchActivity.java
+++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchActivity.java
@@ -23,8 +23,6 @@ public class PowerSwitchActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // 隐藏自带的标题栏
- getSupportActionBar().hide();
binding = ActivityPowerSwitchBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
@@ -69,7 +67,7 @@ public class PowerSwitchActivity extends BaseActivity {
// 标题栏 更多设置
HashMap withData = new HashMap<>(1);
withData.put(Keys.ID, device.getId());
- super.activityButtonMoreSetClickListener(this, PowerSwitchSetActivity.class, withData);
+ super.activityButtonMoreSetClickListener(true, this, PowerSwitchSetActivity.class, withData);
}
diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetActivity.java
index b4519e0..d6b4b87 100644
--- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetActivity.java
+++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetActivity.java
@@ -1,16 +1,17 @@
package cc.niushuai.project.devcontrol.ui.powerswitch;
import android.os.Bundle;
-import android.view.ViewGroup;
+import android.view.View;
+import android.widget.Toast;
+
+import java.util.HashMap;
import cc.niushuai.project.devcontrol.R;
-import cc.niushuai.project.devcontrol.base.entity.device.DeviceInfo;
import cc.niushuai.project.devcontrol.base.ui.BaseActivity;
+import cc.niushuai.project.devcontrol.base.util.ActivityUtil;
import cc.niushuai.project.devcontrol.base.util.GlobalVariables;
import cc.niushuai.project.devcontrol.base.util.Keys;
-import cc.niushuai.project.devcontrol.databinding.ActivityPowerSwitchBinding;
import cc.niushuai.project.devcontrol.databinding.ActivityPowerSwitchSetBinding;
-import cn.hutool.core.util.StrUtil;
public class PowerSwitchSetActivity extends BaseActivity {
@@ -19,7 +20,6 @@ public class PowerSwitchSetActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getSupportActionBar().hide();
binding = ActivityPowerSwitchSetBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
@@ -31,11 +31,32 @@ public class PowerSwitchSetActivity extends BaseActivity {
@Override
protected void init() {
this.device = GlobalVariables.getDeviceInfo(getIntentDeviceId());
- super.setTitle(getString(R.string.set), StrUtil.EMPTY);
+ super.setTitle(getString(R.string.set), null);
}
@Override
protected void addListener() {
+ super.activityButtonBackClickListener(this);
+ super.activityButtonMoreSetClickListener(false, null, null, null);
+
+ binding.powerSwitchSetActivityItemIconChangeOutside.setOnClickListener(this::outsideIconChangeClickListener);
+ binding.powerSwitchSetActivityItemParamSetOutside.setOnClickListener(this::outsideParamSetClickListener);
+ binding.powerSwitchSetActivityItemLogViewOutside.setOnClickListener(this::outsideLogViewClickListener);
+ }
+
+ private void outsideIconChangeClickListener(View view) {
+ Toast.makeText(this, "更换图标暂未实现哦", Toast.LENGTH_SHORT).show();
+ }
+
+ private void outsideParamSetClickListener(View view) {
+
+ HashMap withData = new HashMap<>(1);
+ withData.put(Keys.ID, device.getId());
+ ActivityUtil.startActivity(this, PowerSwitchSetParamActivity.class, withData);
+ }
+
+ private void outsideLogViewClickListener(View view) {
+ Toast.makeText(this, "日志暂未实现哦", Toast.LENGTH_SHORT).show();
}
}
\ No newline at end of file
diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java
new file mode 100644
index 0000000..69b0da6
--- /dev/null
+++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java
@@ -0,0 +1,52 @@
+package cc.niushuai.project.devcontrol.ui.powerswitch;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+
+import cc.niushuai.project.devcontrol.R;
+import cc.niushuai.project.devcontrol.base.ui.BaseActivity;
+import cc.niushuai.project.devcontrol.base.util.GlobalVariables;
+import cc.niushuai.project.devcontrol.databinding.ActivityPowerSwitchSetParamBinding;
+
+
+public class PowerSwitchSetParamActivity extends BaseActivity {
+
+ private ActivityPowerSwitchSetParamBinding binding;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ binding = ActivityPowerSwitchSetParamBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
+
+ this.init();
+ this.addListener();
+ }
+
+ @Override
+ protected void init() {
+ device = GlobalVariables.getDeviceInfo(getIntentDeviceId());
+
+ super.setTitle(getString(R.string.power_switch_set_paramSet), null);
+ }
+
+ @Override
+ protected void addListener() {
+
+ // 隐藏更多按钮
+ super.activityButtonBackClickListener(this);
+ super.activityButtonMoreSetClickListener(false, null, null, null);
+
+ // 保存监听事件
+ binding.powerSwitchSetActivityItemParamSetBtnSave.setOnClickListener(this::btnSaveParamClickListener);
+ }
+
+ private void btnSaveParamClickListener(View view) {
+
+ Toast.makeText(this, "已保存", Toast.LENGTH_SHORT).show();
+ }
+}
diff --git a/app/src/main/res/drawable/shape_round.xml b/app/src/main/res/drawable/shape_round.xml
new file mode 100644
index 0000000..3c65262
--- /dev/null
+++ b/app/src/main/res/drawable/shape_round.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_power_switch_set_param.xml b/app/src/main/res/layout/activity_power_switch_set_param.xml
new file mode 100644
index 0000000..934e819
--- /dev/null
+++ b/app/src/main/res/layout/activity_power_switch_set_param.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 719ed98..ee2ece0 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -10,5 +10,5 @@
#FFAFAFAF
#F6F6F6
#00FF0000
- #83FF4D
+ #449EFF
\ No newline at end of file