mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 08:49:55 +00:00
Add: Prefs fragments
This commit is contained in:
parent
f10a7c09a4
commit
5412f20032
@ -0,0 +1,45 @@
|
||||
package com.looker.droidify.ui.fragments
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.looker.droidify.BuildConfig
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
|
||||
class PrefsOtherFragment : PrefsNavFragmentX() {
|
||||
|
||||
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
|
||||
val preferences = LinearLayoutCompat(scrollLayout.context)
|
||||
preferences.orientation = LinearLayoutCompat.VERTICAL
|
||||
scrollLayout.addView(
|
||||
preferences,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
|
||||
preferences.addCategory(getString(R.string.proxy)) {
|
||||
addEnumeration(Preferences.Key.ProxyType, getString(R.string.proxy_type)) {
|
||||
when (it) {
|
||||
is Preferences.ProxyType.Direct -> getString(R.string.no_proxy)
|
||||
is Preferences.ProxyType.Http -> getString(R.string.http_proxy)
|
||||
is Preferences.ProxyType.Socks -> getString(R.string.socks_proxy)
|
||||
}
|
||||
}
|
||||
addEditString(Preferences.Key.ProxyHost, getString(R.string.proxy_host))
|
||||
addEditInt(Preferences.Key.ProxyPort, getString(R.string.proxy_port), 1..65535)
|
||||
}
|
||||
preferences.addCategory(getString(R.string.credits)) {
|
||||
addText(
|
||||
title = "Based on Foxy-Droid",
|
||||
summary = "FoxyDroid",
|
||||
url = "https://github.com/kitsunyan/foxy-droid/"
|
||||
)
|
||||
addText(
|
||||
title = getString(R.string.application_name),
|
||||
summary = "v ${BuildConfig.VERSION_NAME}",
|
||||
url = "https://github.com/iamlooker/Droid-ify/"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.looker.droidify.ui.fragments
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
|
||||
class PrefsUpdatesFragment : PrefsNavFragmentX() {
|
||||
|
||||
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
|
||||
val preferences = LinearLayoutCompat(scrollLayout.context)
|
||||
preferences.orientation = LinearLayoutCompat.VERTICAL
|
||||
scrollLayout.addView(
|
||||
preferences,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
|
||||
preferences.addCategory(getString(R.string.updates)) {
|
||||
addEnumeration(
|
||||
Preferences.Key.AutoSync,
|
||||
getString(R.string.sync_repositories_automatically)
|
||||
) {
|
||||
when (it) {
|
||||
Preferences.AutoSync.Never -> getString(R.string.never)
|
||||
Preferences.AutoSync.Wifi -> getString(R.string.only_on_wifi)
|
||||
Preferences.AutoSync.WifiBattery -> getString(R.string.only_on_wifi_and_battery)
|
||||
Preferences.AutoSync.Always -> getString(R.string.always)
|
||||
}
|
||||
}
|
||||
addSwitch(
|
||||
Preferences.Key.InstallAfterSync, getString(R.string.install_after_sync),
|
||||
getString(R.string.install_after_sync_summary)
|
||||
)
|
||||
addSwitch(
|
||||
Preferences.Key.UpdateNotify, getString(R.string.notify_about_updates),
|
||||
getString(R.string.notify_about_updates_summary)
|
||||
)
|
||||
addSwitch(
|
||||
Preferences.Key.UpdateUnstable, getString(R.string.unstable_updates),
|
||||
getString(R.string.unstable_updates_summary)
|
||||
)
|
||||
addSwitch(
|
||||
Preferences.Key.IncompatibleVersions, getString(R.string.incompatible_versions),
|
||||
getString(R.string.incompatible_versions_summary)
|
||||
)
|
||||
}
|
||||
preferences.addCategory(getString(R.string.install_types)) {
|
||||
addSwitch(
|
||||
Preferences.Key.RootPermission, getString(R.string.root_permission),
|
||||
getString(R.string.root_permission_description)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.looker.droidify.ui.fragments
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.utility.Utils.getLocaleOfCode
|
||||
import com.looker.droidify.utility.Utils.languagesList
|
||||
import com.looker.droidify.utility.Utils.translateLocale
|
||||
|
||||
class PrefsUserFragment : PrefsNavFragmentX() {
|
||||
|
||||
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
|
||||
val preferences = LinearLayoutCompat(scrollLayout.context)
|
||||
preferences.orientation = LinearLayoutCompat.VERTICAL
|
||||
scrollLayout.addView(
|
||||
preferences,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
|
||||
preferences.addCategory(requireContext().getString(R.string.prefs_personalization)) {
|
||||
addList(
|
||||
Preferences.Key.Language,
|
||||
context.getString(R.string.prefs_language_title),
|
||||
languagesList
|
||||
) { translateLocale(context.getLocaleOfCode(it)) }
|
||||
addEnumeration(Preferences.Key.Theme, getString(R.string.theme)) {
|
||||
when (it) {
|
||||
is Preferences.Theme.System -> getString(R.string.system)
|
||||
is Preferences.Theme.AmoledSystem -> getString(R.string.system) + " " + getString(
|
||||
R.string.amoled
|
||||
)
|
||||
is Preferences.Theme.Light -> getString(R.string.light)
|
||||
is Preferences.Theme.Dark -> getString(R.string.dark)
|
||||
is Preferences.Theme.Amoled -> getString(R.string.amoled)
|
||||
}
|
||||
}
|
||||
addSwitch(
|
||||
Preferences.Key.ListAnimation, getString(R.string.list_animation),
|
||||
getString(R.string.list_animation_description)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user