Commit 63f77d02 authored by fallenstardust's avatar fallenstardust

优化云备份公开和自用切换逻辑

parent db086ee6
......@@ -47,7 +47,7 @@ import okhttp3.Response;
public class DeckSquareApiUtil {
private static final String TAG = "seesee";
private static final String TAG = "DeckSquareApiUtil";
public static boolean needLogin() {
......@@ -416,9 +416,7 @@ public class DeckSquareApiUtil {
*
* @param deckId
*/
public static BasicResponse setDeckPublic(String deckId, LoginToken loginToken,
boolean publicState) throws IOException {
public static BasicResponse setDeckPublic(String deckId, LoginToken loginToken, boolean publicState) throws IOException {
BasicResponse result = null;
String url = "http://rarnu.xyz:38383/api/mdpro3/deck/public";
......
......@@ -157,12 +157,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
return;
}
VUiKit.defer().when(() -> {
BasicResponse result = DeckSquareApiUtil.setDeckPublic(item.getDeckId(), loginToken, !item.getPublic());
BasicResponse result = DeckSquareApiUtil.setDeckPublic(item.getDeckId(), loginToken, item.getPublic());
return result;
}).fail(e -> {
LogUtil.i(TAG, "square deck detail fail" + e.getMessage());
LogUtil.i(TAG, "切换显示失败" + e.getMessage());
}).done(data -> {
LogUtil.i(TAG, "切换显示成功" + data.getMessage());
});
}
}
......@@ -173,8 +173,7 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
helper.setText(R.id.deck_update_date, item.getUpdateDate());
ImageView cardImage = helper.getView(R.id.deck_info_image);
long code = item.getDeckCoverCard1();
boolean isPublic = item.getPublic();
if (isPublic) {
if (item.getPublic()) {
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);
......@@ -192,16 +191,16 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
deleteMyDeckOnLine(item);
});
helper.getView(R.id.ll_switch_show).setOnClickListener(view -> {
if (isPublic) {
if (item.getPublic()) {
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);
item.setPublic(!isPublic);
item.setPublic(false); // 关闭公开状态
} else {
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);
item.setPublic(isPublic);
item.setPublic(true); // 开启公开状态
}
LogUtil.i(TAG, "current " + item.toString());
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.9" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<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"/>
<path android:fillColor="@android:color/white" android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
</vector>
......@@ -33,7 +33,7 @@
android:layout_height="12dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_marginRight="5dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="2dp"
android:background="@drawable/baseline_remove_red_eye_24" />
......
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