Skip to content

Commit

Permalink
Merge pull request #448 from FineFindus/fix/error-crash
Browse files Browse the repository at this point in the history
fix(ErrorStatusDisplayItem): disable button in onBind
  • Loading branch information
LucasGGamerM authored Jul 6, 2024
2 parents 0788b03 + 94ce329 commit 857d0ce
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ public Type getType() {
}

public static class Holder extends StatusDisplayItem.Holder<ErrorStatusDisplayItem> {
private final Button openInBrowserButton;

public Holder(Context context, ViewGroup parent) {
super(context, R.layout.display_item_error, parent);
Button openInBrowserButton=findViewById(R.id.button_open_browser);
openInBrowserButton.setEnabled(item.status.url!=null);
openInBrowserButton=findViewById(R.id.button_open_browser);
openInBrowserButton.setOnClickListener(v -> UiUtils.launchWebBrowser(v.getContext(), item.status.url));
findViewById(R.id.button_copy_error_details).setOnClickListener(this::copyErrorDetails);
}

@Override
public void onBind(ErrorStatusDisplayItem item) {}
public void onBind(ErrorStatusDisplayItem item) {
openInBrowserButton.setEnabled(item.status!=null && item.status.url!=null);
}

private void copyErrorDetails(View v) {
StringWriter stringWriter=new StringWriter();
Expand Down

0 comments on commit 857d0ce

Please sign in to comment.