mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Shortcut fix Oreo (#1026)
* Moved to Android O Shortcutmanager * Re-added possibility to change icon shape pre oreo.
This commit is contained in:
		
				
					committed by
					
						 inorichi
						inorichi
					
				
			
			
				
	
			
			
			
						parent
						
							5c662b1ae1
						
					
				
				
					commit
					deec65446f
				
			| @@ -41,6 +41,8 @@ class NotificationReceiver : BroadcastReceiver() { | ||||
|             ACTION_RESUME_DOWNLOADS -> DownloadService.start(context) | ||||
|             // Clear the download queue | ||||
|             ACTION_CLEAR_DOWNLOADS -> downloadManager.clearQueue(true) | ||||
|             // Show message notification created | ||||
|             ACTION_SHORTCUT_CREATED -> context.toast(R.string.shortcut_created) | ||||
|             // Launch share activity and dismiss notification | ||||
|             ACTION_SHARE_IMAGE -> shareImage(context, intent.getStringExtra(EXTRA_FILE_LOCATION), | ||||
|                     intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)) | ||||
| @@ -161,6 +163,9 @@ class NotificationReceiver : BroadcastReceiver() { | ||||
|         // Called to clear downloads. | ||||
|         private const val ACTION_CLEAR_DOWNLOADS = "$ID.$NAME.ACTION_CLEAR_DOWNLOADS" | ||||
|  | ||||
|         // Called to notify user shortcut is created. | ||||
|         private const val ACTION_SHORTCUT_CREATED = "$ID.$NAME.ACTION_SHORTCUT_CREATED" | ||||
|  | ||||
|         // Called to dismiss notification. | ||||
|         private const val ACTION_DISMISS_NOTIFICATION = "$ID.$NAME.ACTION_DISMISS_NOTIFICATION" | ||||
|  | ||||
| @@ -199,6 +204,13 @@ class NotificationReceiver : BroadcastReceiver() { | ||||
|             return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) | ||||
|         } | ||||
|  | ||||
|         internal fun shortcutCreatedBroadcast(context: Context) : PendingIntent { | ||||
|             val intent = Intent(context, NotificationReceiver::class.java).apply { | ||||
|                 action = ACTION_SHORTCUT_CREATED | ||||
|             } | ||||
|             return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Returns [PendingIntent] that starts a service which dismissed the notification | ||||
|          * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user