Skip to content

Commit

Permalink
Merge pull request #324 from ourfor/develop
Browse files Browse the repository at this point in the history
🐛 fix site modify button disappear
  • Loading branch information
ourfor authored Dec 4, 2024
2 parents 957b644 + a2c22f2 commit 18c7ad4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ public void create(Context context, Map<String, Object> params) {
public View view() {
return binding.getRoot();
}

@Override
public int id() {
return R.id.settingPage;
}
}

0 comments on commit 18c7ad4

Please sign in to comment.