Skip to content

Commit

Permalink
no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush2622 committed Feb 1, 2024
1 parent 37a5374 commit 1a346e6
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,10 @@ class AnimeWatchFragment : Fragment() {
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 ->
selectedIndex = which
selectedSetting = allSettings[selectedIndex]
.setSingleChoiceItems(names, -1) { dialog, which ->
selectedSetting = allSettings[which]
itemSelected = true
dialog.dismiss()

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
exoPlayer.seekTo(exoPlayer.currentPosition + settings.skipTime * 1000)
}
exoSkip.setOnLongClickListener {
val dialog = Dialog(this, R.style.DialogTheme)
val dialog = Dialog(this, R.style.MyPopup)
dialog.setContentView(R.layout.item_seekbar_dialog)
dialog.setCancelable(true)
dialog.setCanceledOnTouchOutside(true)
Expand Down Expand Up @@ -1144,7 +1144,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
playbackParameters = PlaybackParameters(speeds[curSpeed])
var speed: Float
val speedDialog =
AlertDialog.Builder(this, R.style.DialogTheme).setTitle(getString(R.string.speed))
AlertDialog.Builder(this, R.style.MyPopup).setTitle(getString(R.string.speed))
exoSpeed.setOnClickListener {
val dialog = speedDialog.setSingleChoiceItems(speedsName, curSpeed) { dialog, i ->
if (isInitialized) {
Expand Down Expand Up @@ -1413,7 +1413,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
)
)
)
val dialog = AlertDialog.Builder(this, R.style.DialogTheme)
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.continue_from, time)).apply {
setCancelable(false)
setPositiveButton(getString(R.string.yes)) { d, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,10 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
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 ->
selectedIndex = which
selectedSetting = allSettings[selectedIndex]
.setSingleChoiceItems(names, -1) { dialog, which ->
selectedSetting = allSettings[which]
itemSelected = true
dialog.dismiss()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class NovelResponseAdapter(
binding.root.setOnLongClickListener {
val builder = androidx.appcompat.app.AlertDialog.Builder(
fragment.requireContext(),
R.style.DialogTheme
R.style.MyPopup
)
builder.setTitle("Delete ${novel.name}?")
builder.setMessage("Are you sure you want to delete ${novel.name}?")
Expand Down
31 changes: 17 additions & 14 deletions app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package ani.dantotsu.settings

import android.annotation.SuppressLint
import android.app.AlertDialog
import android.os.Build.*
import android.os.Build.VERSION.*
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.View
import android.view.ViewGroup
import android.widget.AutoCompleteTextView
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -16,6 +16,9 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import ani.dantotsu.*
import ani.dantotsu.databinding.ActivityExtensionsBinding
import ani.dantotsu.others.LanguageMapper
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.settings.saving.PrefWrapper
import ani.dantotsu.themes.ThemeManager
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
Expand Down Expand Up @@ -111,20 +114,20 @@ 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()
}*/
binding.languageselect.setOnClickListener {
val languageOptions = LanguageMapper.Companion.Language.entries.map{ it.name }.toTypedArray()
val builder = AlertDialog.Builder(currContext(), R.style.MyPopup)
val listOrder = PrefWrapper.getVal(PrefName.LangSort,"all")
val index = LanguageMapper.Companion.Language.entries.toTypedArray().indexOfFirst{it.code == listOrder}
builder.setTitle("Language")
builder.setSingleChoiceItems(languageOptions, index){ dialog, i ->
PrefWrapper.setVal(PrefName.LangSort, LanguageMapper.Companion.Language.entries[i].code)
dialog.dismiss()
}
val dialog = builder.show()
dialog.window?.setDimAmount(0.8f)
}
binding.settingsContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
var speedsName = curSpeedArr.map { "${it}x" }.toTypedArray()
binding.playerSettingsSpeed.text =
getString(R.string.default_playback_speed, speedsName[settings.defaultSpeed])
val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val speedDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.default_speed))
binding.playerSettingsSpeed.setOnClickListener {
val dialog =
Expand Down Expand Up @@ -246,7 +246,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
}

val resizeModes = arrayOf("Original", "Zoom", "Stretch")
val resizeDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val resizeDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.default_resize_mode))
binding.playerResizeMode.setOnClickListener {
val dialog =
Expand Down Expand Up @@ -332,7 +332,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
"Blue",
"Magenta"
)
val primaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val primaryColorDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.primary_sub_color))
binding.videoSubColorPrimary.setOnClickListener {
val dialog = primaryColorDialog.setSingleChoiceItems(
Expand All @@ -359,7 +359,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
"Magenta",
"Transparent"
)
val secondaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val secondaryColorDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorSecondary.setOnClickListener {
val dialog = secondaryColorDialog.setSingleChoiceItems(
Expand All @@ -373,7 +373,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
dialog.window?.setDimAmount(0.8f)
}
val typesOutline = arrayOf("Outline", "Shine", "Drop Shadow", "None")
val outlineDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val outlineDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.outline_type))
binding.videoSubOutline.setOnClickListener {
val dialog = outlineDialog.setSingleChoiceItems(
Expand All @@ -400,7 +400,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
"Blue",
"Magenta"
)
val subBackgroundDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val subBackgroundDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorBackground.setOnClickListener {
val dialog = subBackgroundDialog.setSingleChoiceItems(
Expand Down Expand Up @@ -428,7 +428,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
"Blue",
"Magenta"
)
val subWindowDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val subWindowDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorWindow.setOnClickListener {
val dialog = subWindowDialog.setSingleChoiceItems(
Expand All @@ -449,7 +449,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
"Century Gothic",
"Century Gothic Bold"
)
val fontDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val fontDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.subtitle_font))
binding.videoSubFont.setOnClickListener {
val dialog = fontDialog.setSingleChoiceItems(fonts, settings.font) { dialog, count ->
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene

val managers = arrayOf("Default", "1DM", "ADM")
val downloadManagerDialog =
AlertDialog.Builder(this, R.style.DialogTheme).setTitle("Download Manager")
AlertDialog.Builder(this, R.style.MyPopup).setTitle("Download Manager")
var downloadManager = PrefWrapper.getVal(PrefName.DownloadManager, 0)
binding.settingsDownloadManager.setOnClickListener {
val dialog = downloadManagerDialog.setSingleChoiceItems(
Expand Down Expand Up @@ -608,7 +608,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
}.toTypedArray()
binding.settingsSubscriptionsTime.text =
getString(R.string.subscriptions_checking_time_s, timeNames[curTime])
val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme)
val speedDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(R.string.subscriptions_checking_time)
binding.settingsSubscriptionsTime.setOnClickListener {
val dialog = speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {

val views = resources.getStringArray(R.array.home_layouts)
binding.uiSettingsHomeLayout.setOnClickListener {
val dialog = AlertDialog.Builder(this, R.style.DialogTheme)
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.home_layout_show)).apply {
setMultiChoiceItems(
views,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class AnimeExtensionPagingSource(
} else {
availableExtensions.filter { it.name.contains(query, ignoreCase = true) }
}
val filternfsw =
if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
val lang = PrefWrapper.getVal(PrefName.LangSort, "all")
val langFilter = if (lang != "all") filteredExtensions.filter { it.lang == lang } else filteredExtensions
val filternfsw = if (isNsfwEnabled) langFilter else langFilter.filterNot { it.isNsfw }
return try {
val sublist = filternfsw.subList(
fromIndex = position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class MangaExtensionPagingSource(
} else {
availableExtensions.filter { it.name.contains(query, ignoreCase = true) }
}
val filternfsw =
if (isNsfwEnabled) filteredExtensions else filteredExtensions.filterNot { it.isNsfw }
val lang = PrefWrapper.getVal(PrefName.LangSort, "all")
val langFilter = if (lang != "all") filteredExtensions.filter { it.lang == lang } else filteredExtensions
val filternfsw = if (isNsfwEnabled) langFilter else langFilter.filterNot { it.isNsfw }
return try {
val sublist = filternfsw.subList(
fromIndex = position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum class PrefName(val data: Pref) {
AllowOpeningLinks(Pref(Location.Irrelevant, Boolean::class)),
SearchStyle(Pref(Location.Irrelevant, Int::class)),
HasUpdatedPrefs(Pref(Location.Irrelevant, Boolean::class)),
LangSort(Pref(Location.Irrelevant, String::class)),

//Protected
DiscordToken(Pref(Location.Protected, String::class)),
Expand Down
13 changes: 10 additions & 3 deletions app/src/main/res/values/style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,24 @@
</style>

<style name="MyPopup" parent="">
<item name="android:fontFamily">@font/poppins_bold</item>
<item name="android:textColor">?attr/colorOnBackground</item>
<item name="android:popupBackground">?attr/colorSurface</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
<item name="android:fontFamily">@font/poppins_semi_bold</item>
<item name="android:textColor">?attr/colorOnBackground</item>
<item name="android:windowTitleStyle">@style/HeadingText</item>
<item name="android:popupBackground">?attr/colorSurface</item>
<item name="android:windowBackground">@drawable/shape_corner_16dp</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>

<style name="HeadingText">
<item name="android:fontFamily">@font/poppins_bold</item>
<item name="android:textColor">?attr/colorPrimary</item>
<item name="android:textSize">58sp</item>
</style>

<style name="BottomNavBar" parent="">
<!-- set background color to transparent -->
<item name="android:background">@android:color/transparent</item>
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@
<item name="android:navigationBarColor">@color/nav_bg</item>
</style>

<style name="DialogTheme" parent="Theme.Dantotsu">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">@drawable/shape_corner_16dp</item>
</style>

<style name="Theme.Dantotsu.ALLBLACK" parent="Theme.Base">
<item name="colorPrimary">@color/bg_black</item>
<item name="colorOnPrimary">@color/bg_black</item>
Expand Down

0 comments on commit 1a346e6

Please sign in to comment.