fix: 设备详情页ui

This commit is contained in:
niushuai233 2022-10-18 18:01:23 +08:00
parent 801731f675
commit 355353b0e7
20 changed files with 190 additions and 75 deletions

View File

@ -0,0 +1,12 @@
package cc.niushuai.project.devcontrol.base.activity;
import androidx.appcompat.app.AppCompatActivity;
/**
* Activity基类
*
* @author niushuai
* @date: 2022/10/18 14:24
*/
public class BaseActivity extends AppCompatActivity {
}

View File

@ -0,0 +1,12 @@
package cc.niushuai.project.devcontrol.base.fragment;
import androidx.fragment.app.Fragment;
/**
* Fragment基类
*
* @author niushuai
* @date: 2022/10/18 14:25
*/
public class BaseFragment extends Fragment {
}

View File

@ -2,17 +2,18 @@ package cc.niushuai.project.devcontrol.ui.device;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import cc.niushuai.project.devcontrol.base.activity.BaseActivity;
import cc.niushuai.project.devcontrol.databinding.DeviceActivityBinding; import cc.niushuai.project.devcontrol.databinding.DeviceActivityBinding;
public class DeviceActivity extends AppCompatActivity { public class DeviceActivity extends BaseActivity {
private DeviceActivityBinding binding; private DeviceActivityBinding binding;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// 隐藏自带的标题栏
getSupportActionBar().hide();
binding = DeviceActivityBinding.inflate(getLayoutInflater()); binding = DeviceActivityBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot()); setContentView(binding.getRoot());

View File

@ -1,32 +0,0 @@
package cc.niushuai.project.devcontrol.ui.device;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import cc.niushuai.project.devcontrol.databinding.DeviceOperateBinding;
/**
* 设备操作页面
*
* @author niushuai
* @date: 2022/10/17 17:41
* @return: {@link }
*/
public class DeviceOperate extends Fragment {
private DeviceOperateBinding thisBinding;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
thisBinding = DeviceOperateBinding.inflate(inflater, container, false);
CharSequence text = thisBinding.deviceOperateFullInfo.getText();
System.out.println(text);
return thisBinding.getRoot();
}
}

View File

