diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt index 496897460..9546efb67 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt @@ -103,6 +103,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.* import org.mariotaku.twidere.util.* import org.mariotaku.twidere.util.ContentScrollHandler.ContentListSupport import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback +import org.mariotaku.twidere.util.RecyclerViewScrollHandler.RecyclerViewCallback import org.mariotaku.twidere.view.CardMediaContainer.OnMediaClickListener import org.mariotaku.twidere.view.ExtendedRecyclerView import org.mariotaku.twidere.view.holder.GapViewHolder @@ -121,19 +122,18 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks> { override fun onCreateLoader(id: Int, args: Bundle): Loader> { @@ -256,36 +256,32 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks return true } - return navigationHelper!!.isKeyboardShortcutHandled(handler, keyCode, event, metaState) + return navigationHelper.isKeyboardShortcutHandled(handler, keyCode, event, metaState) } override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int, repeatCount: Int, event: KeyEvent, metaState: Int): Boolean { - return navigationHelper!!.handleKeyboardShortcutRepeat(handler, keyCode, + return navigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState) } @@ -429,13 +424,13 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks>) { - val event = mStatusEvent ?: return + val event = statusEvent ?: return event.markEnd() val accountKey = UserKey(event.accountId, event.accountHost) HotMobiLogger.getInstance(activity).log(accountKey, event) } - override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { - inflater!!.inflate(R.menu.menu_status, menu) + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + inflater.inflate(R.menu.menu_status, menu) } - override fun onPrepareOptionsMenu(menu: Menu?) { + override fun onPrepareOptionsMenu(menu: Menu) { MenuUtils.setItemAvailability(menu, R.id.current_status, adapter.status != null) super.onPrepareOptionsMenu(menu) } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - when (item!!.itemId) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { R.id.current_status -> { if (adapter.status != null) { val position = adapter.getFirstPositionOfItem(StatusAdapter.ITEM_IDX_STATUS) - recyclerView!!.smoothScrollToPosition(position) + recyclerView.smoothScrollToPosition(position) } return true } @@ -507,10 +502,10 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks= adapter.itemCount - 1 + get() = layoutManager.findLastCompletelyVisibleItemPosition() >= adapter.itemCount - 1 override val reachingStart: Boolean - get() = layoutManager!!.findFirstCompletelyVisibleItemPosition() <= 1 + get() = layoutManager.findFirstCompletelyVisibleItemPosition() <= 1 private val status: ParcelableStatus? get() = adapter.status @@ -566,7 +561,7 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks