clean Sad's shit
This commit is contained in:
parent
84e300482a
commit
cc5b512441
53 changed files with 652 additions and 466 deletions
|
@ -9,9 +9,7 @@ import android.text.TextWatcher
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AutoCompleteTextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
|
@ -117,17 +115,17 @@ class ExtensionsActivity : AppCompatActivity() {
|
|||
|
||||
initActivity(this)
|
||||
binding.languageselect.visibility = View.GONE
|
||||
/* TODO
|
||||
binding.languageselect.setOnClickListener {
|
||||
val popup = PopupMenu(this, it)
|
||||
popup.inflate(R.menu.launguage_selector_menu)
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
true
|
||||
}
|
||||
popup.setOnDismissListener {
|
||||
}
|
||||
popup.show()
|
||||
}*/
|
||||
/* TODO
|
||||
binding.languageselect.setOnClickListener {
|
||||
val popup = PopupMenu(this, it)
|
||||
popup.inflate(R.menu.launguage_selector_menu)
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
true
|
||||
}
|
||||
popup.setOnDismissListener {
|
||||
}
|
||||
popup.show()
|
||||
}*/
|
||||
binding.settingsContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
bottomMargin = navBarHeight
|
||||
|
|
|
@ -18,83 +18,83 @@ class FAQActivity : AppCompatActivity() {
|
|||
|
||||
Triple(
|
||||
R.drawable.ic_round_help_24,
|
||||
currContext()?.getString(R.string.question_1)?:"",
|
||||
currContext()?.getString(R.string.answer_1)?:""
|
||||
currContext()?.getString(R.string.question_1) ?: "",
|
||||
currContext()?.getString(R.string.answer_1) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_auto_awesome_24,
|
||||
currContext()?.getString(R.string.question_2)?:"",
|
||||
currContext()?.getString(R.string.answer_2)?:""
|
||||
currContext()?.getString(R.string.question_2) ?: "",
|
||||
currContext()?.getString(R.string.answer_2) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_auto_awesome_24,
|
||||
currContext()?.getString(R.string.question_17)?:"",
|
||||
currContext()?.getString(R.string.answer_17)?:""
|
||||
currContext()?.getString(R.string.question_17) ?: "",
|
||||
currContext()?.getString(R.string.answer_17) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_download_24,
|
||||
currContext()?.getString(R.string.question_3)?:"",
|
||||
currContext()?.getString(R.string.answer_3)?:""
|
||||
currContext()?.getString(R.string.question_3) ?: "",
|
||||
currContext()?.getString(R.string.answer_3) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_help_24,
|
||||
currContext()?.getString(R.string.question_16)?:"",
|
||||
currContext()?.getString(R.string.answer_16)?:""
|
||||
currContext()?.getString(R.string.question_16) ?: "",
|
||||
currContext()?.getString(R.string.answer_16) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_dns_24,
|
||||
currContext()?.getString(R.string.question_4)?:"",
|
||||
currContext()?.getString(R.string.answer_4)?:""
|
||||
currContext()?.getString(R.string.question_4) ?: "",
|
||||
currContext()?.getString(R.string.answer_4) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_baseline_screen_lock_portrait_24,
|
||||
currContext()?.getString(R.string.question_5)?:"",
|
||||
currContext()?.getString(R.string.answer_5)?:""
|
||||
currContext()?.getString(R.string.question_5) ?: "",
|
||||
currContext()?.getString(R.string.answer_5) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_anilist,
|
||||
currContext()?.getString(R.string.question_6)?:"",
|
||||
currContext()?.getString(R.string.answer_6)?:""
|
||||
currContext()?.getString(R.string.question_6) ?: "",
|
||||
currContext()?.getString(R.string.answer_6) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_movie_filter_24,
|
||||
currContext()?.getString(R.string.question_7)?:"",
|
||||
currContext()?.getString(R.string.answer_7)?:""
|
||||
currContext()?.getString(R.string.question_7) ?: "",
|
||||
currContext()?.getString(R.string.answer_7) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_lock_open_24,
|
||||
currContext()?.getString(R.string.question_9)?:"",
|
||||
currContext()?.getString(R.string.answer_9)?:""
|
||||
currContext()?.getString(R.string.question_9) ?: "",
|
||||
currContext()?.getString(R.string.answer_9) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_smart_button_24,
|
||||
currContext()?.getString(R.string.question_10)?:"",
|
||||
currContext()?.getString(R.string.answer_10)?:""
|
||||
currContext()?.getString(R.string.question_10) ?: "",
|
||||
currContext()?.getString(R.string.answer_10) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_smart_button_24,
|
||||
currContext()?.getString(R.string.question_11)?:"",
|
||||
currContext()?.getString(R.string.answer_11)?:""
|
||||
currContext()?.getString(R.string.question_11) ?: "",
|
||||
currContext()?.getString(R.string.answer_11) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_info_24,
|
||||
currContext()?.getString(R.string.question_12)?:"",
|
||||
currContext()?.getString(R.string.answer_12)?:""
|
||||
currContext()?.getString(R.string.question_12) ?: "",
|
||||
currContext()?.getString(R.string.answer_12) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_help_24,
|
||||
currContext()?.getString(R.string.question_13)?:"",
|
||||
currContext()?.getString(R.string.answer_13)?:""
|
||||
currContext()?.getString(R.string.question_13) ?: "",
|
||||
currContext()?.getString(R.string.answer_13) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_art_track_24,
|
||||
currContext()?.getString(R.string.question_14)?:"",
|
||||
currContext()?.getString(R.string.answer_14)?:""
|
||||
currContext()?.getString(R.string.question_14) ?: "",
|
||||
currContext()?.getString(R.string.answer_14) ?: ""
|
||||
),
|
||||
Triple(
|
||||
R.drawable.ic_round_video_settings_24,
|
||||
currContext()?.getString(R.string.question_15)?:"",
|
||||
currContext()?.getString(R.string.answer_15)?:""
|
||||
currContext()?.getString(R.string.question_15) ?: "",
|
||||
currContext()?.getString(R.string.answer_15) ?: ""
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
|
|||
private val animeExtensionManager: AnimeExtensionManager = Injekt.get()
|
||||
private val extensionsAdapter = AnimeExtensionsAdapter(
|
||||
{ pkg ->
|
||||
val name= pkg.name
|
||||
val name = pkg.name
|
||||
val changeUIVisibility: (Boolean) -> Unit = { show ->
|
||||
val activity = requireActivity() as ExtensionsActivity
|
||||
val visibility = if (show) View.VISIBLE else View.GONE
|
||||
|
@ -58,7 +58,8 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
|
|||
activity.findViewById<TabLayout>(R.id.tabLayout).visibility = visibility
|
||||
activity.findViewById<TextInputLayout>(R.id.searchView).visibility = visibility
|
||||
activity.findViewById<ImageView>(R.id.languageselect).visibility = visibility
|
||||
activity.findViewById<TextView>(R.id.extensions).text = if (show) getString(R.string.extensions) else name
|
||||
activity.findViewById<TextView>(R.id.extensions).text =
|
||||
if (show) getString(R.string.extensions) else name
|
||||
activity.findViewById<FrameLayout>(R.id.fragmentExtensionsContainer).visibility =
|
||||
if (show) View.GONE else View.VISIBLE
|
||||
}
|
||||
|
@ -67,7 +68,8 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
|
|||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names = allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
val names = allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||
.toTypedArray()
|
||||
var selectedIndex = 0
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
|
|
|
@ -47,72 +47,76 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler {
|
|||
private lateinit var extensionsRecyclerView: RecyclerView
|
||||
private val skipIcons = loadData("skip_extension_icons") ?: false
|
||||
private val mangaExtensionManager: MangaExtensionManager = Injekt.get()
|
||||
private val extensionsAdapter = MangaExtensionsAdapter({ pkg ->
|
||||
val name= pkg.name
|
||||
val changeUIVisibility: (Boolean) -> Unit = { show ->
|
||||
val activity = requireActivity() as ExtensionsActivity
|
||||
val visibility = if (show) View.VISIBLE else View.GONE
|
||||
activity.findViewById<ViewPager2>(R.id.viewPager).visibility = visibility
|
||||
activity.findViewById<TabLayout>(R.id.tabLayout).visibility = visibility
|
||||
activity.findViewById<TextInputLayout>(R.id.searchView).visibility = visibility
|
||||
activity.findViewById<ImageView>(R.id.languageselect).visibility = visibility
|
||||
activity.findViewById<TextView>(R.id.extensions).text = if (show) getString(R.string.extensions) else name
|
||||
activity.findViewById<FrameLayout>(R.id.fragmentExtensionsContainer).visibility =
|
||||
if (show) View.GONE else View.VISIBLE
|
||||
}
|
||||
var itemSelected = false
|
||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableSource>()
|
||||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names = allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
var selectedIndex = 0
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
.setSingleChoiceItems(names, selectedIndex) { dialog, which ->
|
||||
itemSelected = true
|
||||
selectedIndex = which
|
||||
selectedSetting = allSettings[selectedIndex]
|
||||
dialog.dismiss()
|
||||
private val extensionsAdapter = MangaExtensionsAdapter(
|
||||
{ pkg ->
|
||||
val name = pkg.name
|
||||
val changeUIVisibility: (Boolean) -> Unit = { show ->
|
||||
val activity = requireActivity() as ExtensionsActivity
|
||||
val visibility = if (show) View.VISIBLE else View.GONE
|
||||
activity.findViewById<ViewPager2>(R.id.viewPager).visibility = visibility
|
||||
activity.findViewById<TabLayout>(R.id.tabLayout).visibility = visibility
|
||||
activity.findViewById<TextInputLayout>(R.id.searchView).visibility = visibility
|
||||
activity.findViewById<ImageView>(R.id.languageselect).visibility = visibility
|
||||
activity.findViewById<TextView>(R.id.extensions).text =
|
||||
if (show) getString(R.string.extensions) else name
|
||||
activity.findViewById<FrameLayout>(R.id.fragmentExtensionsContainer).visibility =
|
||||
if (show) View.GONE else View.VISIBLE
|
||||
}
|
||||
var itemSelected = false
|
||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableSource>()
|
||||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names = allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||
.toTypedArray()
|
||||
var selectedIndex = 0
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
.setSingleChoiceItems(names, selectedIndex) { dialog, which ->
|
||||
itemSelected = true
|
||||
selectedIndex = which
|
||||
selectedSetting = allSettings[selectedIndex]
|
||||
dialog.dismiss()
|
||||
|
||||
// Move the fragment transaction here
|
||||
val fragment =
|
||||
MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {
|
||||
// Move the fragment transaction here
|
||||
val fragment =
|
||||
MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {
|
||||
changeUIVisibility(true)
|
||||
}
|
||||
parentFragmentManager.beginTransaction()
|
||||
.setCustomAnimations(R.anim.slide_up, R.anim.slide_down)
|
||||
.replace(R.id.fragmentExtensionsContainer, fragment)
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
.setOnDismissListener {
|
||||
if (!itemSelected) {
|
||||
changeUIVisibility(true)
|
||||
}
|
||||
parentFragmentManager.beginTransaction()
|
||||
.setCustomAnimations(R.anim.slide_up, R.anim.slide_down)
|
||||
.replace(R.id.fragmentExtensionsContainer, fragment)
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
.setOnDismissListener {
|
||||
if (!itemSelected) {
|
||||
}
|
||||
.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
} else {
|
||||
// If there's only one setting, proceed with the fragment transaction
|
||||
val fragment =
|
||||
MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {
|
||||
changeUIVisibility(true)
|
||||
}
|
||||
}
|
||||
.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
} else {
|
||||
// If there's only one setting, proceed with the fragment transaction
|
||||
val fragment = MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {
|
||||
changeUIVisibility(true)
|
||||
parentFragmentManager.beginTransaction()
|
||||
.setCustomAnimations(R.anim.slide_up, R.anim.slide_down)
|
||||
.replace(R.id.fragmentExtensionsContainer, fragment)
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
parentFragmentManager.beginTransaction()
|
||||
.setCustomAnimations(R.anim.slide_up, R.anim.slide_down)
|
||||
.replace(R.id.fragmentExtensionsContainer, fragment)
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
|
||||
// Hide ViewPager2 and TabLayout
|
||||
changeUIVisibility(false)
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Source is not configurable", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
},
|
||||
{ pkg: MangaExtension.Installed , forceDelete: Boolean ->
|
||||
// Hide ViewPager2 and TabLayout
|
||||
changeUIVisibility(false)
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Source is not configurable", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
},
|
||||
{ pkg: MangaExtension.Installed, forceDelete: Boolean ->
|
||||
if (isAdded) { // Check if the fragment is currently added to its activity
|
||||
val context = requireContext() // Store context in a variable
|
||||
val notificationManager =
|
||||
|
|
|
@ -39,10 +39,11 @@ class InstalledNovelExtensionsFragment : Fragment(), SearchQueryHandler {
|
|||
private lateinit var extensionsRecyclerView: RecyclerView
|
||||
val skipIcons = loadData("skip_extension_icons") ?: false
|
||||
private val novelExtensionManager: NovelExtensionManager = Injekt.get()
|
||||
private val extensionsAdapter = NovelExtensionsAdapter({ pkg ->
|
||||
Toast.makeText(requireContext(), "Source is not configurable", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
},
|
||||
private val extensionsAdapter = NovelExtensionsAdapter(
|
||||
{ pkg ->
|
||||
Toast.makeText(requireContext(), "Source is not configurable", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
},
|
||||
{ pkg, forceDelete ->
|
||||
if (isAdded) { // Check if the fragment is currently added to its activity
|
||||
val context = requireContext() // Store context in a variable
|
||||
|
|
|
@ -97,7 +97,21 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
|
||||
|
||||
val speeds =
|
||||
arrayOf(0.25f, 0.33f, 0.5f, 0.66f, 0.75f, 1f, 1.15f, 1.25f, 1.33f, 1.5f, 1.66f, 1.75f, 2f)
|
||||
arrayOf(
|
||||
0.25f,
|
||||
0.33f,
|
||||
0.5f,
|
||||
0.66f,
|
||||
0.75f,
|
||||
1f,
|
||||
1.15f,
|
||||
1.25f,
|
||||
1.33f,
|
||||
1.5f,
|
||||
1.66f,
|
||||
1.75f,
|
||||
2f
|
||||
)
|
||||
val cursedSpeeds = arrayOf(1f, 1.25f, 1.5f, 1.75f, 2f, 2.5f, 3f, 4f, 5f, 10f, 25f, 50f)
|
||||
var curSpeedArr = if (settings.cursedSpeeds) cursedSpeeds else speeds
|
||||
var speedsName = curSpeedArr.map { "${it}x" }.toTypedArray()
|
||||
|
@ -106,13 +120,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme)
|
||||
.setTitle(getString(R.string.default_speed))
|
||||
binding.playerSettingsSpeed.setOnClickListener {
|
||||
val dialog = speedDialog.setSingleChoiceItems(speedsName, settings.defaultSpeed) { dialog, i ->
|
||||
settings.defaultSpeed = i
|
||||
binding.playerSettingsSpeed.text =
|
||||
getString(R.string.default_playback_speed, speedsName[i])
|
||||
saveData(player, settings)
|
||||
dialog.dismiss()
|
||||
}.show()
|
||||
val dialog =
|
||||
speedDialog.setSingleChoiceItems(speedsName, settings.defaultSpeed) { dialog, i ->
|
||||
settings.defaultSpeed = i
|
||||
binding.playerSettingsSpeed.text =
|
||||
getString(R.string.default_playback_speed, speedsName[i])
|
||||
saveData(player, settings)
|
||||
dialog.dismiss()
|
||||
}.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
}
|
||||
|
||||
|
@ -256,11 +271,12 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
val resizeDialog = AlertDialog.Builder(this, R.style.DialogTheme)
|
||||
.setTitle(getString(R.string.default_resize_mode))
|
||||
binding.playerResizeMode.setOnClickListener {
|
||||
val dialog = resizeDialog.setSingleChoiceItems(resizeModes, settings.resize) { dialog, count ->
|
||||
settings.resize = count
|
||||
saveData(player, settings)
|
||||
dialog.dismiss()
|
||||
}.show()
|
||||
val dialog =
|
||||
resizeDialog.setSingleChoiceItems(resizeModes, settings.resize) { dialog, count ->
|
||||
settings.resize = count
|
||||
saveData(player, settings)
|
||||
dialog.dismiss()
|
||||
}.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
}
|
||||
fun restartApp() {
|
||||
|
@ -382,7 +398,10 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
val outlineDialog = AlertDialog.Builder(this, R.style.DialogTheme)
|
||||
.setTitle(getString(R.string.outline_type))
|
||||
binding.videoSubOutline.setOnClickListener {
|
||||
val dialog = outlineDialog.setSingleChoiceItems(typesOutline, settings.outline) { dialog, count ->
|
||||
val dialog = outlineDialog.setSingleChoiceItems(
|
||||
typesOutline,
|
||||
settings.outline
|
||||
) { dialog, count ->
|
||||
settings.outline = count
|
||||
saveData(player, settings)
|
||||
dialog.dismiss()
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package ani.dantotsu.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.NoPaddingArrayAdapter
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ActivityReaderSettingsBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.loadData
|
||||
import ani.dantotsu.media.novel.novelreader.NovelReaderActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.others.LangSet
|
||||
import ani.dantotsu.saveData
|
||||
|
|
|
@ -58,7 +58,7 @@ import uy.kohesive.injekt.api.get
|
|||
import kotlin.random.Random
|
||||
|
||||
|
||||
class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListener {
|
||||
class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListener {
|
||||
private val restartMainActivity = object : OnBackPressedCallback(false) {
|
||||
override fun handleOnBackPressed() = startMainActivity(this@SettingsActivity)
|
||||
}
|
||||
|
@ -67,7 +67,8 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen
|
|||
private val networkPreferences = Injekt.get<NetworkPreferences>()
|
||||
private var cursedCounter = 0
|
||||
|
||||
@OptIn(UnstableApi::class) @SuppressLint("SetTextI18n")
|
||||
@OptIn(UnstableApi::class)
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
LangSet.setLocale(this)
|
||||
|
@ -188,12 +189,14 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen
|
|||
"custom_theme_int",
|
||||
Color.parseColor("#6200EE")
|
||||
)
|
||||
|
||||
class CustomColorDialog : SimpleColorDialog() { //idk where to put it
|
||||
override fun onPositiveButtonClick() {
|
||||
restartApp()
|
||||
super.onPositiveButtonClick()
|
||||
}
|
||||
}
|
||||
|
||||
val tag = "colorPicker"
|
||||
CustomColorDialog().title("Custom Theme")
|
||||
.colorPreset(originalColor)
|
||||
|
@ -240,7 +243,10 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen
|
|||
AlertDialog.Builder(this, R.style.DialogTheme).setTitle("Download Manager")
|
||||
var downloadManager = loadData<Int>("settings_download_manager") ?: 0
|
||||
binding.settingsDownloadManager.setOnClickListener {
|
||||
val dialog = downloadManagerDialog.setSingleChoiceItems(managers, downloadManager) { dialog, count ->
|
||||
val dialog = downloadManagerDialog.setSingleChoiceItems(
|
||||
managers,
|
||||
downloadManager
|
||||
) { dialog, count ->
|
||||
downloadManager = count
|
||||
saveData("settings_download_manager", downloadManager)
|
||||
dialog.dismiss()
|
||||
|
@ -255,7 +261,11 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen
|
|||
.setPositiveButton("Yes") { dialog, _ ->
|
||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||
downloadsManager.purgeDownloads(DownloadedType.Type.ANIME)
|
||||
DownloadService.sendRemoveAllDownloads(this, ExoplayerDownloadService::class.java, false)
|
||||
DownloadService.sendRemoveAllDownloads(
|
||||
this,
|
||||
ExoplayerDownloadService::class.java,
|
||||
false
|
||||
)
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNegativeButton("No") { dialog, _ ->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ani.dantotsu.settings
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
|
@ -9,25 +9,24 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import ani.dantotsu.BottomSheetDialogFragment
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.MainActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.databinding.BottomSheetSettingsBinding
|
||||
import ani.dantotsu.download.manga.OfflineMangaFragment
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.others.imagesearch.ImageSearchActivity
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.startMainActivity
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.home.AnimeFragment
|
||||
import ani.dantotsu.home.HomeFragment
|
||||
import ani.dantotsu.home.LoginFragment
|
||||
import ani.dantotsu.home.MangaFragment
|
||||
import ani.dantotsu.home.NoInternet
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.offline.OfflineFragment
|
||||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.others.imagesearch.ImageSearchActivity
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.startMainActivity
|
||||
|
||||
class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
||||
class SettingsDialogFragment : BottomSheetDialogFragment() {
|
||||
private var _binding: BottomSheetSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
|
@ -36,8 +35,10 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
pageType = arguments?.getSerializable("pageType") as? PageType ?: PageType.HOME
|
||||
pageType2 = arguments?.getSerializable("pageType2") as? PageType2 ?: PageType2.OfflineMANGA // changed when offline home page comes
|
||||
pageType2 = arguments?.getSerializable("pageType2") as? PageType2
|
||||
?: PageType2.OfflineMANGA // changed when offline home page comes
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
@ -81,8 +82,8 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
) ?: false
|
||||
|
||||
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||
?.putBoolean("incognito", isChecked)?.apply()
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||
?.putBoolean("incognito", isChecked)?.apply()
|
||||
}
|
||||
binding.settingsExtensionSettings.setSafeOnClickListener {
|
||||
startActivity(Intent(activity, ExtensionsActivity::class.java))
|
||||
|
@ -102,7 +103,8 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
}
|
||||
|
||||
binding.settingsDownloads.isChecked =
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.getBoolean("offlineMode", false) ?: false
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
?.getBoolean("offlineMode", false) ?: false
|
||||
binding.settingsDownloads.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
||||
if (!isChecked) {
|
||||
|
@ -112,11 +114,16 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
intent.putExtra("FRAGMENT_CLASS_NAME", MangaFragment::class.java.name)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
PageType2.OfflineHOME -> { //no offline home for now
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", if (Anilist.token != null) HomeFragment::class.java.name else LoginFragment::class.java.name)
|
||||
intent.putExtra(
|
||||
"FRAGMENT_CLASS_NAME",
|
||||
if (Anilist.token != null) HomeFragment::class.java.name else LoginFragment::class.java.name
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
PageType2.OfflineANIME -> { //no offline anime for now
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", AnimeFragment::class.java.name)
|
||||
|
@ -127,14 +134,19 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
when (pageType) {
|
||||
PageType.MANGA -> {
|
||||
val intent = Intent(activity, NoInternet::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", OfflineMangaFragment::class.java.name)
|
||||
intent.putExtra(
|
||||
"FRAGMENT_CLASS_NAME",
|
||||
OfflineMangaFragment::class.java.name
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
PageType.ANIME -> {
|
||||
val intent = Intent(activity, NoInternet::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", OfflineFragment::class.java.name)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
PageType.ANIME -> {
|
||||
val intent = Intent(activity, NoInternet::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", OfflineFragment::class.java.name)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
PageType.HOME -> {
|
||||
val intent = Intent(activity, NoInternet::class.java)
|
||||
intent.putExtra("FRAGMENT_CLASS_NAME", OfflineFragment::class.java.name)
|
||||
|
@ -145,8 +157,8 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
dismiss()
|
||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||
?.putBoolean("offlineMode", isChecked)?.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
|
@ -157,9 +169,11 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
enum class PageType {
|
||||
MANGA, ANIME, HOME
|
||||
}
|
||||
|
||||
enum class PageType2 {
|
||||
OfflineMANGA, OfflineANIME, OfflineHOME
|
||||
}
|
||||
|
||||
fun newInstance(pageType: PageType): SettingsDialogFragment {
|
||||
val fragment = SettingsDialogFragment()
|
||||
val args = Bundle()
|
||||
|
@ -167,6 +181,7 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
|||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
|
||||
fun newInstance2(pageType: PageType2): SettingsDialogFragment {
|
||||
val fragment = SettingsDialogFragment()
|
||||
val args = Bundle()
|
||||
|
|
|
@ -44,14 +44,14 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
|
|||
binding.uiSettingsHomeLayout.setOnClickListener {
|
||||
val dialog = AlertDialog.Builder(this, R.style.DialogTheme)
|
||||
.setTitle(getString(R.string.home_layout_show)).apply {
|
||||
setMultiChoiceItems(
|
||||
views,
|
||||
settings.homeLayoutShow.toBooleanArray()
|
||||
) { _, i, value ->
|
||||
settings.homeLayoutShow[i] = value
|
||||
saveData(ui, settings)
|
||||
}
|
||||
}.show()
|
||||
setMultiChoiceItems(
|
||||
views,
|
||||
settings.homeLayoutShow.toBooleanArray()
|
||||
) { _, i, value ->
|
||||
settings.homeLayoutShow[i] = value
|
||||
saveData(ui, settings)
|
||||
}
|
||||
}.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ class AnimeExtensionPagingSource(
|
|||
} else {
|
||||
availableExtensions.filter { it.name.contains(query, ignoreCase = true) }
|
||||
}
|
||||
val filternfsw = if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
|
||||
val filternfsw =
|
||||
if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
|
||||
return try {
|
||||
val sublist = filternfsw.subList(
|
||||
fromIndex = position,
|
||||
|
|
|
@ -98,7 +98,8 @@ class MangaExtensionPagingSource(
|
|||
} else {
|
||||
availableExtensions.filter { it.name.contains(query, ignoreCase = true) }
|
||||
}
|
||||
val filternfsw = if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
|
||||
val filternfsw =
|
||||
if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
|
||||
return try {
|
||||
val sublist = filternfsw.subList(
|
||||
fromIndex = position,
|
||||
|
@ -192,6 +193,7 @@ class MangaExtensionAdapter(private val clickListener: OnMangaInstallClickListen
|
|||
}
|
||||
|
||||
val extensionIconImageView: ImageView = binding.extensionIconImageView
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun bind(extension: MangaExtension.Available) {
|
||||
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue