improved select only item
This commit is contained in:
parent
34eee52089
commit
940f366fcb
|
@ -217,7 +217,7 @@ public interface IntentConstants {
|
|||
String EXTRA_PINNED_STATUS_IDS = "pinned_status_ids";
|
||||
String EXTRA_SHOULD_INIT_LOADER = "should_init_loader";
|
||||
String EXTRA_START_INTENT = "start_intent";
|
||||
String EXTRA_SELECT_ONLY_ITEM = "select_only_item";
|
||||
String EXTRA_SELECT_ONLY_ITEM_AUTOMATICALLY = "select_only_item_automatically";
|
||||
String EXTRA_OBJECT = "object";
|
||||
String EXTRA_SIMPLE_LAYOUT = "simple_layout";
|
||||
String EXTRA_API_CONFIG = "api_config";
|
||||
|
|
|
@ -73,6 +73,9 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
|||
return intent.getBooleanExtra(EXTRA_SINGLE_SELECTION, false)
|
||||
}
|
||||
|
||||
private val isSelectOnlyItemAutomatically: Boolean
|
||||
get() = intent.getBooleanExtra(EXTRA_SELECT_ONLY_ITEM_AUTOMATICALLY, false)
|
||||
|
||||
private val startIntent: Intent?
|
||||
get() {
|
||||
val startIntent = intent.getParcelableExtra<Intent>(EXTRA_START_INTENT)
|
||||
|
@ -115,6 +118,9 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
|||
}
|
||||
selectAccountButtons.visibility = if (isSingleSelection) View.GONE else View.VISIBLE
|
||||
accountsList.adapter = adapter
|
||||
if (adapter.count == 1 && isSelectOnlyItemAutomatically) {
|
||||
selectSingleAccount(0)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(view: View) {
|
||||
|
|
|
@ -160,7 +160,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
|||
val accountHost: String? = intent.getStringExtra(EXTRA_ACCOUNT_HOST) ?:
|
||||
uri.getQueryParameter(QUERY_PARAM_ACCOUNT_HOST) ?: e.accountHost
|
||||
selectIntent.putExtra(EXTRA_SINGLE_SELECTION, true)
|
||||
selectIntent.putExtra(EXTRA_SELECT_ONLY_ITEM, true)
|
||||
selectIntent.putExtra(EXTRA_SELECT_ONLY_ITEM_AUTOMATICALLY, true)
|
||||
selectIntent.putExtra(EXTRA_ACCOUNT_HOST, accountHost)
|
||||
selectIntent.putExtra(EXTRA_START_INTENT, intent)
|
||||
startActivity(selectIntent)
|
||||
|
|
Loading…
Reference in New Issue