android-widgets 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {android_widgets-0.1.3 → android_widgets-0.1.5}/PKG-INFO +4 -5
- {android_widgets-0.1.3 → android_widgets-0.1.5}/README.md +2 -2
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/__init__.py +4 -2
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/config.py +1 -6
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/maker.py +24 -13
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/tools.py +6 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/PKG-INFO +4 -5
- {android_widgets-0.1.3 → android_widgets-0.1.5}/pyproject.toml +2 -3
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/aw_logging.py +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/facade.py +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets/java_classes.py +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/SOURCES.txt +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/dependency_links.txt +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/requires.txt +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/top_level.txt +0 -0
- {android_widgets-0.1.3 → android_widgets-0.1.5}/setup.cfg +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-widgets
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: This would be used to auto gen XMLs for Android Home Screen widgets.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/Fector101/kivy-androidwidgets
|
|
8
8
|
Project-URL: Documentation, https://github.com/Fector101/kivy-androidwidgets
|
|
9
9
|
Project-URL: Source, https://github.com/Fector101/kivy-androidwidgets
|
|
10
10
|
Project-URL: Tracker, https://github.com/Fector101/kivy-androidwidgets/issues
|
|
11
11
|
Keywords: kivy,android,widgets,hello-world,python-package
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
13
|
Classifier: Operating System :: Android
|
|
15
14
|
Classifier: Development Status :: 3 - Alpha
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -68,8 +67,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
|
|
|
68
67
|
|
|
69
68
|
### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
|
|
70
69
|
path: `src/SimpleWidget.java`.
|
|
71
|
-
This will receive an event when widget is add to change it's text
|
|
72
|
-
|
|
70
|
+
- This will receive an event when widget is add to change it's text
|
|
71
|
+
- You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
|
|
73
72
|
```java
|
|
74
73
|
package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
|
|
75
74
|
|
|
@@ -47,8 +47,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
|
|
|
47
47
|
|
|
48
48
|
### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
|
|
49
49
|
path: `src/SimpleWidget.java`.
|
|
50
|
-
This will receive an event when widget is add to change it's text
|
|
51
|
-
|
|
50
|
+
- This will receive an event when widget is add to change it's text
|
|
51
|
+
- You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
|
|
52
52
|
```java
|
|
53
53
|
package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
|
|
54
54
|
|
|
@@ -6,7 +6,6 @@ from .config import is_platform_android
|
|
|
6
6
|
from .aw_logging import logger, enable_logging
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
__all__ = ["logger"]
|
|
10
9
|
|
|
11
10
|
from .config import get_python_activity_context
|
|
12
11
|
|
|
@@ -35,7 +34,7 @@ def get_package_name():
|
|
|
35
34
|
def get_resource(name, folder_base):
|
|
36
35
|
resources = get_resources()
|
|
37
36
|
package_name = get_package_name()
|
|
38
|
-
print("resources.getIdentifier",name, folder_base,"id:",resources.getIdentifier(name, folder_base, package_name))
|
|
37
|
+
# print("resources.getIdentifier",name, folder_base,"id:",resources.getIdentifier(name, folder_base, package_name))
|
|
39
38
|
return resources.getIdentifier(name, folder_base, package_name)
|
|
40
39
|
|
|
41
40
|
def get_buildozer_spec_file_path():
|
|
@@ -139,6 +138,9 @@ class AppWidgetManager:
|
|
|
139
138
|
logger.info(f"Found Layout: {java_file_path}")
|
|
140
139
|
return None
|
|
141
140
|
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# Tests
|
|
142
144
|
# try:
|
|
143
145
|
# print("-"*5,'test 1','-'*5)
|
|
144
146
|
# appWidgetManager = AppWidgetManager("Image")
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
|
-
try: # This for when genrating xml with P4A.hook
|
|
4
|
-
from jnius import autoclass
|
|
5
|
-
except ModuleNotFoundError:
|
|
6
|
-
pass
|
|
7
|
-
|
|
8
|
-
|
|
9
3
|
ON_ANDROID = False
|
|
10
4
|
def is_platform_android():
|
|
11
5
|
# Took this from kivy to fix my logs in P4A.hook, so no need to import things i don't need by doing `from kivy.utils import platform`
|
|
@@ -23,6 +17,7 @@ def is_platform_android():
|
|
|
23
17
|
|
|
24
18
|
|
|
25
19
|
if is_platform_android():
|
|
20
|
+
from jnius import autoclass # This for when genrating xml with P4A.hook
|
|
26
21
|
ON_ANDROID = True
|
|
27
22
|
|
|
28
23
|
def from_service_file():
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
print("----------------------Running android_widget.maker-----------------")
|
|
2
|
-
|
|
3
1
|
from dataclasses import dataclass
|
|
4
2
|
from typing import List, Optional
|
|
3
|
+
from android_widgets.tools import SpecFile
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
@dataclass
|
|
@@ -14,7 +13,13 @@ class Receiver:
|
|
|
14
13
|
meta_name: Optional[str] = "android.appwidget.provider"
|
|
15
14
|
meta_resource: Optional[str] = None
|
|
16
15
|
|
|
17
|
-
def to_xml(self, package: str) -> str:
|
|
16
|
+
def to_xml(self, package: str = None, spec_file_path: str = None) -> str:
|
|
17
|
+
if not package and spec_file_path:
|
|
18
|
+
specFile = SpecFile(spec_file_path)
|
|
19
|
+
package_name = specFile.get("app", "package.name")
|
|
20
|
+
package_domain = specFile.get("app", "package.domain")
|
|
21
|
+
package = f"{package_domain}.{package_name}"
|
|
22
|
+
|
|
18
23
|
attrs = [
|
|
19
24
|
f'android:name="{package}.{self.name}"',
|
|
20
25
|
f'android:enabled="{str(self.enabled).lower()}"',
|
|
@@ -24,8 +29,7 @@ class Receiver:
|
|
|
24
29
|
if self.label:
|
|
25
30
|
attrs.append(f'android:label="{self.label}"')
|
|
26
31
|
|
|
27
|
-
xml = [f"<receiver {' '.join(attrs)}>"]
|
|
28
|
-
xml.append(" <intent-filter>")
|
|
32
|
+
xml = [f"<receiver {' '.join(attrs)}>", " <intent-filter>"]
|
|
29
33
|
|
|
30
34
|
for action in self.actions:
|
|
31
35
|
xml.append(f' <action android:name="{action}" />')
|
|
@@ -42,7 +46,7 @@ class Receiver:
|
|
|
42
46
|
return "\n".join(xml)
|
|
43
47
|
|
|
44
48
|
|
|
45
|
-
def
|
|
49
|
+
def test_generate_receivers(package: str = None) -> str:
|
|
46
50
|
receivers = [
|
|
47
51
|
Receiver(
|
|
48
52
|
name="Action1",
|
|
@@ -73,17 +77,15 @@ def generate_receivers(package: str) -> str:
|
|
|
73
77
|
return "\n\n".join(r.to_xml(package) for r in receivers)
|
|
74
78
|
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
print("------------------ Hello from android_widget.service_injector ------------------")
|
|
78
|
-
|
|
79
|
-
|
|
80
80
|
def inject_foreground_service_types(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
manifest_text: str,
|
|
82
|
+
services: dict[str, str],
|
|
83
|
+
package: str = None,
|
|
84
|
+
spec_file_path: str = None
|
|
84
85
|
) -> str:
|
|
85
86
|
"""
|
|
86
87
|
Inject android:foregroundServiceType into <service /> tags.
|
|
88
|
+
:param spec_file_path:
|
|
87
89
|
:param manifest_text: AndroidManifest.xml file Text Content
|
|
88
90
|
:param package: package.domain + "." + package.name
|
|
89
91
|
:param services:
|
|
@@ -93,6 +95,11 @@ def inject_foreground_service_types(
|
|
|
93
95
|
"location": "location"
|
|
94
96
|
}
|
|
95
97
|
"""
|
|
98
|
+
if not package and spec_file_path:
|
|
99
|
+
specFile = SpecFile(spec_file_path)
|
|
100
|
+
package_name = specFile.get("app", "package.name")
|
|
101
|
+
package_domain = specFile.get("app", "package.domain")
|
|
102
|
+
package = f"{package_domain}.{package_name}"
|
|
96
103
|
|
|
97
104
|
for name, fgs_type in services.items():
|
|
98
105
|
service_name = f"{package}.Service{name.capitalize()}"
|
|
@@ -127,3 +134,7 @@ def inject_foreground_service_types(
|
|
|
127
134
|
)
|
|
128
135
|
|
|
129
136
|
return manifest_text
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
print(test_generate_receivers())
|
|
@@ -41,3 +41,9 @@ class SpecFile:
|
|
|
41
41
|
|
|
42
42
|
def section(self, section: str) -> dict:
|
|
43
43
|
return self.data.get(section, {}).copy()
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
specFile = SpecFile("/home/fabian/Documents/Laner/mobile/buildozer.spec")
|
|
47
|
+
package_name = specFile.get("app","package.name")
|
|
48
|
+
package_domain = specFile.get("app","package.domain")
|
|
49
|
+
print("-"*20,f"{package_name}.{package_domain}","-"*20)
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-widgets
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: This would be used to auto gen XMLs for Android Home Screen widgets.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/Fector101/kivy-androidwidgets
|
|
8
8
|
Project-URL: Documentation, https://github.com/Fector101/kivy-androidwidgets
|
|
9
9
|
Project-URL: Source, https://github.com/Fector101/kivy-androidwidgets
|
|
10
10
|
Project-URL: Tracker, https://github.com/Fector101/kivy-androidwidgets/issues
|
|
11
11
|
Keywords: kivy,android,widgets,hello-world,python-package
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
13
|
Classifier: Operating System :: Android
|
|
15
14
|
Classifier: Development Status :: 3 - Alpha
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -68,8 +67,8 @@ Create preview image png in right path`res/drawable/ic_launcher_foreground.png`
|
|
|
68
67
|
|
|
69
68
|
### step 3: Create a `AppWidgetProvider` it's used to receive events for widget.
|
|
70
69
|
path: `src/SimpleWidget.java`.
|
|
71
|
-
This will receive an event when widget is add to change it's text
|
|
72
|
-
|
|
70
|
+
- This will receive an event when widget is add to change it's text
|
|
71
|
+
- You Can use [python to make changes](https://github.com/Fector101/kivy-androidwidgets/blob/main/using-python-to-update-widget.md#changing-text-with-python), but i don't to make it recive events like swipes and taps to widget
|
|
73
72
|
```java
|
|
74
73
|
package org.wally.waller; // Change here from buildozer.spec package.domain+package.name
|
|
75
74
|
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "android-widgets"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.5"
|
|
8
8
|
description = "This would be used to auto gen XMLs for Android Home Screen widgets."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "Fabian", email = "fector101@yahoo.com" }
|
|
12
12
|
]
|
|
13
|
-
license =
|
|
13
|
+
license = "MIT"
|
|
14
14
|
requires-python = ">=3.7"
|
|
15
15
|
dependencies = [
|
|
16
16
|
"kivy>=2.0.0"
|
|
@@ -24,7 +24,6 @@ keywords = [
|
|
|
24
24
|
]
|
|
25
25
|
classifiers = [
|
|
26
26
|
"Programming Language :: Python :: 3",
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
27
|
"Operating System :: Android",
|
|
29
28
|
"Development Status :: 3 - Alpha",
|
|
30
29
|
"Intended Audience :: Developers",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_widgets-0.1.3 → android_widgets-0.1.5}/android_widgets.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|