diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.kt b/app/src/main/java/org/wikipedia/feed/FeedFragment.kt index 7e63b48e12a..bd645854217 100644 --- a/app/src/main/java/org/wikipedia/feed/FeedFragment.kt +++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.kt @@ -40,7 +40,6 @@ import org.wikipedia.settings.Prefs import org.wikipedia.settings.SettingsActivity import org.wikipedia.settings.languages.WikipediaLanguagesActivity import org.wikipedia.util.FeedbackUtil -import org.wikipedia.util.ResourceUtil import org.wikipedia.util.UriUtil class FeedFragment : Fragment(), BackPressedHandler { @@ -95,7 +94,6 @@ class FeedFragment : Fragment(), BackPressedHandler { feedAdapter = FeedAdapter(coordinator, feedCallback) binding.feedView.adapter = feedAdapter binding.feedView.addOnScrollListener(feedScrollListener) - binding.swipeRefreshLayout.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.swipeRefreshLayout.setOnRefreshListener { refresh() } binding.customizeButton.setOnClickListener { showConfigureActivity(-1) } coordinator.setFeedUpdateListener(object : FeedUpdateListener { diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.kt b/app/src/main/java/org/wikipedia/page/PageFragment.kt index ca7ff27ddeb..20fe7e69270 100644 --- a/app/src/main/java/org/wikipedia/page/PageFragment.kt +++ b/app/src/main/java/org/wikipedia/page/PageFragment.kt @@ -196,7 +196,6 @@ class PageFragment : Fragment(), BackPressedHandler, CommunicationBridge.Communi _binding = FragmentPageBinding.inflate(inflater, container, false) webView = binding.pageWebView initWebViewListeners() - binding.pageRefreshContainer.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.pageRefreshContainer.scrollableChild = webView binding.pageRefreshContainer.setOnRefreshListener(pageRefreshListener) val swipeOffset = DimenUtil.getContentTopOffsetPx(requireActivity()) + REFRESH_SPINNER_ADDITIONAL_OFFSET diff --git a/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt b/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt index 70bb2490f91..b93bf385886 100644 --- a/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt +++ b/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt @@ -292,7 +292,6 @@ class ReadingListFragment : Fragment(), MenuProvider, ReadingListItemActionsDial } private fun setSwipeRefreshView() { - binding.readingListSwipeRefresh.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.readingListSwipeRefresh.setOnRefreshListener { ReadingListsFragment.refreshSync(this, binding.readingListSwipeRefresh) } if (RemoteConfig.config.disableReadingListSync) { binding.readingListSwipeRefresh.isEnabled = false diff --git a/app/src/main/java/org/wikipedia/readinglist/ReadingListsFragment.kt b/app/src/main/java/org/wikipedia/readinglist/ReadingListsFragment.kt index 9d629401f35..123cd67d40a 100644 --- a/app/src/main/java/org/wikipedia/readinglist/ReadingListsFragment.kt +++ b/app/src/main/java/org/wikipedia/readinglist/ReadingListsFragment.kt @@ -106,7 +106,6 @@ class ReadingListsFragment : Fragment(), SortReadingListsDialog.Callback, Readin binding.recyclerView.adapter = adapter binding.recyclerView.addItemDecoration(DrawableItemDecoration(requireContext(), R.attr.list_divider)) setUpScrollListener() - binding.swipeRefreshLayout.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.swipeRefreshLayout.setOnRefreshListener { refreshSync(this, binding.swipeRefreshLayout) } if (RemoteConfig.config.disableReadingListSync) { binding.swipeRefreshLayout.isEnabled = false diff --git a/app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsTasksFragment.kt b/app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsTasksFragment.kt index 832e9a2dce3..1191cb440d0 100644 --- a/app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsTasksFragment.kt +++ b/app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsTasksFragment.kt @@ -133,7 +133,6 @@ class SuggestedEditsTasksFragment : Fragment() { FeedbackUtil.showAndroidAppEditingFAQ(requireContext()) } - binding.swipeRefreshLayout.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.swipeRefreshLayout.setOnRefreshListener { refreshContents() } binding.errorView.retryClickListener = View.OnClickListener { refreshContents() } diff --git a/app/src/main/java/org/wikipedia/talk/TalkTopicActivity.kt b/app/src/main/java/org/wikipedia/talk/TalkTopicActivity.kt index 029a1a4b667..09b6f559865 100644 --- a/app/src/main/java/org/wikipedia/talk/TalkTopicActivity.kt +++ b/app/src/main/java/org/wikipedia/talk/TalkTopicActivity.kt @@ -40,7 +40,6 @@ import org.wikipedia.util.DeviceUtil import org.wikipedia.util.FeedbackUtil import org.wikipedia.util.L10nUtil import org.wikipedia.util.Resource -import org.wikipedia.util.ResourceUtil import org.wikipedia.util.ShareUtil import org.wikipedia.util.StringUtil import org.wikipedia.util.UriUtil @@ -101,7 +100,6 @@ class TalkTopicActivity : BaseActivity() { L10nUtil.setConditionalLayoutDirection(binding.talkRecyclerView, viewModel.pageTitle.wikiSite.languageCode) L10nUtil.setConditionalLayoutDirection(binding.talkErrorView, viewModel.pageTitle.wikiSite.languageCode) - binding.talkRefreshView.setColorSchemeResources(ResourceUtil.getThemedAttributeId(this, R.attr.progressive_color)) ViewUtil.getTitleViewFromToolbar(binding.toolbar)?.let { it.movementMethod = linkMovementMethod diff --git a/app/src/main/java/org/wikipedia/talk/TalkTopicsActivity.kt b/app/src/main/java/org/wikipedia/talk/TalkTopicsActivity.kt index d26248c0c1c..1889a183730 100644 --- a/app/src/main/java/org/wikipedia/talk/TalkTopicsActivity.kt +++ b/app/src/main/java/org/wikipedia/talk/TalkTopicsActivity.kt @@ -186,7 +186,6 @@ class TalkTopicsActivity : BaseActivity(), WatchlistExpiryDialog.Callback { resetViews() viewModel.loadTopics() } - binding.talkRefreshView.setColorSchemeResources(ResourceUtil.getThemedAttributeId(this, R.attr.progressive_color)) invokeSource = intent.getSerializableExtra(Constants.INTENT_EXTRA_INVOKE_SOURCE) as Constants.InvokeSource diff --git a/app/src/main/java/org/wikipedia/views/SwipeRefreshLayoutWithScroll.kt b/app/src/main/java/org/wikipedia/views/WikiSwipeRefreshLayout.kt similarity index 52% rename from app/src/main/java/org/wikipedia/views/SwipeRefreshLayoutWithScroll.kt rename to app/src/main/java/org/wikipedia/views/WikiSwipeRefreshLayout.kt index cf698307fd5..814f2fc1713 100644 --- a/app/src/main/java/org/wikipedia/views/SwipeRefreshLayoutWithScroll.kt +++ b/app/src/main/java/org/wikipedia/views/WikiSwipeRefreshLayout.kt @@ -4,14 +4,20 @@ import android.content.Context import android.util.AttributeSet import android.view.View import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import org.wikipedia.R +import org.wikipedia.util.ResourceUtil -class SwipeRefreshLayoutWithScroll constructor(context: Context, attrs: AttributeSet?) : SwipeRefreshLayout(context, attrs) { +open class WikiSwipeRefreshLayout(context: Context, attrs: AttributeSet?) : SwipeRefreshLayout(context, attrs) { var scrollableChild: View? = null + init { + setColorSchemeResources(ResourceUtil.getThemedAttributeId(context, R.attr.progressive_color)) + } + override fun canChildScrollUp(): Boolean { return if (scrollableChild == null) { - false + super.canChildScrollUp() } else scrollableChild!!.scrollY > 0 } } diff --git a/app/src/main/java/org/wikipedia/watchlist/WatchlistFragment.kt b/app/src/main/java/org/wikipedia/watchlist/WatchlistFragment.kt index b3bf7be2e3d..e06b141a718 100644 --- a/app/src/main/java/org/wikipedia/watchlist/WatchlistFragment.kt +++ b/app/src/main/java/org/wikipedia/watchlist/WatchlistFragment.kt @@ -80,7 +80,6 @@ class WatchlistFragment : Fragment(), WatchlistItemView.Callback, MenuProvider { super.onViewCreated(view, savedInstanceState) requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED) - binding.watchlistRefreshView.setColorSchemeResources(ResourceUtil.getThemedAttributeId(requireContext(), R.attr.progressive_color)) binding.watchlistRefreshView.setOnRefreshListener { viewModel.fetchWatchlist(actionMode == null) } binding.watchlistErrorView.retryClickListener = View.OnClickListener { viewModel.fetchWatchlist(actionMode == null) } diff --git a/app/src/main/res/layout/activity_edit_history.xml b/app/src/main/res/layout/activity_edit_history.xml index b99f4ebbabf..e32ec606857 100644 --- a/app/src/main/res/layout/activity_edit_history.xml +++ b/app/src/main/res/layout/activity_edit_history.xml @@ -35,7 +35,7 @@ android:layout_height="0dp" android:layout_weight="1"> - @@ -88,7 +88,7 @@ - + diff --git a/app/src/main/res/layout/activity_insert_media.xml b/app/src/main/res/layout/activity_insert_media.xml index 14446c0404c..46d83f883bb 100644 --- a/app/src/main/res/layout/activity_insert_media.xml +++ b/app/src/main/res/layout/activity_insert_media.xml @@ -136,7 +136,7 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> - @@ -147,7 +147,7 @@ android:layout_height="match_parent" android:scrollbars="vertical"/> - + - - + diff --git a/app/src/main/res/layout/activity_talk_topic.xml b/app/src/main/res/layout/activity_talk_topic.xml index 5fb07e54f73..fb3caebea43 100644 --- a/app/src/main/res/layout/activity_talk_topic.xml +++ b/app/src/main/res/layout/activity_talk_topic.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/activity_talk_topics.xml b/app/src/main/res/layout/activity_talk_topics.xml index c0b0a047bf6..29763eade5b 100644 --- a/app/src/main/res/layout/activity_talk_topics.xml +++ b/app/src/main/res/layout/activity_talk_topics.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/activity_user_contrib.xml b/app/src/main/res/layout/activity_user_contrib.xml index 4191c171208..0e7bc6cd40f 100644 --- a/app/src/main/res/layout/activity_user_contrib.xml +++ b/app/src/main/res/layout/activity_user_contrib.xml @@ -24,7 +24,7 @@ android:layout_height="0dp" android:layout_weight="1"> - @@ -41,7 +41,7 @@ - + diff --git a/app/src/main/res/layout/fragment_feed.xml b/app/src/main/res/layout/fragment_feed.xml index 4dc91524184..c97d4b0419c 100644 --- a/app/src/main/res/layout/fragment_feed.xml +++ b/app/src/main/res/layout/fragment_feed.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/fragment_file_page.xml b/app/src/main/res/layout/fragment_file_page.xml index c155ec131dd..05f5086b0ff 100644 --- a/app/src/main/res/layout/fragment_file_page.xml +++ b/app/src/main/res/layout/fragment_file_page.xml @@ -1,5 +1,5 @@ - @@ -35,4 +35,4 @@ android:background="?attr/paper_color"/> - + diff --git a/app/src/main/res/layout/fragment_page.xml b/app/src/main/res/layout/fragment_page.xml index 5728445defb..8274f87bd7e 100644 --- a/app/src/main/res/layout/fragment_page.xml +++ b/app/src/main/res/layout/fragment_page.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/fragment_reading_list.xml b/app/src/main/res/layout/fragment_reading_list.xml index cfeadcd9342..75441ecbbae 100644 --- a/app/src/main/res/layout/fragment_reading_list.xml +++ b/app/src/main/res/layout/fragment_reading_list.xml @@ -40,7 +40,7 @@ - - + diff --git a/app/src/main/res/layout/fragment_reading_lists.xml b/app/src/main/res/layout/fragment_reading_lists.xml index 4607138d108..aaea1ec6782 100644 --- a/app/src/main/res/layout/fragment_reading_lists.xml +++ b/app/src/main/res/layout/fragment_reading_lists.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_suggested_edits_recent_edits.xml b/app/src/main/res/layout/fragment_suggested_edits_recent_edits.xml index 84a39b19143..32e8aa99820 100644 --- a/app/src/main/res/layout/fragment_suggested_edits_recent_edits.xml +++ b/app/src/main/res/layout/fragment_suggested_edits_recent_edits.xml @@ -9,7 +9,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" /> - - + diff --git a/app/src/main/res/layout/fragment_suggested_edits_tasks.xml b/app/src/main/res/layout/fragment_suggested_edits_tasks.xml index 88a6f5350c6..16488dbfd9a 100644 --- a/app/src/main/res/layout/fragment_suggested_edits_tasks.xml +++ b/app/src/main/res/layout/fragment_suggested_edits_tasks.xml @@ -1,6 +1,5 @@ - - - + diff --git a/app/src/main/res/layout/fragment_watchlist.xml b/app/src/main/res/layout/fragment_watchlist.xml index 48d2fe97755..2a0eb577c07 100644 --- a/app/src/main/res/layout/fragment_watchlist.xml +++ b/app/src/main/res/layout/fragment_watchlist.xml @@ -1,5 +1,5 @@ - - +