fixed NPE

This commit is contained in:
Mariotaku Lee 2016-12-02 08:25:23 +08:00
parent 01ccd4d60a
commit 756c1aec97
4 changed files with 13 additions and 5 deletions

View File

@ -283,7 +283,10 @@ class CustomTabsFragment : BaseSupportFragment(), LoaderCallbacks<Cursor?>, Mult
TAG_EDIT_TAB -> {
tab = arguments.getParcelable(EXTRA_OBJECT)
tabType = tab.type
conf = TabConfiguration.ofType(tabType)!!
conf = TabConfiguration.ofType(tabType) ?: run {
dismiss()
return
}
}
else -> {
throw AssertionError()

View File

@ -6,6 +6,8 @@ import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.main.layout_extra_config_user.view.*
import kotlinx.android.synthetic.main.list_item_simple_user.view.*
import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.UserListSelectorActivity
import org.mariotaku.twidere.constant.IntentConstants.*
@ -44,8 +46,8 @@ class UserExtraConfiguration(key: String) : TabConfiguration.ExtraConfiguration(
intent.setClass(context, UserListSelectorActivity::class.java)
fragment.startExtraConfigurationActivityForResult(this@UserExtraConfiguration, intent, 1)
}
hintView = view.findViewById(R.id.selectUserHint)
viewHolder = TwoLineWithIconViewHolder(view.findViewById(R.id.listItem))
hintView = view.selectUserHint
viewHolder = TwoLineWithIconViewHolder(view.listItem)
viewHolder.view.visibility = View.GONE
hintView.visibility = View.VISIBLE

View File

@ -6,6 +6,8 @@ import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.main.layout_extra_config_user_list.view.*
import kotlinx.android.synthetic.main.list_item_simple_user_list.view.*
import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.UserListSelectorActivity
import org.mariotaku.twidere.constant.IntentConstants.*
@ -44,8 +46,8 @@ class UserListExtraConfiguration(key: String) : TabConfiguration.ExtraConfigurat
intent.setClass(context, UserListSelectorActivity::class.java)
fragment.startExtraConfigurationActivityForResult(this@UserListExtraConfiguration, intent, 1)
}
hintView = view.findViewById(R.id.selectUserHint)
viewHolder = SimpleUserListViewHolder(view.findViewById(R.id.listItem))
hintView = view.selectUserListHint
viewHolder = SimpleUserListViewHolder(view.listItem)
viewHolder.itemView.visibility = View.GONE
hintView.visibility = View.VISIBLE

View File

@ -18,6 +18,7 @@
-->
<LinearLayout
android:id="@+id/listItem"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"