android-notify 1.51__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 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.__addNotificationStyle()
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) #"BLAH"
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
- def __addNotificationStyle(self):
304
- if self.style == NotificationStyles.BIG_TEXT:
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 self.style == NotificationStyles.INBOX:
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 self.style == NotificationStyles.BIG_PICTURE and self.big_picture_path:
316
- self.__buildImg(self.big_picture_path, self.style)
327
+ elif style == NotificationStyles.BIG_PICTURE and self.big_picture_path:
328
+ self.__buildImg(self.big_picture_path, style)
317
329
 
318
- elif self.style == NotificationStyles.LARGE_ICON and self.large_icon_path:
319
- self.__buildImg(self.large_icon_path, self.style)
330
+ elif style == NotificationStyles.LARGE_ICON and self.large_icon_path:
331
+ self.__buildImg(self.large_icon_path, style)
320
332
 
321
- elif self.style == NotificationStyles.BOTH_IMGS and (self.big_picture_path or self.large_icon_path):
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 self.style == 'progress':
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
- # elif self.style == 'custom':
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
- if NotificationStyles.BIG_PICTURE:
348
- bitmap = self.__getImgFromPath(user_img)
349
- if bitmap:
350
- big_picture_style = NotificationCompatBigPictureStyle().bigPicture(bitmap) # pylint: disable=E0606
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: android-notify
3
- Version: 1.51
3
+ Version: 1.51.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
@@ -47,7 +47,7 @@ Dynamic: summary
47
47
 
48
48
  - Also Compatible with Android 8.0+.
49
49
  - Supports including images in notifications.
50
- - All Notifications can take Functions (version 1.50+) [functions docs](#functions).
50
+ - All Notifications can take Functions (version 1.50+) [functions section](#functions).
51
51
  - Support for multiple notification styles:
52
52
  - [Simple](#basic-usage)
53
53
  - [Progress](#progress-bar-notification)
@@ -88,6 +88,7 @@ android.permissions = POST_NOTIFICATIONS
88
88
  # Required dependencies (write exactly as shown, no quotation marks)
89
89
  android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
90
90
  android.enable_androidx = True
91
+ android.api = 35
91
92
  ```
92
93
 
93
94
  ---
@@ -142,10 +143,14 @@ Clock.schedule_once(lambda dt: notification.updateProgressBar(30, "30% downloade
142
143
  **Sample Image:**
143
144
  ![progress img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/progress.jpg)
144
145
 
145
- #### Notification with an Image (Big Picture Style)
146
+ #### Images
147
+
148
+ ##### Notification with an Image (Big Picture Style)
146
149
 
147
150
  > [!NOTE]
148
- > Online Images should start with `http://` or `https://`
151
+ > Online Images should start with `http://` or `https://`
152
+ > And request for permission, `android.permissions = INTERNET`
153
+ > No additionally permissions needed for images in App folder
149
154
 
150
155
  ```python
151
156
  # Image notification
@@ -162,10 +167,7 @@ notification.send()
162
167
  **Sample Image:**
163
168
  ![big_picture img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/bigpicturenoti.jpg)
164
169
 
165
- #### Notification with an Image (Large Icon Style)
166
-
167
- > [!NOTE]
168
- > Online Images should start with `http://` or `https://`
170
+ ##### Notification with an Image (Large Icon Style)
169
171
 
170
172
  ```python
171
173
  notification = Notification(
@@ -223,7 +225,7 @@ notification.send()
223
225
  ```python
224
226
  notification = Notification(
225
227
  title="Article",
226
- subject="Histroy of Loerm Ipsuim"
228
+ subject="Histroy of Loerm Ipsuim",
227
229
  message="Lorem Ipsum is simply dummy text of the printing and ...",
228
230
  style="big_text"
229
231
  )
@@ -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=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,,
@@ -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=mmQM5G9lOGYGKuVCXd_t2iFeh_MHXDrWvJJlv1kU9e0,25840
6
- android_notify-1.51.dist-info/METADATA,sha256=xipCm99AC9KyJyUMzeoShYLrZkaDOygHOaTSllMwt80,12639
7
- android_notify-1.51.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
8
- android_notify-1.51.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
9
- android_notify-1.51.dist-info/RECORD,,