Merge pull request #427 from FineFindus/fix/erro-null-url

fix(ErrorStatusDisplayItem): disable open in browser button on null URL
This commit is contained in:
LucasGGamerM 2024-06-13 16:29:35 -03:00 committed by GitHub
commit 57911ce070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import org.joinmastodon.android.BuildConfig; import org.joinmastodon.android.BuildConfig;
import org.joinmastodon.android.R; import org.joinmastodon.android.R;
@ -32,7 +33,9 @@ public class ErrorStatusDisplayItem extends StatusDisplayItem{
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);
findViewById(R.id.button_open_browser).setOnClickListener(v -> UiUtils.launchWebBrowser(v.getContext(), item.status.url)); Button openInBrowserButton=findViewById(R.id.button_open_browser);
openInBrowserButton.setEnabled(item.status.url!=null);
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);
} }