From b83ad85c959af6bd96f8249f5bac206d8d631e9d Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Fri, 8 Jul 2016 13:24:39 +0800 Subject: [PATCH] added user list details --- .../twidere/fragment/UserListFragment.kt | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserListFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserListFragment.kt index b8c36643e..17017326b 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserListFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserListFragment.kt @@ -65,7 +65,7 @@ import org.mariotaku.twidere.util.* class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCallbacks>, SystemWindowsInsetsCallback, SupportFragmentCallback { - private var mUserListLoaderInitialized: Boolean = false + private var userListLoaderInitialized: Boolean = false var userList: ParcelableUserList? = null private set @@ -88,9 +88,9 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa lm.destroyLoader(0) val args = Bundle(arguments) args.putBoolean(EXTRA_OMIT_INTENT_EXTRA, omitIntentExtra) - if (!mUserListLoaderInitialized) { + if (!userListLoaderInitialized) { lm.initLoader(0, args, this) - mUserListLoaderInitialized = true + userListLoaderInitialized = true } else { lm.restartLoader(0, args, this) } @@ -101,8 +101,7 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa when (requestCode) { REQUEST_SELECT_USER -> { val userList = this.userList - if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || twitter == null - || userList == null) + if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || userList == null) return val user = data.getParcelableExtra(EXTRA_USER) twitter.addUserListMembersAsync(userList.account_key, userList.id, user) @@ -248,6 +247,12 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa intent.putExtra(EXTRA_SINGLE_SELECTION, true) 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 -> { if (item.intent != null) { try { @@ -440,4 +445,15 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener, LoaderCa } + class UserListDetailsDialogFragment : BaseDialogFragment() { + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val userList = arguments.getParcelable(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() + } + } + }