From 092bf21368ea824e9dc22467166960219165dc00 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 21 二月 2025 17:32:59 +0800 Subject: [PATCH] 1.我的界面每个item添加点击效果。 2.更新本地数据添加二次确认。 --- app/src/main/java/com/dayu/pipirrapp/fragment/MyFragment.java | 16 +++++++++++++--- app/src/main/res/drawable/bg_loading_dialog.xml | 6 ++++++ app/src/main/res/drawable/my_item_ripple.xml | 17 +++++++++++++++++ app/src/main/res/layout/fragment_my.xml | 19 +++++++++++-------- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/dayu/pipirrapp/fragment/MyFragment.java b/app/src/main/java/com/dayu/pipirrapp/fragment/MyFragment.java index 7218451..418de9f 100644 --- a/app/src/main/java/com/dayu/pipirrapp/fragment/MyFragment.java +++ b/app/src/main/java/com/dayu/pipirrapp/fragment/MyFragment.java @@ -46,7 +46,7 @@ } private void initView() { - binding.changePS.setOnClickListener(v -> { + binding.changePSRL.setOnClickListener(v -> { Intent intent = new Intent(MyFragment.this.getContext(), ChangePSActivity.class); MyFragment.this.getActivity().startActivity(intent); }); @@ -96,14 +96,24 @@ Intent intent = new Intent(MyFragment.this.getContext(), IssueListActivity.class); MyFragment.this.getActivity().startActivity(intent); }); - binding.refreshDataTV.setOnClickListener(v -> { + binding.refreshDataRL.setOnClickListener(v -> { + ConfirmDialog confirmDialog = new ConfirmDialog(MyFragment.this.getActivity(), "纭畾鏇存柊鏈湴鏁版嵁鍚楋紵", (confirmDialog1, v12) -> { + try { + LiveEventBus.get(CommonKeyName.refreshData).post(true); + } catch (Exception e) { + e.printStackTrace(); + } + }); + confirmDialog.show(); // 鍙戦�佸埛鏂颁簨浠堕�氱煡MapFragment鍒锋柊鏁版嵁 - LiveEventBus.get(CommonKeyName.refreshData).post(true); + }); binding.inspectListRL.setOnClickListener(v -> { Intent intent = new Intent(MyFragment.this.getContext(), InspectListActivity.class); MyFragment.this.getActivity().startActivity(intent); }); + binding.versionRL.setOnClickListener(v -> { + }); } private void initData() { diff --git a/app/src/main/res/drawable/bg_loading_dialog.xml b/app/src/main/res/drawable/bg_loading_dialog.xml new file mode 100644 index 0000000..0c035c6 --- /dev/null +++ b/app/src/main/res/drawable/bg_loading_dialog.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="#88000000" /> + <corners android:radius="8dp" /> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/my_item_ripple.xml b/app/src/main/res/drawable/my_item_ripple.xml new file mode 100644 index 0000000..dd91631 --- /dev/null +++ b/app/src/main/res/drawable/my_item_ripple.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="?android:attr/colorControlHighlight"> + <!-- 鑳屾櫙褰㈢姸鍙婇鑹� --> + <item> + <shape android:shape="rectangle"> + <solid android:color="@color/white" /> <!-- 鑳屾櫙鑹� --> + <corners android:radius="10dp" /> <!-- 鍦嗚鍗婂緞 --> + </shape> + </item> + <!-- 鎺╃爜鏁堟灉锛岀敤浜庢帶鍒舵尝绾硅寖鍥达紙鍙�夛級 --> + <item android:id="@android:id/mask"> + <shape android:shape="rectangle"> + <solid android:color="@color/text_color" /> <!-- 鎺╃爜棰滆壊 --> + </shape> + </item> +</ripple> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_my.xml b/app/src/main/res/layout/fragment_my.xml index de9e5b5..7b15501 100644 --- a/app/src/main/res/layout/fragment_my.xml +++ b/app/src/main/res/layout/fragment_my.xml @@ -82,12 +82,13 @@ android:id="@+id/issueListRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/headRL_top"> <TextView android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" + android:gravity="center_vertical" android:paddingLeft="30dp" android:text="闂鍒楄〃" @@ -106,12 +107,13 @@ android:id="@+id/inspectListRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:layout_marginTop="1dp" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/issueListRL"> <TextView android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="30dp" android:text="宸℃璁板綍" @@ -129,9 +131,10 @@ </RelativeLayout> <RelativeLayout - android:id="@+id/passwordRL" + android:id="@+id/changePSRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/inspectListRL" android:layout_marginTop="1dp"> @@ -159,14 +162,14 @@ android:id="@+id/refreshDataRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:layout_below="@+id/passwordRL" + android:background="@drawable/my_item_ripple" + android:layout_below="@+id/changePSRL" android:layout_marginTop="1dp"> <TextView android:id="@+id/refreshDataTV" android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="30dp" android:text="鏇存柊鏈湴鏁版嵁" @@ -185,6 +188,7 @@ android:id="@+id/cleanDataRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/refreshDataRL" android:layout_marginTop="1dp"> @@ -192,7 +196,6 @@ android:id="@+id/cleanData" android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="30dp" android:text="娓呴櫎缂撳瓨" @@ -212,6 +215,7 @@ android:id="@+id/loginOutRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/cleanDataRL" android:layout_marginTop="1dp"> @@ -219,7 +223,6 @@ android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="30dp" android:text="閫�鍑虹櫥褰�" @@ -240,13 +243,13 @@ android:id="@+id/versionRL" android:layout_width="match_parent" android:layout_height="@dimen/item_height" + android:background="@drawable/my_item_ripple" android:layout_below="@+id/loginOutRL" android:layout_marginTop="1dp"> <TextView android:layout_width="match_parent" android:layout_height="@dimen/item_height" - android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="30dp" android:text="褰撳墠鐗堟湰" -- Gitblit v1.8.0