android-notify 1.52__py3-none-any.whl → 1.52.2__py3-none-any.whl
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.
Potentially problematic release.
This version of android-notify might be problematic. Click here for more details.
- android_notify/sword.py +19 -24
- {android_notify-1.52.dist-info → android_notify-1.52.2.dist-info}/METADATA +32 -24
- android_notify-1.52.2.dist-info/RECORD +9 -0
- android_notify-1.52.dist-info/RECORD +0 -9
- {android_notify-1.52.dist-info → android_notify-1.52.2.dist-info}/WHEEL +0 -0
- {android_notify-1.52.dist-info → android_notify-1.52.2.dist-info}/top_level.txt +0 -0
android_notify/sword.py
CHANGED
|
@@ -76,7 +76,7 @@ class Notification:
|
|
|
76
76
|
:param large_icon_path: Relative Path to the image resource.
|
|
77
77
|
:param progress_current_value: interger To set progress bar current value.
|
|
78
78
|
:param progress_max_value: interger To set Max range for progress bar.
|
|
79
|
-
:param
|
|
79
|
+
:param body: large text For `big_Text` style, while `message` acts as sub-title.
|
|
80
80
|
---
|
|
81
81
|
(Advance Options)
|
|
82
82
|
:param callback: Function for notification Click.
|
|
@@ -105,7 +105,7 @@ class Notification:
|
|
|
105
105
|
'large_icon_path':'',
|
|
106
106
|
'progress_max_value': 0,
|
|
107
107
|
'progress_current_value': 0,
|
|
108
|
-
'
|
|
108
|
+
'body':'',
|
|
109
109
|
'channel_name':'Default Channel',
|
|
110
110
|
'channel_id':'default_channel',
|
|
111
111
|
'logs':True,
|
|
@@ -116,6 +116,7 @@ class Notification:
|
|
|
116
116
|
# if key not in non_string_keys: value = str(value) to fix
|
|
117
117
|
#non_string_keys=['progress_max_value','progress_current_value','callback','logs']
|
|
118
118
|
# TODO using default values to check types
|
|
119
|
+
|
|
119
120
|
# During Development (When running on PC)
|
|
120
121
|
logs=not ON_ANDROID
|
|
121
122
|
def __init__(self,**kwargs):
|
|
@@ -128,7 +129,7 @@ class Notification:
|
|
|
128
129
|
self.big_picture_path=''
|
|
129
130
|
self.progress_current_value=0
|
|
130
131
|
self.progress_max_value=0
|
|
131
|
-
self.
|
|
132
|
+
self.body= ''
|
|
132
133
|
|
|
133
134
|
# For Nofitication Functions
|
|
134
135
|
self.identifer=''
|
|
@@ -139,9 +140,6 @@ class Notification:
|
|
|
139
140
|
self.channel_id='default_channel'
|
|
140
141
|
self.silent=False
|
|
141
142
|
|
|
142
|
-
# During Dev on PC
|
|
143
|
-
self.logs=self.logs
|
|
144
|
-
|
|
145
143
|
# Private (Don't Touch)
|
|
146
144
|
self.__id = self.__getUniqueID()
|
|
147
145
|
self.__setArgs(kwargs)
|
|
@@ -160,6 +158,8 @@ class Notification:
|
|
|
160
158
|
new_title (str): New Notification Title
|
|
161
159
|
"""
|
|
162
160
|
self.title=new_title
|
|
161
|
+
if self.logs:
|
|
162
|
+
print(f'new notification title: {new_title}')
|
|
163
163
|
if ON_ANDROID:
|
|
164
164
|
self.__builder.setContentTitle(new_title)
|
|
165
165
|
|
|
@@ -170,11 +170,11 @@ class Notification:
|
|
|
170
170
|
new_message (str): New Notification Message
|
|
171
171
|
"""
|
|
172
172
|
self.message=new_message
|
|
173
|
+
if self.logs:
|
|
174
|
+
print(f'new notification message: {new_message}')
|
|
173
175
|
if ON_ANDROID:
|
|
174
176
|
self.__builder.setContentText(new_message)
|
|
175
|
-
|
|
176
|
-
return True
|
|
177
|
-
return 'Updated'
|
|
177
|
+
|
|
178
178
|
def updateProgressBar(self,current_value,message:str=''):
|
|
179
179
|
"""current_value is the value to set progressbar, message defaults to last message"""
|
|
180
180
|
|
|
@@ -193,7 +193,7 @@ class Notification:
|
|
|
193
193
|
"""message defaults to last message"""
|
|
194
194
|
|
|
195
195
|
if self.logs:
|
|
196
|
-
print('removed')
|
|
196
|
+
print(f'removed progress bar with message: {self.message}')
|
|
197
197
|
|
|
198
198
|
if not ON_ANDROID:
|
|
199
199
|
return True
|
|
@@ -218,7 +218,7 @@ class Notification:
|
|
|
218
218
|
string_to_display=''
|
|
219
219
|
print("\n Sent Notification!!!")
|
|
220
220
|
for name,value in vars(self).items():
|
|
221
|
-
if value and name in ["title", "message", "style", "
|
|
221
|
+
if value and name in ["title", "message", "style", "body", "large_icon_path", "big_picture_path", "progress_current_value", "progress_max_value", "channel_name"]:
|
|
222
222
|
string_to_display += f'\n {name}: {value}'
|
|
223
223
|
string_to_display +="\n (Won't Print Logs When Complied,except if selected `Notification.logs=True`)"
|
|
224
224
|
print(string_to_display)
|
|
@@ -291,10 +291,7 @@ class Notification:
|
|
|
291
291
|
# str() This is to prevent Error When user does Notification.title='blah' instead of Notification(title='blah'
|
|
292
292
|
# TODO fix this by creating a on_Title method in other versions
|
|
293
293
|
self.__builder.setContentTitle(str(self.title))
|
|
294
|
-
|
|
295
|
-
self.__builder.setContentText(str(self.subject))
|
|
296
|
-
else:
|
|
297
|
-
self.__builder.setContentText(str(self.message))
|
|
294
|
+
self.__builder.setContentText(str(self.message))
|
|
298
295
|
self.__builder.setSmallIcon(context.getApplicationInfo().icon)
|
|
299
296
|
self.__builder.setDefaults(NotificationCompat.DEFAULT_ALL) # pylint: disable=E0606
|
|
300
297
|
self.__builder.setPriority(NotificationCompat.PRIORITY_DEFAULT if self.silent else NotificationCompat.PRIORITY_HIGH)
|
|
@@ -303,7 +300,7 @@ class Notification:
|
|
|
303
300
|
@run_on_ui_thread
|
|
304
301
|
def addNotificationStyle(self,style:str,already_sent=False):
|
|
305
302
|
"""Adds Style to Notification
|
|
306
|
-
Version 1.51.2+
|
|
303
|
+
Version 1.51.2+ Exposes method to Users (Note): Always try to Call On UI Thread
|
|
307
304
|
|
|
308
305
|
Args:
|
|
309
306
|
style (str): required style
|
|
@@ -315,20 +312,18 @@ class Notification:
|
|
|
315
312
|
|
|
316
313
|
if style == NotificationStyles.BIG_TEXT:
|
|
317
314
|
big_text_style = NotificationCompatBigTextStyle() # pylint: disable=E0606
|
|
318
|
-
big_text_style.bigText(self.
|
|
315
|
+
big_text_style.bigText(str(self.body))
|
|
319
316
|
self.__builder.setStyle(big_text_style)
|
|
320
317
|
|
|
321
318
|
elif style == NotificationStyles.INBOX:
|
|
322
319
|
inbox_style = NotificationCompatInboxStyle() # pylint: disable=E0606
|
|
323
320
|
for line in self.message.split("\n"):
|
|
324
|
-
inbox_style.addLine(line)
|
|
321
|
+
inbox_style.addLine(str(line))
|
|
325
322
|
self.__builder.setStyle(inbox_style)
|
|
326
323
|
|
|
327
|
-
elif style == NotificationStyles.BIG_PICTURE and self.big_picture_path:
|
|
328
|
-
self.
|
|
329
|
-
|
|
330
|
-
elif style == NotificationStyles.LARGE_ICON and self.large_icon_path:
|
|
331
|
-
self.__buildImg(self.large_icon_path, style)
|
|
324
|
+
elif (style == NotificationStyles.LARGE_ICON and self.large_icon_path) or (style == NotificationStyles.BIG_PICTURE and self.big_picture_path):
|
|
325
|
+
img = self.large_icon_path if style == NotificationStyles.LARGE_ICON else self.big_picture_path
|
|
326
|
+
self.__buildImg(img, style)
|
|
332
327
|
|
|
333
328
|
elif style == NotificationStyles.BOTH_IMGS and (self.big_picture_path or self.large_icon_path):
|
|
334
329
|
if self.big_picture_path:
|
|
@@ -336,7 +331,7 @@ class Notification:
|
|
|
336
331
|
if self.large_icon_path:
|
|
337
332
|
self.__buildImg(self.large_icon_path, NotificationStyles.LARGE_ICON)
|
|
338
333
|
|
|
339
|
-
elif style ==
|
|
334
|
+
elif style == NotificationStyles.PROGRESS:
|
|
340
335
|
self.__builder.setContentTitle(String(self.title))
|
|
341
336
|
self.__builder.setContentText(String(self.message))
|
|
342
337
|
self.__builder.setProgress(self.progress_max_value, self.progress_current_value, False)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.52
|
|
3
|
+
Version: 1.52.2
|
|
4
4
|
Summary: A Python package that simpilfies creating Android notifications in Kivy apps.
|
|
5
5
|
Home-page: https://github.com/fector101/android-notify
|
|
6
6
|
Author: Fabian
|
|
@@ -116,11 +116,11 @@ The library supports multiple notification styles:
|
|
|
116
116
|
|
|
117
117
|
1. `simple` - Basic notification with title and message
|
|
118
118
|
2. `progress` - Shows a progress bar
|
|
119
|
-
3. `
|
|
120
|
-
4. `
|
|
121
|
-
5. `
|
|
122
|
-
6. `
|
|
123
|
-
7. `
|
|
119
|
+
3. `big_picture` - Notification with a large image
|
|
120
|
+
4. `large_icon` - Notification with a custom icon
|
|
121
|
+
5. `both_imgs` - Combines big picture and large icon
|
|
122
|
+
6. `inbox` - List-style notification
|
|
123
|
+
7. `big_text` - Expandable notification with long text
|
|
124
124
|
8. `custom` - For custom notification styles
|
|
125
125
|
|
|
126
126
|
### Style Examples
|
|
@@ -138,7 +138,7 @@ notification = Notification(
|
|
|
138
138
|
progress_current_value=0
|
|
139
139
|
)
|
|
140
140
|
notification.send()
|
|
141
|
-
Clock.
|
|
141
|
+
Clock.schedule_interval(lambda dt: notification.updateProgressBar(dt, f"{dt}% downloaded"), 30)
|
|
142
142
|
```
|
|
143
143
|
|
|
144
144
|
**Sample Image:**
|
|
@@ -223,11 +223,13 @@ notification.send()
|
|
|
223
223
|
|
|
224
224
|
#### Big text notification
|
|
225
225
|
|
|
226
|
+
When using `big_text` style `message` acts as sub-title, Then when notification drop down button is pressed `body` is revealed
|
|
227
|
+
|
|
226
228
|
```python
|
|
227
229
|
notification = Notification(
|
|
228
230
|
title="Article",
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
message="Histroy of Loerm Ipsuim",
|
|
232
|
+
body="Lorem Ipsum is simply dummy text of the printing and ...",
|
|
231
233
|
style="big_text"
|
|
232
234
|
)
|
|
233
235
|
```
|
|
@@ -256,6 +258,8 @@ notification = Notification(
|
|
|
256
258
|
title="Download..",
|
|
257
259
|
style="progress"
|
|
258
260
|
)
|
|
261
|
+
# send notification
|
|
262
|
+
notification.send()
|
|
259
263
|
|
|
260
264
|
# Update progress
|
|
261
265
|
notification.updateProgressBar(30, "30% downloaded")
|
|
@@ -264,22 +268,9 @@ notification.updateProgressBar(30, "30% downloaded")
|
|
|
264
268
|
notification.removeProgressBar("Download Complete")
|
|
265
269
|
```
|
|
266
270
|
|
|
267
|
-
###
|
|
268
|
-
|
|
269
|
-
Notifications are organized into channels. You can customize the channel name and ID:
|
|
270
|
-
|
|
271
|
-
- Custom Channel Name's Gives User ability to turn on/off specific
|
|
272
|
-
|
|
273
|
-
```python
|
|
274
|
-
notification = Notification(
|
|
275
|
-
title="Download finished",
|
|
276
|
-
message="How to Catch a Fish.mp4",
|
|
277
|
-
channel_name="Download Notifications", # Will create User-visible name "Download Notifications"
|
|
278
|
-
channel_id="downloads_notifications" # Optional: specify custom channel ID
|
|
279
|
-
)
|
|
280
|
-
```
|
|
271
|
+
### Adding Style even when already sent
|
|
281
272
|
|
|
282
|
-
|
|
273
|
+
This is how you add a new style to notification, If already sent or not
|
|
283
274
|
|
|
284
275
|
```python
|
|
285
276
|
from android_notify import NotificationStyles
|
|
@@ -292,11 +283,28 @@ notification.send()
|
|
|
292
283
|
|
|
293
284
|
notification.updateTitle("Download Completed")
|
|
294
285
|
notification.removeProgressBar()
|
|
286
|
+
|
|
287
|
+
# Add New Style
|
|
295
288
|
notification.large_icon_path="users/imgs/profile1234.png"
|
|
296
289
|
notification.addNotificationStyle(NotificationStyles.LARGE_ICON,already_sent=True)
|
|
297
290
|
|
|
298
291
|
```
|
|
299
292
|
|
|
293
|
+
### Channel Management
|
|
294
|
+
|
|
295
|
+
Notifications are organized into channels. You can customize the channel name and ID:
|
|
296
|
+
|
|
297
|
+
- Custom Channel Name's Gives User ability to turn on/off specific notifications
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
notification = Notification(
|
|
301
|
+
title="Download finished",
|
|
302
|
+
message="How to Catch a Fish.mp4",
|
|
303
|
+
channel_name="Download Notifications", # Will create User-visible name "Download Notifications"
|
|
304
|
+
channel_id="downloads_notifications" # Optional: specify custom channel ID
|
|
305
|
+
)
|
|
306
|
+
```
|
|
307
|
+
|
|
300
308
|
**Sample Image:**
|
|
301
309
|

|
|
302
310
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,172
|
|
2
|
+
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
android_notify/core.py,sha256=B3gOgbLGGI6tz-Q_T2wmk74oggOSDX0Qz4lqj00vaFo,6114
|
|
4
|
+
android_notify/styles.py,sha256=3olKruhAbTrk5OzuhDnk_Pgpv8XYk8dWFmr48Q9rQVk,352
|
|
5
|
+
android_notify/sword.py,sha256=xBcrRPpbOYKoXzErNYAsjEtSj8NI78unTEnO9nipRPs,26037
|
|
6
|
+
android_notify-1.52.2.dist-info/METADATA,sha256=sR2K5ZdPsDveDmQqYCgiKKEuambWOT30ktB5UHnQCoc,13445
|
|
7
|
+
android_notify-1.52.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
8
|
+
android_notify-1.52.2.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
9
|
+
android_notify-1.52.2.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,172
|
|
2
|
-
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
android_notify/core.py,sha256=B3gOgbLGGI6tz-Q_T2wmk74oggOSDX0Qz4lqj00vaFo,6114
|
|
4
|
-
android_notify/styles.py,sha256=3olKruhAbTrk5OzuhDnk_Pgpv8XYk8dWFmr48Q9rQVk,352
|
|
5
|
-
android_notify/sword.py,sha256=P1P1leYCqnLwtvUC0KDWGp8DI3wkwVjHw8bBB1xSgcE,26002
|
|
6
|
-
android_notify-1.52.dist-info/METADATA,sha256=4U4Zrw7USlCJ0tKPBAsTYflJRWzuZYFQgtmGP2iAFKk,13165
|
|
7
|
-
android_notify-1.52.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
8
|
-
android_notify-1.52.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
9
|
-
android_notify-1.52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|