added user list details
This commit is contained in:
parent
6a43aca5eb
commit
b83ad85c95
|
@ -65,7 +65,7 @@ import org.mariotaku.twidere.util.*
|
||||||
|
|
||||||
class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCallbacks<SingleResponse<ParcelableUserList>>, SystemWindowsInsetsCallback, SupportFragmentCallback {
|
class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCallbacks<SingleResponse<ParcelableUserList>>, SystemWindowsInsetsCallback, SupportFragmentCallback {
|
||||||
|
|
||||||
private var mUserListLoaderInitialized: Boolean = false
|
private var userListLoaderInitialized: Boolean = false
|
||||||
|
|
||||||
var userList: ParcelableUserList? = null
|
var userList: ParcelableUserList? = null
|
||||||
private set
|
private set
|
||||||
|
@ -88,9 +88,9 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa
|
||||||
lm.destroyLoader(0)
|
lm.destroyLoader(0)
|
||||||
val args = Bundle(arguments)
|
val args = Bundle(arguments)
|
||||||
args.putBoolean(EXTRA_OMIT_INTENT_EXTRA, omitIntentExtra)
|
args.putBoolean(EXTRA_OMIT_INTENT_EXTRA, omitIntentExtra)
|
||||||
if (!mUserListLoaderInitialized) {
|
if (!userListLoaderInitialized) {
|
||||||
lm.initLoader(0, args, this)
|
lm.initLoader(0, args, this)
|
||||||
mUserListLoaderInitialized = true
|
userListLoaderInitialized = true
|
||||||
} else {
|
} else {
|
||||||
lm.restartLoader(0, args, this)
|
lm.restartLoader(0, args, this)
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,7 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_USER -> {
|
REQUEST_SELECT_USER -> {
|
||||||
val userList = this.userList
|
val userList = this.userList
|
||||||
if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || twitter == null
|
if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || userList == null)
|
||||||
|| userList == null)
|
|
||||||
return
|
return
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
||||||
twitter.addUserListMembersAsync(userList.account_key, userList.id, user)
|
twitter.addUserListMembersAsync(userList.account_key, userList.id, user)
|
||||||
|
@ -248,6 +247,12 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa
|
||||||
intent.putExtra(EXTRA_SINGLE_SELECTION, true)
|
intent.putExtra(EXTRA_SINGLE_SELECTION, true)
|
||||||
startActivityForResult(intent, REQUEST_SELECT_ACCOUNT)
|
startActivityForResult(intent, REQUEST_SELECT_ACCOUNT)
|
||||||
}
|
}
|
||||||
|
R.id.info -> {
|
||||||
|
val df = UserListDetailsDialogFragment()
|
||||||
|
df.arguments = Bundle()
|
||||||
|
df.arguments.putParcelable(EXTRA_USER_LIST, userList)
|
||||||
|
df.show(childFragmentManager, "user_list_details")
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
if (item.intent != null) {
|
if (item.intent != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -440,4 +445,15 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class UserListDetailsDialogFragment : BaseDialogFragment() {
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
val userList = arguments.getParcelable<ParcelableUserList>(EXTRA_USER_LIST)
|
||||||
|
val builder = AlertDialog.Builder(context)
|
||||||
|
builder.setTitle(userList.name)
|
||||||
|
builder.setMessage(userList.description)
|
||||||
|
builder.setPositiveButton(android.R.string.ok, null)
|
||||||
|
return builder.create()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue