mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 21:13:01 +00:00
small ui fixes
This commit is contained in:
parent
bac2de06d8
commit
8b707cfc55
4 changed files with 19 additions and 11 deletions
|
@ -77,7 +77,7 @@ class HomeFragment : Home(), View.OnClickListener {
|
|||
true
|
||||
}
|
||||
|
||||
binding.homeRefresh.isRefreshing = true
|
||||
viewModel.fetchData()
|
||||
|
||||
with(binding.includeChangelogsLayout) {
|
||||
viewpager.adapter = if (variantPref == "root") SectionPageRootAdapter(this@HomeFragment) else SectionPageAdapter(this@HomeFragment)
|
||||
|
|
|
@ -32,27 +32,35 @@ class VancedLanguageSelectionFragment : Fragment() {
|
|||
return inflater.inflate(R.layout.fragment_vanced_language_selection, container, false)
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
langs = runBlocking { getJson("${PreferenceManager.getDefaultSharedPreferences(activity).getString("install_url", baseUrl)}/vanced.json").array<String>("langs")?.value }!!
|
||||
loadBoxes(view.findViewById(R.id.lang_button_ll))
|
||||
langs = runBlocking { getJson("${PreferenceManager.getDefaultSharedPreferences(activity).getString("install_url", baseUrl)}/vanced.json").array<String>("langs")?.value } ?: mutableListOf("null")
|
||||
if (!langs.contains("null"))
|
||||
loadBoxes(view.findViewById(R.id.lang_button_ll))
|
||||
|
||||
view.findViewById<MaterialButton>(R.id.vanced_install_finish).setOnClickListener {
|
||||
val chosenLangs = mutableListOf("en")
|
||||
for (lang in langs) {
|
||||
if (view.findViewWithTag<MaterialCheckBox>(lang).isChecked) {
|
||||
chosenLangs.add(lang)
|
||||
if (!langs.contains("null"))
|
||||
for (lang in langs) {
|
||||
if (view.findViewWithTag<MaterialCheckBox>(lang).isChecked) {
|
||||
chosenLangs.add(lang)
|
||||
}
|
||||
}
|
||||
}
|
||||
activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)?.edit()?.putString("lang", chosenLangs.joinToString())?.apply()
|
||||
val sharedPrefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)?.edit()
|
||||
sharedPrefs?.putString("lang", chosenLangs.joinToString())?.apply()
|
||||
sharedPrefs?.putBoolean("isInstalling", true)?.apply()
|
||||
view.findNavController().navigate(R.id.action_installTo_homeFragment)
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
private fun loadBoxes(ll: LinearLayout) = CoroutineScope(Dispatchers.Main).launch {
|
||||
for (lang in langs) {
|
||||
val loc = Locale(lang)
|
||||
val box: MaterialCheckBox = MaterialCheckBox(activity).apply {
|
||||
tag = lang
|
||||
text = Locale(lang).displayLanguage
|
||||
text = loc.getDisplayLanguage(loc).capitalize(Locale.ROOT)
|
||||
textSize = 16F
|
||||
typeface = activity?.let { ResourcesCompat.getFont(it, R.font.exo_bold) }
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.vanced.manager.utils.PackageHelper.isPackageInstalled
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
class HomeViewModel(application: Application): AndroidViewModel(application) {
|
||||
open class HomeViewModel(application: Application): AndroidViewModel(application) {
|
||||
|
||||
private val variant = getDefaultSharedPreferences(application).getString("vanced_variant", "nonroot")
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
android:id="@+id/en"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorDisabled"
|
||||
android:buttonTint="?colorDisabled"
|
||||
android:fontFamily="@font/exo_semibold"
|
||||
android:text="English (default)"
|
||||
android:tag="en"
|
||||
|
|
Loading…
Reference in a new issue