From 6b4ee19c7c22e906c93015f100038b44c8f272b0 Mon Sep 17 00:00:00 2001 From: Cooltey Feng Date: Fri, 15 Nov 2024 04:58:10 -0800 Subject: [PATCH 1/5] Convert FixedDrawerLayout to Kotlin (#5125) --- .../widget/FixedDrawerLayout.java | 38 ------------------- .../drawerlayout/widget/FixedDrawerLayout.kt | 26 +++++++++++++ 2 files changed, 26 insertions(+), 38 deletions(-) delete mode 100644 app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.java create mode 100644 app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.kt diff --git a/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.java b/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.java deleted file mode 100644 index 559d8de0cd7..00000000000 --- a/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.java +++ /dev/null @@ -1,38 +0,0 @@ -package androidx.drawerlayout.widget; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; - -public class FixedDrawerLayout extends DrawerLayout { - public FixedDrawerLayout(Context context) { - super(context); - } - - public FixedDrawerLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public FixedDrawerLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public void setSlidingEnabled(boolean enable) { - if (enable) { - this.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); - } else { - this.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); - } - } - - // TODO: Remove this class when Google updates the Support library. - // This solves an intermittent crash when using DrawerLayout. - // https://code.google.com/p/android/issues/detail?id=77926 - @Override - boolean isContentView(View child) { - if (child == null) { - return false; - } - return super.isContentView(child); - } -} diff --git a/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.kt b/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.kt new file mode 100644 index 00000000000..32655b6f5c5 --- /dev/null +++ b/app/src/main/java/androidx/drawerlayout/widget/FixedDrawerLayout.kt @@ -0,0 +1,26 @@ +package androidx.drawerlayout.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.View + +class FixedDrawerLayout(context: Context, attrs: AttributeSet? = null) : DrawerLayout(context, attrs) { + + fun setSlidingEnabled(enable: Boolean) { + if (enable) { + this.setDrawerLockMode(LOCK_MODE_UNLOCKED) + } else { + this.setDrawerLockMode(LOCK_MODE_LOCKED_CLOSED) + } + } + + // TODO: Remove this class when Google updates the Support library. + // This solves an intermittent crash when using DrawerLayout. + // https://issuetracker.google.com/issues/37007884 + override fun isContentView(child: View?): Boolean { + if (child == null) { + return false + } + return super.isContentView(child) + } +} From 4d4fd58e05dd6293e2c729d62d52a57b40c6dea6 Mon Sep 17 00:00:00 2001 From: Cooltey Feng Date: Fri, 15 Nov 2024 05:07:46 -0800 Subject: [PATCH 2/5] Convert test classes to Kotlin (#5126) Co-authored-by: Dmitry Brant --- .../org/wikipedia/test/ImmediateExecutor.java | 12 ----- .../test/ImmediateExecutorService.java | 33 ------------- .../test/ImmediateExecutorService.kt | 31 ++++++++++++ .../java/org/wikipedia/test/TestFileUtil.java | 18 ------- .../java/org/wikipedia/test/TestFileUtil.kt | 18 +++++++ .../org/wikipedia/test/TestParcelUtil.java | 45 ------------------ .../java/org/wikipedia/test/TestParcelUtil.kt | 47 +++++++++++++++++++ 7 files changed, 96 insertions(+), 108 deletions(-) delete mode 100644 app/src/test/java/org/wikipedia/test/ImmediateExecutor.java delete mode 100644 app/src/test/java/org/wikipedia/test/ImmediateExecutorService.java create mode 100644 app/src/test/java/org/wikipedia/test/ImmediateExecutorService.kt delete mode 100644 app/src/test/java/org/wikipedia/test/TestFileUtil.java create mode 100644 app/src/test/java/org/wikipedia/test/TestFileUtil.kt delete mode 100644 app/src/test/java/org/wikipedia/test/TestParcelUtil.java create mode 100644 app/src/test/java/org/wikipedia/test/TestParcelUtil.kt diff --git a/app/src/test/java/org/wikipedia/test/ImmediateExecutor.java b/app/src/test/java/org/wikipedia/test/ImmediateExecutor.java deleted file mode 100644 index 96560accd87..00000000000 --- a/app/src/test/java/org/wikipedia/test/ImmediateExecutor.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.wikipedia.test; - -import androidx.annotation.NonNull; - -import java.util.concurrent.Executor; - -public class ImmediateExecutor implements Executor { - @Override - public void execute(@NonNull Runnable runnable) { - runnable.run(); - } -} diff --git a/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.java b/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.java deleted file mode 100644 index 4181af20314..00000000000 --- a/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.wikipedia.test; - -import androidx.annotation.NonNull; - -import java.util.List; -import java.util.concurrent.AbstractExecutorService; -import java.util.concurrent.TimeUnit; - -public final class ImmediateExecutorService extends AbstractExecutorService { - @Override public void shutdown() { - throw new UnsupportedOperationException(); - } - - @NonNull @Override public List shutdownNow() { - throw new UnsupportedOperationException(); - } - - @Override public boolean isShutdown() { - throw new UnsupportedOperationException(); - } - - @Override public boolean isTerminated() { - throw new UnsupportedOperationException(); - } - - @Override public boolean awaitTermination(long l, @NonNull TimeUnit timeUnit) { - throw new UnsupportedOperationException(); - } - - @Override public void execute(@NonNull Runnable runnable) { - runnable.run(); - } -} diff --git a/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.kt b/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.kt new file mode 100644 index 00000000000..e36c43b42f3 --- /dev/null +++ b/app/src/test/java/org/wikipedia/test/ImmediateExecutorService.kt @@ -0,0 +1,31 @@ +package org.wikipedia.test + +import java.lang.UnsupportedOperationException +import java.util.concurrent.AbstractExecutorService +import java.util.concurrent.TimeUnit + +class ImmediateExecutorService : AbstractExecutorService() { + override fun shutdown() { + throw UnsupportedOperationException() + } + + override fun shutdownNow(): MutableList { + throw UnsupportedOperationException() + } + + override fun isShutdown(): Boolean { + throw UnsupportedOperationException() + } + + override fun isTerminated(): Boolean { + throw UnsupportedOperationException() + } + + override fun awaitTermination(l: Long, timeUnit: TimeUnit): Boolean { + throw UnsupportedOperationException() + } + + override fun execute(runnable: Runnable) { + runnable.run() + } +} diff --git a/app/src/test/java/org/wikipedia/test/TestFileUtil.java b/app/src/test/java/org/wikipedia/test/TestFileUtil.java deleted file mode 100644 index a250a790552..00000000000 --- a/app/src/test/java/org/wikipedia/test/TestFileUtil.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.wikipedia.test; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; - -public final class TestFileUtil { - private static final String RAW_DIR = "src/test/res/raw/"; - - public static String readRawFile(String basename) throws IOException { - // TODO: Use Files.readString() once it is available in the Android SDK. - return new String(Files.readAllBytes(Paths.get(RAW_DIR + basename)), - StandardCharsets.UTF_8); - } - - private TestFileUtil() { } -} diff --git a/app/src/test/java/org/wikipedia/test/TestFileUtil.kt b/app/src/test/java/org/wikipedia/test/TestFileUtil.kt new file mode 100644 index 00000000000..5ad6e310d2d --- /dev/null +++ b/app/src/test/java/org/wikipedia/test/TestFileUtil.kt @@ -0,0 +1,18 @@ +package org.wikipedia.test + +import java.io.IOException +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.nio.file.Paths + +object TestFileUtil { + private const val RAW_DIR = "src/test/res/raw/" + + @Throws(IOException::class) + fun readRawFile(basename: String?): String { + return String( + Files.readAllBytes(Paths.get(RAW_DIR + basename)), + StandardCharsets.UTF_8 + ) + } +} diff --git a/app/src/test/java/org/wikipedia/test/TestParcelUtil.java b/app/src/test/java/org/wikipedia/test/TestParcelUtil.java deleted file mode 100644 index e1cbd7ab563..00000000000 --- a/app/src/test/java/org/wikipedia/test/TestParcelUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.wikipedia.test; - -import android.os.Parcel; -import android.os.Parcelable; - -import androidx.annotation.NonNull; - -import org.wikipedia.page.PageTitle; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -public final class TestParcelUtil { - public static void test(PageTitle title) throws Throwable { - Parcel parcel = parcel(title); - parcel.setDataPosition(0); - PageTitle title2 = (PageTitle) unparcel(parcel, PageTitle.class); - assertThat(title.getText(), is(title2.getText())); - assertThat(title.namespace(), is(title2.namespace())); - assertThat(title.getUri(), is(title2.getUri())); - } - - public static void test(Parcelable parcelable) throws Throwable { - Parcel parcel = parcel(parcelable); - - parcel.setDataPosition(0); - Parcelable unparceled = unparcel(parcel, parcelable.getClass()); - - assertThat(parcelable, is(unparceled)); - } - - @NonNull private static Parcelable unparcel(@NonNull Parcel parcel, - Class clazz) throws Throwable { - Parcelable.Creator creator = (Parcelable.Creator) clazz.getField("CREATOR").get(null); - return (Parcelable) creator.createFromParcel(parcel); - } - - @NonNull private static Parcel parcel(@NonNull Parcelable parcelable) { - Parcel parcel = Parcel.obtain(); - parcelable.writeToParcel(parcel, 0); - return parcel; - } - - private TestParcelUtil() { } -} diff --git a/app/src/test/java/org/wikipedia/test/TestParcelUtil.kt b/app/src/test/java/org/wikipedia/test/TestParcelUtil.kt new file mode 100644 index 00000000000..0780559df45 --- /dev/null +++ b/app/src/test/java/org/wikipedia/test/TestParcelUtil.kt @@ -0,0 +1,47 @@ +package org.wikipedia.test + +import android.os.Parcel +import android.os.Parcelable +import org.hamcrest.MatcherAssert +import org.hamcrest.Matchers +import org.wikipedia.page.Namespace +import org.wikipedia.page.PageTitle + +object TestParcelUtil { + @Throws(Throwable::class) + fun test(title: PageTitle) { + + val parcel = parcel(title) + parcel.setDataPosition(0) + + val title2 = unparcel(parcel, PageTitle::class.java) as PageTitle + + MatcherAssert.assertThat(title.text, Matchers.equalTo(title2.text)) + MatcherAssert.assertThat(title.namespace(), Matchers.equalTo(title2.namespace())) + + MatcherAssert.assertThat(title.uri, Matchers.equalTo(title2.uri)) + } + + @Throws(Throwable::class) + fun test(parcelable: Parcelable) { + + val parcel = parcel(parcelable) + + parcel.setDataPosition(0) + val unparceled = unparcel(parcel, parcelable.javaClass) + + MatcherAssert.assertThat(parcelable, Matchers.equalTo(unparceled)) + } + + @Throws(Throwable::class) + private fun unparcel(parcel: Parcel, clazz: Class): Parcelable { + val creator = clazz.getField("CREATOR").get(null) as Parcelable.Creator<*> + return creator.createFromParcel(parcel) as Parcelable + } + + private fun parcel(parcelable: Parcelable): Parcel { + val parcel = Parcel.obtain() + parcelable.writeToParcel(parcel, 0) + return parcel + } +} From f6c7e0b00e045bd452f78e80dbc83c09482cbacf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:46:10 -0500 Subject: [PATCH 3/5] Bump org.robolectric:robolectric from 4.13 to 4.14 (#5128) Bumps [org.robolectric:robolectric](https://github.com/robolectric/robolectric) from 4.13 to 4.14. - [Release notes](https://github.com/robolectric/robolectric/releases) - [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.13...robolectric-4.14) --- updated-dependencies: - dependency-name: org.robolectric:robolectric dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3c61b7ddc97..8c84e2e3f5a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ photoview = "1.0.2" preferenceKtx = "1.2.1" recyclerview = "1.3.2" retrofitVersion = "2.11.0" -robolectric = "4.13" +robolectric = "4.14" roomVersion = "2.6.1" swiperefreshlayout = "1.1.0" uiautomator = "2.3.0" From 4e07e1392ba284d3c738cc4d05b7105f0198d7b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:22:58 -0500 Subject: [PATCH 4/5] Bump com.google.firebase:firebase-messaging-ktx from 24.0.3 to 24.1.0 (#5127) Bumps [com.google.firebase:firebase-messaging-ktx](https://github.com/firebase/firebase-android-sdk) from 24.0.3 to 24.1.0. - [Commits](https://github.com/firebase/firebase-android-sdk/commits) --- updated-dependencies: - dependency-name: com.google.firebase:firebase-messaging-ktx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dmitry Brant --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8c84e2e3f5a..4309720f044 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ coreKtx = "1.15.0" desugar_jdk_libs = "2.1.3" drawerlayout = "1.2.0" espressoVersion = "3.6.1" -firebaseMessagingVersion = "24.0.3" +firebaseMessagingVersion = "24.1.0" flexbox = "3.0.0" fragmentKtx = "1.8.5" glideVersion = "4.16.0" From 3518d098d0c0aecda8040a5f567e839fe8177928 Mon Sep 17 00:00:00 2001 From: Cooltey Feng Date: Fri, 15 Nov 2024 11:45:10 -0800 Subject: [PATCH 5/5] Create a custom SwipeRefreshLayout for the style consistency (#5129) Co-authored-by: Dmitry Brant --- app/src/main/java/org/wikipedia/feed/FeedFragment.kt | 2 -- app/src/main/java/org/wikipedia/page/PageFragment.kt | 1 - .../org/wikipedia/readinglist/ReadingListFragment.kt | 1 - .../org/wikipedia/readinglist/ReadingListsFragment.kt | 1 - .../suggestededits/SuggestedEditsTasksFragment.kt | 1 - .../main/java/org/wikipedia/talk/TalkTopicActivity.kt | 2 -- .../main/java/org/wikipedia/talk/TalkTopicsActivity.kt | 1 - ...shLayoutWithScroll.kt => WikiSwipeRefreshLayout.kt} | 10 ++++++++-- .../java/org/wikipedia/watchlist/WatchlistFragment.kt | 1 - app/src/main/res/layout/activity_edit_history.xml | 4 ++-- app/src/main/res/layout/activity_insert_media.xml | 4 ++-- app/src/main/res/layout/activity_notifications.xml | 4 ++-- app/src/main/res/layout/activity_talk_topic.xml | 4 ++-- app/src/main/res/layout/activity_talk_topics.xml | 4 ++-- app/src/main/res/layout/activity_user_contrib.xml | 4 ++-- app/src/main/res/layout/fragment_feed.xml | 4 ++-- app/src/main/res/layout/fragment_file_page.xml | 4 ++-- app/src/main/res/layout/fragment_page.xml | 4 ++-- app/src/main/res/layout/fragment_reading_list.xml | 4 ++-- app/src/main/res/layout/fragment_reading_lists.xml | 4 ++-- .../layout/fragment_suggested_edits_recent_edits.xml | 4 ++-- .../main/res/layout/fragment_suggested_edits_tasks.xml | 5 ++--- app/src/main/res/layout/fragment_watchlist.xml | 4 ++-- 23 files changed, 36 insertions(+), 41 deletions(-) rename app/src/main/java/org/wikipedia/views/{SwipeRefreshLayoutWithScroll.kt => WikiSwipeRefreshLayout.kt} (52%) 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 @@ - - +