From a488776daa6e31924f35331f11b8bbecc1624b75 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sun, 17 Mar 2024 15:53:49 +0100 Subject: [PATCH 1/2] feat(profile): display DecentralizationExplainerSheet by clicking on username --- .../android/fragments/ProfileFragment.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index c5fad076af..9e27046bce 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -398,7 +398,7 @@ public void getOutline(View view, Outline outline){ followingBtn.setOnClickListener(this::onFollowersOrFollowingClick); content.findViewById(R.id.username_wrap).setOnClickListener(v->{ - UiUtils.goToInstanceAboutFragment(Uri.parse(account.url).getHost(), accountID, getContext()); + new DecentralizationExplainerSheet(getActivity(), accountID, account).show(); }); content.findViewById(R.id.username_wrap).setOnLongClickListener(v->{ @@ -435,14 +435,6 @@ public void getOutline(View view, Outline outline){ nameEdit.addTextChangedListener(new SimpleTextWatcher(e->editDirty=true)); bioEdit.addTextChangedListener(new SimpleTextWatcher(e->editDirty=true)); - usernameDomain.setOnClickListener(v->{ - UiUtils.goToInstanceAboutFragment(Uri.parse(account.url).getHost(), accountID, getContext()); - }); - - usernameDomain.setOnLongClickListener(v->{ - new DecentralizationExplainerSheet(getActivity(), accountID, account).show(); - return true; - }); // qrCodeButton.setOnClickListener(v->{ // Bundle args=new Bundle(); From 4d91ff38665371c14d71d9191423d7933a949c13 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sun, 17 Mar 2024 15:55:14 +0100 Subject: [PATCH 2/2] feat(DecentralizationExplainerSheet): add button to open about page --- .../ui/sheets/DecentralizationExplainerSheet.java | 6 ++++++ .../src/main/res/layout/sheet_decentralization_info.xml | 9 +++++++++ mastodon/src/main/res/values/strings_mo.xml | 1 + 3 files changed, 16 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/sheets/DecentralizationExplainerSheet.java b/mastodon/src/main/java/org/joinmastodon/android/ui/sheets/DecentralizationExplainerSheet.java index c15f201b1d..b23586373e 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/sheets/DecentralizationExplainerSheet.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/sheets/DecentralizationExplainerSheet.java @@ -4,6 +4,7 @@ import android.content.ClipboardManager; import android.content.Context; import android.graphics.drawable.ColorDrawable; +import android.net.Uri; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; @@ -45,6 +46,11 @@ public DecentralizationExplainerSheet(@NonNull Context context, String accountID TextView handleExplanation=findViewById(R.id.handle_explanation); findViewById(R.id.btn_cancel).setOnClickListener(v->dismiss()); + findViewById(R.id.btn_view_info).setOnClickListener(v->{ + UiUtils.goToInstanceAboutFragment(Uri.parse(account.url).getHost(), accountID, context); + dismiss(); + }); + String domain=account.getDomain(); if(TextUtils.isEmpty(domain)) domain=AccountSessionManager.get(accountID).domain; diff --git a/mastodon/src/main/res/layout/sheet_decentralization_info.xml b/mastodon/src/main/res/layout/sheet_decentralization_info.xml index 9460b1a9ef..274d95fe2e 100644 --- a/mastodon/src/main/res/layout/sheet_decentralization_info.xml +++ b/mastodon/src/main/res/layout/sheet_decentralization_info.xml @@ -174,5 +174,14 @@ style="@style/Widget.Mastodon.M3.Button.Filled" android:text="@string/got_it"/> +