Merge branch 'update_dependencies' into 'master'
Update dependencies See merge request pixeldroid/PixelDroid!312
This commit is contained in:
commit
ad39fdb9f6
|
@ -96,32 +96,32 @@ dependencies {
|
|||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
|
||||
implementation "androidx.browser:browser:1.3.0"
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
|
||||
implementation 'androidx.paging:paging-runtime-ktx:3.0.0-alpha12'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0'
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
|
||||
implementation 'androidx.paging:paging-runtime-ktx:3.0.0-beta02'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0'
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.0"
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0"
|
||||
implementation "androidx.annotation:annotation:1.1.0"
|
||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||
|
||||
// Use the most recent version of CameraX
|
||||
def cameraX_version = '1.0.0-rc02'
|
||||
def cameraX_version = '1.0.0-rc03'
|
||||
implementation "androidx.camera:camera-core:${cameraX_version}"
|
||||
implementation "androidx.camera:camera-camera2:${cameraX_version}"
|
||||
// CameraX Lifecycle library
|
||||
implementation "androidx.camera:camera-lifecycle:$cameraX_version"
|
||||
|
||||
// CameraX View class
|
||||
implementation 'androidx.camera:camera-view:1.0.0-alpha21'
|
||||
implementation 'androidx.camera:camera-view:1.0.0-alpha22'
|
||||
|
||||
def room_version = "2.3.0-beta01"
|
||||
def room_version = "2.3.0-beta03"
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
kapt "androidx.room:room-compiler:$room_version"
|
||||
implementation "androidx.room:room-ktx:$room_version"
|
||||
|
@ -190,7 +190,7 @@ dependencies {
|
|||
|
||||
// debugImplementation required vs testImplementation: https://issuetracker.google.com/issues/128612536
|
||||
//noinspection FragmentGradleConfiguration
|
||||
stagingImplementation("androidx.fragment:fragment-testing:1.3.0") {
|
||||
stagingImplementation("androidx.fragment:fragment-testing:1.3.1") {
|
||||
exclude group:'androidx.test', module:'monitor'
|
||||
}
|
||||
|
||||
|
|
|
@ -220,9 +220,7 @@ class HomeFeedTest {
|
|||
@Test
|
||||
fun performClickOnSensitiveWarning() {
|
||||
waitForView(R.id.username)
|
||||
|
||||
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(1))
|
||||
|
||||
|
||||
onView(second(withId(R.id.sensitiveWarning))).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
onView(withId(R.id.list))
|
||||
|
|
|
@ -6,14 +6,15 @@ import com.h.pixeldroid.utils.api.PixelfedAPI
|
|||
import com.h.pixeldroid.utils.api.objects.Account
|
||||
import retrofit2.HttpException
|
||||
import java.io.IOException
|
||||
import java.math.BigInteger
|
||||
|
||||
class FollowersPagingSource(
|
||||
private val api: PixelfedAPI,
|
||||
private val accessToken: String,
|
||||
private val accountId: String,
|
||||
private val following: Boolean
|
||||
) : PagingSource<Int, Account>() {
|
||||
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, Account> {
|
||||
) : PagingSource<String, Account>() {
|
||||
override suspend fun load(params: LoadParams<String>): LoadResult<String, Account> {
|
||||
val position = params.key
|
||||
return try {
|
||||
val response =
|
||||
|
@ -24,14 +25,14 @@ class FollowersPagingSource(
|
|||
api.followers(account_id = accountId,
|
||||
authorization = "Bearer $accessToken",
|
||||
limit = params.loadSize,
|
||||
page = position?.toString(),
|
||||
max_id = position?.toString())
|
||||
page = position,
|
||||
max_id = position)
|
||||
} else {
|
||||
api.following(account_id = accountId,
|
||||
authorization = "Bearer $accessToken",
|
||||
limit = params.loadSize,
|
||||
page = position?.toString(),
|
||||
max_id = position?.toString())
|
||||
page = position,
|
||||
max_id = position)
|
||||
}
|
||||
|
||||
val accounts = if(response.isSuccessful){
|
||||
|
@ -40,19 +41,19 @@ class FollowersPagingSource(
|
|||
throw HttpException(response)
|
||||
}
|
||||
|
||||
val nextPosition = if(response.headers()["Link"] != null){
|
||||
val nextPosition: String = if(response.headers()["Link"] != null){
|
||||
//Header is of the form:
|
||||
// Link: <https://mastodon.social/api/v1/accounts/1/followers?limit=2&max_id=7628164>; rel="next", <https://mastodon.social/api/v1/accounts/1/followers?limit=2&since_id=7628165>; rel="prev"
|
||||
// So we want the first max_id value. In case there are arguments after
|
||||
// the max_id in the URL, we make sure to stop at the first '?'
|
||||
response.headers()["Link"]
|
||||
.orEmpty()
|
||||
.substringAfter("max_id=")
|
||||
.substringBefore('?')
|
||||
.substringBefore('>')
|
||||
.toIntOrNull() ?: 0
|
||||
.substringAfter("max_id=", "")
|
||||
.substringBefore('?', "")
|
||||
.substringBefore('>', "")
|
||||
} else {
|
||||
params.key?.plus(1) ?: 2
|
||||
// No Link header, so we just increment the position value
|
||||
(position?.toBigIntegerOrNull() ?: 1.toBigInteger()).inc().toString()
|
||||
}
|
||||
|
||||
LoadResult.Page(
|
||||
|
@ -66,4 +67,9 @@ class FollowersPagingSource(
|
|||
LoadResult.Error(exception)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRefreshKey(state: PagingState<String, Account>): String? =
|
||||
state.anchorPosition?.run {
|
||||
state.closestItemToPosition(this)?.id
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.h.pixeldroid.posts.feeds.uncachedFeeds.search
|
||||
|
||||
import androidx.paging.PagingSource
|
||||
import androidx.paging.PagingState
|
||||
import com.h.pixeldroid.utils.api.PixelfedAPI
|
||||
import com.h.pixeldroid.utils.api.objects.FeedContent
|
||||
import com.h.pixeldroid.utils.api.objects.Results
|
||||
|
@ -44,4 +45,9 @@ class SearchPagingSource<T: FeedContent>(
|
|||
LoadResult.Error(exception)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRefreshKey(state: PagingState<Int, T>): Int? =
|
||||
state.anchorPosition?.run {
|
||||
state.closestItemToPosition(this)?.id?.toIntOrNull()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue