added fab for trends tab

This commit is contained in:
Mariotaku Lee 2017-03-22 12:39:15 +08:00
parent 1bd6184502
commit b312a703fb
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
1 changed files with 24 additions and 1 deletions

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.fragment package org.mariotaku.twidere.fragment
import android.content.Context import android.content.Context
import android.content.Intent
import android.database.Cursor import android.database.Cursor
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.LoaderManager.LoaderCallbacks import android.support.v4.app.LoaderManager.LoaderCallbacks
@ -33,17 +34,24 @@ import kotlinx.android.synthetic.main.fragment_content_listview.*
import org.mariotaku.kpreferences.get import org.mariotaku.kpreferences.get
import org.mariotaku.sqliteqb.library.Expression import org.mariotaku.sqliteqb.library.Expression
import org.mariotaku.twidere.R import org.mariotaku.twidere.R
import org.mariotaku.twidere.TwidereConstants
import org.mariotaku.twidere.TwidereConstants.*
import org.mariotaku.twidere.activity.QuickSearchBarActivity
import org.mariotaku.twidere.adapter.TrendsAdapter import org.mariotaku.twidere.adapter.TrendsAdapter
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_EXTRAS import org.mariotaku.twidere.constant.IntentConstants.EXTRA_EXTRAS
import org.mariotaku.twidere.constant.localTrendsWoeIdKey import org.mariotaku.twidere.constant.localTrendsWoeIdKey
import org.mariotaku.twidere.fragment.iface.IFloatingActionButtonFragment
import org.mariotaku.twidere.fragment.iface.IFloatingActionButtonFragment.ActionInfo
import org.mariotaku.twidere.model.UserKey import org.mariotaku.twidere.model.UserKey
import org.mariotaku.twidere.model.event.TrendsRefreshedEvent import org.mariotaku.twidere.model.event.TrendsRefreshedEvent
import org.mariotaku.twidere.model.tab.extra.TrendsTabExtras import org.mariotaku.twidere.model.tab.extra.TrendsTabExtras
import org.mariotaku.twidere.provider.TwidereDataStore.CachedTrends import org.mariotaku.twidere.provider.TwidereDataStore.CachedTrends
import org.mariotaku.twidere.util.IntentUtils
import org.mariotaku.twidere.util.IntentUtils.openTweetSearch import org.mariotaku.twidere.util.IntentUtils.openTweetSearch
import org.mariotaku.twidere.util.Utils import org.mariotaku.twidere.util.Utils
class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), LoaderCallbacks<Cursor>, AdapterView.OnItemClickListener { class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), LoaderCallbacks<Cursor>,
AdapterView.OnItemClickListener, IFloatingActionButtonFragment {
private val tabExtras: TrendsTabExtras? private val tabExtras: TrendsTabExtras?
get() = arguments.getParcelable(EXTRA_EXTRAS) get() = arguments.getParcelable(EXTRA_EXTRAS)
@ -131,4 +139,19 @@ class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), L
refreshing = false refreshing = false
} }
override fun getActionInfo(tag: String): ActionInfo? {
when (tag) {
"home" -> {
return ActionInfo(R.drawable.ic_action_search, getString(R.string.action_search))
}
}
return null
}
override fun onActionClick(tag: String): Boolean {
val intent = Intent(activity, QuickSearchBarActivity::class.java)
intent.putExtra(EXTRA_ACCOUNT_KEY, accountKey)
startActivity(intent)
return true
}
} }