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_PINNED_STATUS_IDS = "pinned_status_ids";
|
||||||
String EXTRA_SHOULD_INIT_LOADER = "should_init_loader";
|
String EXTRA_SHOULD_INIT_LOADER = "should_init_loader";
|
||||||
String EXTRA_START_INTENT = "start_intent";
|
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_OBJECT = "object";
|
||||||
String EXTRA_SIMPLE_LAYOUT = "simple_layout";
|
String EXTRA_SIMPLE_LAYOUT = "simple_layout";
|
||||||
String EXTRA_API_CONFIG = "api_config";
|
String EXTRA_API_CONFIG = "api_config";
|
||||||
|
|
|
@ -73,6 +73,9 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
||||||
return intent.getBooleanExtra(EXTRA_SINGLE_SELECTION, false)
|
return intent.getBooleanExtra(EXTRA_SINGLE_SELECTION, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val isSelectOnlyItemAutomatically: Boolean
|
||||||
|
get() = intent.getBooleanExtra(EXTRA_SELECT_ONLY_ITEM_AUTOMATICALLY, false)
|
||||||
|
|
||||||
private val startIntent: Intent?
|
private val startIntent: Intent?
|
||||||
get() {
|
get() {
|
||||||
val startIntent = intent.getParcelableExtra<Intent>(EXTRA_START_INTENT)
|
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
|
selectAccountButtons.visibility = if (isSingleSelection) View.GONE else View.VISIBLE
|
||||||
accountsList.adapter = adapter
|
accountsList.adapter = adapter
|
||||||
|
if (adapter.count == 1 && isSelectOnlyItemAutomatically) {
|
||||||
|
selectSingleAccount(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(view: View) {
|
override fun onClick(view: View) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||||
val accountHost: String? = intent.getStringExtra(EXTRA_ACCOUNT_HOST) ?:
|
val accountHost: String? = intent.getStringExtra(EXTRA_ACCOUNT_HOST) ?:
|
||||||
uri.getQueryParameter(QUERY_PARAM_ACCOUNT_HOST) ?: e.accountHost
|
uri.getQueryParameter(QUERY_PARAM_ACCOUNT_HOST) ?: e.accountHost
|
||||||
selectIntent.putExtra(EXTRA_SINGLE_SELECTION, true)
|
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_ACCOUNT_HOST, accountHost)
|
||||||
selectIntent.putExtra(EXTRA_START_INTENT, intent)
|
selectIntent.putExtra(EXTRA_START_INTENT, intent)
|
||||||
startActivity(selectIntent)
|
startActivity(selectIntent)
|
||||||
|
|
Loading…
Reference in New Issue