parent
63e4081ff1
commit
3f793b2193
|
@ -28,7 +28,7 @@ subprojects {
|
|||
buildscript {
|
||||
ext {
|
||||
libVersions = [
|
||||
Kotlin : '1.1.1',
|
||||
Kotlin : '1.1.2',
|
||||
SupportLib : '25.3.1',
|
||||
MariotakuCommons : '0.9.15',
|
||||
RestFu : '0.9.54',
|
||||
|
|
|
@ -41,8 +41,8 @@ android {
|
|||
applicationId "org.mariotaku.twidere"
|
||||
minSdkVersion project.properties['overrideMinSdkVersion'] ?: 14
|
||||
targetSdkVersion 25
|
||||
versionCode 348
|
||||
versionName '3.5.31'
|
||||
versionCode 349
|
||||
versionName '3.5.32'
|
||||
multiDexEnabled true
|
||||
|
||||
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.content.Intent
|
|||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks
|
||||
import android.support.v4.content.Loader
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
|
@ -445,7 +446,8 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
|
||||
protected abstract fun onContentLoaded(loader: Loader<List<ParcelableActivity>>, data: List<ParcelableActivity>?)
|
||||
|
||||
protected fun saveReadPosition(position: Int) {
|
||||
@CallSuper
|
||||
protected open fun saveReadPosition(position: Int) {
|
||||
if (host == null) return
|
||||
if (position == RecyclerView.NO_POSITION || adapter.getActivityCount(false) <= 0) return
|
||||
val item = adapter.getActivity(position)
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks
|
||||
import android.support.v4.content.Loader
|
||||
|
@ -475,8 +476,8 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
return StatusesBusCallback()
|
||||
}
|
||||
|
||||
|
||||
protected fun saveReadPosition(position: Int) {
|
||||
@CallSuper
|
||||
protected open fun saveReadPosition(position: Int) {
|
||||
if (host == null) return
|
||||
if (position == RecyclerView.NO_POSITION || adapter.getStatusCount(false) <= 0) return
|
||||
val status = adapter.getStatus(position.coerceIn(rangeOfSize(adapter.statusStartIndex,
|
||||
|
|
|
@ -28,10 +28,8 @@ import android.net.Uri
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.support.v4.content.Loader
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.widget.Toast
|
||||
import com.squareup.otto.Subscribe
|
||||
import kotlinx.android.synthetic.main.fragment_content_recyclerview.*
|
||||
import org.mariotaku.ktextension.addOnAccountsUpdatedListenerSafe
|
||||
import org.mariotaku.ktextension.contains
|
||||
import org.mariotaku.ktextension.removeOnAccountsUpdatedListenerSafe
|
||||
|
@ -74,14 +72,6 @@ abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
|
|||
|
||||
private var contentObserver: ContentObserver? = null
|
||||
|
||||
private val onScrollListener = object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
clearNotifications()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val accountListener: OnAccountsUpdateListener = OnAccountsUpdateListener {
|
||||
reloadActivities()
|
||||
}
|
||||
|
@ -100,13 +90,11 @@ abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
|
|||
context.contentResolver.registerContentObserver(Filters.CONTENT_URI, true, contentObserver)
|
||||
}
|
||||
AccountManager.get(context).addOnAccountsUpdatedListenerSafe(accountListener, updateImmediately = false)
|
||||
recyclerView.addOnScrollListener(onScrollListener)
|
||||
updateRefreshState()
|
||||
reloadActivities()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
recyclerView.removeOnScrollListener(onScrollListener)
|
||||
if (contentObserver != null) {
|
||||
context.contentResolver.unregisterContentObserver(contentObserver)
|
||||
contentObserver = null
|
||||
|
@ -115,13 +103,6 @@ abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
|
|||
super.onStop()
|
||||
}
|
||||
|
||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||
super.setUserVisibleHint(isVisibleToUser)
|
||||
if (isVisibleToUser) {
|
||||
clearNotifications()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateActivitiesLoader(context: Context, args: Bundle, fromUser: Boolean): Loader<List<ParcelableActivity>> {
|
||||
val uri = contentUri
|
||||
val table = getTableNameByUri(uri)!!
|
||||
|
@ -215,6 +196,12 @@ abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
|
|||
return true
|
||||
}
|
||||
|
||||
override fun saveReadPosition(position: Int) {
|
||||
super.saveReadPosition(position)
|
||||
if (position == 0) {
|
||||
clearNotifications()
|
||||
}
|
||||
}
|
||||
protected fun getFiltersWhere(table: String): Expression? {
|
||||
if (!isFilterEnabled) return null
|
||||
return DataStoreUtils.buildActivityFilterWhereClause(table, null)
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.net.Uri
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.support.v4.content.Loader
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.widget.Toast
|
||||
import com.bumptech.glide.Glide
|
||||
import com.squareup.otto.Subscribe
|
||||
|
@ -85,14 +84,6 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
|
|||
reloadStatuses()
|
||||
}
|
||||
|
||||
private val onScrollListener = object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
clearNotifications()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
if (contentObserver == null) {
|
||||
|
@ -104,13 +95,11 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
|
|||
context.contentResolver.registerContentObserver(Filters.CONTENT_URI, true, contentObserver)
|
||||
}
|
||||
AccountManager.get(context).addOnAccountsUpdatedListenerSafe(accountListener, updateImmediately = false)
|
||||
recyclerView.addOnScrollListener(onScrollListener)
|
||||
updateRefreshState()
|
||||
reloadStatuses()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
recyclerView.removeOnScrollListener(onScrollListener)
|
||||
if (contentObserver != null) {
|
||||
context.contentResolver.unregisterContentObserver(contentObserver)
|
||||
contentObserver = null
|
||||
|
@ -207,9 +196,9 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
|
|||
return true
|
||||
}
|
||||
|
||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||
super.setUserVisibleHint(isVisibleToUser)
|
||||
if (isVisibleToUser) {
|
||||
override fun saveReadPosition(position: Int) {
|
||||
super.saveReadPosition(position)
|
||||
if (position == 0) {
|
||||
clearNotifications()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue