incognito
This commit is contained in:
parent
c1a0eeb361
commit
e77ab2800a
9 changed files with 119 additions and 33 deletions
|
@ -13,27 +13,33 @@ import kotlinx.coroutines.launch
|
|||
import kotlin.math.roundToInt
|
||||
|
||||
fun updateProgress(media: Media, number: String) {
|
||||
if (Anilist.userid != null) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val a = number.toFloatOrNull()?.toInt()
|
||||
if ((a ?: 0) > (media.userProgress ?: 0)) {
|
||||
Anilist.mutation.editList(
|
||||
media.id,
|
||||
a,
|
||||
status = if (media.userStatus == "REPEATING") media.userStatus else "CURRENT"
|
||||
)
|
||||
MAL.query.editList(
|
||||
media.idMAL,
|
||||
media.anime != null,
|
||||
a, null,
|
||||
if (media.userStatus == "REPEATING") media.userStatus!! else "CURRENT"
|
||||
)
|
||||
toast(currContext()?.getString(R.string.setting_progress, a))
|
||||
val incognito = currContext()?.getSharedPreferences("Dantotsu", 0)
|
||||
?.getBoolean("incognito", false) ?: false
|
||||
if (!incognito) {
|
||||
if (Anilist.userid != null) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val a = number.toFloatOrNull()?.toInt()
|
||||
if ((a ?: 0) > (media.userProgress ?: 0)) {
|
||||
Anilist.mutation.editList(
|
||||
media.id,
|
||||
a,
|
||||
status = if (media.userStatus == "REPEATING") media.userStatus else "CURRENT"
|
||||
)
|
||||
MAL.query.editList(
|
||||
media.idMAL,
|
||||
media.anime != null,
|
||||
a, null,
|
||||
if (media.userStatus == "REPEATING") media.userStatus!! else "CURRENT"
|
||||
)
|
||||
toast(currContext()?.getString(R.string.setting_progress, a))
|
||||
}
|
||||
media.userProgress = a
|
||||
Refresh.all()
|
||||
}
|
||||
media.userProgress = a
|
||||
Refresh.all()
|
||||
} else {
|
||||
toast(currContext()?.getString(R.string.login_anilist_account))
|
||||
}
|
||||
} else {
|
||||
toast(currContext()?.getString(R.string.login_anilist_account))
|
||||
toast("Sneaky sneaky :3")
|
||||
}
|
||||
}
|
|
@ -998,7 +998,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
preloading = false
|
||||
val context = this
|
||||
|
||||
if (isOnline(context) && Discord.token != null) {
|
||||
val incognito = this.getSharedPreferences("Dantotsu", MODE_PRIVATE)
|
||||
.getBoolean("incognito", false)
|
||||
if (isOnline(context) && Discord.token != null && !incognito) {
|
||||
lifecycleScope.launch {
|
||||
val presence = RPC.createPresence(RPC.Companion.RPCData(
|
||||
applicationId = Discord.application_Id,
|
||||
|
@ -1158,6 +1160,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true)
|
||||
AlertDialog.Builder(this, R.style.MyPopup)
|
||||
.setTitle(getString(R.string.auto_update, media.userPreferredName))
|
||||
.setMessage(getString(R.string.incognito_will_not_update))
|
||||
.apply {
|
||||
setOnCancelListener { hideSystemBars() }
|
||||
setCancelable(false)
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.view.*
|
|||
import android.view.KeyEvent.*
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import android.widget.AdapterView
|
||||
import android.widget.CheckBox
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -253,20 +254,22 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
showProgressDialog =
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") != true else false
|
||||
progressDialog =
|
||||
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true)
|
||||
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) {
|
||||
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
||||
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
|
||||
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
|
||||
checkbox.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) progressDialog = null
|
||||
saveData("${media.id}_progressDialog", isChecked)
|
||||
showProgressDialog = isChecked
|
||||
}
|
||||
AlertDialog.Builder(this, R.style.MyPopup)
|
||||
.setTitle(getString(R.string.title_update_progress)).apply {
|
||||
setMultiChoiceItems(
|
||||
arrayOf(getString(R.string.dont_ask_again, media.userPreferredName)),
|
||||
booleanArrayOf(false)
|
||||
) { _, _, isChecked ->
|
||||
if (isChecked) progressDialog = null
|
||||
saveData("${media.id}_progressDialog", isChecked)
|
||||
showProgressDialog = isChecked
|
||||
}
|
||||
.setTitle(getString(R.string.title_update_progress))
|
||||
.setView(dialogView)
|
||||
.apply {
|
||||
setOnCancelListener { hideBars() }
|
||||
}
|
||||
else null
|
||||
} else null
|
||||
|
||||
//Chapter Change
|
||||
fun change(index: Int) {
|
||||
|
@ -329,7 +332,9 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
chaptersTitleArr.getOrNull(currentChapterIndex - 1) ?: ""
|
||||
applySettings()
|
||||
val context = this
|
||||
if (isOnline(context) && Discord.token != null) {
|
||||
val incognito = context.getSharedPreferences("Dantotsu", 0)
|
||||
?.getBoolean("incognito", false) ?: false
|
||||
if (isOnline(context) && Discord.token != null && !incognito) {
|
||||
lifecycleScope.launch {
|
||||
val presence = RPC.createPresence(
|
||||
RPC.Companion.RPCData(
|
||||
|
|
|
@ -416,6 +416,16 @@ class SettingsActivity : AppCompatActivity() {
|
|||
uiTheme(true, it)
|
||||
}
|
||||
|
||||
binding.settingsIncognito.isChecked =
|
||||
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean(
|
||||
"incognito",
|
||||
false
|
||||
)
|
||||
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
|
||||
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
|
||||
.putBoolean("incognito", isChecked).apply()
|
||||
}
|
||||
|
||||
var previousStart: View = when (uiSettings.defaultStartUpTab) {
|
||||
0 -> binding.uiSettingsAnime
|
||||
1 -> binding.uiSettingsHome
|
||||
|
|
6
app/src/main/res/drawable/ic_incognito_24.xml
Normal file
6
app/src/main/res/drawable/ic_incognito_24.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<vector android:height="24dp" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#212121" android:fillType="nonZero"
|
||||
android:pathData="M17.5,12C19.985,12 22,14.015 22,16.5C22,18.985 19.985,21 17.5,21C15.359,21 13.567,19.505 13.112,17.502L10.888,17.502C10.433,19.505 8.641,21 6.5,21C4.015,21 2,18.985 2,16.5C2,14.015 4.015,12 6.5,12C8.816,12 10.724,13.75 10.973,16L13.027,16C13.276,13.75 15.184,12 17.5,12ZM6.5,13.5C4.843,13.5 3.5,14.843 3.5,16.5C3.5,18.157 4.843,19.5 6.5,19.5C8.157,19.5 9.5,18.157 9.5,16.5C9.5,14.843 8.157,13.5 6.5,13.5ZM17.5,13.5C15.843,13.5 14.5,14.843 14.5,16.5C14.5,18.157 15.843,19.5 17.5,19.5C19.157,19.5 20.5,18.157 20.5,16.5C20.5,14.843 19.157,13.5 17.5,13.5ZM12,9.25C15.389,9.25 18.53,9.59 21.422,10.27C21.825,10.365 22.075,10.769 21.98,11.172C21.885,11.575 21.481,11.825 21.078,11.73C18.303,11.077 15.277,10.75 12,10.75C8.723,10.75 5.697,11.077 2.922,11.73C2.519,11.825 2.115,11.575 2.02,11.172C1.925,10.769 2.175,10.365 2.578,10.27C5.47,9.59 8.611,9.25 12,9.25ZM15.7,3.25C16.723,3.25 17.656,3.817 18.13,4.712L18.213,4.883L19.685,8.195C19.854,8.574 19.683,9.017 19.305,9.185C18.958,9.34 18.556,9.209 18.362,8.895L18.315,8.805L16.843,5.492C16.66,5.082 16.274,4.804 15.834,4.757L15.7,4.75L8.3,4.75C7.851,4.75 7.44,4.99 7.218,5.373L7.157,5.492L5.685,8.805C5.517,9.183 5.074,9.354 4.695,9.185C4.348,9.031 4.176,8.646 4.28,8.291L4.315,8.195L5.787,4.883C6.202,3.948 7.099,3.327 8.109,3.257L8.3,3.25L15.7,3.25Z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1"/>
|
||||
</vector>
|
|
@ -573,6 +573,24 @@
|
|||
app:drawableStartCompat="@drawable/ic_round_help_24"
|
||||
app:drawableTint="?attr/colorPrimary" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/settingsIncognito"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:drawableStart="@drawable/ic_incognito_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:minHeight="64dp"
|
||||
android:text="@string/incognito_mode"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track" />
|
||||
|
||||
|
||||
</ani.dantotsu.others.Xpandable>
|
||||
|
||||
|
|
25
app/src/main/res/layout/item_custom_dialog.xml
Normal file
25
app/src/main/res/layout/item_custom_dialog.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/incognito_will_not_update"
|
||||
android:paddingBottom="16dp"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/dialog_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dont_ask_again"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_bold"/>
|
||||
</LinearLayout>
|
|
@ -493,6 +493,7 @@
|
|||
<string name="auto_update">Auto Update progress for %1$s?</string>
|
||||
<string name="continue_from">Continue from %1$s?</string>
|
||||
<string name="title_update_progress">Update progress on anilist?</string>
|
||||
<string name="incognito_will_not_update">Incognito mode will still ignore progress.</string>
|
||||
<string name="dont_ask_again">"Don\'t ask again for %1$s"</string>
|
||||
<string name="default_speed">Default Speed</string>
|
||||
<string name="default_resize_mode">Default Resize Mode</string>
|
||||
|
@ -628,9 +629,19 @@
|
|||
<string name="extensions_settings">Extensions</string>
|
||||
<string name="NSFWExtention">NSFW Extensions</string>
|
||||
<string name="skip_loading_extension_icons">Skip loading extension icons</string>
|
||||
<string name="use_material_you">Use Material You</string>
|
||||
<string name="use_material_you">Material You</string>
|
||||
<string name="extension_specific_dns">Extension-specific DNS</string>
|
||||
<string name="theme_">Theme:</string>
|
||||
<string name="user_agent">User Agent</string>
|
||||
<string name="custom_theme">Custom Theme</string>
|
||||
<string name="use_custom_theme">Custom theme</string>
|
||||
<string name="use_unique_theme_for_each_item">Color same as Anime/Manga cover</string>
|
||||
<string name="oled_theme_variant">OLED theme variant</string>
|
||||
<string name="installed_anime">Installed Anime</string>
|
||||
<string name="available_anime">Available Anime</string>
|
||||
<string name="installed_manga">Installed Manga</string>
|
||||
<string name="color_picker">Color Picker</string>
|
||||
<string name="random_selection">Random Selection</string>
|
||||
<string name="incognito_mode">Incognito Mode</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -493,6 +493,7 @@
|
|||
<string name="auto_update">Auto Update progress for %1$s?</string>
|
||||
<string name="continue_from">Continue from %1$s?</string>
|
||||
<string name="title_update_progress">Update progress on anilist?</string>
|
||||
<string name="incognito_will_not_update">Incognito mode will still ignore progress.</string>
|
||||
<string name="dont_ask_again">"Don\'t ask again for %1$s"</string>
|
||||
<string name="default_speed">Default Speed</string>
|
||||
<string name="default_resize_mode">Default Resize Mode</string>
|
||||
|
@ -641,5 +642,6 @@
|
|||
<string name="installed_manga">Installed Manga</string>
|
||||
<string name="color_picker">Color Picker</string>
|
||||
<string name="random_selection">Random Selection</string>
|
||||
<string name="incognito_mode">Incognito Mode</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue