From a2c22f2b5bc049c43561a1b39f6863aba7e1061c Mon Sep 17 00:00:00 2001 From: ourfor Date: Wed, 4 Dec 2024 18:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20site=20modify=20button=20d?= =?UTF-8?q?isappear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../top/ourfor/app/iplayx/page/login/SiteViewCell.java | 10 ++++++---- .../ourfor/app/iplayx/page/setting/SettingPage.java | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java b/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java index f14c3c42..0e3a18d8 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; +import lombok.extern.slf4j.Slf4j; import lombok.val; import top.ourfor.app.iplayx.R; import top.ourfor.app.iplayx.action.DispatchAction; @@ -21,6 +22,7 @@ import top.ourfor.app.iplayx.model.SiteModel; import top.ourfor.app.iplayx.store.GlobalStore; +@Slf4j public class SiteViewCell extends ConstraintLayout implements UpdateModelAction { private SiteModel model; SiteCellBinding binding = null; @@ -75,13 +77,13 @@ void setupUI(Context context) { void bind() { binding.content.setOnClickListener(v -> callOnClick()); - binding.delete.setOnClickListener(v -> XGET(GlobalStore.class).removeSite(model)); - boolean allowModify = XGET(Navigator.class).getCurrentPageId() == R.id.sitePage; + val currentPageId = XGET(Navigator.class).getCurrentPageId(); + boolean allowModify = currentPageId == R.id.sitePage || currentPageId == R.id.settingPage; binding.modify.setVisibility(allowModify ? VISIBLE : GONE); binding.modify.setOnClickListener(v -> { - val dst = XGET(Navigator.class).getCurrentPageId(); - if (dst == R.id.sitePage) { + val pageId = XGET(Navigator.class).getCurrentPageId(); + if (pageId == R.id.sitePage || pageId == R.id.settingPage) { val action = XGET(SiteUpdateAction.class); if (action == null) return; XGET(DispatchAction.class).runOnUiThread(() -> action.onSiteModify(model)); diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/page/setting/SettingPage.java b/android/app/src/main/java/top/ourfor/app/iplayx/page/setting/SettingPage.java index a58444c4..bcc60782 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/page/setting/SettingPage.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/page/setting/SettingPage.java @@ -95,4 +95,9 @@ public void create(Context context, Map params) { public View view() { return binding.getRoot(); } + + @Override + public int id() { + return R.id.settingPage; + } }