feat: 更名

This commit is contained in:
niushuai233 2022-10-19 15:24:51 +08:00
parent ee1d6d5bb8
commit 2dbdf57e26
3 changed files with 32 additions and 32 deletions

View File

@ -48,15 +48,15 @@ public class PowerSwitchActivity extends BaseActivity {
if (null != data) { if (null != data) {
this.device = data; this.device = data;
// 标题名称 // 标题名称
TextView titleTextView = findViewById(R.id.device_activity_title_name); TextView titleTextView = findViewById(R.id.power_switch_activity_title_name);
titleTextView.setText(device.getName()); titleTextView.setText(device.getName());
// 副标题名称 // 副标题名称
TextView descTextView = findViewById(R.id.device_activity_title_description); TextView descTextView = findViewById(R.id.power_switch_activity_title_description);
descTextView.setText(device.getDescription()); descTextView.setText(device.getDescription());
// 开关底部的名称 // 开关底部的名称
TextView contentTextTextView = findViewById(R.id.device_activity_content_text); TextView contentTextTextView = findViewById(R.id.power_switch_activity_content_text);
contentTextTextView.setText(device.getName()); contentTextTextView.setText(device.getName());
} }
} }
@ -69,13 +69,13 @@ public class PowerSwitchActivity extends BaseActivity {
*/ */
private void addListener() { private void addListener() {
// 开关点击事件 // 开关点击事件
binding.deviceActivityContentSwitch.setOnClickListener(this::imageSwitchClickListener); binding.powerSwitchActivityContentSwitch.setOnClickListener(this::imageSwitchClickListener);
// 标题栏 返回 // 标题栏 返回
binding.deviceActivityTitleBack.setOnClickListener(this::buttonBackClickListener); binding.powerSwitchActivityTitleBack.setOnClickListener(this::buttonBackClickListener);
// 标题栏 更多设置 // 标题栏 更多设置
binding.deviceActivityTitleMoreSet.setOnClickListener(this::buttonMoreSetClickListener); binding.powerSwitchActivityTitleMoreSet.setOnClickListener(this::buttonMoreSetClickListener);
} }
/** /**
@ -125,7 +125,7 @@ public class PowerSwitchActivity extends BaseActivity {
iconImageId = R.drawable.ic_device_light_1_close; iconImageId = R.drawable.ic_device_light_1_close;
} }
appCompatImageView.setImageResource(switchImageId); appCompatImageView.setImageResource(switchImageId);
((AppCompatImageView) findViewById(R.id.device_activity_content_icon)).setImageResource(iconImageId); ((AppCompatImageView) findViewById(R.id.power_switch_activity_content_icon)).setImageResource(iconImageId);
} }

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/device_activity" android:id="@id/power_switch_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.powerswitch.PowerSwitchActivity"> tools:context=".ui.powerswitch.PowerSwitchActivity">
<RelativeLayout <RelativeLayout
android:id="@id/device_activity_layout" android:id="@id/power_switch_activity_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/main_bg_color"> android:background="@color/main_bg_color">
<LinearLayout <LinearLayout
android:id="@id/device_activity_layout_title" android:id="@id/power_switch_activity_layout_title"
android:background="@color/main_bg_color" android:background="@color/main_bg_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:gravity="center" android:gravity="center"
@ -21,7 +21,7 @@
<!--标题栏 返回--> <!--标题栏 返回-->
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@id/device_activity_title_back" android:id="@id/power_switch_activity_title_back"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
@ -37,7 +37,7 @@
<!--name名称--> <!--name名称-->
<TextView <TextView
android:id="@id/device_activity_title_name" android:id="@id/power_switch_activity_title_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:gravity="center" android:gravity="center"
@ -45,18 +45,18 @@
android:text="@string/test_hello_blank_textview_1"/> android:text="@string/test_hello_blank_textview_1"/>
<!--描述信息--> <!--描述信息-->
<TextView <TextView
android:id="@id/device_activity_title_description" android:id="@id/power_switch_activity_title_description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="20dp" android:layout_height="20dp"
android:gravity="center" android:gravity="center"
android:textSize="12dp" android:textSize="12dp"
android:layout_below="@id/device_activity_title_name" android:layout_below="@id/power_switch_activity_title_name"
android:text="@string/test_hello_blank_textview_3"/> android:text="@string/test_hello_blank_textview_3"/>
</RelativeLayout> </RelativeLayout>
<!--标题栏 更多设置--> <!--标题栏 更多设置-->
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@id/device_activity_title_more_set" android:id="@id/power_switch_activity_title_more_set"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
@ -66,17 +66,17 @@
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@id/device_activity_layout_content" android:id="@id/power_switch_activity_layout_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/device_activity_layout_title" android:layout_below="@id/power_switch_activity_layout_title"
android:background="@color/main_bg_color" android:background="@color/main_bg_color"
> >
<!--中间开关图片 可点击--> <!--中间开关图片 可点击-->
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@id/device_activity_content_switch" android:id="@id/power_switch_activity_content_switch"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="375dp" android:layout_height="375dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
@ -89,7 +89,7 @@
android:src="@drawable/img_switch_close" /> android:src="@drawable/img_switch_close" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@id/device_activity_content_icon" android:id="@id/power_switch_activity_content_icon"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
@ -97,10 +97,10 @@
android:src="@drawable/ic_device_light_1_close" /> android:src="@drawable/ic_device_light_1_close" />
<TextView <TextView
android:id="@id/device_activity_content_text" android:id="@id/power_switch_activity_content_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/device_activity_content_icon" android:layout_below="@id/power_switch_activity_content_icon"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_marginTop="225dp" android:layout_marginTop="225dp"
android:gravity="center" android:gravity="center"

View File

@ -16,21 +16,21 @@
<item name="device_item_cardView_text" type="id"/> <item name="device_item_cardView_text" type="id"/>
<!--开关操作页 start--> <!--开关操作页 start-->
<item name="device_activity" type="id"/> <item name="power_switch_activity" type="id"/>
<item name="device_activity_layout" type="id"/> <item name="power_switch_activity_layout" type="id"/>
<item name="device_activity_layout_title" type="id"/> <item name="power_switch_activity_layout_title" type="id"/>
<item name="device_activity_layout_content" type="id"/> <item name="power_switch_activity_layout_content" type="id"/>
<!--标题栏--> <!--标题栏-->
<item name="device_activity_title_back" type="id"/> <item name="power_switch_activity_title_back" type="id"/>
<item name="device_activity_title_name" type="id"/> <item name="power_switch_activity_title_name" type="id"/>
<item name="device_activity_title_description" type="id"/> <item name="power_switch_activity_title_description" type="id"/>
<item name="device_activity_title_more_set" type="id"/> <item name="power_switch_activity_title_more_set" type="id"/>
<!--内容栏--> <!--内容栏-->
<item name="device_activity_content_icon" type="id"/> <item name="power_switch_activity_content_icon" type="id"/>
<item name="device_activity_content_switch" type="id"/> <item name="power_switch_activity_content_switch" type="id"/>
<item name="device_activity_content_text" type="id"/> <item name="power_switch_activity_content_text" type="id"/>
<!--开关操作页 end--> <!--开关操作页 end-->
<!--设备页 end--> <!--设备页 end-->