code cleanup
This commit is contained in:
parent
dbb61b7032
commit
569ea6f4e3
|
@ -45,9 +45,6 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
||||||
|
|
||||||
private lateinit var adapter: AccountDetailsAdapter
|
private lateinit var adapter: AccountDetailsAdapter
|
||||||
|
|
||||||
private var firstCreated: Boolean = false
|
|
||||||
|
|
||||||
|
|
||||||
private val keysWhiteList: Array<UserKey>?
|
private val keysWhiteList: Array<UserKey>?
|
||||||
get() {
|
get() {
|
||||||
return intent.getParcelableArrayExtra(EXTRA_ACCOUNT_KEYS)?.toTypedArray(UserKey.CREATOR)
|
return intent.getParcelableArrayExtra(EXTRA_ACCOUNT_KEYS)?.toTypedArray(UserKey.CREATOR)
|
||||||
|
@ -91,7 +88,6 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
firstCreated = savedInstanceState == null
|
|
||||||
setContentView(R.layout.activity_account_selector)
|
setContentView(R.layout.activity_account_selector)
|
||||||
DataStoreUtils.prepareDatabase(this)
|
DataStoreUtils.prepareDatabase(this)
|
||||||
adapter = AccountDetailsAdapter(this).apply {
|
adapter = AccountDetailsAdapter(this).apply {
|
||||||
|
@ -101,13 +97,13 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
||||||
val am = AccountManager.get(context)
|
val am = AccountManager.get(context)
|
||||||
val allAccountDetails = AccountUtils.getAllAccountDetails(am, AccountUtils.getAccounts(am), false)
|
val allAccountDetails = AccountUtils.getAllAccountDetails(am, AccountUtils.getAccounts(am), false)
|
||||||
val extraKeys = keysWhiteList
|
val extraKeys = keysWhiteList
|
||||||
val oAuthOnly = isOAuthOnly
|
val oauthOnly = isOAuthOnly
|
||||||
val accountHost = accountHost
|
val accountHost = accountHost
|
||||||
addAll(allAccountDetails.filter {
|
addAll(allAccountDetails.filter {
|
||||||
if (extraKeys != null) {
|
if (extraKeys != null) {
|
||||||
return@filter extraKeys.contains(it.key)
|
return@filter extraKeys.contains(it.key)
|
||||||
}
|
}
|
||||||
if (oAuthOnly && !it.is_oauth) {
|
if (oauthOnly && !it.is_oauth) {
|
||||||
return@filter false
|
return@filter false
|
||||||
}
|
}
|
||||||
if (USER_TYPE_TWITTER_COM == accountHost) {
|
if (USER_TYPE_TWITTER_COM == accountHost) {
|
||||||
|
|
Loading…
Reference in New Issue