Skip to content

Instantly share code, notes, and snippets.

View mitchtabian's full-sized avatar
🎞️
Building stuff

Mitch Tabian mitchtabian

🎞️
Building stuff
View GitHub Profile
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
// Align composables with respect to one another
@Composable
fun CircularIndeterminateProgressBar(isDisplayed: Boolean) {
if (isDisplayed) {
ConstraintLayout(
modifier = Modifier.fillMaxSize()
) {
val (progress, text) = createRefs()
CircularProgressIndicator(
modifier = Modifier.constrainAs(progress) {
sealed class ProgressBarState{
object Loading: ProgressBarState()
object None: ProgressBarState()
}
sealed class DataState<T> {
data class Response<T>(
def private_chat_room_view(request, *args, **kwargs):
room_id = request.GET.get("room_id")
user = request.user
if not user.is_authenticated:
base_url = reverse('login')
query_string = urlencode({'next': f"/chat/?room_id={room_id}"})
url = f"{base_url}?{query_string}"
return redirect(url)
context = {}
struct RecipeListScreen: View {
@ObservedObject var viewModel: RecipeListViewModel
init(){
self.viewModel = RecipeListViewModel()
}
var body: some View {
List {
@Composable
fun RecipeListScreen(
state: RecipeListState,
onTriggerEvent: (Event) -> Unit,
onClickRecipeListItem: (Int) -> Unit,
){
AppTheme {
RecipeList(
loading = state.isLoading,
recipes = state.recipes,

I couldn't get BottomSheetScaffold to work properly when used on top of a GoogleMap (in an AndroidView). So I made my own.

It is not thoroughly tested but seems to be working well enough.

Create a bottom sheet like this: https://imgur.com/gallery/FTWS8Uc

Usage

Keep reference to SimpleBottomSheetManager in viewmodel

Updates for the Food2ForkCompose app from alpha-11 to beta01.

Versions

  1. kotlin -> 1.4.30
    • Make sure Kotlin is updated to early version
    • Settings > Languages and Frameworks > Kotlin > Early Access Preview 1.4.x
  2. kotlin_compiler_extension -> 1.0.0-beta01
  3. compose -> 1.0.0-beta01 (from alpha11)
  4. navigation-compose -> 1.0.0-alpha08 (from alpha06)
  5. Add const val compose_constraint = "1.0.0-alpha03"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
>