@@ -83,171 +83,171 @@ allprojects {
8383
8484### Step 3. Implement frogo-notification (Simple Notification)
8585``` kotlin
86- FrogoNotification .Inject (this ) // Intialize for Context
87- .setChannelId(CHANNEL_ID ) // Intialize for Channel ID
88- .setChannelName(CHANNEL_NAME ) // Initialize for Channel Name
89- .setContentIntent(pendingIntent) // Initialize for Content Intent
90- .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
91- .setLargeIcon(R .drawable.ic_frogo_notif) // Initialize for Large Icon
92- .setContentTitle(resources.getString(R .string.content_title)) // Initialize for Content Title
93- .setContentText(resources.getString(R .string.content_text)) // Initialize for Content Text
94- .setSubText(resources.getString(R .string.subtext)) // Initialize for Sub Text
95- .setupAutoCancel() // Initialize for Auto Cancel
96- .build() // Build the Frogo Notification
97- .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
86+ FrogoNotification .Inject (this ) // Intialize for Context
87+ .setChannelId(CHANNEL_ID ) // Intialize for Channel ID
88+ .setChannelName(CHANNEL_NAME ) // Initialize for Channel Name
89+ .setContentIntent(pendingIntent) // Initialize for Content Intent
90+ .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
91+ .setLargeIcon(R .drawable.ic_frogo_notif) // Initialize for Large Icon
92+ .setContentTitle(resources.getString(R .string.content_title)) // Initialize for Content Title
93+ .setContentText(resources.getString(R .string.content_text)) // Initialize for Content Text
94+ .setSubText(resources.getString(R .string.subtext)) // Initialize for Sub Text
95+ .setupAutoCancel() // Initialize for Auto Cancel
96+ .build() // Build the Frogo Notification
97+ .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
9898```
9999
100100## Feature frogo-notification
101101
102102### Simple Notification
103103``` kotlin
104- FrogoNotification .Inject (this ) // Intialize for Context
105- .setChannelId(CHANNEL_ID ) // Intialize for Channel ID
106- .setChannelName(CHANNEL_NAME ) // Initialize for Channel Name
107- .setContentIntent(pendingIntent) // Initialize for Content Intent
108- .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
109- .setLargeIcon(R .drawable.ic_frogo_notif) // Initialize for Large Icon
110- .setContentTitle(resources.getString(R .string.content_title)) // Initialize for Content Title
111- .setContentText(resources.getString(R .string.content_text)) // Initialize for Content Text
112- .setSubText(resources.getString(R .string.subtext)) // Initialize for Sub Text
113- .setupAutoCancel() // Initialize for Auto Cancel
114- .build() // Build the Frogo Notification
115- .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
104+ FrogoNotification .Inject (this ) // Intialize for Context
105+ .setChannelId(CHANNEL_ID ) // Intialize for Channel ID
106+ .setChannelName(CHANNEL_NAME ) // Initialize for Channel Name
107+ .setContentIntent(pendingIntent) // Initialize for Content Intent
108+ .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
109+ .setLargeIcon(R .drawable.ic_frogo_notif) // Initialize for Large Icon
110+ .setContentTitle(resources.getString(R .string.content_title)) // Initialize for Content Title
111+ .setContentText(resources.getString(R .string.content_text)) // Initialize for Content Text
112+ .setSubText(resources.getString(R .string.subtext)) // Initialize for Sub Text
113+ .setupAutoCancel() // Initialize for Auto Cancel
114+ .build() // Build the Frogo Notification
115+ .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
116116```
117117
118118### Custom Layout (NEW FEATURE)
119119``` kotlin
120- val collapsed = object : FrogoNotifCustomContentViewListener {
121- override fun setupCustomView (): Int {
122- return R .layout.notification_collapsed
123- }
120+ val collapsed = object : FrogoNotifCustomContentViewListener {
121+ override fun setupCustomView (): Int {
122+ return R .layout.notification_collapsed
123+ }
124124
125- override fun setupComponent (context : Context , customView : RemoteViews ) {
126- customView.apply {
127- setTextViewText(R .id.text_view_collapsed_1, " Hello World!" )
128- }
125+ override fun setupComponent (context : Context , customView : RemoteViews ) {
126+ customView.apply {
127+ setTextViewText(R .id.text_view_collapsed_1, " Hello World!" )
129128 }
130129 }
130+ }
131131
132- val expanded = object : FrogoNotifCustomContentViewListener {
133- override fun setupCustomView (): Int {
134- return R .layout.notification_expanded
135- }
132+ val expanded = object : FrogoNotifCustomContentViewListener {
133+ override fun setupCustomView (): Int {
134+ return R .layout.notification_expanded
135+ }
136136
137- override fun setupComponent (context : Context , customView : RemoteViews ) {
138- customView.apply {
139- setImageViewResource(R .id.image_view_expanded, R .drawable.ic_android)
140- setOnClickPendingIntent(R .id.image_view_expanded, clickPendingIntent)
141- }
137+ override fun setupComponent (context : Context , customView : RemoteViews ) {
138+ customView.apply {
139+ setImageViewResource(R .id.image_view_expanded, R .drawable.ic_android)
140+ setOnClickPendingIntent(R .id.image_view_expanded, clickPendingIntent)
142141 }
143142 }
143+ }
144144
145- FrogoNotification .Inject (this ) // Intialize for Context
146- .setChannelId(FrogoApp .CHANNEL_ID ) // Intialize for Channel ID
147- .setChannelName(FrogoApp .CHANNEL_NAME ) // Initialize for Channel Name
148- .setSmallIcon(R .drawable.ic_android) // Initialize for Small Icon
149- .setCustomContentView(collapsed)
150- .setCustomBigContentView(expanded)
151- .build() // Build the Frogo Notification
152- .launch(FrogoApp .NOTIFICATION_ID ) // Notify the Frogo Notification
145+ FrogoNotification .Inject (this ) // Intialize for Context
146+ .setChannelId(FrogoApp .CHANNEL_ID ) // Intialize for Channel ID
147+ .setChannelName(FrogoApp .CHANNEL_NAME ) // Initialize for Channel Name
148+ .setSmallIcon(R .drawable.ic_android) // Initialize for Small Icon
149+ .setCustomContentView(collapsed)
150+ .setCustomBigContentView(expanded)
151+ .build() // Build the Frogo Notification
152+ .launch(FrogoApp .NOTIFICATION_ID ) // Notify the Frogo Notification
153153```
154154
155155### With Action Replay
156156``` kotlin
157- FrogoNotification .Inject (this )
158- .setChannelId(CHANNEL_ID )
159- .setChannelName(CHANNEL_NAME as String )
160- .setSmallIcon(R .drawable.ic_frogo_notif)
161- .setContentTitle(getString(R .string.notif_title))
162- .setContentText(getString(R .string.notif_content))
163- .setupShowWhen()
164- .setupActionRemoteInput(object : FrogoNotifActionRemoteInputListener {
165- override fun setRemoteInputResultKey (): String {
166- return KEY_REPLY
167- }
157+ FrogoNotification .Inject (this )
158+ .setChannelId(CHANNEL_ID )
159+ .setChannelName(CHANNEL_NAME as String )
160+ .setSmallIcon(R .drawable.ic_frogo_notif)
161+ .setContentTitle(getString(R .string.notif_title))
162+ .setContentText(getString(R .string.notif_content))
163+ .setupShowWhen()
164+ .setupActionRemoteInput(object : FrogoNotifActionRemoteInputListener {
165+ override fun setRemoteInputResultKey (): String {
166+ return KEY_REPLY
167+ }
168168
169- override fun setRemoteInputLabel (): String {
170- return getString(R .string.notif_action_reply)
171- }
169+ override fun setRemoteInputLabel (): String {
170+ return getString(R .string.notif_action_reply)
171+ }
172172
173- override fun setActionIcon (): Int {
174- return R .drawable.ic_frogo_send
175- }
173+ override fun setActionIcon (): Int {
174+ return R .drawable.ic_frogo_send
175+ }
176176
177- override fun setActionTitle (): String {
178- return getString(R .string.notif_action_reply)
179- }
177+ override fun setActionTitle (): String {
178+ return getString(R .string.notif_action_reply)
179+ }
180180
181- override fun setActionIntent (): PendingIntent ? {
182- return getReplyPendingIntent()
183- }
181+ override fun setActionIntent (): PendingIntent ? {
182+ return getReplyPendingIntent()
183+ }
184184
185- override fun setAllowGeneratedReplies (): Boolean {
186- return true
187- }
188- })
189- .build()
190- .launch(mNotificationId)
185+ override fun setAllowGeneratedReplies (): Boolean {
186+ return true
187+ }
188+ })
189+ .build()
190+ .launch(mNotificationId)
191191```
192192
193193### With Inbox Style (Stack)
194194``` kotlin
195- val frogoNotification = FrogoNotification .Inject (this )
196- .setChannelId(CHANNEL_ID )
197- .setChannelName(CHANNEL_NAME )
198- .setSmallIcon(R .drawable.ic_frogo_email)
199- .setGroup(GROUP_KEY_EMAILS )
200- .setContentIntent(pendingIntent)
201- .setupAutoCancel()
202-
203- // Check if NotificationID is smaller than Max Notif
204- if (idNotification < MAX_NOTIFICATION ) {
205-
206- stackNotif[idNotification].message?.let {
207- frogoNotification
208- .setContentTitle(" New Email from " + stackNotif[idNotification].sender)
209- .setContentText(it)
210- .setLargeIcon(R .drawable.ic_frogo_notif)
211- }
212-
213- } else {
214-
195+ val frogoNotification = FrogoNotification .Inject (this )
196+ .setChannelId(CHANNEL_ID )
197+ .setChannelName(CHANNEL_NAME )
198+ .setSmallIcon(R .drawable.ic_frogo_email)
199+ .setGroup(GROUP_KEY_EMAILS )
200+ .setContentIntent(pendingIntent)
201+ .setupAutoCancel()
202+
203+ // Check if NotificationID is smaller than Max Notif
204+ if (idNotification < MAX_NOTIFICATION ) {
205+
206+ stackNotif[idNotification].message?.let {
215207 frogoNotification
216- .setContentTitle(" $idNotification new emails" )
217- .setContentText(
" [email protected] " )
218- .setGroupSummary()
219- .setupInboxStyle(object : FrogoNotifInboxStyleListener {
220- override fun addLine1 (): String {
221- return " New Email from " + stackNotif[idNotification].sender
222- }
223-
224- override fun addLine2 (): String {
225- return " New Email from " + stackNotif[idNotification - 1 ].sender
226- }
227-
228- override fun setBigContentTitle (): String {
229- return " $idNotification new emails"
230- }
231-
232- override fun setSummaryText (): String {
233- return " mail@frogobox"
234- }
235- })
236-
208+ .setContentTitle(" New Email from " + stackNotif[idNotification].sender)
209+ .setContentText(it)
210+ .setLargeIcon(R .drawable.ic_frogo_notif)
237211 }
238212
213+ } else {
214+
239215 frogoNotification
240- .build()
241- .launch(idNotification)
216+ .setContentTitle(" $idNotification new emails" )
217+ .setContentText(
" [email protected] " )
218+ .setGroupSummary()
219+ .setupInboxStyle(object : FrogoNotifInboxStyleListener {
220+ override fun addLine1 (): String {
221+ return " New Email from " + stackNotif[idNotification].sender
222+ }
223+
224+ override fun addLine2 (): String {
225+ return " New Email from " + stackNotif[idNotification - 1 ].sender
226+ }
227+
228+ override fun setBigContentTitle (): String {
229+ return " $idNotification new emails"
230+ }
231+
232+ override fun setSummaryText (): String {
233+ return " mail@frogobox"
234+ }
235+ })
236+
237+ }
238+
239+ frogoNotification
240+ .build()
241+ .launch(idNotification)
242242```
243243
244244### With Frogo Style
245245``` kotlin
246- FrogoNotification .Inject (this ) // Intialize for Context
247- .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
248- .setupWithFrogoStyle()
249- .build() // Build the Frogo Notification
250- .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
246+ FrogoNotification .Inject (this ) // Intialize for Context
247+ .setSmallIcon(R .drawable.ic_frogo_notif) // Initialize for Small Icon
248+ .setupWithFrogoStyle()
249+ .build() // Build the Frogo Notification
250+ .launch(NOTIFICATION_ID ) // Notify the Frogo Notification
251251```
252252
253253### For Documentation
0 commit comments