feat: setting to hide red dot
This commit is contained in:
parent
0b32636c1b
commit
b30047804a
8 changed files with 41 additions and 8 deletions
|
@ -349,7 +349,8 @@ class DownloadsManager(private val context: Context) {
|
||||||
private fun getBaseDirectory(context: Context): DocumentFile? {
|
private fun getBaseDirectory(context: Context): DocumentFile? {
|
||||||
val baseDirectory = Uri.parse(PrefManager.getVal<String>(PrefName.DownloadsDir))
|
val baseDirectory = Uri.parse(PrefManager.getVal<String>(PrefName.DownloadsDir))
|
||||||
if (baseDirectory == Uri.EMPTY) return null
|
if (baseDirectory == Uri.EMPTY) return null
|
||||||
return DocumentFile.fromTreeUri(context, baseDirectory)
|
val base = DocumentFile.fromTreeUri(context, baseDirectory) ?: return null
|
||||||
|
return base.findOrCreateFolder(BASE_LOCATION, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val lock = Any()
|
private val lock = Any()
|
||||||
|
@ -364,7 +365,7 @@ class DownloadsManager(private val context: Context) {
|
||||||
createDirectory(validName)
|
createDirectory(validName)
|
||||||
} else {
|
} else {
|
||||||
val folder = findFolder(validName)
|
val folder = findFolder(validName)
|
||||||
return folder ?: createDirectory(validName)
|
folder ?: createDirectory(validName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,8 +111,8 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||||
trendingBinding.searchBar.performClick()
|
trendingBinding.searchBar.performClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
trendingBinding.notificationCount.visibility =
|
trendingBinding.notificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
|
|
||||||
listOf(
|
listOf(
|
||||||
|
@ -295,8 +295,8 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||||
|
|
||||||
fun updateNotificationCount() {
|
fun updateNotificationCount() {
|
||||||
if (this::binding.isInitialized) {
|
if (this::binding.isInitialized) {
|
||||||
trendingBinding.notificationCount.visibility =
|
trendingBinding.notificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ class HomeFragment : Fragment() {
|
||||||
)
|
)
|
||||||
binding.homeUserDataProgressBar.visibility = View.GONE
|
binding.homeUserDataProgressBar.visibility = View.GONE
|
||||||
binding.homeNotificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
binding.homeNotificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
|
|
||||||
binding.homeAnimeList.setOnClickListener {
|
binding.homeAnimeList.setOnClickListener {
|
||||||
|
@ -511,6 +512,7 @@ class HomeFragment : Fragment() {
|
||||||
if (!model.loaded) Refresh.activity[1]!!.postValue(true)
|
if (!model.loaded) Refresh.activity[1]!!.postValue(true)
|
||||||
if (_binding != null) {
|
if (_binding != null) {
|
||||||
binding.homeNotificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
binding.homeNotificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
}
|
}
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
|
@ -80,6 +80,7 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||||
|
|
||||||
updateAvatar()
|
updateAvatar()
|
||||||
trendingBinding.notificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
trendingBinding.notificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
trendingBinding.searchBar.hint = "MANGA"
|
trendingBinding.searchBar.hint = "MANGA"
|
||||||
trendingBinding.searchBarText.setOnClickListener {
|
trendingBinding.searchBarText.setOnClickListener {
|
||||||
|
@ -296,8 +297,8 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||||
|
|
||||||
fun updateNotificationCount() {
|
fun updateNotificationCount() {
|
||||||
if (this::binding.isInitialized) {
|
if (this::binding.isInitialized) {
|
||||||
trendingBinding.notificationCount.visibility =
|
trendingBinding.notificationCount.isVisible = Anilist.unreadNotificationCount > 0
|
||||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
&& PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot) == true
|
||||||
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,10 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
|
||||||
PrefManager.setVal(PrefName.ImmersiveMode, isChecked)
|
PrefManager.setVal(PrefName.ImmersiveMode, isChecked)
|
||||||
restartApp()
|
restartApp()
|
||||||
}
|
}
|
||||||
|
binding.uiSettingsHideRedDot.isChecked = !PrefManager.getVal<Boolean>(PrefName.ShowNotificationRedDot)
|
||||||
|
binding.uiSettingsHideRedDot.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
PrefManager.setVal(PrefName.ShowNotificationRedDot, !isChecked)
|
||||||
|
}
|
||||||
binding.uiSettingsBannerAnimation.isChecked = PrefManager.getVal(PrefName.BannerAnimations)
|
binding.uiSettingsBannerAnimation.isChecked = PrefManager.getVal(PrefName.BannerAnimations)
|
||||||
binding.uiSettingsBannerAnimation.setOnCheckedChangeListener { _, isChecked ->
|
binding.uiSettingsBannerAnimation.setOnCheckedChangeListener { _, isChecked ->
|
||||||
PrefManager.setVal(PrefName.BannerAnimations, isChecked)
|
PrefManager.setVal(PrefName.BannerAnimations, isChecked)
|
||||||
|
|
|
@ -82,6 +82,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||||
MangaListSortOrder(Pref(Location.UI, String::class, "score")),
|
MangaListSortOrder(Pref(Location.UI, String::class, "score")),
|
||||||
CommentSortOrder(Pref(Location.UI, String::class, "newest")),
|
CommentSortOrder(Pref(Location.UI, String::class, "newest")),
|
||||||
FollowerLayout(Pref(Location.UI, Int::class, 0)),
|
FollowerLayout(Pref(Location.UI, Int::class, 0)),
|
||||||
|
ShowNotificationRedDot(Pref(Location.UI, Boolean::class, true)),
|
||||||
|
|
||||||
|
|
||||||
//Player
|
//Player
|
||||||
|
|
|
@ -122,6 +122,29 @@
|
||||||
|
|
||||||
</com.google.android.material.materialswitch.MaterialSwitch>
|
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/uiSettingsHideRedDot"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:checked="true"
|
||||||
|
android:drawableStart="@drawable/ic_round_notifications_active_24"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:elegantTextHeight="true"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:minHeight="64dp"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/hide_notification_dot"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
app:cornerRadius="0dp"
|
||||||
|
app:drawableTint="?attr/colorPrimary"
|
||||||
|
app:showText="false"
|
||||||
|
app:thumbTint="@color/button_switch_track">
|
||||||
|
|
||||||
|
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
|
|
|
@ -1028,5 +1028,6 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
||||||
<string name="bio_prompt_info_title">Biometric Authentication</string>
|
<string name="bio_prompt_info_title">Biometric Authentication</string>
|
||||||
<string name="bio_prompt_info_desc">Use your fingerprint or face to unlock the app</string>
|
<string name="bio_prompt_info_desc">Use your fingerprint or face to unlock the app</string>
|
||||||
<string name="enable_forgot_password">Enable Forgot Password (hold clear button for 10 seconds)</string>
|
<string name="enable_forgot_password">Enable Forgot Password (hold clear button for 10 seconds)</string>
|
||||||
|
<string name="hide_notification_dot">Hide Notification Dot</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue