mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Some fixes
This commit is contained in:
parent
76f63a7aa2
commit
8f85aed7e8
8 changed files with 91 additions and 88 deletions
|
@ -1,8 +1,5 @@
|
||||||
package com.lagradost.cloudstream3.ui.account
|
package com.lagradost.cloudstream3.ui.account
|
||||||
|
|
||||||
import android.graphics.RenderEffect
|
|
||||||
import android.graphics.Shader
|
|
||||||
import android.os.Build
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
@ -17,13 +14,14 @@ import com.lagradost.cloudstream3.ui.account.AccountHelper.showAccountEditDialog
|
||||||
import com.lagradost.cloudstream3.ui.result.setImage
|
import com.lagradost.cloudstream3.ui.result.setImage
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
|
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||||
|
|
||||||
class AccountAdapter(
|
class AccountAdapter(
|
||||||
private val accounts: List<DataStoreHelper.Account>,
|
private val accounts: List<DataStoreHelper.Account>,
|
||||||
private val accountSelectCallback: (DataStoreHelper.Account) -> Unit,
|
private val accountSelectCallback: (DataStoreHelper.Account) -> Unit,
|
||||||
private val accountCreateCallback: (DataStoreHelper.Account) -> Unit,
|
private val accountCreateCallback: (DataStoreHelper.Account) -> Unit,
|
||||||
private val accountEditCallback: (DataStoreHelper.Account) -> Unit,
|
private val accountEditCallback: (DataStoreHelper.Account) -> Unit,
|
||||||
private val accountDeleteCallback: () -> Unit
|
private val accountDeleteCallback: (DataStoreHelper.Account) -> Unit
|
||||||
) : RecyclerView.Adapter<AccountAdapter.AccountViewHolder>() {
|
) : RecyclerView.Adapter<AccountAdapter.AccountViewHolder>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -62,11 +60,13 @@ class AccountAdapter(
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
root.setOnLongClickListener {
|
root.setOnLongClickListener {
|
||||||
showAccountEditDialog(root.context, account, isNewAccount = false) {
|
showAccountEditDialog(
|
||||||
if (it != null) {
|
context = root.context,
|
||||||
accountEditCallback.invoke(it)
|
account = account,
|
||||||
} else accountDeleteCallback.invoke()
|
isNewAccount = false,
|
||||||
}
|
accountEditCallback = { account -> accountEditCallback.invoke(account) },
|
||||||
|
accountDeleteCallback = { account -> accountDeleteCallback.invoke(account) }
|
||||||
|
)
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -85,18 +85,14 @@ class AccountAdapter(
|
||||||
val isLastUsedAccount = account.keyIndex == DataStoreHelper.selectedKeyIndex
|
val isLastUsedAccount = account.keyIndex == DataStoreHelper.selectedKeyIndex
|
||||||
|
|
||||||
accountName.text = account.name
|
accountName.text = account.name
|
||||||
accountImage.setImage(account.image)
|
accountImage.setImage(
|
||||||
|
account.image,
|
||||||
|
fadeIn = false,
|
||||||
|
radius = 10
|
||||||
|
)
|
||||||
lockIcon.isVisible = account.lockPin != null
|
lockIcon.isVisible = account.lockPin != null
|
||||||
outline.isVisible = !isTv && isLastUsedAccount
|
outline.isVisible = !isTv && isLastUsedAccount
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
accountImage.setRenderEffect(
|
|
||||||
RenderEffect.createBlurEffect(
|
|
||||||
10f, 10f, Shader.TileMode.CLAMP
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTv) {
|
if (isTv) {
|
||||||
// For emulator but this is fine on TV also
|
// For emulator but this is fine on TV also
|
||||||
root.isFocusableInTouchMode = true
|
root.isFocusableInTouchMode = true
|
||||||
|
@ -111,11 +107,13 @@ class AccountAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
showAccountEditDialog(root.context, account, isNewAccount = false) {
|
showAccountEditDialog(
|
||||||
if (it != null) {
|
context = root.context,
|
||||||
accountEditCallback.invoke(it)
|
account = account,
|
||||||
} else accountDeleteCallback.invoke()
|
isNewAccount = false,
|
||||||
}
|
accountEditCallback = { account -> accountEditCallback.invoke(account) },
|
||||||
|
accountDeleteCallback = { account -> accountDeleteCallback.invoke(account) }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,16 +129,18 @@ class AccountAdapter(
|
||||||
|
|
||||||
val accountName = root.context.getString(R.string.account)
|
val accountName = root.context.getString(R.string.account)
|
||||||
|
|
||||||
showAccountEditDialog(root.context, DataStoreHelper.Account(
|
showAccountEditDialog(
|
||||||
|
root.context,
|
||||||
|
DataStoreHelper.Account(
|
||||||
keyIndex = keyIndex,
|
keyIndex = keyIndex,
|
||||||
name = "$accountName $keyIndex",
|
name = "$accountName $keyIndex",
|
||||||
customImage = null,
|
customImage = null,
|
||||||
defaultImageIndex = image
|
defaultImageIndex = image
|
||||||
), isNewAccount = true) {
|
),
|
||||||
if (it != null) {
|
isNewAccount = true,
|
||||||
accountCreateCallback.invoke(it)
|
accountEditCallback = { account -> accountCreateCallback.invoke(account) },
|
||||||
}
|
accountDeleteCallback = {}
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
|
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKeys
|
|
||||||
import com.lagradost.cloudstream3.MainActivity
|
import com.lagradost.cloudstream3.MainActivity
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.databinding.AccountEditDialogBinding
|
import com.lagradost.cloudstream3.databinding.AccountEditDialogBinding
|
||||||
|
@ -31,17 +30,16 @@ import com.lagradost.cloudstream3.ui.result.setLinearListLayout
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.setDefaultFocus
|
import com.lagradost.cloudstream3.utils.AppUtils.setDefaultFocus
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getDefaultAccount
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.getDefaultAccount
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.setAccount
|
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.showInputMethod
|
import com.lagradost.cloudstream3.utils.UIHelper.showInputMethod
|
||||||
import kotlin.system.exitProcess
|
|
||||||
|
|
||||||
object AccountHelper {
|
object AccountHelper {
|
||||||
fun showAccountEditDialog(
|
fun showAccountEditDialog(
|
||||||
context: Context,
|
context: Context,
|
||||||
account: DataStoreHelper.Account,
|
account: DataStoreHelper.Account,
|
||||||
isNewAccount: Boolean,
|
isNewAccount: Boolean,
|
||||||
callback: (DataStoreHelper.Account?) -> Unit
|
accountEditCallback: (DataStoreHelper.Account) -> Unit,
|
||||||
|
accountDeleteCallback: (DataStoreHelper.Account) -> Unit
|
||||||
) {
|
) {
|
||||||
val binding = AccountEditDialogBinding.inflate(LayoutInflater.from(context), null, false)
|
val binding = AccountEditDialogBinding.inflate(LayoutInflater.from(context), null, false)
|
||||||
val builder = AlertDialog.Builder(context, R.style.AlertDialogCustom)
|
val builder = AlertDialog.Builder(context, R.style.AlertDialogCustom)
|
||||||
|
@ -63,17 +61,7 @@ object AccountHelper {
|
||||||
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
||||||
when (which) {
|
when (which) {
|
||||||
DialogInterface.BUTTON_POSITIVE -> {
|
DialogInterface.BUTTON_POSITIVE -> {
|
||||||
// Remove the account
|
accountDeleteCallback.invoke(account)
|
||||||
removeKeys(account.keyIndex.toString())
|
|
||||||
val currentAccounts = DataStoreHelper.accounts.toMutableList()
|
|
||||||
currentAccounts.removeIf { it.keyIndex == account.keyIndex }
|
|
||||||
DataStoreHelper.accounts = currentAccounts.toTypedArray()
|
|
||||||
|
|
||||||
if (account.keyIndex == DataStoreHelper.selectedKeyIndex) {
|
|
||||||
setAccount(getDefaultAccount(context))
|
|
||||||
}
|
|
||||||
|
|
||||||
callback.invoke(null)
|
|
||||||
dialog?.dismissSafe()
|
dialog?.dismissSafe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +105,12 @@ object AccountHelper {
|
||||||
showPinInputDialog(context, currentEditAccount.lockPin, false) { pin ->
|
showPinInputDialog(context, currentEditAccount.lockPin, false) { pin ->
|
||||||
if (pin == null) return@showPinInputDialog
|
if (pin == null) return@showPinInputDialog
|
||||||
// PIN is correct, proceed to update the account
|
// PIN is correct, proceed to update the account
|
||||||
callback.invoke(currentEditAccount)
|
accountEditCallback.invoke(currentEditAccount)
|
||||||
dialog.dismissSafe()
|
dialog.dismissSafe()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No lock PIN set, proceed to update the account
|
// No lock PIN set, proceed to update the account
|
||||||
callback.invoke(currentEditAccount)
|
accountEditCallback.invoke(currentEditAccount)
|
||||||
dialog.dismissSafe()
|
dialog.dismissSafe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +208,7 @@ object AccountHelper {
|
||||||
builder.setTitle(context.getString(R.string.enter_pin_with_name, currentAccount?.name))
|
builder.setTitle(context.getString(R.string.enter_pin_with_name, currentAccount?.name))
|
||||||
builder.setOnDismissListener {
|
builder.setOnDismissListener {
|
||||||
if (!isPinValid) {
|
if (!isPinValid) {
|
||||||
exitProcess(0)
|
context.getActivity()?.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// So that if they don't know the PIN for the current account,
|
// So that if they don't know the PIN for the current account,
|
||||||
|
@ -335,8 +323,6 @@ object AccountHelper {
|
||||||
|
|
||||||
recyclerView.setLinearListLayout(isHorizontal = true)
|
recyclerView.setLinearListLayout(isHorizontal = true)
|
||||||
|
|
||||||
viewModel.updateAccounts(activity)
|
|
||||||
|
|
||||||
activity.observe(viewModel.accounts) { liveAccounts ->
|
activity.observe(viewModel.accounts) { liveAccounts ->
|
||||||
recyclerView.adapter = AccountAdapter(
|
recyclerView.adapter = AccountAdapter(
|
||||||
liveAccounts,
|
liveAccounts,
|
||||||
|
@ -346,7 +332,7 @@ object AccountHelper {
|
||||||
},
|
},
|
||||||
accountCreateCallback = { viewModel.handleAccountUpdate(it, activity) },
|
accountCreateCallback = { viewModel.handleAccountUpdate(it, activity) },
|
||||||
accountEditCallback = { viewModel.handleAccountUpdate(it, activity) },
|
accountEditCallback = { viewModel.handleAccountUpdate(it, activity) },
|
||||||
accountDeleteCallback = { viewModel.updateAccounts(activity) }
|
accountDeleteCallback = { viewModel.handleAccountDelete(it, activity) }
|
||||||
)
|
)
|
||||||
|
|
||||||
activity.observe(viewModel.selectedKeyIndex) { selectedKeyIndex ->
|
activity.observe(viewModel.selectedKeyIndex) { selectedKeyIndex ->
|
||||||
|
|
|
@ -5,8 +5,8 @@ import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
|
|
||||||
import com.lagradost.cloudstream3.CommonActivity
|
import com.lagradost.cloudstream3.CommonActivity
|
||||||
import com.lagradost.cloudstream3.CommonActivity.loadThemes
|
import com.lagradost.cloudstream3.CommonActivity.loadThemes
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
|
@ -40,10 +40,11 @@ class AccountSelectActivity : AppCompatActivity() {
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
val skipStartup = getKey(
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
val skipStartup = settingsManager.getBoolean(
|
||||||
getString(R.string.skip_startup_account_select_key),
|
getString(R.string.skip_startup_account_select_key),
|
||||||
false
|
false
|
||||||
) ?: false || accounts.count() <= 1
|
) || accounts.count() <= 1
|
||||||
|
|
||||||
viewModel = ViewModelProvider(this)[AccountViewModel::class.java]
|
viewModel = ViewModelProvider(this)[AccountViewModel::class.java]
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ class AccountSelectActivity : AppCompatActivity() {
|
||||||
navigateToMainActivity()
|
navigateToMainActivity()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
accountDeleteCallback = { viewModel.updateAccounts(this) }
|
accountDeleteCallback = { viewModel.handleAccountDelete(it,this) }
|
||||||
)
|
)
|
||||||
|
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
|
|
|
@ -5,15 +5,19 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
||||||
|
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKeys
|
||||||
import com.lagradost.cloudstream3.ui.account.AccountHelper.showPinInputDialog
|
import com.lagradost.cloudstream3.ui.account.AccountHelper.showPinInputDialog
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAccounts
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAccounts
|
||||||
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.getDefaultAccount
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.setAccount
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.setAccount
|
||||||
|
|
||||||
class AccountViewModel : ViewModel() {
|
class AccountViewModel : ViewModel() {
|
||||||
private val _accounts: MutableLiveData<List<DataStoreHelper.Account>> = MutableLiveData(
|
private fun getAllAccounts(): List<DataStoreHelper.Account> {
|
||||||
context?.let { getAccounts(it) } ?: DataStoreHelper.accounts.toList()
|
return context?.let { getAccounts(it) } ?: DataStoreHelper.accounts.toList()
|
||||||
)
|
}
|
||||||
|
|
||||||
|
private val _accounts: MutableLiveData<List<DataStoreHelper.Account>> = MutableLiveData(getAllAccounts())
|
||||||
val accounts: LiveData<List<DataStoreHelper.Account>> = _accounts
|
val accounts: LiveData<List<DataStoreHelper.Account>> = _accounts
|
||||||
|
|
||||||
private val _isEditing = MutableLiveData(false)
|
private val _isEditing = MutableLiveData(false)
|
||||||
|
@ -22,7 +26,11 @@ class AccountViewModel : ViewModel() {
|
||||||
private val _isAllowedLogin = MutableLiveData(false)
|
private val _isAllowedLogin = MutableLiveData(false)
|
||||||
val isAllowedLogin: LiveData<Boolean> = _isAllowedLogin
|
val isAllowedLogin: LiveData<Boolean> = _isAllowedLogin
|
||||||
|
|
||||||
private val _selectedKeyIndex = MutableLiveData(DataStoreHelper.selectedKeyIndex)
|
private val _selectedKeyIndex = MutableLiveData(
|
||||||
|
getAllAccounts().indexOfFirst {
|
||||||
|
it.keyIndex == DataStoreHelper.selectedKeyIndex
|
||||||
|
}
|
||||||
|
)
|
||||||
val selectedKeyIndex: LiveData<Int> = _selectedKeyIndex
|
val selectedKeyIndex: LiveData<Int> = _selectedKeyIndex
|
||||||
|
|
||||||
fun setIsEditing(value: Boolean) {
|
fun setIsEditing(value: Boolean) {
|
||||||
|
@ -33,11 +41,6 @@ class AccountViewModel : ViewModel() {
|
||||||
_isEditing.postValue(!(_isEditing.value ?: false))
|
_isEditing.postValue(!(_isEditing.value ?: false))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAccounts(context: Context) {
|
|
||||||
_accounts.postValue(getAccounts(context))
|
|
||||||
_selectedKeyIndex.postValue(DataStoreHelper.selectedKeyIndex)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun handleAccountUpdate(
|
fun handleAccountUpdate(
|
||||||
account: DataStoreHelper.Account,
|
account: DataStoreHelper.Account,
|
||||||
context: Context
|
context: Context
|
||||||
|
@ -58,7 +61,29 @@ class AccountViewModel : ViewModel() {
|
||||||
DataStoreHelper.accounts = currentAccounts.toTypedArray()
|
DataStoreHelper.accounts = currentAccounts.toTypedArray()
|
||||||
|
|
||||||
_accounts.postValue(getAccounts(context))
|
_accounts.postValue(getAccounts(context))
|
||||||
_selectedKeyIndex.postValue(account.keyIndex)
|
_selectedKeyIndex.postValue(getAccounts(context).indexOf(account))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun handleAccountDelete(
|
||||||
|
account: DataStoreHelper.Account,
|
||||||
|
context: Context
|
||||||
|
) {
|
||||||
|
removeKeys(account.keyIndex.toString())
|
||||||
|
|
||||||
|
val currentAccounts = getAccounts(context).toMutableList()
|
||||||
|
|
||||||
|
currentAccounts.removeIf { it.keyIndex == account.keyIndex }
|
||||||
|
|
||||||
|
DataStoreHelper.accounts = currentAccounts.toTypedArray()
|
||||||
|
|
||||||
|
if (account.keyIndex == DataStoreHelper.selectedKeyIndex) {
|
||||||
|
setAccount(getDefaultAccount(context))
|
||||||
|
}
|
||||||
|
|
||||||
|
_accounts.postValue(getAccounts(context))
|
||||||
|
_selectedKeyIndex.postValue(getAllAccounts().indexOfFirst {
|
||||||
|
it.keyIndex == DataStoreHelper.selectedKeyIndex
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleAccountSelect(
|
fun handleAccountSelect(
|
||||||
|
@ -78,13 +103,13 @@ class AccountViewModel : ViewModel() {
|
||||||
if (pin == null) return@showPinInputDialog
|
if (pin == null) return@showPinInputDialog
|
||||||
// Pin is correct, proceed
|
// Pin is correct, proceed
|
||||||
_isAllowedLogin.postValue(true)
|
_isAllowedLogin.postValue(true)
|
||||||
_selectedKeyIndex.postValue(account.keyIndex)
|
_selectedKeyIndex.postValue(getAccounts(context).indexOf(account))
|
||||||
setAccount(account)
|
setAccount(account)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No PIN set for the selected account, proceed
|
// No PIN set for the selected account, proceed
|
||||||
_isAllowedLogin.postValue(true)
|
_isAllowedLogin.postValue(true)
|
||||||
_selectedKeyIndex.postValue(account.keyIndex)
|
_selectedKeyIndex.postValue(getAccounts(context).indexOf(account))
|
||||||
setAccount(account)
|
setAccount(account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,15 +335,6 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
||||||
return@setOnPreferenceChangeListener true
|
return@setOnPreferenceChangeListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsManager.edit().putBoolean(
|
|
||||||
getString(R.string.skip_startup_account_select_key),
|
|
||||||
getKey(getString(R.string.skip_startup_account_select_key), false) ?: false
|
|
||||||
).apply()
|
|
||||||
getPref(R.string.skip_startup_account_select_key)?.setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
setKey(getString(R.string.skip_startup_account_select_key), newValue)
|
|
||||||
return@setOnPreferenceChangeListener true
|
|
||||||
}
|
|
||||||
|
|
||||||
getPref(R.string.download_path_key)?.setOnPreferenceClickListener {
|
getPref(R.string.download_path_key)?.setOnPreferenceClickListener {
|
||||||
val dirs = getDownloadDirs()
|
val dirs = getDownloadDirs()
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/manage_accounts_button"
|
android:id="@+id/manage_accounts_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:text="@string/manage_accounts"
|
android:text="@string/manage_accounts"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
app:icon="@drawable/ic_baseline_edit_24"
|
app:icon="@drawable/ic_baseline_edit_24"
|
||||||
style="@style/Widget.MaterialComponents.Button.TextButton" />
|
style="@style/BlackButton" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,6 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:icon="@drawable/ic_outline_account_circle_24"
|
||||||
|
android:key="@string/skip_startup_account_select_key"
|
||||||
|
android:title="@string/skip_startup_account_select_pref" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/mal_logo"
|
android:icon="@drawable/mal_logo"
|
||||||
android:key="@string/mal_key" />
|
android:key="@string/mal_key" />
|
||||||
|
|
|
@ -11,12 +11,6 @@
|
||||||
android:title="@string/download_path_pref"
|
android:title="@string/download_path_pref"
|
||||||
android:icon="@drawable/netflix_download" />
|
android:icon="@drawable/netflix_download" />
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:icon="@drawable/ic_outline_account_circle_24"
|
|
||||||
android:key="@string/skip_startup_account_select_key"
|
|
||||||
android:title="@string/skip_startup_account_select_pref" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="@string/legal_notice_key"
|
android:key="@string/legal_notice_key"
|
||||||
android:title="@string/legal_notice"
|
android:title="@string/legal_notice"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue