parent
732e780fd9
commit
f1ce700c93
|
@ -32,7 +32,7 @@ public class M3AlertDialogBuilder extends AlertDialog.Builder{
|
|||
View title=alert.findViewById(titleID);
|
||||
if(title!=null){
|
||||
int pad=V.dp(24);
|
||||
title.setPadding(pad, pad, pad, pad);
|
||||
title.setPadding(pad, pad, pad, V.dp(18));
|
||||
}
|
||||
}
|
||||
int titleDividerID=getContext().getResources().getIdentifier("titleDividerNoCustom", "id", "android");
|
||||
|
|
|
@ -19,8 +19,6 @@ import android.widget.PopupMenu;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.requests.accounts.GetAccountRelationships;
|
||||
|
@ -139,6 +137,7 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
avatar.setOutlineProvider(roundCornersOutline);
|
||||
avatar.setClipToOutline(true);
|
||||
more.setOnClickListener(this::onMoreClick);
|
||||
more.setOnLongClickListener((v) -> { openWithAccount(); return true; });
|
||||
visibility.setOnClickListener(v->item.parentFragment.onVisibilityIconClick(this));
|
||||
deleteNotification.setOnClickListener(v->UiUtils.confirmDeleteNotification(activity, item.parentFragment.getAccountID(), item.notification, ()->{
|
||||
if (item.parentFragment instanceof NotificationsListFragment fragment) {
|
||||
|
@ -191,8 +190,11 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
}
|
||||
}else if(id==R.id.delete){
|
||||
UiUtils.confirmDeletePost(item.parentFragment.getActivity(), item.parentFragment.getAccountID(), item.status, s->{});
|
||||
}else if(id==R.id.pin || id==R.id.unpin){
|
||||
UiUtils.confirmPinPost(item.parentFragment.getActivity(), item.parentFragment.getAccountID(), item.status, !item.status.pinned, s->{});
|
||||
}else if(id==R.id.pin || id==R.id.unpin) {
|
||||
UiUtils.confirmPinPost(item.parentFragment.getActivity(), item.parentFragment.getAccountID(), item.status, !item.status.pinned, s -> {
|
||||
});
|
||||
}else if(id==R.id.open_with_account) {
|
||||
openWithAccount();
|
||||
}else if(id==R.id.mute){
|
||||
UiUtils.confirmToggleMuteUser(item.parentFragment.getActivity(), item.parentFragment.getAccountID(), account, relationship!=null && relationship.muting, r->{});
|
||||
}else if(id==R.id.block){
|
||||
|
@ -231,6 +233,13 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
});
|
||||
}
|
||||
|
||||
private void openWithAccount() {
|
||||
UiUtils.pickAccount(item.parentFragment.getActivity(), (session, dialog) -> {
|
||||
UiUtils.openURL(item.parentFragment.getActivity(), session.getID(), item.status.url);
|
||||
return true;
|
||||
}, R.string.sk_open_with_account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBind(HeaderStatusDisplayItem item){
|
||||
name.setText(item.parsedName);
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.joinmastodon.android.api.requests.search.GetSearchResults;
|
|||
import org.joinmastodon.android.api.requests.statuses.DeleteStatus;
|
||||
import org.joinmastodon.android.api.requests.statuses.GetStatusByID;
|
||||
import org.joinmastodon.android.api.requests.statuses.SetStatusPinned;
|
||||
import org.joinmastodon.android.api.session.AccountSession;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
|
||||
import org.joinmastodon.android.events.FollowRequestHandledEvent;
|
||||
|
@ -97,6 +98,7 @@ import java.util.function.Consumer;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.browser.customtabs.CustomTabsIntent;
|
||||
|
@ -832,4 +834,12 @@ public class UiUtils{
|
|||
public static boolean isMIUI(){
|
||||
return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.code"));
|
||||
}
|
||||
|
||||
public static void pickAccount(Context context, BiPredicate<AccountSession, DialogInterface> pick, @StringRes int title) {
|
||||
List<AccountSession> sessions=AccountSessionManager.getInstance().getLoggedInAccounts();
|
||||
new M3AlertDialogBuilder(context)
|
||||
.setItems(sessions.stream().map(as->"@"+as.self.username+"@"+as.domain).toArray(String[]::new), (d, which)->pick.test(sessions.get(which), d))
|
||||
.setTitle(title == 0 ? R.string.choose_account : title)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<item android:id="@+id/delete_and_redraft" android:title="@string/sk_delete_and_redraft"/>
|
||||
<item android:id="@+id/pin" android:title="@string/sk_pin_post"/>
|
||||
<item android:id="@+id/unpin" android:title="@string/sk_unpin_post"/>
|
||||
<item android:id="@+id/open_with_account" android:title="@string/sk_open_with_account"/>
|
||||
<item android:id="@+id/mute" android:title="@string/mute_user"/>
|
||||
<item android:id="@+id/block" android:title="@string/block_user"/>
|
||||
<item android:id="@+id/block_domain" android:title="@string/block_domain"/>
|
||||
|
|
|
@ -88,4 +88,5 @@
|
|||
<string name="sk_quote_post">Post about this</string>
|
||||
<string name="sk_hashtags_you_follow">Hashtags you follow</string>
|
||||
<string name="sk_copy_link_to_post">Copy link to post</string>
|
||||
<string name="sk_open_with_account">Open with other account</string>
|
||||
</resources>
|
Loading…
Reference in New Issue