@ -25,7 +25,6 @@ import cc.niushuai.project.devcontrol.base.entity.device.DeviceInfo;
import cc.niushuai.project.devcontrol.databinding.DeviceItemBinding; import cc.niushuai.project.devcontrol.databinding.DeviceItemBinding;
import cc.niushuai.project.devcontrol.databinding.MainNavFragmentDeviceBinding; import cc.niushuai.project.devcontrol.databinding.MainNavFragmentDeviceBinding;
import cc.niushuai.project.devcontrol.ui.device.DeviceActivity; import cc.niushuai.project.devcontrol.ui.device.DeviceActivity;
import cc.niushuai.project.devcontrol.ui.device.DeviceOperate;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
/** /**

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M929.71,487.73 L167.94,487.73l358.79,-318.92c12.39,-11.01 13.51,-29.98 2.49,-42.37 -11.01,-12.39 -29.98,-13.51 -42.37,-2.49L74.84,490.17c-6.41,5.7 -10.07,13.86 -10.07,22.43 0,8.57 3.67,16.74 10.07,22.43l412.02,366.23c5.72,5.08 12.84,7.58 19.93,7.58 8.28,-0 16.52,-3.4 22.44,-10.07 11.01,-12.39 9.9,-31.36 -2.49,-42.37L179.89,548.1l749.81,0c16.58,0 30.01,-13.61 30.01,-30.19S946.28,487.73 929.71,487.73z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M929.71,487.73 L167.94,487.73l358.79,-318.92c12.39,-11.01 13.51,-29.98 2.49,-42.37 -11.01,-12.39 -29.98,-13.51 -42.37,-2.49L74.84,490.17c-6.41,5.7 -10.07,13.86 -10.07,22.43 0,8.57 3.67,16.74 10.07,22.43l412.02,366.23c5.72,5.08 12.84,7.58 19.93,7.58 8.28,-0 16.52,-3.4 22.44,-10.07 11.01,-12.39 9.9,-31.36 -2.49,-42.37L179.89,548.1l749.81,0c16.58,0 30.01,-13.61 30.01,-30.19S946.28,487.73 929.71,487.73z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M320,512c0,35.2 -28.8,64 -64,64s-64,-28.8 -64,-64 28.8,-64 64,-64 64,28.8 64,64zM512,448c-35.2,0 -64,28.8 -64,64s28.8,64 64,64 64,-28.8 64,-64 -28.8,-64 -64,-64zM768,448c-35.2,0 -64,28.8 -64,64s28.8,64 64,64 64,-28.8 64,-64 -28.8,-64 -64,-64z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M320,512c0,35.2 -28.8,64 -64,64s-64,-28.8 -64,-64 28.8,-64 64,-64 64,28.8 64,64zM512,448c-35.2,0 -64,28.8 -64,64s28.8,64 64,64 64,-28.8 64,-64 -28.8,-64 -64,-64zM768,448c-35.2,0 -64,28.8 -64,64s28.8,64 64,64 64,-28.8 64,-64 -28.8,-64 -64,-64z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M512,704c35.2,0 64,28.8 64,64s-28.8,64 -64,64 -64,-28.8 -64,-64 28.8,-64 64,-64zM448,512c0,35.2 28.8,64 64,64s64,-28.8 64,-64 -28.8,-64 -64,-64 -64,28.8 -64,64zM448,256c0,35.2 28.8,64 64,64s64,-28.8 64,-64 -28.8,-64 -64,-64 -64,28.8 -64,64z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M512,704c35.2,0 64,28.8 64,64s-28.8,64 -64,64 -64,-28.8 -64,-64 28.8,-64 64,-64zM448,512c0,35.2 28.8,64 64,64s64,-28.8 64,-64 -28.8,-64 -64,-64 -64,28.8 -64,64zM448,256c0,35.2 28.8,64 64,64s64,-28.8 64,-64 -28.8,-64 -64,-64 -64,28.8 -64,64z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,43 +1,106 @@
<?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/device_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.device.DeviceActivity"> tools:context=".ui.device.DeviceActivity">
<RelativeLayout <RelativeLayout
android:id="@+id/device_activity_rl" android:id="@id/device_activity_outside"
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">
<Button <LinearLayout
android:id="@+id/device_btn1" android:id="@id/device_activity_inner_title"
android:background="@color/main_bg_color"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="50dp">
<!--标题栏 返回-->
<androidx.appcompat.widget.AppCompatImageButton
android:id="@id/device_activity_inner_back"
android:layout_weight="1"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@color/empty"
android:scaleType="centerInside"
android:src="@drawable/ic_back_32"/>
<!--标题中间部分-->
<RelativeLayout
android:layout_weight="5"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<!--name名称-->
<TextView
android:id="@id/device_activity_inner_name"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:textSize="16dp"
android:text="@string/test_hello_blank_textview_1"/>
<!--描述信息-->
<TextView
android:id="@id/device_activity_inner_description"
android:layout_width="match_parent"
android:layout_height="20dp"
android:gravity="center"
android:textSize="12dp"
android:layout_below="@id/device_activity_inner_name"
android:text="@string/test_hello_blank_textview_3"/>
</RelativeLayout>
<!--标题栏 更多设置-->
<androidx.appcompat.widget.AppCompatImageButton
android:id="@id/device_activity_inner_more_set"
android:layout_weight="1"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerInside"
android:background="@color/empty"
android:src="@drawable/ic_more_v_32"/>
</LinearLayout>
<RelativeLayout
android:id="@id/device_activity_inner_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/test_btn_1"> android:layout_below="@id/device_activity_inner_title"
android:background="@color/main_bg_color"
>
</Button>
<TextView <!--中间开关图片 可点击-->
android:id="@+id/device_tv1" <androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content" android:id="@id/device_activity_inner_content_switch"
android:layout_height="wrap_content" android:layout_margin="50dp"
android:text="@string/test_hello_blank_textview_1"/> android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img_switch_close"/>
<TextView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/device_tv2" android:id="@id/device_activity_inner_content_icon"
android:layout_width="wrap_content" android:layout_centerHorizontal="true"
android:layout_height="wrap_content" android:layout_width="128dp"
android:layout_below="@id/device_tv1" android:layout_height="128dp"
android:text="@string/test_hello_blank_textview_2"/> android:src="@drawable/ic_device_light_1"/>
<TextView <TextView
android:id="@+id/device_tv3" android:id="@id/device_activity_inner_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_tv2" android:layout_marginTop="50dp"
android:text="@string/test_hello_blank_textview_3"/> android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_below="@id/device_activity_inner_content_icon"
android:text="@string/test_btn_1"/>
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.device.DeviceOperate">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@id/device_operate_fullInfo"/>
</RelativeLayout>

View File

@ -9,4 +9,5 @@
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="gray">#FFAFAFAF</color> <color name="gray">#FFAFAFAF</color>
<color name="main_bg_color">#F6F6F6</color> <color name="main_bg_color">#F6F6F6</color>
<color name="empty">#00FF0000</color>
</resources> </resources>

View File

@ -15,7 +15,23 @@
<item name="device_item_cardView_image" type="id"/> <item name="device_item_cardView_image" type="id"/>
<item name="device_item_cardView_text" type="id"/> <item name="device_item_cardView_text" type="id"/>
<item name="device_operate_fullInfo" type="id"/> <!--设备操作页 start-->
<item name="device_activity" type="id"/>
<item name="device_activity_outside" type="id"/>
<item name="device_activity_inner_title" type="id"/>
<item name="device_activity_inner_content" type="id"/>
<!--标题栏-->
<item name="device_activity_inner_back" type="id"/>
<item name="device_activity_inner_name" type="id"/>
<item name="device_activity_inner_description" type="id"/>
<item name="device_activity_inner_more_set" type="id"/>
<!--内容栏-->
<item name="device_activity_inner_content_icon" type="id"/>
<item name="device_activity_inner_content_switch" type="id"/>
<item name="device_activity_inner_content_text" type="id"/>
<!--设备操作页 end-->
<!--设备页 end--> <!--设备页 end-->
</resources> </resources>

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666080162787" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3896" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M320 512c0 35.2-28.8 64-64 64s-64-28.8-64-64 28.8-64 64-64 64 28.8 64 64z m192-64c-35.2 0-64 28.8-64 64s28.8 64 64 64 64-28.8 64-64-28.8-64-64-64z m256 0c-35.2 0-64 28.8-64 64s28.8 64 64 64 64-28.8 64-64-28.8-64-64-64z" p-id="3897"></path></svg>

After

Width:  |  Height:  |  Size: 576 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666080155527" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3741" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M512 704c35.2 0 64 28.8 64 64s-28.8 64-64 64-64-28.8-64-64 28.8-64 64-64z m-64-192c0 35.2 28.8 64 64 64s64-28.8 64-64-28.8-64-64-64-64 28.8-64 64z m0-256c0 35.2 28.8 64 64 64s64-28.8 64-64-28.8-64-64-64-64 28.8-64 64z" p-id="3742"></path></svg>

After

Width:  |  Height:  |  Size: 575 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666080120834" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2526" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M929.70745 487.72513 167.942967 487.72513l358.793666-318.918493c12.390191-11.012821 13.505595-29.982872 2.493797-42.37204-11.010775-12.388145-29.979802-13.506619-42.369993-2.492774L74.839499 490.168786c-6.407943 5.695722-10.073426 13.859659-10.073426 22.432918 0 8.573259 3.665483 16.737196 10.073426 22.432918l412.019914 366.227985c5.717212 5.082762 12.83533 7.581676 19.926842 7.581676 8.275477-0.002047 16.515139-3.403516 22.443152-10.07445 11.012821-12.389168 9.897418-31.359218-2.493797-42.37204L179.893136 548.100196l749.814314 0c16.575514 0 30.013571-13.612019 30.013571-30.187533S946.283987 487.72513 929.70745 487.72513z" p-id="2527"></path></svg>

After

Width:  |  Height:  |  Size: 987 B