Skip to content

Commit

Permalink
Merge pull request #358
Browse files Browse the repository at this point in the history
feat: add instance info button to DecentralizationExplainerSheet
  • Loading branch information
LucasGGamerM authored Mar 17, 2024
2 parents b1b03a3 + 4d91ff3 commit a95c005
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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->{
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions mastodon/src/main/res/layout/sheet_decentralization_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,14 @@
style="@style/Widget.Mastodon.M3.Button.Filled"
android:text="@string/got_it"/>

<Button
android:id="@+id/btn_view_info"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="8dp"
android:layout_marginHorizontal="16dp"
style="@style/Widget.Mastodon.M3.Button.Text"
android:text="@string/mo_instance_view_info"/>

</LinearLayout>
</org.joinmastodon.android.ui.views.CustomScrollView>
1 change: 1 addition & 0 deletions mastodon/src/main/res/values/strings_mo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

<string name="mo_share_open_url">Open in App</string>

<string name="mo_instance_view_info">View Server Info</string>
<string name="mo_instance_admin">Administered by</string>
<string name="mo_instance_contact">Contact</string>
<string name="mo_instance_users">Users</string>
Expand Down

0 comments on commit a95c005

Please sign in to comment.