Skip to content

Commit

Permalink
Merge branch 'main' into Reading-list-expedited
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne authored Nov 16, 2024
2 parents 0ae4bb8 + 3518d09 commit 093efd1
Show file tree
Hide file tree
Showing 33 changed files with 160 additions and 189 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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)
}
}
2 changes: 0 additions & 2 deletions app/src/main/java/org/wikipedia/feed/FeedFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/org/wikipedia/page/PageFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/org/wikipedia/talk/TalkTopicActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/org/wikipedia/talk/TalkTopicsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_edit_history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
android:layout_height="0dp"
android:layout_weight="1">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/edit_history_refresh_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -88,7 +88,7 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_insert_media.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand All @@ -147,7 +147,7 @@
android:layout_height="match_parent"
android:scrollbars="vertical"/>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>

<TextView
android:id="@+id/emptyMessage"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_notifications.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

</com.google.android.material.appbar.AppBarLayout>

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/notifications_refresh_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -140,5 +140,5 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_talk_topic.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.wikipedia.views.WikiSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/talkRefreshView"
Expand Down Expand Up @@ -41,4 +41,4 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_talk_topics.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.wikipedia.views.WikiSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/talkRefreshView"
Expand Down Expand Up @@ -138,4 +138,4 @@

</LinearLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_user_contrib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_height="0dp"
android:layout_weight="1">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/refresh_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand All @@ -41,7 +41,7 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_feed.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.wikipedia.views.WikiSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_refresh_layout"
Expand Down Expand Up @@ -55,4 +55,4 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_file_page.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.wikipedia.views.WikiSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -35,4 +35,4 @@
android:background="?attr/paper_color"/>
</LinearLayout>
</ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_page.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.wikipedia.views.SwipeRefreshLayoutWithScroll
<org.wikipedia.views.WikiSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/page_refresh_container"
android:layout_width="match_parent"
Expand Down Expand Up @@ -64,4 +64,4 @@

</androidx.coordinatorlayout.widget.CoordinatorLayout>

</org.wikipedia.views.SwipeRefreshLayoutWithScroll>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_reading_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

</com.google.android.material.appbar.AppBarLayout>

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/reading_list_swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -79,6 +79,6 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_reading_lists.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipe_refresh_layout"
Expand Down Expand Up @@ -86,4 +86,4 @@

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
android:id="@+id/refreshContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -21,6 +21,6 @@
android:layout_height="wrap_content"
android:scrollbars="vertical"/>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>

</LinearLayout>
5 changes: 2 additions & 3 deletions app/src/main/res/layout/fragment_suggested_edits_tasks.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand Down Expand Up @@ -306,4 +305,4 @@
android:indeterminate="true" />

</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_watchlist.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<org.wikipedia.views.WikiSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand Down Expand Up @@ -96,4 +96,4 @@

</FrameLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</org.wikipedia.views.WikiSwipeRefreshLayout>
12 changes: 0 additions & 12 deletions app/src/test/java/org/wikipedia/test/ImmediateExecutor.java

This file was deleted.

Loading

0 comments on commit 093efd1

Please sign in to comment.