Merge pull request #448 from FineFindus/fix/error-crash
fix(ErrorStatusDisplayItem): disable button in onBind
This commit is contained in:
commit
857d0ce539
|
@ -30,17 +30,19 @@ public class ErrorStatusDisplayItem extends StatusDisplayItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Holder extends StatusDisplayItem.Holder<ErrorStatusDisplayItem> {
|
public static class Holder extends StatusDisplayItem.Holder<ErrorStatusDisplayItem> {
|
||||||
|
private final Button openInBrowserButton;
|
||||||
|
|
||||||
public Holder(Context context, ViewGroup parent) {
|
public Holder(Context context, ViewGroup parent) {
|
||||||
super(context, R.layout.display_item_error, parent);
|
super(context, R.layout.display_item_error, parent);
|
||||||
Button openInBrowserButton=findViewById(R.id.button_open_browser);
|
openInBrowserButton=findViewById(R.id.button_open_browser);
|
||||||
openInBrowserButton.setEnabled(item.status.url!=null);
|
|
||||||
openInBrowserButton.setOnClickListener(v -> UiUtils.launchWebBrowser(v.getContext(), item.status.url));
|
openInBrowserButton.setOnClickListener(v -> UiUtils.launchWebBrowser(v.getContext(), item.status.url));
|
||||||
findViewById(R.id.button_copy_error_details).setOnClickListener(this::copyErrorDetails);
|
findViewById(R.id.button_copy_error_details).setOnClickListener(this::copyErrorDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
private void copyErrorDetails(View v) {
|
||||||
StringWriter stringWriter=new StringWriter();
|
StringWriter stringWriter=new StringWriter();
|
||||||
|
|
Loading…
Reference in New Issue