From 24fbf41d081e9b7036d59dd0a0fc05732a52832a Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 21 Dec 2023 18:11:51 +0100 Subject: [PATCH] Fix issue #994 - Add a scroll bar for timelines (default: disabled) --- .../android/mastodon/helper/ComposeHelper.java | 6 ++---- .../ui/fragment/admin/FragmentAdminAccount.java | 5 +++++ .../ui/fragment/admin/FragmentAdminDomain.java | 6 +++++- .../ui/fragment/admin/FragmentAdminReport.java | 6 +++++- .../ui/fragment/media/FragmentMediaProfile.java | 5 +++++ .../fragment/settings/FragmentTimelinesSettings.java | 12 +++++++++++- .../fragment/timeline/FragmentMastodonAccount.java | 5 +++++ .../timeline/FragmentMastodonAnnouncement.java | 5 +++++ .../fragment/timeline/FragmentMastodonContext.java | 5 +++++ .../timeline/FragmentMastodonConversation.java | 3 +++ .../timeline/FragmentMastodonDomainBlock.java | 5 +++++ .../timeline/FragmentMastodonNotification.java | 3 +++ .../timeline/FragmentMastodonSuggestion.java | 5 +++++ .../ui/fragment/timeline/FragmentMastodonTag.java | 5 +++++ .../fragment/timeline/FragmentMastodonTimeline.java | 6 +++++- .../res/drawables/peertube/drawable/progress_bar.xml | 4 ++-- .../layouts/mastodon/layout/fragment_pagination.xml | 3 ++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/pref_timelines.xml | 8 ++++++++ 19 files changed, 88 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/ComposeHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/ComposeHelper.java index 230e186f..57de14a3 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/ComposeHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/ComposeHelper.java @@ -14,17 +14,15 @@ package app.fedilab.android.mastodon.helper; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see . */ -import static app.fedilab.android.mastodon.helper.Helper.mentionLongPattern; -import static app.fedilab.android.mastodon.helper.Helper.mentionPattern; + import static app.fedilab.android.mastodon.helper.Helper.mentionPatternALL; -import static app.fedilab.android.mastodon.helper.MastodonHelper.countWithEmoji; import android.util.Patterns; import java.util.ArrayList; import java.util.regex.Matcher; -import app.fedilab.android.mastodon.ui.drawer.ComposeAdapter; + public class ComposeHelper { diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminAccount.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminAccount.java index 90e02138..678e8bb4 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminAccount.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminAccount.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.admin; * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -63,6 +65,9 @@ public class FragmentAdminAccount extends Fragment { } flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminDomain.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminDomain.java index b5c24ece..a46645a8 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminDomain.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminDomain.java @@ -16,6 +16,7 @@ package app.fedilab.android.mastodon.ui.fragment.admin; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -25,6 +26,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -119,7 +121,9 @@ public class FragmentAdminDomain extends Fragment { ); adminVM = new ViewModelProvider(FragmentAdminDomain.this).get(viewModelKey, AdminVM.class); - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); binding.noActionText.setText(R.string.no_blocked_domains); binding.loader.setVisibility(View.VISIBLE); binding.recyclerView.setVisibility(View.GONE); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminReport.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminReport.java index dc3834d8..93f03cd2 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminReport.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/admin/FragmentAdminReport.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.admin; * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -69,7 +71,9 @@ public class FragmentAdminReport extends Fragment { } binding = FragmentPaginationBinding.inflate(inflater, container, false); - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); int c1 = ThemeHelper.getAttColor(requireActivity(), R.attr.colorAccent); binding.swipeContainer.setColorSchemeColors( c1, c1, c1 diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java index c6da7a0b..8d8daca7 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java @@ -14,6 +14,7 @@ package app.fedilab.android.mastodon.ui.fragment.media; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -23,6 +24,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -63,6 +65,9 @@ public class FragmentMediaProfile extends Fragment { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); Bundle bundle = this.getArguments(); if (bundle != null) { accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java index bc6c01f3..77946049 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java @@ -26,9 +26,11 @@ import androidx.preference.SwitchPreferenceCompat; import app.fedilab.android.R; import app.fedilab.android.activities.MainActivity; +import app.fedilab.android.mastodon.helper.Helper; public class FragmentTimelinesSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { + boolean recreate; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.pref_timelines); @@ -78,7 +80,7 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_PIXELFED_PRESENTATION) + MainActivity.currentUserID + MainActivity.currentInstance, false); SET_PIXELFED_PRESENTATION.setChecked(checked); } - + recreate = false; } @Override @@ -89,6 +91,9 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen if (key.compareToIgnoreCase(getString(R.string.SET_TRANSLATOR)) == 0) { createPref(); } + if (key.compareToIgnoreCase(getString(R.string.SET_TIMELINE_SCROLLBAR)) == 0) { + recreate = true; + } if (key.compareToIgnoreCase(getString(R.string.SET_DISPLAY_BOOKMARK)) == 0) { SwitchPreferenceCompat SET_DISPLAY_BOOKMARK = findPreference(getString(R.string.SET_DISPLAY_BOOKMARK)); if (SET_DISPLAY_BOOKMARK != null) { @@ -124,6 +129,11 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen super.onPause(); getPreferenceScreen().getSharedPreferences() .unregisterOnSharedPreferenceChangeListener(this); + if (recreate) { + recreate = false; + requireActivity().recreate(); + Helper.recreateMainActivity(requireActivity()); + } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java index 55879749..4e26ec8e 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java @@ -19,6 +19,7 @@ import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.currentToken; import static app.fedilab.android.mastodon.helper.MastodonHelper.ACCOUNTS_PER_CALL; +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -28,6 +29,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -103,6 +105,9 @@ public class FragmentMastodonAccount extends Fragment { flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAnnouncement.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAnnouncement.java index 38701d1d..b19a4e9a 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAnnouncement.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAnnouncement.java @@ -14,6 +14,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -22,6 +23,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import java.util.List; @@ -45,6 +47,9 @@ public class FragmentMastodonAnnouncement extends Fragment { ViewGroup container, Bundle savedInstanceState) { binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); View root = binding.getRoot(); announcementsVM = new ViewModelProvider(FragmentMastodonAnnouncement.this).get(AnnouncementsVM.class); binding.loader.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonContext.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonContext.java index 01cd0e2c..3adf0c1f 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonContext.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonContext.java @@ -20,6 +20,7 @@ import static app.fedilab.android.mastodon.activities.ContextActivity.expand; import android.content.BroadcastReceiver; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; @@ -31,6 +32,7 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import java.util.ArrayList; @@ -175,6 +177,9 @@ public class FragmentMastodonContext extends Fragment { } binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); statusesVM = new ViewModelProvider(FragmentMastodonContext.this).get(StatusesVM.class); binding.recyclerView.setNestedScrollingEnabled(true); this.statuses = new ArrayList<>(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonConversation.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonConversation.java index 99a22dca..5f70deac 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonConversation.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonConversation.java @@ -82,6 +82,9 @@ public class FragmentMastodonConversation extends Fragment implements Conversati ViewGroup container, Bundle savedInstanceState) { flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); isViewInitialized = false; return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonDomainBlock.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonDomainBlock.java index 9674611c..96704670 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonDomainBlock.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonDomainBlock.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline; * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -52,6 +54,9 @@ public class FragmentMastodonDomainBlock extends Fragment { ViewGroup container, Bundle savedInstanceState) { binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java index 56b74026..e5f09fa7 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java @@ -201,6 +201,9 @@ public class FragmentMastodonNotification extends Fragment implements Notificati flagLoading = false; isViewInitialized = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); View root = binding.getRoot(); if (getArguments() != null) { notificationType = (NotificationTypeEnum) getArguments().get(Helper.ARG_NOTIFICATION_TYPE); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonSuggestion.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonSuggestion.java index 64eafe2e..8437cc3c 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonSuggestion.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonSuggestion.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline; * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -51,6 +53,9 @@ public class FragmentMastodonSuggestion extends Fragment { ViewGroup container, Bundle savedInstanceState) { flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTag.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTag.java index 13254a16..d0027c98 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTag.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTag.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline; * see . */ +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -63,6 +65,9 @@ public class FragmentMastodonTag extends Fragment { } binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java index a1647ed4..717dface 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -355,9 +355,10 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. lockForResumeCall = 0; binding.loader.setVisibility(View.VISIBLE); binding.recyclerView.setVisibility(View.GONE); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); max_id = statusReport != null ? statusReport.id : null; offset = 0; - SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true); //Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false if (max_id == null && !isViewInitialized && rememberPosition) { @@ -459,6 +460,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED); binding = FragmentPaginationBinding.inflate(inflater, container, false); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); + boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); + binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); return binding.getRoot(); } diff --git a/app/src/main/res/drawables/peertube/drawable/progress_bar.xml b/app/src/main/res/drawables/peertube/drawable/progress_bar.xml index c0a479c8..049d4b60 100644 --- a/app/src/main/res/drawables/peertube/drawable/progress_bar.xml +++ b/app/src/main/res/drawables/peertube/drawable/progress_bar.xml @@ -3,7 +3,7 @@ - + @@ -17,7 +17,7 @@ - + diff --git a/app/src/main/res/layouts/mastodon/layout/fragment_pagination.xml b/app/src/main/res/layouts/mastodon/layout/fragment_pagination.xml index 6801a969..3ec6f30b 100644 --- a/app/src/main/res/layouts/mastodon/layout/fragment_pagination.xml +++ b/app/src/main/res/layouts/mastodon/layout/fragment_pagination.xml @@ -38,7 +38,8 @@ android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="6dp" - android:scrollbars="none" /> + android:scrollbarThumbVertical="?colorPrimary" + android:scrollbars="vertical" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fc6d9500..565a3579 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1190,6 +1190,7 @@ SET_GROUP_REBLOGS SET_BOOST_ORIGINAL_DATE + SET_TIMELINE_SCROLLBAR SET_MARKDOWN_SUPPORT SET_TRUNCATE_LINKS SET_UNDERLINE_CLICKABLE @@ -1951,6 +1952,7 @@ Followed by: Directory Display original date for boosts + Display a scroll bar for timelines Markdown support Disable release notes When a new version is published, you will not be alerted inside the app. diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index c59d8b78..ecf37ffd 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -50,6 +50,14 @@ app:singleLineTitle="false" app:title="@string/boost_original_date" /> + + +