clean incognito notification function
This commit is contained in:
parent
a851c0f715
commit
f038dcb255
3 changed files with 7 additions and 6 deletions
|
@ -941,7 +941,8 @@ fun checkCountry(context: Context): Boolean {
|
|||
else -> false
|
||||
}
|
||||
}
|
||||
fun notification(context: Context){
|
||||
fun incognitoNotification(context: Context){
|
||||
val CHANNEL_ID = 26
|
||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
val incognito = context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean("incognito", false)
|
||||
if (incognito) {
|
||||
|
@ -951,9 +952,9 @@ fun notification(context: Context){
|
|||
.setContentText("Disable Incognito Mode")
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setOngoing(true)
|
||||
notificationManager.notify(26, builder.build())
|
||||
notificationManager.notify(CHANNEL_ID, builder.build())
|
||||
} else {
|
||||
notificationManager.cancel(26)
|
||||
notificationManager.cancel(CHANNEL_ID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
}
|
||||
|
||||
notification(this)
|
||||
incognitoNotification(this)
|
||||
|
||||
var doubleBackToExitPressedOnce = false
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import ani.dantotsu.home.LoginFragment
|
|||
import ani.dantotsu.home.MangaFragment
|
||||
import ani.dantotsu.home.NoInternet
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.notification
|
||||
import ani.dantotsu.incognitoNotification
|
||||
import ani.dantotsu.offline.OfflineFragment
|
||||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.others.imagesearch.ImageSearchActivity
|
||||
|
@ -85,7 +85,7 @@ class SettingsDialogFragment : BottomSheetDialogFragment() {
|
|||
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||
?.putBoolean("incognito", isChecked)?.apply()
|
||||
notification(requireContext())
|
||||
incognitoNotification(requireContext())
|
||||
}
|
||||
binding.settingsExtensionSettings.setSafeOnClickListener {
|
||||
startActivity(Intent(activity, ExtensionsActivity::class.java))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue