android-notify 1.51.1__py3-none-any.whl → 1.51.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 +31 -21
- {android_notify-1.51.1.dist-info → android_notify-1.51.2.dist-info}/METADATA +1 -1
- {android_notify-1.51.1.dist-info → android_notify-1.51.2.dist-info}/RECORD +5 -5
- {android_notify-1.51.1.dist-info → android_notify-1.51.2.dist-info}/WHEEL +0 -0
- {android_notify-1.51.1.dist-info → android_notify-1.51.2.dist-info}/top_level.txt +0 -0
android_notify/sword.py
CHANGED
|
@@ -172,6 +172,7 @@ class Notification:
|
|
|
172
172
|
self.message=new_message
|
|
173
173
|
if ON_ANDROID:
|
|
174
174
|
self.__builder.setContentText(new_message)
|
|
175
|
+
|
|
175
176
|
return True
|
|
176
177
|
return 'Updated'
|
|
177
178
|
def updateProgressBar(self,current_value,message:str=''):
|
|
@@ -271,11 +272,11 @@ class Notification:
|
|
|
271
272
|
def __startNotificationBuild(self):
|
|
272
273
|
self.__createBasicNotification()
|
|
273
274
|
if self.style not in ['simple','']:
|
|
274
|
-
self.
|
|
275
|
+
self.addNotificationStyle(self.style)
|
|
275
276
|
|
|
276
277
|
def __createBasicNotification(self):
|
|
277
278
|
# Notification Channel (Required for Android 8.0+)
|
|
278
|
-
# print("THis is cchannel is ",self.channel_id) #"
|
|
279
|
+
# print("THis is cchannel is ",self.channel_id) #"
|
|
279
280
|
if BuildVersion.SDK_INT >= 26 and self.notification_manager.getNotificationChannel(self.channel_id) is None:
|
|
280
281
|
importance=NotificationManagerCompat.IMPORTANCE_DEFAULT if self.silent else NotificationManagerCompat.IMPORTANCE_HIGH # pylint: disable=possibly-used-before-assignment
|
|
281
282
|
# importance = 3 or 4
|
|
@@ -299,37 +300,51 @@ class Notification:
|
|
|
299
300
|
self.__builder.setPriority(NotificationCompat.PRIORITY_DEFAULT if self.silent else NotificationCompat.PRIORITY_HIGH)
|
|
300
301
|
self.__builder.setOnlyAlertOnce(True)
|
|
301
302
|
self.__addIntentToOpenApp()
|
|
303
|
+
@run_on_ui_thread
|
|
304
|
+
def addNotificationStyle(self,style:str,already_sent=False):
|
|
305
|
+
"""Adds Style to Notification
|
|
306
|
+
Version 1.51.2+ Exposing to Users (Note): Always Call On UI Thread
|
|
302
307
|
|
|
303
|
-
|
|
304
|
-
|
|
308
|
+
Args:
|
|
309
|
+
style (str): required style
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
if not ON_ANDROID:
|
|
313
|
+
# TODO for logs when not on android and style related to imgs etraxct app path from buildozer.spec and print
|
|
314
|
+
return
|
|
315
|
+
|
|
316
|
+
if style == NotificationStyles.BIG_TEXT:
|
|
305
317
|
big_text_style = NotificationCompatBigTextStyle() # pylint: disable=E0606
|
|
306
318
|
big_text_style.bigText(self.message)
|
|
307
319
|
self.__builder.setStyle(big_text_style)
|
|
308
320
|
|
|
309
|
-
elif
|
|
321
|
+
elif style == NotificationStyles.INBOX:
|
|
310
322
|
inbox_style = NotificationCompatInboxStyle() # pylint: disable=E0606
|
|
311
323
|
for line in self.message.split("\n"):
|
|
312
324
|
inbox_style.addLine(line)
|
|
313
325
|
self.__builder.setStyle(inbox_style)
|
|
314
326
|
|
|
315
|
-
elif
|
|
316
|
-
self.__buildImg(self.big_picture_path,
|
|
327
|
+
elif style == NotificationStyles.BIG_PICTURE and self.big_picture_path:
|
|
328
|
+
self.__buildImg(self.big_picture_path, style)
|
|
317
329
|
|
|
318
|
-
elif
|
|
319
|
-
self.__buildImg(self.large_icon_path,
|
|
330
|
+
elif style == NotificationStyles.LARGE_ICON and self.large_icon_path:
|
|
331
|
+
self.__buildImg(self.large_icon_path, style)
|
|
320
332
|
|
|
321
|
-
elif
|
|
333
|
+
elif style == NotificationStyles.BOTH_IMGS and (self.big_picture_path or self.large_icon_path):
|
|
322
334
|
if self.big_picture_path:
|
|
323
335
|
self.__buildImg(self.big_picture_path, NotificationStyles.BIG_PICTURE)
|
|
324
336
|
if self.large_icon_path:
|
|
325
337
|
self.__buildImg(self.large_icon_path, NotificationStyles.LARGE_ICON)
|
|
326
338
|
|
|
327
|
-
elif
|
|
339
|
+
elif style == 'progress':
|
|
328
340
|
self.__builder.setContentTitle(String(self.title))
|
|
329
341
|
self.__builder.setContentText(String(self.message))
|
|
330
342
|
self.__builder.setProgress(self.progress_max_value, self.progress_current_value, False)
|
|
331
343
|
|
|
332
|
-
|
|
344
|
+
if already_sent:
|
|
345
|
+
self.notification_manager.notify(self.__id, self.__builder.build())
|
|
346
|
+
|
|
347
|
+
# elif style == 'custom':
|
|
333
348
|
# self.__builder = self.__doCustomStyle()
|
|
334
349
|
|
|
335
350
|
# def __doCustomStyle(self):
|
|
@@ -344,15 +359,10 @@ class Notification:
|
|
|
344
359
|
)
|
|
345
360
|
thread.start()
|
|
346
361
|
else:
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
self.__builder.setStyle(big_picture_style)
|
|
352
|
-
elif NotificationStyles.LARGE_ICON:
|
|
353
|
-
bitmap = self.__getImgFromPath(user_img)
|
|
354
|
-
if bitmap:
|
|
355
|
-
self.__builder.setLargeIcon(bitmap)
|
|
362
|
+
bitmap = self.__getImgFromPath(user_img)
|
|
363
|
+
if bitmap:
|
|
364
|
+
self.__applyNotificationImage(bitmap,img_style)
|
|
365
|
+
|
|
356
366
|
|
|
357
367
|
def __getImgFromPath(self, relative_path):
|
|
358
368
|
app_folder=os.path.join(app_storage_path(),'app') # pylint: disable=possibly-used-before-assignment
|
|
@@ -2,8 +2,8 @@ android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,17
|
|
|
2
2
|
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
android_notify/core.py,sha256=B3gOgbLGGI6tz-Q_T2wmk74oggOSDX0Qz4lqj00vaFo,6114
|
|
4
4
|
android_notify/styles.py,sha256=3olKruhAbTrk5OzuhDnk_Pgpv8XYk8dWFmr48Q9rQVk,352
|
|
5
|
-
android_notify/sword.py,sha256=
|
|
6
|
-
android_notify-1.51.
|
|
7
|
-
android_notify-1.51.
|
|
8
|
-
android_notify-1.51.
|
|
9
|
-
android_notify-1.51.
|
|
5
|
+
android_notify/sword.py,sha256=P1P1leYCqnLwtvUC0KDWGp8DI3wkwVjHw8bBB1xSgcE,26002
|
|
6
|
+
android_notify-1.51.2.dist-info/METADATA,sha256=6WUSXQKtwVz0KAGRTs28kwOjMIfs88dV3MPWEcTmPL8,12737
|
|
7
|
+
android_notify-1.51.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
8
|
+
android_notify-1.51.2.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
9
|
+
android_notify-1.51.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|