fixed #787
This commit is contained in:
Mariotaku Lee 2017-04-24 18:54:09 +08:00
parent a376c6f01d
commit 92ab85adf9
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
3 changed files with 11 additions and 13 deletions

View File

@ -21,9 +21,11 @@ package org.mariotaku.twidere.model.tab.impl
import android.content.Context
import org.mariotaku.twidere.R
import org.mariotaku.twidere.annotation.AccountType
import org.mariotaku.twidere.annotation.TabAccountFlags
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_PLACE
import org.mariotaku.twidere.fragment.TrendsSuggestionsFragment
import org.mariotaku.twidere.model.AccountDetails
import org.mariotaku.twidere.model.Tab
import org.mariotaku.twidere.model.tab.DrawableHolder
import org.mariotaku.twidere.model.tab.StringHolder
@ -84,4 +86,10 @@ class TrendsTabConfiguration : TabConfiguration() {
}
return true
}
override fun checkAccountAvailability(details: AccountDetails) = when (details.type) {
AccountType.FANFOU, AccountType.TWITTER -> true
else -> false
}
}

View File

@ -191,7 +191,6 @@ class ContentNotificationManager(
style.setSummaryText(accountName)
val ci = ObjectCursor.indicesFrom(c, ParcelableActivity::class.java)
var timestamp = -1L
var newMaxPositionKey = -1L
val filteredUserKeys = DataStoreUtils.getFilteredUserKeys(context)
var consumed = 0
@ -214,11 +213,6 @@ class ContentNotificationManager(
if (sources.isEmpty()) return@forEachRow false
if (timestamp == -1L) {
timestamp = activity.timestamp
}
val message = ActivityTitleSummaryMessage.get(context, userColorNameManager,
activity, sources, 0, useStarForLikes, nameFirst) ?: return@forEachRow false
val summary = message.summary
@ -250,13 +244,9 @@ class ContentNotificationManager(
style.setBigContentTitle(title)
builder.setNumber(displayCount)
builder.setContentIntent(getContentIntent(context, CustomTabType.NOTIFICATIONS_TIMELINE,
NotificationType.INTERACTIONS, accountKey, timestamp))
NotificationType.INTERACTIONS, accountKey, newMaxPositionKey))
builder.setDeleteIntent(getMarkReadDeleteIntent(context, NotificationType.INTERACTIONS,
accountKey, newMaxPositionKey, false))
if (timestamp != -1L) {
builder.setDeleteIntent(getMarkReadDeleteIntent(context,
NotificationType.INTERACTIONS, accountKey, timestamp, false))
}
} catch (e: IOException) {
return
} finally {

View File

@ -112,10 +112,10 @@ class TwidereSQLiteOpenHelper(
for (i in 0 until tabTypes.size) {
@CustomTabType
val tabType = tabTypes[i]
val conf = TabConfiguration.ofType(tabType)
val conf = TabConfiguration.ofType(tabType) ?: continue
val tab = Tab().apply {
this.type = tabType
this.icon = conf!!.icon.persistentKey
this.icon = conf.icon.persistentKey
this.position = i
}
db.insert(Tabs.TABLE_NAME, null, creator.create(tab))