improved trends tab
This commit is contained in:
parent
e9ed62eb6e
commit
c975118390
|
@ -65,6 +65,7 @@ val mediaPreloadKey = KBooleanKey(KEY_MEDIA_PRELOAD, false)
|
|||
val mediaPreloadOnWifiOnlyKey = KBooleanKey(KEY_PRELOAD_WIFI_ONLY, true)
|
||||
val autoRefreshCompatibilityModeKey = KBooleanKey("auto_refresh_compatibility_mode", Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||
val floatingDetailedContentsKey = KBooleanKey("floating_detailed_contents", true)
|
||||
val localTrendsWoeIdKey = KIntKey(SharedPreferenceConstants.KEY_LOCAL_TRENDS_WOEID, 1)
|
||||
|
||||
object themeBackgroundAlphaKey : KSimpleKey<Int>(KEY_THEME_BACKGROUND_ALPHA, 0xFF) {
|
||||
override fun read(preferences: SharedPreferences): Int {
|
||||
|
|
|
@ -30,10 +30,12 @@ import android.widget.AdapterView
|
|||
import android.widget.ListView
|
||||
import com.squareup.otto.Subscribe
|
||||
import kotlinx.android.synthetic.main.fragment_content_listview.*
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.sqliteqb.library.Expression
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.TrendsAdapter
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_EXTRAS
|
||||
import org.mariotaku.twidere.constant.localTrendsWoeIdKey
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.model.message.TrendsRefreshedEvent
|
||||
import org.mariotaku.twidere.model.tab.extra.TrendsTabExtras
|
||||
|
@ -43,13 +45,16 @@ import org.mariotaku.twidere.util.Utils
|
|||
|
||||
class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), LoaderCallbacks<Cursor>, AdapterView.OnItemClickListener {
|
||||
|
||||
private val accountKey: UserKey? get() = Utils.getAccountKeys(context, arguments)?.firstOrNull()
|
||||
?: Utils.getDefaultAccountKey(context)
|
||||
private val tabExtras: TrendsTabExtras? get() = arguments.getParcelable(EXTRA_EXTRAS)
|
||||
|
||||
private val accountKey: UserKey? get() {
|
||||
return Utils.getAccountKeys(context, arguments)?.firstOrNull()
|
||||
?: Utils.getDefaultAccountKey(context)
|
||||
}
|
||||
|
||||
private val woeId: Int get() {
|
||||
val id = tabExtras?.woeId ?: return 1
|
||||
return if (id > 0) id else 1
|
||||
val id = tabExtras?.woeId ?: 0
|
||||
return if (id > 0) id else preferences[localTrendsWoeIdKey]
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
|
|
Loading…
Reference in New Issue