diff --git a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java index d802892c8..c983862a4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java @@ -124,7 +124,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{ .setContentText(pn.body) .setStyle(new Notification.BigTextStyle().bigText(pn.body)) .setSmallIcon(R.drawable.ic_ntf_logo) - .setContentIntent(PendingIntent.getActivity(context, accountID.hashCode() & 0xFFFF, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_CANCEL_CURRENT)) + .setContentIntent(PendingIntent.getActivity(context, accountID.hashCode() & 0xFFFF, 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/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index e577f1bb5..6fe518a72 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -331,6 +331,7 @@ public abstract class BaseStatusListFragment exten if(toolbar==null) return; toolbar.setOnClickListener(v->scrollToTop()); + toolbar.setNavigationContentDescription(R.string.back); } protected int getMainAdapterOffset(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 8025e9dde..bd2df7365 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -101,7 +101,7 @@ import me.grishka.appkit.imageloader.ViewImageLoader; import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest; import me.grishka.appkit.utils.V; -public class ComposeFragment extends ToolbarFragment implements OnBackPressedListener, ComposeEditText.SelectionListener{ +public class ComposeFragment extends MastodonToolbarFragment implements OnBackPressedListener, ComposeEditText.SelectionListener{ private static final int MEDIA_RESULT=717; private static final int IMAGE_DESCRIPTION_RESULT=363; @@ -433,7 +433,6 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis updateCharCounter(s); } }); - updateToolbar(); if(replyTo!=null){ replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName)); ArrayList mentions=new ArrayList<>(); @@ -518,7 +517,6 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis public void onConfigurationChanged(Configuration newConfig){ super.onConfigurationChanged(newConfig); emojiKeyboard.onConfigurationChanged(); - updateToolbar(); } @SuppressLint("NewApi") @@ -556,7 +554,9 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis mainEditText.getText().replace(start, mainEditText.getSelectionEnd(), prefix+emoji.shortcode+':'); } - private void updateToolbar(){ + @Override + protected void updateToolbar(){ + super.updateToolbar(); getToolbar().setNavigationIcon(R.drawable.ic_fluent_dismiss_24_regular); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeImageDescriptionFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeImageDescriptionFragment.java index 20e3553c0..02bea5f6d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeImageDescriptionFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeImageDescriptionFragment.java @@ -30,7 +30,7 @@ import me.grishka.appkit.imageloader.ViewImageLoader; import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest; import me.grishka.appkit.utils.V; -public class ComposeImageDescriptionFragment extends ToolbarFragment{ +public class ComposeImageDescriptionFragment extends MastodonToolbarFragment{ private String accountID, attachmentID; private EditText edit; private Button saveButton; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonToolbarFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonToolbarFragment.java new file mode 100644 index 000000000..93cb88fdf --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonToolbarFragment.java @@ -0,0 +1,33 @@ +package org.joinmastodon.android.fragments; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.Toolbar; + +import org.joinmastodon.android.R; + +import androidx.annotation.CallSuper; +import me.grishka.appkit.fragments.ToolbarFragment; + +public abstract class MastodonToolbarFragment extends ToolbarFragment{ + @Override + public void onViewCreated(View view, Bundle savedInstanceState){ + super.onViewCreated(view, savedInstanceState); + updateToolbar(); + } + + @Override + public void onConfigurationChanged(Configuration newConfig){ + super.onConfigurationChanged(newConfig); + updateToolbar(); + } + + @CallSuper + protected void updateToolbar(){ + Toolbar toolbar=getToolbar(); + if(toolbar!=null && toolbar.getNavigationIcon()!=null){ + toolbar.setNavigationContentDescription(R.string.back); + } + } +} diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java index 77f1e59d2..d8042db11 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java @@ -24,7 +24,7 @@ import me.grishka.appkit.fragments.BaseRecyclerFragment; import me.grishka.appkit.fragments.ToolbarFragment; import me.grishka.appkit.utils.V; -public class NotificationsFragment extends ToolbarFragment implements ScrollableToTop{ +public class NotificationsFragment extends MastodonToolbarFragment implements ScrollableToTop{ private TabLayout tabLayout; private ViewPager2 pager; @@ -123,18 +123,6 @@ public class NotificationsFragment extends ToolbarFragment implements Scrollable return view; } - @Override - public void onViewCreated(View view, Bundle savedInstanceState){ - super.onViewCreated(view, savedInstanceState); - updateToolbar(); - } - - @Override - public void onConfigurationChanged(Configuration newConfig){ - super.onConfigurationChanged(newConfig); - updateToolbar(); - } - @Override public void scrollToTop(){ getFragmentForPage(pager.getCurrentItem()).scrollToTop(); @@ -145,7 +133,9 @@ public class NotificationsFragment extends ToolbarFragment implements Scrollable allNotificationsFragment.loadData(); } - private void updateToolbar(){ + @Override + protected void updateToolbar(){ + super.updateToolbar(); getToolbar().setOutlineProvider(null); } 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 447088f5f..b36197302 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -454,6 +454,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList toolbarSubtitleView.setTranslationY(titleTransY); } getToolbar().setOnClickListener(v->scrollToTop()); + getToolbar().setNavigationContentDescription(R.string.back); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 3a5db031f..92535a487 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -17,6 +17,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.PopupMenu; +import android.widget.RadioButton; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; @@ -52,7 +53,7 @@ import me.grishka.appkit.utils.BindableViewHolder; import me.grishka.appkit.utils.V; import me.grishka.appkit.views.UsableRecyclerView; -public class SettingsFragment extends ToolbarFragment{ +public class SettingsFragment extends MastodonToolbarFragment{ private UsableRecyclerView list; private ArrayList items=new ArrayList<>(); private ThemeItem themeItem; @@ -511,7 +512,8 @@ public class SettingsFragment extends ToolbarFragment{ private class SubitemHolder{ public TextView text; - public ImageView icon, checkbox; + public ImageView icon; + public RadioButton checkbox; public SubitemHolder(View view){ text=view.findViewById(R.id.text); @@ -526,11 +528,11 @@ public class SettingsFragment extends ToolbarFragment{ public void bind(int text, int icon, boolean checked){ this.text.setText(text); this.icon.setImageResource(icon); - checkbox.setSelected(checked); + checkbox.setChecked(checked); } public void setChecked(boolean checked){ - checkbox.setSelected(checked); + checkbox.setChecked(checked); } } } 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 cd4effc3c..1dc9978b5 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 @@ -183,6 +183,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, searchClear=view.findViewById(R.id.search_clear); searchProgress=view.findViewById(R.id.search_progress); searchBack.setEnabled(searchActive); + searchBack.setImportantForAccessibility(searchActive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); searchBack.setOnClickListener(v->exitSearch()); if(searchActive){ searchBack.setImageResource(R.drawable.ic_fluent_arrow_left_24_regular); @@ -221,6 +222,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, searchView.setVisibility(View.VISIBLE); searchBack.setImageResource(R.drawable.ic_fluent_arrow_left_24_regular); searchBack.setEnabled(true); + searchBack.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } } @@ -233,6 +235,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, searchEdit.setText(""); searchBack.setImageResource(R.drawable.ic_fluent_search_24_regular); searchBack.setEnabled(false); + searchBack.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/BaseReportChoiceFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/BaseReportChoiceFragment.java index ff2f8b2b6..6d7991895 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/BaseReportChoiceFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/BaseReportChoiceFragment.java @@ -14,6 +14,7 @@ import android.widget.TextView; import org.joinmastodon.android.E; import org.joinmastodon.android.R; +import org.joinmastodon.android.fragments.MastodonToolbarFragment; import org.joinmastodon.android.model.Account; import org.joinmastodon.android.model.Status; import org.joinmastodon.android.ui.DividerItemDecoration; @@ -32,7 +33,7 @@ import me.grishka.appkit.utils.SingleViewRecyclerAdapter; import me.grishka.appkit.utils.V; import me.grishka.appkit.views.UsableRecyclerView; -public abstract class BaseReportChoiceFragment extends ToolbarFragment{ +public abstract class BaseReportChoiceFragment extends MastodonToolbarFragment{ private UsableRecyclerView list; private MergeRecyclerAdapter adapter; private Button btn; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportCommentFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportCommentFragment.java index 8953fd2f2..c5a880c9f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportCommentFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportCommentFragment.java @@ -17,6 +17,7 @@ import org.joinmastodon.android.E; import org.joinmastodon.android.R; import org.joinmastodon.android.api.requests.reports.SendReport; import org.joinmastodon.android.events.FinishReportFragmentsEvent; +import org.joinmastodon.android.fragments.MastodonToolbarFragment; import org.joinmastodon.android.model.Account; import org.joinmastodon.android.model.ReportReason; import org.joinmastodon.android.ui.utils.UiUtils; @@ -30,7 +31,7 @@ import me.grishka.appkit.api.ErrorResponse; import me.grishka.appkit.fragments.ToolbarFragment; import me.grishka.appkit.utils.V; -public class ReportCommentFragment extends ToolbarFragment{ +public class ReportCommentFragment extends MastodonToolbarFragment{ private String accountID; private Account reportAccount; private Button btn; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportDoneFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportDoneFragment.java index 8ce6d19c0..1970bf48d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportDoneFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/report/ReportDoneFragment.java @@ -13,6 +13,7 @@ import android.widget.TextView; import org.joinmastodon.android.R; import org.joinmastodon.android.api.requests.accounts.SetAccountFollowed; +import org.joinmastodon.android.fragments.MastodonToolbarFragment; import org.joinmastodon.android.model.Account; import org.joinmastodon.android.model.Relationship; import org.joinmastodon.android.model.ReportReason; @@ -29,7 +30,7 @@ import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest; import me.grishka.appkit.utils.CubicBezierInterpolator; import me.grishka.appkit.utils.V; -public class ReportDoneFragment extends ToolbarFragment{ +public class ReportDoneFragment extends MastodonToolbarFragment{ private String accountID; private Account reportAccount; private Button btn; diff --git a/mastodon/src/main/res/layout/fragment_discover.xml b/mastodon/src/main/res/layout/fragment_discover.xml index 598165144..29cd7bb6b 100644 --- a/mastodon/src/main/res/layout/fragment_discover.xml +++ b/mastodon/src/main/res/layout/fragment_discover.xml @@ -49,6 +49,7 @@ android:background="?android:selectableItemBackgroundBorderless" android:tint="?colorSearchHint" android:elevation="1dp" + android:contentDescription="@string/back" android:src="@drawable/ic_fluent_search_24_regular"/> \ No newline at end of file diff --git a/mastodon/src/main/res/layout/item_recent_searches_header.xml b/mastodon/src/main/res/layout/item_recent_searches_header.xml index f696a7b86..29352a7b3 100644 --- a/mastodon/src/main/res/layout/item_recent_searches_header.xml +++ b/mastodon/src/main/res/layout/item_recent_searches_header.xml @@ -24,6 +24,7 @@ android:layout_marginEnd="6dp" android:tint="?android:textColorSecondary" android:background="?android:selectableItemBackgroundBorderless" + android:contentDescription="@string/clear" android:src="@drawable/ic_fluent_dismiss_circle_24_filled"/> \ No newline at end of file diff --git a/mastodon/src/main/res/layout/item_settings_theme_subitem.xml b/mastodon/src/main/res/layout/item_settings_theme_subitem.xml index 93d24295f..1bd0e4c6b 100644 --- a/mastodon/src/main/res/layout/item_settings_theme_subitem.xml +++ b/mastodon/src/main/res/layout/item_settings_theme_subitem.xml @@ -27,12 +27,14 @@ android:ellipsize="end" tools:text="@string/theme_auto"/> - + android:focusable="false" + android:clickable="false" + android:button="@drawable/ic_round_checkbox"/> \ No newline at end of file diff --git a/mastodon/src/main/res/values/strings.xml b/mastodon/src/main/res/values/strings.xml index f3420c67e..22365a374 100644 --- a/mastodon/src/main/res/values/strings.xml +++ b/mastodon/src/main/res/values/strings.xml @@ -294,4 +294,8 @@ Show boosts from %s why do you want to join? This will help us review your application. + Clear + Header image + Profile picture + Reorder \ No newline at end of file