mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-19 03:29:58 +01:00
improved FAB
This commit is contained in:
parent
95fdb49477
commit
b967c1aeb3
@ -835,14 +835,9 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
val position = mainPager.currentItem
|
||||
if (pagerAdapter.count == 0) return
|
||||
val fragment = pagerAdapter.instantiateItem(mainPager, position) as? IFloatingActionButtonFragment ?: return
|
||||
fragment.onActionClick("home")
|
||||
val tab = pagerAdapter.getTab(position)
|
||||
when (tab.cls) {
|
||||
MessagesEntriesFragment::class.java -> {
|
||||
//TODO: open message creator
|
||||
}
|
||||
TrendsSuggestionsFragment::class.java -> openSearchView(null)
|
||||
else -> startActivity(Intent(INTENT_ACTION_COMPOSE))
|
||||
val handled = fragment.onActionClick("home") ?: false
|
||||
if (!handled) {
|
||||
startActivity(Intent(INTENT_ACTION_COMPOSE))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.mariotaku.twidere.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks
|
||||
import android.support.v4.content.Loader
|
||||
@ -10,6 +11,9 @@ import org.mariotaku.ktextension.toStringArray
|
||||
import org.mariotaku.sqliteqb.library.Expression
|
||||
import org.mariotaku.sqliteqb.library.OrderBy
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_ACCOUNT_KEYS
|
||||
import org.mariotaku.twidere.TwidereConstants.REQUEST_SELECT_ACCOUNT
|
||||
import org.mariotaku.twidere.activity.AccountSelectorActivity
|
||||
import org.mariotaku.twidere.adapter.MessagesEntriesAdapter
|
||||
import org.mariotaku.twidere.adapter.MessagesEntriesAdapter.MessageConversationClickListener
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
@ -119,7 +123,9 @@ class MessagesEntriesFragment : AbsContentListRecyclerViewFragment<MessagesEntri
|
||||
|
||||
override fun onActionClick(tag: String) {
|
||||
val accountKey = accountKeys.singleOrNull() ?: run {
|
||||
|
||||
val selectIntent = Intent(context, AccountSelectorActivity::class.java)
|
||||
selectIntent.putExtra(EXTRA_ACCOUNT_KEYS, accountKeys)
|
||||
startActivityForResult(selectIntent, REQUEST_SELECT_ACCOUNT)
|
||||
return
|
||||
}
|
||||
startActivity(IntentUtils.newMessageConversation(accountKey))
|
||||
|
@ -26,7 +26,7 @@ package org.mariotaku.twidere.fragment.iface
|
||||
interface IFloatingActionButtonFragment {
|
||||
|
||||
fun getActionInfo(tag: String): ActionInfo?
|
||||
fun onActionClick(tag: String)
|
||||
fun onActionClick(tag: String) : Boolean
|
||||
|
||||
data class ActionInfo(val icon: Int, val title: String)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user