Commit e2b1df9d authored by fallenstardust's avatar fallenstardust

优化公开状态切换

parent 1809a180
...@@ -80,7 +80,7 @@ public class DeckSquareMyDeckFragment extends Fragment { ...@@ -80,7 +80,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
dialog.show(); dialog.show();
return true; return true;
}); });
/*
//点击“我的卡组”中的某个卡组后,弹出dialog,dialog根据卡组的同步情况自动显示对应的下载/上传按钮 //点击“我的卡组”中的某个卡组后,弹出dialog,dialog根据卡组的同步情况自动显示对应的下载/上传按钮
deckListAdapter.setOnItemClickListener( deckListAdapter.setOnItemClickListener(
(adapter, view, position) -> { (adapter, view, position) -> {
...@@ -89,7 +89,7 @@ public class DeckSquareMyDeckFragment extends Fragment { ...@@ -89,7 +89,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
DeckFile deckFile = new DeckFile(item.getDeckId(), DeckType.ServerType.MY_SQUARE); DeckFile deckFile = new DeckFile(item.getDeckId(), DeckType.ServerType.MY_SQUARE);
onDeckMenuListener.onDeckSelect(deckFile); onDeckMenuListener.onDeckSelect(deckFile);
} }
); );*/
return binding.getRoot(); return binding.getRoot();
} }
......
...@@ -142,8 +142,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold ...@@ -142,8 +142,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
if (item.getPublic()) { if (item.getPublic()) {
helper.setText(R.id.change_show_or_hide, R.string.in_public); helper.setText(R.id.change_show_or_hide, R.string.in_public);
helper.getView(R.id.show_on_deck_square).setBackgroundResource(R.drawable.baseline_remove_red_eye_24);
helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_red);
} else { } else {
helper.setText(R.id.change_show_or_hide, R.string.in_personal_use); helper.setText(R.id.change_show_or_hide, R.string.in_personal_use);
helper.getView(R.id.show_on_deck_square).setBackgroundResource(R.drawable.closed_eyes_24);
helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_n);
} }
LogUtil.i(TAG, code + " " + item.getDeckName()); LogUtil.i(TAG, code + " " + item.getDeckName());
if (code != 0) { if (code != 0) {
...@@ -157,10 +161,14 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold ...@@ -157,10 +161,14 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
helper.getView(R.id.ll_switch_show).setOnClickListener(view -> { helper.getView(R.id.ll_switch_show).setOnClickListener(view -> {
if (item.getPublic()) { if (item.getPublic()) {
helper.setText(R.id.change_show_or_hide, R.string.in_personal_use); helper.setText(R.id.change_show_or_hide, R.string.in_personal_use);
helper.getView(R.id.show_on_deck_square).setBackgroundResource(R.drawable.closed_eyes_24);
helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_n); helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_n);
item.setPublic(false);
} else { } else {
helper.setText(R.id.change_show_or_hide, R.string.in_public); helper.setText(R.id.change_show_or_hide, R.string.in_public);
helper.getView(R.id.show_on_deck_square).setBackgroundResource(R.drawable.baseline_remove_red_eye_24);
helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_red); helper.getView(R.id.ll_switch_show).setBackgroundResource(R.drawable.button_radius_red);
item.setPublic(true);
} }
LogUtil.i(TAG, "current " + item.toString()); LogUtil.i(TAG, "current " + item.toString());
changeDeckPublicState(item); changeDeckPublicState(item);
......
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.8" android:height="16.032064dp" android:viewportHeight="1024" android:viewportWidth="1533" android:width="24dp"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.8" android:height="16.032064dp" android:viewportHeight="1024" android:viewportWidth="1533" android:width="24dp">
<path android:fillColor="#ffffff" android:pathData="M1035.4,348.1l-136.7,136.6a176.3,176.3 0,0 1,1.3 21.4,195.3 195.3,0 0,1 -195.2,194.8 175.7,175.7 0,0 1,-21.3 -1.3L597.7,785.4a449.9,449.9 0,0 0,107.5 12.6c217.8,0 377.8,-174.7 487.9,-289.4a1268.1,1268.1 0,0 0,-157.7 -160.4zM996.3,186.1l-81.1,81.1a452.2,452.2 0,0 0,-210.5 -53.8c-178.3,0 -317.3,111.5 -487.8,292.6 80.6,84.9 154.3,164.4 240.2,219.2l-53.3,53.3 59.3,59.3 592.4,-592.4zM510.2,506.1a194.5,194.5 0,0 1,317.3 -151.1l-57.2,57.2a112.3,112.3 0,0 0,-64.8 -20.6A113.3,113.3 0,0 0,611.7 570.9l-57.9,58.5a193.2,193.2 0,0 1,-44 -123.3z"/> <path android:fillColor="#000000" android:pathData="M1035.4,348.1l-136.7,136.6a176.3,176.3 0,0 1,1.3 21.4,195.3 195.3,0 0,1 -195.2,194.8 175.7,175.7 0,0 1,-21.3 -1.3L597.7,785.4a449.9,449.9 0,0 0,107.5 12.6c217.8,0 377.8,-174.7 487.9,-289.4a1268.1,1268.1 0,0 0,-157.7 -160.4zM996.3,186.1l-81.1,81.1a452.2,452.2 0,0 0,-210.5 -53.8c-178.3,0 -317.3,111.5 -487.8,292.6 80.6,84.9 154.3,164.4 240.2,219.2l-53.3,53.3 59.3,59.3 592.4,-592.4zM510.2,506.1a194.5,194.5 0,0 1,317.3 -151.1l-57.2,57.2a112.3,112.3 0,0 0,-64.8 -20.6A113.3,113.3 0,0 0,611.7 570.9l-57.9,58.5a193.2,193.2 0,0 1,-44 -123.3z"/>
</vector> </vector>
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
android:src="@drawable/unknown" /> android:src="@drawable/unknown" />
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/box" /> android:src="@drawable/box" />
<LinearLayout <LinearLayout
android:id="@+id/btn_download" android:id="@+id/ll_switch_show"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
...@@ -28,22 +28,24 @@ ...@@ -28,22 +28,24 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/show_on_deck_square"
android:layout_width="12dp" android:layout_width="12dp"
android:layout_height="11dp" android:layout_height="12dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:src="@drawable/ic_file_download_black_24dp" /> android:background="@drawable/baseline_remove_red_eye_24" />
<TextView <TextView
android:id="@+id/change_show_or_hide"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:gravity="center" android:gravity="center"
android:lines="1" android:lines="1"
android:text="@string/Download" android:text="@string/in_public"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="8sp" /> android:textSize="8sp" />
</LinearLayout> </LinearLayout>
...@@ -59,6 +61,7 @@ ...@@ -59,6 +61,7 @@
android:src="@drawable/ic_add_white" /> android:src="@drawable/ic_add_white" />
<LinearLayout <LinearLayout
android:id="@+id/btn_download"
android:layout_width="75dp" android:layout_width="75dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="18dp" android:layout_marginLeft="18dp"
...@@ -66,7 +69,6 @@ ...@@ -66,7 +69,6 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/ll_switch_show"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
...@@ -75,21 +77,19 @@ ...@@ -75,21 +77,19 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/show_on_deck_square"
android:layout_width="10dp" android:layout_width="10dp"
android:layout_height="10dp" android:layout_height="10dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:src="@drawable/baseline_remove_red_eye_24" /> android:src="@drawable/ic_file_download_black_24dp" />
<TextView <TextView
android:id="@+id/change_show_or_hide"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="1dp" android:layout_marginLeft="1dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:lines="1" android:lines="1"
android:text="@string/in_public" android:text="@string/Download"
android:textSize="5sp" /> android:textSize="5sp" />
</LinearLayout> </LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment