Skip to content

Commit

Permalink
Merge pull request #2595 from gwen-sarapata/remove-extra-andriod-depe…
Browse files Browse the repository at this point in the history
…ndency

Remove extra android dependency
  • Loading branch information
freakboy3742 authored May 22, 2024
2 parents 234544e + 745fe3a commit 2bf76fe
Show file tree
Hide file tree
Showing 47 changed files with 27 additions and 50 deletions.
29 changes: 22 additions & 7 deletions android/src/toga_android/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
from android.graphics import Rect
from android.view import Gravity, View
from android.widget import ImageView, LinearLayout, RelativeLayout, ScrollView, TextView
from androidx.swiperefreshlayout.widget import SwipeRefreshLayout
from java import dynamic_proxy

try:
from androidx.swiperefreshlayout.widget import SwipeRefreshLayout
except ImportError: # pragma: no cover
# Import will fail if SwipeRefreshLayout is not listed in dependencies
# No cover due to not being able to test in CI
SwipeRefreshLayout = None


from .base import Widget


Expand Down Expand Up @@ -78,17 +85,25 @@ def onClick(self, dialog, which):
self.actions[which].handler(row=self.row)


class OnRefreshListener(dynamic_proxy(SwipeRefreshLayout.OnRefreshListener)):
def __init__(self, interface):
super().__init__()
self._interface = interface
if SwipeRefreshLayout is not None: # pragma: no cover

class OnRefreshListener(dynamic_proxy(SwipeRefreshLayout.OnRefreshListener)):
def __init__(self, interface):
super().__init__()
self._interface = interface

def onRefresh(self):
self._interface.on_refresh()
def onRefresh(self):
self._interface.on_refresh()


class DetailedList(Widget):
def create(self):
if SwipeRefreshLayout is None: # pragma: no cover
raise RuntimeError(
"Unable to import SwipeRefreshLayout. Ensure that the AndroidX Swipe Refresh Layout "
"widget package (androidx.swiperefreshlayout:swiperefreshlayout:1.1.0) "
"is listed in your app's dependencies."
)
# get the selection color from the current theme
attrs = [R.attr.colorBackground, R.attr.colorControlHighlight]
typed_array = self._native_activity.obtainStyledAttributes(attrs)
Expand Down
1 change: 1 addition & 0 deletions changes/2454.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Android deployments no longer require the SwipeRefreshLayout component unless the app uses the Toga DetailedList widget.
3 changes: 3 additions & 0 deletions docs/reference/api/widgets/detailedlist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ Notes
* The WinForms implementation currently uses a column layout similar to :any:`Table`,
and does not support the primary, secondary or refresh actions.

* Using DetailedList on Android requires the AndroidX SwipeRefreshLayout widget in your project's Gradle dependencies. Ensure your app declares a dependency on ``androidx.swiperefreshlayout:swiperefreshlayout:1.1.0`` or later.


Reference
---------

Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ whitespace
Winforms
Xcode
zoomable
AndroidX
1 change: 0 additions & 1 deletion examples/activityindicator/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/box/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/button/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/canvas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/colors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/command/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/date_and_time/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/dialogs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/divider/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/documentapp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/examples_overview/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/focus/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/font/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/font_size/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/handlers/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/hardware/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
"org.osmdroid:osmdroid-android:6.1.0",
]
1 change: 0 additions & 1 deletion examples/layout/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/mapview/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
"org.osmdroid:osmdroid-android:6.1.0",
]

Expand Down
1 change: 0 additions & 1 deletion examples/multilinetextinput/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/numberinput/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/optioncontainer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/positron-django/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/positron-static/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/progressbar/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/resize/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/screenshot/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
"org.osmdroid:osmdroid-android:6.1.0",
]
1 change: 0 additions & 1 deletion examples/scrollcontainer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/selection/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/slider/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/splitcontainer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/switch_demo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/table/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/table_source/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/textinput/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tree/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tree_source/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial0/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial3/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial4/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
Expand Down
Loading

0 comments on commit 2bf76fe

Please sign in to comment.