mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 05:05:15 +00:00
dev settings cleanup
This commit is contained in:
parent
6c421185f3
commit
b2fa77b640
2 changed files with 25 additions and 21 deletions
|
@ -8,11 +8,9 @@ import androidx.annotation.RequiresApi
|
|||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import androidx.preference.*
|
||||
import com.crowdin.platform.Crowdin
|
||||
import com.vanced.manager.BuildConfig.ENABLE_CROWDIN_AUTH
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.WelcomeActivity
|
||||
import com.vanced.manager.ui.dialogs.ManagerUpdateDialog
|
||||
|
@ -49,24 +47,28 @@ class DevSettingsFragment: PreferenceFragmentCompat() {
|
|||
|
||||
}
|
||||
|
||||
findPreference<Preference>("crowdin_auth")?.isVisible = !Crowdin.isAuthorized()
|
||||
findPreference<SwitchPreferenceCompat>("crowdin_upload_screenshot")?.isVisible = Crowdin.isAuthorized()
|
||||
findPreference<SwitchPreferenceCompat>("crowdin_real_time")?.isVisible = Crowdin.isAuthorized()
|
||||
if (ENABLE_CROWDIN_AUTH) {
|
||||
findPreference<PreferenceCategory>("crowdin_pref_category")?.isVisible = true
|
||||
|
||||
findPreference<Preference>("crowdin_auth")?.setOnPreferenceClickListener {
|
||||
requireActivity().authCrowdin()
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
if (!Settings.canDrawOverlays(requireActivity())) {
|
||||
val intent = Intent(
|
||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
("package:" + requireActivity().packageName).toUri()
|
||||
)
|
||||
startActivityForResult(intent, 69)
|
||||
return@setOnPreferenceClickListener true
|
||||
findPreference<Preference>("crowdin_auth")?.isVisible = !Crowdin.isAuthorized()
|
||||
findPreference<SwitchPreferenceCompat>("crowdin_upload_screenshot")?.isVisible = Crowdin.isAuthorized()
|
||||
findPreference<SwitchPreferenceCompat>("crowdin_real_time")?.isVisible = Crowdin.isAuthorized()
|
||||
|
||||
findPreference<Preference>("crowdin_auth")?.setOnPreferenceClickListener {
|
||||
requireActivity().authCrowdin()
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
if (!Settings.canDrawOverlays(requireActivity())) {
|
||||
val intent = Intent(
|
||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
("package:" + requireActivity().packageName).toUri()
|
||||
)
|
||||
startActivityForResult(intent, 69)
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
Crowdin.authorize(requireActivity())
|
||||
true
|
||||
}
|
||||
|
||||
Crowdin.authorize(requireActivity())
|
||||
true
|
||||
}
|
||||
|
||||
findPreference<Preference>("install_url")?.setOnPreferenceClickListener {
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
android:key="install_url" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="Crowdin">
|
||||
android:title="Crowdin"
|
||||
android:key="crowdin_pref_category"
|
||||
app:isPreferenceVisible="false">
|
||||
|
||||
<Preference
|
||||
android:title="Authorize"
|
||||
|
|
Loading…
Reference in a new issue