Merge pull request #448 from FineFindus/fix/error-crash

fix(ErrorStatusDisplayItem): disable button in onBind
This commit is contained in:
LucasGGamerM 2024-07-06 09:33:31 -03:00 committed by GitHub
commit 857d0ce539
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -30,17 +30,19 @@ public class ErrorStatusDisplayItem extends StatusDisplayItem{
}
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();