diff --git a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java index 3cd93eb38..3b8dfbb28 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java @@ -130,14 +130,14 @@ public class PushNotificationReceiver extends BroadcastReceiver{ contentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); contentIntent.putExtra("fromNotification", true); contentIntent.putExtra("accountID", accountID); - contentIntent.putExtra("notificationID", notificationId); + contentIntent.putExtra("notificationID", notificationID); if(notification!=null){ contentIntent.putExtra("notification", Parcels.wrap(notification)); } builder.setContentTitle(pn.title) .setContentText(pn.body) .setStyle(new Notification.BigTextStyle().bigText(pn.body)) - .setContentIntent(PendingIntent.getActivity(context, notificationId, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT)) + .setContentIntent(PendingIntent.getActivity(context, notificationID, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT)) .setWhen(notification==null ? System.currentTimeMillis() : notification.createdAt.toEpochMilli()) .setShowWhen(true) .setCategory(Notification.CATEGORY_SOCIAL) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelineFragment.java index 96bc5165b..5423d65ea 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelineFragment.java @@ -65,7 +65,6 @@ public class ListTimelineFragment extends StatusListFragment { editor.applyList(listTitle, repliesPolicy); new M3AlertDialogBuilder(getActivity()) .setTitle(R.string.sk_edit_list_title) - .setIcon(R.drawable.ic_fluent_people_list_28_regular) .setView(editor) .setPositiveButton(R.string.save, (d, which) -> { new UpdateList(listID, editor.getTitle(), editor.getRepliesPolicy()).setCallback(new Callback<>() { diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java index 4c8e70d5a..794216148 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java @@ -55,14 +55,12 @@ public class ListTimelinesFragment extends BaseRecyclerFragment im super.onCreate(savedInstanceState); Bundle args=getArguments(); accountId=args.getString("account"); - setHasOptionsMenu(true); if(args.containsKey("profileAccount")){ profileAccountId=args.getString("profileAccount"); profileDisplayUsername=args.getString("profileDisplayUsername"); setTitle(getString(R.string.sk_lists_with_user, profileDisplayUsername)); - } else { - setTitle(R.string.sk_your_lists); + setHasOptionsMenu(true); } } @@ -84,7 +82,6 @@ public class ListTimelinesFragment extends BaseRecyclerFragment im ListTimelineEditor editor = new ListTimelineEditor(getContext()); new M3AlertDialogBuilder(getActivity()) .setTitle(R.string.sk_create_list_title) - .setIcon(R.drawable.ic_fluent_people_add_28_regular) .setView(editor) .setPositiveButton(R.string.sk_create, (d, which) -> { new CreateList(editor.getTitle(), editor.getRepliesPolicy()).setCallback(new Callback<>() { @@ -211,7 +208,7 @@ public class ListTimelinesFragment extends BaseRecyclerFragment im @Override public void onBind(ListTimeline item) { title.setText(item.title); - title.setCompoundDrawablesRelativeWithIntrinsicBounds(itemView.getContext().getDrawable(R.drawable.ic_fluent_people_list_24_regular), null, null, null); + title.setCompoundDrawablesRelativeWithIntrinsicBounds(itemView.getContext().getDrawable(R.drawable.ic_fluent_people_community_24_regular), null, null, null); if (profileAccountId != null) { Boolean checked = userInList.get(item.id); listToggle.setVisibility(View.VISIBLE); 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 d6ac22e20..519431d27 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -635,14 +635,17 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList menu.findItem(R.id.block).setTitle(getString(relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getShortUsername())); menu.findItem(R.id.report).setTitle(getString(R.string.report_user, account.getShortUsername())); + MenuItem manageUserLists=menu.findItem(R.id.manage_user_lists); if(relationship.following) { MenuItem hideBoosts = menu.findItem(R.id.hide_boosts); hideBoosts.setTitle(getString(relationship.showingReblogs ? R.string.hide_boosts_from_user : R.string.show_boosts_from_user, account.getShortUsername())); hideBoosts.setIcon(relationship.showingReblogs ? R.drawable.ic_fluent_arrow_repeat_all_off_24_regular : R.drawable.ic_fluent_arrow_repeat_all_24_regular); UiUtils.insetPopupMenuIcon(getContext(), hideBoosts); - menu.findItem(R.id.manage_user_lists).setTitle(getString(R.string.sk_lists_with_user, account.getShortUsername())); + manageUserLists.setTitle(getString(R.string.sk_lists_with_user, account.getShortUsername())); + manageUserLists.setVisible(true); }else { menu.findItem(R.id.hide_boosts).setVisible(false); + manageUserLists.setVisible(false); } if(!account.isLocal()) menu.findItem(R.id.block_domain).setTitle(getString(relationship.domainBlocking ? R.string.unblock_domain : R.string.block_domain, account.getDomain())); @@ -700,10 +703,8 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList }else if(id==R.id.manage_user_lists){ final Bundle args=new Bundle(); args.putString("account", accountID); - if (!isOwnProfile) { - args.putString("profileAccount", profileAccountID); - args.putString("profileDisplayUsername", account.getDisplayUsername()); - } + args.putString("profileAccount", profileAccountID); + args.putString("profileDisplayUsername", account.getDisplayUsername()); Nav.go(getActivity(), ListTimelinesFragment.class, args); }else if(id==R.id.followed_hashtags){ Bundle args=new Bundle(); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java index 6dfea2f68..dd40d2367 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java @@ -18,9 +18,11 @@ import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; +import org.joinmastodon.android.BuildConfig; import org.joinmastodon.android.GlobalUserPreferences; import org.joinmastodon.android.R; import org.joinmastodon.android.fragments.ScrollableToTop; +import org.joinmastodon.android.fragments.ListTimelinesFragment; import org.joinmastodon.android.ui.SimpleViewHolder; import org.joinmastodon.android.ui.tabs.TabLayout; import org.joinmastodon.android.ui.tabs.TabLayoutMediator; @@ -55,6 +57,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, private SearchFragment searchFragment; private LocalTimelineFragment localTimelineFragment; private FederatedTimelineFragment federatedTimelineFragment; + private ListTimelinesFragment listTimelinesFragment; private String accountID; private Runnable searchDebouncer=this::onSearchChangedDebounced; @@ -78,17 +81,18 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, tabLayout=view.findViewById(R.id.tabbar); pager=view.findViewById(R.id.pager); - tabViews=new FrameLayout[noFederated ? 5 : 6]; + tabViews=new FrameLayout[noFederated ? 6 : 7]; for(int i=0;i 0 ? i + 1 : i; tabView.setId(switch(switchIndex){ case 0 -> R.id.discover_local_timeline; case 1 -> R.id.discover_federated_timeline; - case 2 -> R.id.discover_hashtags; - case 3 -> R.id.discover_posts; - case 4 -> R.id.discover_news; - case 5 -> R.id.discover_users; + case 2 -> R.id.discover_lists; + case 3 -> R.id.discover_hashtags; + case 4 -> R.id.discover_posts; + case 5 -> R.id.discover_news; + case 6 -> R.id.discover_users; default -> throw new IllegalStateException("Unexpected value: "+switchIndex); }); tabView.setVisibility(View.GONE); @@ -135,12 +139,16 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, localTimelineFragment=new LocalTimelineFragment(); localTimelineFragment.setArguments(args); + listTimelinesFragment=new ListTimelinesFragment(); + listTimelinesFragment.setArguments(args); + FragmentTransaction transaction = getChildFragmentManager().beginTransaction() .add(R.id.discover_posts, postsFragment) .add(R.id.discover_local_timeline, localTimelineFragment) .add(R.id.discover_hashtags, hashtagsFragment) .add(R.id.discover_news, newsFragment) - .add(R.id.discover_users, accountsFragment); + .add(R.id.discover_users, accountsFragment) + .add(R.id.discover_lists, listTimelinesFragment); if (!noFederated) { federatedTimelineFragment=new FederatedTimelineFragment(); @@ -158,10 +166,12 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, tab.setText(switch(position){ case 0 -> R.string.local_timeline; case 1 -> R.string.sk_federated_timeline; - case 2 -> R.string.hashtags; - case 3 -> R.string.posts; - case 4 -> R.string.news; - case 5 -> R.string.for_you; + case 2 -> R.string.sk_list_timelines; + case 3 -> R.string.hashtags; + case 4 -> R.string.posts; + case 5 -> R.string.news; + case 6 -> R.string.for_you; + default -> throw new IllegalStateException("Unexpected value: "+position); }); tab.view.textView.setAllCaps(true); @@ -291,6 +301,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, case 3 -> postsFragment; case 4 -> newsFragment; case 5 -> accountsFragment; + case 6 -> listTimelinesFragment; default -> throw new IllegalStateException("Unexpected value: "+page); }; } @@ -347,4 +358,10 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, return position; } } + + public void selectSearch(){ + searchEdit.requestFocus(); + onSearchEditFocusChanged(searchEdit, true); + getActivity().getSystemService(InputMethodManager.class).showSoftInput(searchEdit, 0); + } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 1eef7802b..52ee0ca7e 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -537,18 +537,16 @@ public class UiUtils{ public static void confirmDeleteList(Activity activity, String accountID, String listID, Runnable callback) { showConfirmationAlert(activity, R.string.sk_delete_list, R.string.sk_delete_list_confirm, R.string.delete, R.drawable.ic_fluent_delete_28_regular, () -> new DeleteList(listID).setCallback(new Callback<>() { - @Override - public void onSuccess(Object o) { - callback.run(); - } + @Override + public void onSuccess(Object o) { + callback.run(); + } - @Override - public void onError(ErrorResponse error) { - error.showToast(activity); - } - }) - .wrapProgress(activity, R.string.deleting, false) - .exec(accountID)); + @Override + public void onError(ErrorResponse error) { + error.showToast(activity); + } + }).exec(accountID)); } public static void setRelationshipToActionButton(Relationship relationship, Button button){ diff --git a/mastodon/src/main/res/drawable/ic_fluent_people_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_people_24_regular.xml deleted file mode 100644 index 7e747822e..000000000 --- a/mastodon/src/main/res/drawable/ic_fluent_people_24_regular.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mastodon/src/main/res/drawable/ic_fluent_people_add_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_people_add_24_regular.xml deleted file mode 100644 index 84cd0634b..000000000 --- a/mastodon/src/main/res/drawable/ic_fluent_people_add_24_regular.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mastodon/src/main/res/drawable/ic_fluent_people_add_28_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_people_add_28_regular.xml deleted file mode 100644 index 370ecb02a..000000000 --- a/mastodon/src/main/res/drawable/ic_fluent_people_add_28_regular.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mastodon/src/main/res/drawable/ic_fluent_people_list_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_people_list_24_regular.xml deleted file mode 100644 index f4b216279..000000000 --- a/mastodon/src/main/res/drawable/ic_fluent_people_list_24_regular.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mastodon/src/main/res/drawable/ic_fluent_people_list_28_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_people_list_28_regular.xml deleted file mode 100644 index 39394a989..000000000 --- a/mastodon/src/main/res/drawable/ic_fluent_people_list_28_regular.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mastodon/src/main/res/menu/menu_list.xml b/mastodon/src/main/res/menu/menu_list.xml index 93123a9f2..dbd92e417 100644 --- a/mastodon/src/main/res/menu/menu_list.xml +++ b/mastodon/src/main/res/menu/menu_list.xml @@ -3,6 +3,6 @@ \ No newline at end of file diff --git a/mastodon/src/main/res/menu/profile.xml b/mastodon/src/main/res/menu/profile.xml index abf7b0e03..1f2a99a2d 100644 --- a/mastodon/src/main/res/menu/profile.xml +++ b/mastodon/src/main/res/menu/profile.xml @@ -6,6 +6,6 @@ - + \ No newline at end of file diff --git a/mastodon/src/main/res/menu/profile_own.xml b/mastodon/src/main/res/menu/profile_own.xml index 14c7b2c30..07acdf591 100644 --- a/mastodon/src/main/res/menu/profile_own.xml +++ b/mastodon/src/main/res/menu/profile_own.xml @@ -1,7 +1,6 @@ - diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index 88f0772fc..5f8c9c6f9 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -154,7 +154,6 @@ Delete list Are you sure you want to delete this list? Edit list - Your lists Add new poll option