correct???

This commit is contained in:
aayush262 2023-12-12 15:30:31 +05:30
parent 5c4e9d7696
commit cc98e2f307
6 changed files with 17 additions and 12 deletions

View file

@ -75,9 +75,9 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000.toInt() textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000.toInt()
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt()) materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt())
} }
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
val settings = loadData("incognito") ?: false ?.getBoolean("incognito", false) ?: false
if(settings) { if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE binding.incognitoView.visibility = View.VISIBLE
} }

View file

@ -21,6 +21,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import ani.dantotsu.App
import ani.dantotsu.R import ani.dantotsu.R
import ani.dantotsu.Refresh import ani.dantotsu.Refresh
import ani.dantotsu.bottomBar import ani.dantotsu.bottomBar
@ -114,8 +115,9 @@ class HomeFragment : Fragment() {
snackString(currContext()?.getString(R.string.please_reload)) snackString(currContext()?.getString(R.string.please_reload))
} }
} }
val settings = loadData("incognito") ?: false val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
if(settings) { ?.getBoolean("incognito", false) ?: false
if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE binding.incognitoView.visibility = View.VISIBLE
} }

View file

@ -75,8 +75,9 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt()) materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt())
} }
val settings = loadData("incognito") ?: false val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
if(settings) { ?.getBoolean("incognito", false) ?: false
if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE binding.incognitoView.visibility = View.VISIBLE
} }

View file

@ -1156,7 +1156,8 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
} }
preloading = false preloading = false
val setting = loadData("incognito") ?: false val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
val showProgressDialog = val showProgressDialog =
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
?: true else false ?: true else false
@ -1164,7 +1165,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
AlertDialog.Builder(this, R.style.MyPopup) AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.auto_update, media.userPreferredName)) .setTitle(getString(R.string.auto_update, media.userPreferredName))
.apply { .apply {
if (setting) { if (incognito) {
setMessage(getString(R.string.incognito_will_not_update)) setMessage(getString(R.string.incognito_will_not_update))
} }
setOnCancelListener { hideSystemBars() } setOnCancelListener { hideSystemBars() }

View file

@ -3,6 +3,7 @@ package ani.dantotsu.media.manga.mangareader
import android.animation.ObjectAnimator import android.animation.ObjectAnimator
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.AlertDialog import android.app.AlertDialog
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
@ -804,11 +805,12 @@ class MangaReaderActivity : AppCompatActivity() {
saveData("${media.id}_progressDialog", isChecked) saveData("${media.id}_progressDialog", isChecked)
showProgressDialog = !isChecked showProgressDialog = !isChecked
} }
val setting = loadData("incognito") ?: false val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
AlertDialog.Builder(this, R.style.MyPopup) AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.title_update_progress)) .setTitle(getString(R.string.title_update_progress))
.apply { .apply {
if (setting) { if (incognito) {
setMessage(getString(R.string.incognito_will_not_update)) setMessage(getString(R.string.incognito_will_not_update))
} }
} }

View file

@ -408,7 +408,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked -> binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putBoolean("incognito", isChecked).apply() .putBoolean("incognito", isChecked).apply()
saveData("incognito", isChecked)
restartApp() restartApp()
} }