-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/w3engineers/jitpackbottomnav/util/NotificationUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.w3engineers.jitpackbottomnav.util | ||
|
||
import android.os.Bundle | ||
import androidx.core.app.NotificationCompat | ||
import androidx.core.app.NotificationManagerCompat | ||
import androidx.navigation.NavDeepLinkBuilder | ||
import androidx.navigation.Navigation | ||
import com.w3engineers.jitpackbottomnav.App | ||
import com.w3engineers.jitpackbottomnav.R | ||
import com.w3engineers.jitpackbottomnav.data.model.User | ||
import com.w3engineers.jitpackbottomnav.data.model.User_ | ||
import com.w3engineers.jitpackbottomnav.fragment.home.HomeFragmentDirections | ||
|
||
|
||
/* | ||
* **************************************************************************** | ||
* * Created by : Md. Azizul Islam on 12/17/2018 at 12:43 PM. | ||
* * Email : azizul@w3engineers.com | ||
* * | ||
* * Purpose: | ||
* * | ||
* * Last edited by : Md. Azizul Islam on 12/17/2018. | ||
* * | ||
* * Last Reviewed by : <Reviewer Name> on <mm/dd/yy> | ||
* **************************************************************************** | ||
*/ | ||
|
||
object NotificationUtil { | ||
|
||
fun showNotification() { | ||
val user = App.getBoxStore().boxFor(User::class.java).all | ||
/* | ||
val args = Bundle().apply { | ||
putParcelable("user", user.get(0)) | ||
} | ||
*/ | ||
|
||
// Prepare the pending intent, while specifying the graph and destination | ||
val pendingIndent = NavDeepLinkBuilder(App.getContext()) | ||
.setGraph(R.navigation.bottom_nav_graph) | ||
.setDestination(R.id.fragment_chat) | ||
.setArguments(HomeFragmentDirections.openChatPage(user.get(0)).arguments) | ||
.createPendingIntent() | ||
|
||
|
||
// Create notification instance | ||
val notification = NotificationCompat.Builder(App.getContext(), "navigation") | ||
.setSmallIcon(R.mipmap.ic_launcher) | ||
.setContentTitle("Explicit deep link") | ||
.setContentText("Clicking on this notification will take you to the destination fragment") | ||
.setContentIntent(pendingIndent) | ||
.setAutoCancel(true) | ||
.build() | ||
|
||
// Display notification | ||
NotificationManagerCompat.from(App.getContext()).notify(10, notification) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#FFFAFA" | ||
android:viewportHeight="24.0" android:viewportWidth="24.0" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#FF000000" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM16,17L8,17v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5v6z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters