This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.background | |
import androidx.compose.foundation.horizontalScroll | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.foundation.rememberScrollState | |
import androidx.compose.foundation.shape.CircleShape | |
import androidx.compose.material.Divider | |
import androidx.compose.material.Icon | |
import androidx.compose.material.Text | |
import androidx.compose.material.icons.Icons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventBus{ | |
private val event = MutableSharedFlow<Any>() | |
fun post(o: Any) = GlobalScope.launch(Dispatchers.IO) { | |
event.emit(o) | |
} | |
inline fun <reified T> subscribeOn(): Flow<T> = event.asSharedFlow() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.recyclerview.widget.GridLayoutManager | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.StaggeredGridLayoutManager | |
import kotlin.math.min | |
fun RecyclerView.onLoadMoreListener(onLoadMore: () -> Unit) { | |
this.addOnScrollListener(object : RecyclerView.OnScrollListener() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- add this permission --> | |
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | |
<!-- add provider --> | |
<application ...> | |
<provider | |
android:name="androidx.core.content.FileProvider" | |
android:authorities="${applicationId}.provider" | |
android:exported="false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log | |
import okhttp3.Interceptor | |
import okhttp3.Response | |
class OAuthInterceptor(private val tokenEntry: TokenEntry) : Interceptor { | |
override fun intercept(chain: Interceptor.Chain): Response { | |
var request = chain.request() | |
request = request.newBuilder() | |
.addHeader("Accept", "application/json") |