mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-21 18:55:12 +00:00
improvement/core-ui create core-ui and replase base abstracts
This commit is contained in:
parent
7586c50f45
commit
e89b0b2b55
31 changed files with 160 additions and 90 deletions
|
@ -98,6 +98,8 @@ static def surroundWithQuotes(Object[] arr) {
|
|||
|
||||
dependencies {
|
||||
|
||||
implementation project(":core-ui")
|
||||
|
||||
// Kotlin
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
|
|
|
@ -15,8 +15,8 @@ import com.vanced.manager.R
|
|||
import com.vanced.manager.core.downloader.MicrogDownloader.downloadMicrog
|
||||
import com.vanced.manager.core.downloader.MusicDownloader.downloadMusic
|
||||
import com.vanced.manager.core.downloader.VancedDownloader.downloadVanced
|
||||
import com.vanced.manager.core.ui.base.BindingDialogFragment
|
||||
import com.vanced.manager.databinding.DialogAppDownloadBinding
|
||||
import com.vanced.manager.ui.core.BindingDialogFragment
|
||||
import com.vanced.manager.utils.DownloadHelper.downloadProgress
|
||||
|
||||
class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {
|
||||
|
|
|
@ -8,8 +8,8 @@ import android.view.LayoutInflater
|
|||
import android.view.ViewGroup
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingDialogFragment
|
||||
import com.vanced.manager.databinding.DialogAppInfoBinding
|
||||
import com.vanced.manager.ui.core.BindingDialogFragment
|
||||
|
||||
class AppInfoDialog : BindingDialogFragment<DialogAppInfoBinding>() {
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ import android.view.ViewGroup
|
|||
import androidx.core.content.edit
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogBottomRadioButtonBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
import com.vanced.manager.utils.Extensions.getDefaultPrefs
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
|
||||
class AppVersionSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomRadioButtonBinding>() {
|
||||
|
||||
|
@ -83,9 +83,9 @@ class AppVersionSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomRa
|
|||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
if (arguments?.getString(TAG_APP) == "vanced") {
|
||||
VancedPreferencesDialog().show(requireActivity())
|
||||
showDialog(VancedPreferencesDialog())
|
||||
} else {
|
||||
MusicPreferencesDialog().show(requireActivity())
|
||||
showDialog(MusicPreferencesDialog())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,9 +8,9 @@ import com.vanced.manager.R
|
|||
import com.vanced.manager.core.downloader.MicrogDownloader.startMicrogInstall
|
||||
import com.vanced.manager.core.downloader.MusicDownloader.startMusicInstall
|
||||
import com.vanced.manager.core.downloader.VancedDownloader.startVancedInstall
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogInstallationFilesDetectedBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
|
||||
class InstallationFilesDetectedDialog : BindingBottomSheetDialogFragment<DialogInstallationFilesDetectedBinding>() {
|
||||
|
||||
|
@ -45,23 +45,30 @@ class InstallationFilesDetectedDialog : BindingBottomSheetDialogFragment<DialogI
|
|||
installationDetectedRedownload.setOnClickListener {
|
||||
dismiss()
|
||||
if (app == getString(R.string.vanced))
|
||||
VancedPreferencesDialog().show(requireActivity())
|
||||
showDialog(VancedPreferencesDialog())
|
||||
else {
|
||||
AppDownloadDialog.newInstance(app).show(requireActivity())
|
||||
showDialog(AppDownloadDialog.newInstance(app))
|
||||
}
|
||||
}
|
||||
installationDetectedInstall.setOnClickListener {
|
||||
dismiss()
|
||||
when (app) {
|
||||
getString(R.string.vanced) -> startVancedInstall(requireContext(),
|
||||
getDefaultSharedPreferences(requireContext()).getString("vanced_variant", "nonroot"))
|
||||
getString(R.string.vanced) -> startVancedInstall(
|
||||
requireContext(),
|
||||
getDefaultSharedPreferences(requireContext()).getString(
|
||||
"vanced_variant",
|
||||
"nonroot"
|
||||
)
|
||||
)
|
||||
getString(R.string.music) -> startMusicInstall(requireContext())
|
||||
getString(R.string.microg) -> startMicrogInstall(requireContext())
|
||||
}
|
||||
AppDownloadDialog.newInstance(
|
||||
app = app,
|
||||
installing = true
|
||||
).show(requireActivity())
|
||||
showDialog(
|
||||
AppDownloadDialog.newInstance(
|
||||
app = app,
|
||||
installing = true
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import android.view.ViewGroup
|
|||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.databinding.DialogManagerAccentColorBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
|
||||
class ManagerAccentColorDialog : BindingBottomSheetDialogFragment<DialogManagerAccentColorBinding>() {
|
||||
|
|
|
@ -9,8 +9,8 @@ import androidx.core.content.edit
|
|||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.vanced.manager.BuildConfig.MANAGER_LANGUAGES
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.databinding.DialogManagerLanguageBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
import com.vanced.manager.utils.LanguageHelper.getLanguageFormat
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import android.view.ViewGroup
|
|||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.databinding.DialogManagerThemeBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
|
||||
class ManagerThemeDialog : BindingBottomSheetDialogFragment<DialogManagerThemeBinding>() {
|
||||
|
|
|
@ -12,8 +12,8 @@ import android.view.ViewGroup
|
|||
import androidx.core.view.isVisible
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingDialogFragment
|
||||
import com.vanced.manager.databinding.DialogManagerUpdateBinding
|
||||
import com.vanced.manager.ui.core.BindingDialogFragment
|
||||
import com.vanced.manager.utils.DownloadHelper.downloadManager
|
||||
import com.vanced.manager.utils.DownloadHelper.downloadProgress
|
||||
import com.vanced.manager.utils.InternetTools.isUpdateAvailable
|
||||
|
|
|
@ -7,8 +7,8 @@ import androidx.core.content.edit
|
|||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.databinding.DialogManagerVariantBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
|
||||
class ManagerVariantDialog : BindingBottomSheetDialogFragment<DialogManagerVariantBinding>() {
|
||||
|
|
|
@ -4,11 +4,11 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogMusicPreferencesBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.convertToAppVersions
|
||||
import com.vanced.manager.utils.Extensions.getDefaultPrefs
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
import com.vanced.manager.utils.InternetTools.musicVersions
|
||||
|
||||
class MusicPreferencesDialog : BindingBottomSheetDialogFragment<DialogMusicPreferencesBinding>() {
|
||||
|
@ -39,16 +39,20 @@ class MusicPreferencesDialog : BindingBottomSheetDialogFragment<DialogMusicPrefe
|
|||
musicVersion.text = getString(R.string.chosen_version, prefs.getString("music_version", "latest"))
|
||||
openVersionSelector.setOnClickListener {
|
||||
dismiss()
|
||||
AppVersionSelectorDialog.newInstance(
|
||||
versions = musicVersionsConv,
|
||||
app = "music"
|
||||
).show(requireActivity())
|
||||
showDialog(
|
||||
AppVersionSelectorDialog.newInstance(
|
||||
versions = musicVersionsConv,
|
||||
app = "music"
|
||||
)
|
||||
)
|
||||
}
|
||||
musicInstall.setOnClickListener {
|
||||
dismiss()
|
||||
AppDownloadDialog.newInstance(
|
||||
app = getString(R.string.music)
|
||||
).show(requireActivity())
|
||||
showDialog(
|
||||
AppDownloadDialog.newInstance(
|
||||
app = getString(R.string.music)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.adapter.SelectAppsAdapter
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.databinding.DialogSelectAppsBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
|
||||
class SelectAppsDialog : BindingBottomSheetDialogFragment<DialogSelectAppsBinding>() {
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import android.widget.TextView
|
|||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.vanced.manager.core.ui.base.BindingDialogFragment
|
||||
import com.vanced.manager.databinding.DialogCustomUrlBinding
|
||||
import com.vanced.manager.ui.core.BindingDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.fetchData
|
||||
import com.vanced.manager.utils.InternetTools.baseUrl
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
|
@ -13,9 +13,9 @@ import androidx.core.content.edit
|
|||
import androidx.core.content.res.ResourcesCompat
|
||||
import com.google.android.material.checkbox.MaterialCheckBox
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogVancedLanguageSelectionBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
import com.vanced.manager.utils.InternetTools.vanced
|
||||
import com.vanced.manager.utils.LanguageHelper.getDefaultVancedLanguages
|
||||
import java.util.*
|
||||
|
@ -79,6 +79,6 @@ class VancedLanguageSelectionDialog : BindingBottomSheetDialogFragment<DialogVan
|
|||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
VancedPreferencesDialog().show(requireActivity())
|
||||
showDialog(VancedPreferencesDialog())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogVancedPreferencesBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.convertToAppTheme
|
||||
import com.vanced.manager.utils.Extensions.convertToAppVersions
|
||||
import com.vanced.manager.utils.Extensions.getDefaultPrefs
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
import com.vanced.manager.utils.InternetTools.vancedVersions
|
||||
import com.vanced.manager.utils.LanguageHelper.getDefaultVancedLanguages
|
||||
import java.util.*
|
||||
|
@ -51,24 +51,28 @@ class VancedPreferencesDialog : BindingBottomSheetDialogFragment<DialogVancedPre
|
|||
vancedLang.text = getString(R.string.chosen_lang, showLang)
|
||||
openThemeSelector.setOnClickListener {
|
||||
dismiss()
|
||||
VancedThemeSelectorDialog().show(requireActivity())
|
||||
showDialog(VancedThemeSelectorDialog())
|
||||
}
|
||||
openVersionSelector.setOnClickListener {
|
||||
dismiss()
|
||||
AppVersionSelectorDialog.newInstance(
|
||||
versions = vancedVersionsConv,
|
||||
app = "vanced"
|
||||
).show(requireActivity())
|
||||
showDialog(
|
||||
AppVersionSelectorDialog.newInstance(
|
||||
versions = vancedVersionsConv,
|
||||
app = "vanced"
|
||||
)
|
||||
)
|
||||
}
|
||||
openLanguageSelector.setOnClickListener {
|
||||
dismiss()
|
||||
VancedLanguageSelectionDialog().show(requireActivity())
|
||||
showDialog(VancedLanguageSelectionDialog())
|
||||
}
|
||||
vancedInstall.setOnClickListener {
|
||||
dismiss()
|
||||
AppDownloadDialog.newInstance(
|
||||
app = getString(R.string.vanced)
|
||||
).show(requireActivity())
|
||||
showDialog(
|
||||
AppDownloadDialog.newInstance(
|
||||
app = getString(R.string.vanced)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ import android.view.ViewGroup
|
|||
import androidx.core.content.edit
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.DialogBottomRadioButtonBinding
|
||||
import com.vanced.manager.ui.core.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.utils.Extensions.convertToAppTheme
|
||||
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
|
||||
import com.vanced.manager.utils.Extensions.show
|
||||
import com.vanced.manager.utils.InternetTools.vanced
|
||||
|
||||
class VancedThemeSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomRadioButtonBinding>() {
|
||||
|
@ -70,6 +70,6 @@ class VancedThemeSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomR
|
|||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
VancedPreferencesDialog().show(requireActivity())
|
||||
showDialog(VancedPreferencesDialog())
|
||||
}
|
||||
}
|
|
@ -11,9 +11,9 @@ import androidx.core.content.edit
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ext.showDialog
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.FragmentAboutBinding
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
import com.vanced.manager.ui.dialogs.AppInfoDialog
|
||||
import com.vanced.manager.ui.viewmodels.AboutViewModel
|
||||
import com.vanced.manager.utils.InternetTools.manager
|
||||
|
|
|
@ -9,9 +9,9 @@ import androidx.core.content.edit
|
|||
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.databinding.FragmentGrantRootBinding
|
||||
import com.vanced.manager.ui.MainActivity
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
|
||||
class GrantRootFragment : BindingFragment<FragmentGrantRootBinding>() {
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ import com.vanced.manager.R
|
|||
import com.vanced.manager.adapter.AppListAdapter
|
||||
import com.vanced.manager.adapter.LinkAdapter
|
||||
import com.vanced.manager.adapter.SponsorAdapter
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.databinding.FragmentHomeBinding
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.installAlertBuilder
|
||||
import com.vanced.manager.ui.viewmodels.HomeViewModel
|
||||
import com.vanced.manager.ui.viewmodels.HomeViewModelFactory
|
||||
|
|
|
@ -10,8 +10,8 @@ import androidx.preference.PreferenceManager.getDefaultSharedPreferences
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.adapter.SelectAppsAdapter
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.databinding.FragmentSelectAppsBinding
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
|
||||
class SelectAppsFragment : BindingFragment<FragmentSelectAppsBinding>() {
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics
|
|||
import com.google.firebase.perf.FirebasePerformance
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.adapter.GetNotifAdapter
|
||||
import com.vanced.manager.core.ext.showDialogRefl
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.FragmentSettingsBinding
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
import com.vanced.manager.ui.dialogs.*
|
||||
import com.vanced.manager.utils.LanguageHelper.getLanguageFormat
|
||||
import java.io.File
|
||||
|
@ -54,7 +54,7 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
|
|||
bindManagerTheme()
|
||||
bindManagerAccentColor()
|
||||
bindManagerLanguage()
|
||||
selectApps.setOnClickListener { showDialogRefl<SelectAppsDialog>() }
|
||||
selectApps.setOnClickListener { showDialog(SelectAppsDialog()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
|
|||
private fun FragmentSettingsBinding.bindManagerVariant() {
|
||||
managerVariant.apply {
|
||||
prefs.getString("vanced_variant", "nonroot")?.let { setSummary(it) }
|
||||
setOnClickListener { showDialogRefl<ManagerVariantDialog>() }
|
||||
setOnClickListener { showDialog(ManagerVariantDialog()) }
|
||||
}
|
||||
}
|
||||
private fun FragmentSettingsBinding.bindClearFiles() {
|
||||
|
@ -96,11 +96,11 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
|
|||
setSummary(
|
||||
when (themePref) {
|
||||
LIGHT -> getString(R.string.theme_light)
|
||||
DARK -> getString(R.string.theme_dark)
|
||||
else -> getString(R.string.system_default)
|
||||
DARK -> getString(R.string.theme_dark)
|
||||
else -> getString(R.string.system_default)
|
||||
}
|
||||
)
|
||||
setOnClickListener { showDialogRefl<ManagerThemeDialog>() }
|
||||
setOnClickListener { showDialog(ManagerThemeDialog()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,14 +109,14 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
|
|||
managerAccentColor.apply {
|
||||
setSummary(
|
||||
when (accentPref) {
|
||||
BLUE -> getString(R.string.accent_blue)
|
||||
RED -> getString(R.string.accent_red)
|
||||
GREEN -> getString(R.string.accent_green)
|
||||
BLUE -> getString(R.string.accent_blue)
|
||||
RED -> getString(R.string.accent_red)
|
||||
GREEN -> getString(R.string.accent_green)
|
||||
YELLOW -> getString(R.string.accent_yellow)
|
||||
else -> getString(R.string.accent_purple)
|
||||
else -> getString(R.string.accent_purple)
|
||||
}
|
||||
)
|
||||
setOnClickListener { showDialogRefl<ManagerAccentColorDialog>() }
|
||||
setOnClickListener { showDialog(ManagerAccentColorDialog()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
|
|||
val langPref = prefs.getString("manager_lang", "System Default")
|
||||
managerLanguage.apply {
|
||||
setSummary(getLanguageFormat(requireActivity(), requireNotNull(langPref)))
|
||||
setOnClickListener { showDialogRefl<ManagerLanguageDialog>() }
|
||||
setOnClickListener { showDialog(ManagerLanguageDialog()) }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.databinding.FragmentWelcomeBinding
|
||||
import com.vanced.manager.ui.core.BindingFragment
|
||||
|
||||
class WelcomeFragment : BindingFragment<FragmentWelcomeBinding>() {
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ object InternetTools {
|
|||
suspend fun loadJson(context: Context) = withContext(Dispatchers.IO) {
|
||||
val installUrl = context.getDefaultPrefs().getString("install_url", baseUrl)
|
||||
val latest = JsonHelper.getJson("$installUrl/latest.json?fetchTime=${SimpleDateFormat("HHmmss", Locale.ROOT)}")
|
||||
Log.d(
|
||||
"latest",
|
||||
"$installUrl/latest.json?fetchTime=${SimpleDateFormat("HHmmss", Locale.ROOT)}"
|
||||
)
|
||||
val versions = JsonHelper.getJson("$installUrl/versions.json?fetchTime=${SimpleDateFormat("HHmmss", Locale.ROOT)}")
|
||||
// braveTiers.apply {
|
||||
// set(getJson("$installUrl/sponsor.json"))
|
||||
|
|
1
core-ui/.gitignore
vendored
Normal file
1
core-ui/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
50
core-ui/build.gradle
Normal file
50
core-ui/build.gradle
Normal file
|
@ -0,0 +1,50 @@
|
|||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
||||
|
||||
//https://developer.android.com/jetpack/androidx/releases/lifecycle
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
|
||||
}
|
1
core-ui/src/main/AndroidManifest.xml
Normal file
1
core-ui/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<manifest package="com.vanced.manager.core.ui" />
|
|
@ -1,4 +1,4 @@
|
|||
package com.vanced.manager.ui.core
|
||||
package com.vanced.manager.core.ui.base
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -9,29 +9,29 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
|||
|
||||
abstract class BindingBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment() {
|
||||
|
||||
private var _binding: VB? = null
|
||||
protected val binding: VB get() = requireNotNull(_binding)
|
||||
private var _binding: VB? = null
|
||||
protected val binding: VB get() = requireNotNull(_binding)
|
||||
|
||||
override fun onCreateView(
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = binding(inflater, container, savedInstanceState)
|
||||
otherSetups()
|
||||
return binding.root
|
||||
}
|
||||
_binding = binding(inflater, container, savedInstanceState)
|
||||
otherSetups()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
protected abstract fun binding(
|
||||
protected abstract fun binding(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): VB
|
||||
|
||||
protected open fun otherSetups() = Unit
|
||||
protected open fun otherSetups() = Unit
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.vanced.manager.ui.core
|
||||
package com.vanced.manager.core.ui.base
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
|
@ -1,4 +1,4 @@
|
|||
package com.vanced.manager.ui.core
|
||||
package com.vanced.manager.core.ui.base
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
|
@ -1,15 +1,10 @@
|
|||
package com.vanced.manager.core.ext
|
||||
package com.vanced.manager.core.ui.ext
|
||||
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import kotlin.reflect.full.createInstance
|
||||
|
||||
fun Fragment.requireSupportFM() = requireActivity().supportFragmentManager
|
||||
|
||||
inline fun <reified D : DialogFragment> Fragment.showDialogRefl() {
|
||||
D::class.createInstance().show(requireSupportFM(), D::class.simpleName)
|
||||
}
|
||||
|
||||
fun <D : DialogFragment> Fragment.showDialog(dialog: D) {
|
||||
dialog.show(requireSupportFM(), dialog::class.simpleName)
|
||||
}
|
|
@ -1,2 +1,4 @@
|
|||
rootProject.name='Vanced Manager'
|
||||
include ':app'
|
||||
|
||||
include ':core-ui'
|
Loading…
Reference in a new issue