Coder Social home page Coder Social logo

skydoves / orbital Goto Github PK

View Code? Open in Web Editor NEW
1.0K 15.0 34.0 41.42 MB

๐Ÿช Jetpack Compose Multiplatform library that allows you to implement dynamic transition animations such as shared element transitions.

License: Apache License 2.0

Kotlin 100.00%
android animation jetpack-compose sharedelementtransitions skydoves

orbital's Introduction

Orbital


Google
License API Build Status Android Weekly Kotlin Weekly Profile


๐Ÿช Jetpack Compose animation library that allows you to implement animations such as shared element transition. This library support Kotlin Multiplatform (Android, iOS, Desktop, macOS, and js)


Download

Maven Central

Gradle

Add the dependency below to your module's build.gradle file:

dependencies {
    implementation("com.github.skydoves:orbital:0.3.4")
}

Note: This is an experimental library that demonstrates various animations with Jetpack Compose. Please make sure that your project uses Jetpack Compose 1.5.4, Compose Compiler 1.5.4, and Kotlin 1.9.20.

For Kotlin Multiplatform, add the dependency below to your module's build.gradle.kts file:

sourceSets {
    val commonMain by getting {
        dependencies {
            implementation("com.github.skydoves:orbital:$version")
        }
    }
}

Usage

You can implement three kinds of animations with Orbital: Movement, Transformation, and Shared Element Transition. Basically, you can run animation with Orbital Composable function, which provides OrbitalScope that allows you to create animations.

Transformation

The example below shows how to implement resizing animation with the animateTransformation extension of the OrbitalScope. The rememberContentWithOrbitalScope allows you to create custom animations such as animateTransformation on the OrbitalScope. You can apply the animateTransformation animation to specific Composables and customize its AnimationSpec as seen the below:

  val transformationSpec = SpringSpec<IntSize>(
    dampingRatio = Spring.DampingRatioMediumBouncy,
    stiffness = 200f
  )

  var isTransformed by rememberSaveable { mutableStateOf(false) }
  val poster = rememberContentWithOrbitalScope {
    GlideImage(
      modifier = if (isTransformed) {
        Modifier.size(300.dp, 620.dp)
      } else {
        Modifier.size(100.dp, 220.dp)
      }.animateTransformation(this, transformationSpec),
      imageModel = ItemUtils.urls[0],
      contentScale = ContentScale.Fit
    )
  }

  Orbital(
    modifier = Modifier
      .clickable { isTransformed = !isTransformed }
  ) {
    Column(
      Modifier.fillMaxSize(),
      horizontalAlignment = Alignment.CenterHorizontally,
      verticalArrangement = Arrangement.Center
    ) {
      poster()
    }
  }

Movement

The example below shows how to implement movement animation with the animateMovement extension of the OrbitalScope. The rememberContentWithOrbitalScope allows you to create custom animations such as animateMovement on the OrbitalScope. You can apply the animateMovement animation to specific Composables and customize its AnimationSpec as seen the below:

  val movementSpec = SpringSpec<IntOffset>(
    dampingRatio = Spring.DampingRatioMediumBouncy,
    stiffness = 200f
  )
  
  var isTransformed by rememberSaveable { mutableStateOf(false) }
  val poster = rememberContentWithOrbitalScope {
    GlideImage(
      modifier = if (isTransformed) {
        Modifier.size(360.dp, 620.dp)
      } else {
        Modifier.size(130.dp, 220.dp)
      }.animateMovement(this, movementSpec),
      imageModel = ItemUtils.urls[3],
      contentScale = ContentScale.Fit
    )
  }

  Orbital(
    modifier = Modifier
      .clickable { isTransformed = !isTransformed }
  ) {
    if (isTransformed) {
      Column(
        Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
      ) {
        poster()
      }
    } else {
      Column(
        Modifier
          .fillMaxSize()
          .padding(20.dp),
        horizontalAlignment = Alignment.End,
        verticalArrangement = Arrangement.Bottom
      ) {
        poster()
      }
    }
  }

Shared Element Transition

The example below shows how to implement shared element transition with the animateSharedElementTransition extension of the OrbitalScope. The rememberContentWithOrbitalScope allows you to create custom animations such as animateSharedElementTransition on the OrbitalScope. You can apply the animateSharedElementTransition animation to specific Composables and customize its AnimationSpec. Also, you can set the different AnimationSpecs for the movement and transformation as seen the below:

@Composable
private fun OrbitalSharedElementTransitionExample() {
  var isTransformed by rememberSaveable { mutableStateOf(false) }
  val item = MockUtils.getMockPosters()[3]
  val poster = rememberContentWithOrbitalScope {
    GlideImage(
      modifier = if (isTransformed) {
        Modifier.fillMaxSize()
      } else {
        Modifier.size(130.dp, 220.dp)
      }.animateSharedElementTransition(
        this,
        SpringSpec(stiffness = 500f),
        SpringSpec(stiffness = 500f)
      ),
      imageModel = item.poster,
      contentScale = ContentScale.Fit
    )
  }

  Orbital(
    modifier = Modifier
      .clickable { isTransformed = !isTransformed }
  ) {
    if (isTransformed) {
      PosterDetails(
        poster = item,
        sharedElementContent = { poster() },
        pressOnBack = {}
      )
    } else {
      Column(
        Modifier
          .fillMaxSize()
          .padding(20.dp),
        horizontalAlignment = Alignment.End,
        verticalArrangement = Arrangement.Bottom
      ) {
        poster()
      }
    }
  }
}

Note: LookaheadLayout is a very experimental API, so measuring complex Composables might throw exceptions.

Shared Element Transition with Multiple Items

The example below shows how to implement shared element transition with multipe items. The basic concept of the usage is the same as the Shared Element Transition example.

  var isTransformed by rememberSaveable { mutableStateOf(false) }
  val items = rememberContentWithOrbitalScope {
    ItemUtils.urls.forEach { url ->
      GlideImage(
        modifier = if (isTransformed) {
          Modifier.size(140.dp, 180.dp)
        } else {
          Modifier.size(100.dp, 220.dp)
        }
          .animateSharedElementTransition(movementSpec, transformationSpec)
          .padding(8.dp),
        imageModel = url,
        contentScale = ContentScale.Fit
      )
    }
  }

  Orbital(
    modifier = Modifier
      .fillMaxSize()
      .clickable { isTransformed = !isTransformed },
    isTransformed = isTransformed,
    onStartContent = {
      Column(
        Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
      ) {
        items()
      }
    },
    onTransformedContent = {
      Row(
        verticalAlignment = Alignment.CenterVertically
      ) { items() }
    }
  )

Shared Element Transition With LazyList

The provided code example illustrates the implementation of shared element transformation (container transform) with a lazy list, such as LazyColumn and LazyRow. The OrbitalScope function initiates a scope in which all layout scopes will be measured and pre-calculated for size and position across all child layouts.

@Composable
fun OrbitalLazyColumnSample() {
  val mocks = MockUtils.getMockPosters()

  Orbital {
    LazyColumn {
      items(mocks, key = { it.name }) { poster ->
        var expanded by rememberSaveable { mutableStateOf(false) }
        AnimatedVisibility(
          remember { MutableTransitionState(false) }
            .apply { targetState = true },
          enter = fadeIn(),
        ) {
          Orbital(modifier = Modifier
            .fillMaxWidth()
            .clickable {
              expanded = !expanded
            }
            .background(color = poster.color, shape = RoundedCornerShape(10.dp))) {
            val title = rememberMovableContentOf {
              Column(
                modifier = Modifier
                  .padding(10.dp)
                  .animateBounds(Modifier),
              ) {
                Text(
                  text = poster.name,
                  fontSize = 18.sp,
                  color = Color.Black,
                  fontWeight = FontWeight.Bold,
                )

                Text(
                  text = poster.description,
                  color = Color.Gray,
                  fontSize = 12.sp,
                  maxLines = 3,
                  overflow = TextOverflow.Ellipsis,
                  fontWeight = FontWeight.Bold,
                )
              }
            }
            val image = rememberMovableContentOf {
              GlideImage(
                imageModel = { poster.poster },
                component = rememberImageComponent {
                  +CrossfadePlugin()
                },
                modifier = Modifier
                  .padding(10.dp)
                  .animateBounds(
                    if (expanded) {
                      Modifier.fillMaxWidth()
                    } else {
                      Modifier.size(80.dp)
                    },
                    spring(stiffness = Spring.StiffnessLow),
                  )
                  .clip(RoundedCornerShape(5.dp)),
                imageOptions = ImageOptions(requestSize = IntSize(600, 600)),
              )
            }

            if (expanded) {
              Column {
                image()
                title()
              }
            } else {
              Row {
                image()
                title()
              }
            }
          }
        }
      }
    }
  }
}

You should bear in mind these three aspects:

  • Orbital: The Orbital function starts a scope, which measures and pre-calculates the layout size and position for all child layouts. Fundamentally, it initiates a reusable Compose node for the given content, which makes all magic things under the hood. You can utilize the Orbital in nested ways based on your specific scenarios, as illustrated in the code above.
  • rememberMovableContentOf: Utilize this function to remember a movable Composable function, allowing it to be relocated within the Compose tree. All items intended for transformation should be pre-defined using this function, enabling you to display different content based on various situations. All content defined using rememberMovableContentOf must be employed within the Orbital.
  • animateBounds: This serves as the delegate of the Modifier to compute distinct layout sizes based on various situations. It should be used in conjunction with the rememberMovableContentOf function.

Transition Between Composables

You can implement transitions between composable functions, as you've learned in the previous functions. The sample code below demonstrates how you can implement a shared element transition between screens A and B by defining shared content:

enum class Screen {
  A, B;
}

@Composable
fun ScreenTransitionSample() {
  Orbital {
    var screen by rememberSaveable { mutableStateOf(Screen.A) }
    val sizeAnim = spring<IntSize>(stiffness = Spring.StiffnessLow)
    val positionAnim = spring<IntOffset>(stiffness = Spring.StiffnessLow)
    val image = rememberMovableContentOf {
      GlideImage(
        imageModel = { MockUtils.getMockPoster().poster },
        component = rememberImageComponent {
          +CrossfadePlugin()
        },
        modifier = Modifier
          .padding(10.dp)
          .animateBounds(
            modifier = if (screen == Screen.A) {
              Modifier.size(80.dp)
            } else {
              Modifier.fillMaxWidth()
            },
            sizeAnimationSpec = sizeAnim,
            positionAnimationSpec = positionAnim,
          )
          .clip(RoundedCornerShape(12.dp)),
        imageOptions = ImageOptions(requestSize = IntSize(600, 600)),
      )
    }

    val title = rememberMovableContentOf {
      Column(
        modifier = Modifier
          .padding(10.dp)
          .animateBounds(
            modifier = Modifier,
            sizeAnimationSpec = sizeAnim,
            positionAnimationSpec = positionAnim
          ),
      ) {
        Text(
          text = MockUtils.getMockPoster().name,
          fontSize = 18.sp,
          color = Color.Black,
          fontWeight = FontWeight.Bold,
        )

        Text(
          text = MockUtils.getMockPoster().description,
          color = Color.Gray,
          fontSize = 12.sp,
          maxLines = 3,
          overflow = TextOverflow.Ellipsis,
          fontWeight = FontWeight.Bold,
        )
      }
    }

    if (screen == Screen.A) {
      ScreenA(
        sharedContent = {
          image()
          title()
        }) {
        screen = Screen.B
      }
    } else {
      ScreenB(
        sharedContent = {
          image()
          title()
        }) {
        screen = Screen.A
      }
    }
  }
}

@Composable
private fun ScreenA(
  sharedContent: @Composable () -> Unit,
  navigateToScreenB: () -> Unit
) {
  Orbital {
    Row(modifier = Modifier
      .background(color = Color(0xFFffd7d7))
      .fillMaxSize()
      .clickable {
        navigateToScreenB.invoke()
      }) {
      sharedContent()
    }
  }
}

@Composable
private fun ScreenB(
  sharedContent: @Composable () -> Unit,
  navigateToScreenA: () -> Unit
) {
  Orbital {
    Column(modifier = Modifier
      .background(color = Color(0xFFe3ffd9))
      .fillMaxSize()
      .clickable {
        navigateToScreenA()
      }) {
      sharedContent()
    }
  }
}

Unfortunately, you can't achieve this transition with Jetpack Compose Navigation yet.

Find this repository useful? โค๏ธ

Support it by joining stargazers for this repository. โญ
Also, follow me on GitHub for my next creations! ๐Ÿคฉ

License

Designed and developed by 2022 skydoves (Jaewoong Eum)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

orbital's People

Contributors

martmists-gh avatar qdsfdhvh avatar skydoves avatar toastmeister1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orbital's Issues

`isTransformed` check backwards

Please complete the following information:

  • Library Version 0.3.3
  • Affected Device(s) Pixel Tablet, Pixel 7 Pro, Windows Subsystem for Android

Describe the Bug:

When using this overload of Orbital( ... ) the behaviour of the isTransformed flag is opposite of what's documented.

Expected Behavior:

isTransformed = false should render onStartContent and isTransformed = true should render onTransformedContent

Shared element composable inside `LazyRow` crashes while scrolling horizontally

Please complete the following information:

  • Library Version - v0.2.2
  • Test Device(s) - Emulator with Android 13, Poco F1 with Android 12

Describe the Bug:

How do I handle the shared element transition of a composable within a LazyRow?
The app just crashes when I try to scroll through the row, the transition works fine as intended.

Expected Behavior:

The LazyRow should scroll horizontally, but instead crashes.

Stacktrace:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: app.test.compose, PID: 3603
    java.lang.IllegalStateException: Check failed.
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.replace(LayoutNodeLayoutDelegate.kt:1045)
        at androidx.compose.ui.node.LayoutNode.lookaheadReplace$ui_release(LayoutNode.kt:829)
        at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout-0kLqBqw(MeasureAndLayoutDelegate.kt:352)
        at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout-0kLqBqw(AndroidComposeView.android.kt:783)
        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$precompose$1.premeasure-0kLqBqw(SubcomposeLayout.kt:671)
        at androidx.compose.foundation.lazy.layout.LazyLayoutPrefetcher.run(LazyLayoutPrefetcher.android.kt:187)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Animation like WhatsApp/Twitter

Hello,

Good morning,

Hope you are doing well. Actually I am stuck in an issue where I have to implement the animation feature like WhatsApp and Twitter. Hope you have used Twitter and in Twitter we have a post let's say an Image Post with text and whenever we tap on the image it comes out with an animation and in the form of pop-up and if we tap again it goes to it's original position. This I have to implement for the list.
In short, whenever we click on the image it should jump from its original position to center in form of popup and on tapping back again it should come back to its original position.

Will be waiting for your revert as soon as possible.

Thank you
Shubham Jain

Shared Element throws ArrayIndexOutOfBoundsException

Library Version: 0.2.4
Kotlin Version: 1.8.0
Compose Compiler Version: 1.4.0
Compose UI version: 1.3.2

Hi.

  • I have A TextField under the topbar.
    image

  • When I click on that TextField, I want to show SearchComponent() with that TextField placed on the top of the app, like this:
    image

but after click, I got this error message instead,

java.lang.ArrayIndexOutOfBoundsException: src.length=16 srcPos=4 dst.length=16 dstPos=3 length=-2
    at java.lang.System.arraycopy(Native Method)
    at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:1247)
    at androidx.compose.runtime.collection.MutableVector.removeAt(MutableVector.kt:795)
    at androidx.compose.ui.node.MutableVectorWithMutationTracking.removeAt(MutableVectorWithMutationTracking.kt:43)
    at androidx.compose.ui.node.LayoutNode.removeAt$ui_release(LayoutNode.kt:287)
    at androidx.compose.ui.node.UiApplier.remove(UiApplier.android.kt:35)
    at androidx.compose.runtime.ComposerImpl$realizeMovement$1.invoke(Composer.kt:3769)
    at androidx.compose.runtime.ComposerImpl$realizeMovement$1.invoke(Composer.kt:3769)
    at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:808)
    ...

This is my code:

var isTransformed by rememberSaveable { mutableStateOf(false) }
val sharedSearchBar = rememberContentWithOrbitalScope {
    AppTextField.SearchBar(
        modifier = Modifier
            .height(50.dp)
            .animateSharedElementTransition(
                this,
                TweenSpec(durationMillis = 200),
                TweenSpec(durationMillis = 200)
            ),

        value = textFieldValue,
        placeHolderText = "Search",
        onValueChange = { textFieldValue = it }
    )
}

Scaffold(
    scaffoldState = scaffoldState,
    drawerContent = {...},
    drawerGesturesEnabled = scaffoldState.drawerState.isOpen,
) { paddingValues ->

    Orbital(
        modifier = Modifier
            .fillMaxSize()
            .padding(paddingValues)
            .clickable { isTransformed = !isTransformed }
    ) {

        if (isTransformed) {
            SearchComponent(sharedTextField = { sharedSearchBar() }) {

            }
        } else {

            Column(
                modifier = Modifier
                    .fillMaxSize()
            ) {
                TopBar(
                    onLeftIconClick = {
                        scope.launch {
                            scaffoldState.drawerState.open()
                        }
                    },
                    onRightIconClick = {}
                )

                sharedSearchBar()
            }
        }

    }
}


@Composable
fun SearchComponent(
    sharedTextField: @Composable () -> Unit,
    onBack: () -> Unit
) {

    Column(modifier = Modifier.fillMaxSize()) {
        sharedTextField()
        Column(
            modifier = Modifier
                .fillMaxSize()
                .background(Color.Gray)
        ) {
            Button(onClick = { onBack() }) {
                TextComponents.MediumText(text = "Back")
            }
        }
    }
}

Using multiple separately remembered orbital-scoped elements in the same Orbital scope causes issues in rendering

Please complete the following information:

  • Library Version: Latest git
  • Affected Device(s): Web, Desktop

Describe the Bug:
Peek 2023-11-08 00-27
All entries become invisible and the first location is used as the source location.

Expected Behavior:

Only the selected entry moves

Code snippet

package com.martmists.bbs.app.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.unit.dp
import com.martmists.bbsp.graphql.client.OwnedCardGraphQL
import com.skydoves.orbital.Orbital
import com.skydoves.orbital.OrbitalScope
import com.skydoves.orbital.animateSharedElementTransition
import com.skydoves.orbital.rememberContentWithOrbitalScope

@Composable
fun CardGrid(cards: List<OwnedCardGraphQL>) {
    val itemWidth = 256
    val padding = 5

    var width by remember { mutableStateOf(1) }
    var selected by remember { mutableStateOf(-1) }
    val cardIsSelected by derivedStateOf { selected >= 0 }

    // I want to avoid recreating these entries as much as possible, hence the below hack
    val cardRenders = remember {
        Array<@Composable OrbitalScope.() -> Unit>(cards.size) { { } }
    }

    cards.forEachIndexed { i, it ->
        val item = rememberContentWithOrbitalScope {
            CardRender(
                modifier = Modifier
                    .animateSharedElementTransition(this)
                    .clickable(!cardIsSelected) {
                        selected = i
                    },
                card = it
            )
        }
        cardRenders[i] = item
    }

    Orbital {
        // Grid of items
        LazyVerticalGrid(
            columns = GridCells.Adaptive(minSize = itemWidth.dp),
            horizontalArrangement = Arrangement.spacedBy(padding.dp),
            verticalArrangement = Arrangement.spacedBy(15.dp),
            modifier = Modifier
                .onGloballyPositioned {
                    width = it.size.width
                }
                .fillMaxSize()
        ) {
            itemsIndexed(cards, key = { i, it -> i }) { i, it ->
                Box {
                    // Blank placeholder
                    CardRender()
                    // Card
                    if (!cardIsSelected) {
                        cardRenders[i]()
                    }
                }
            }

            // Fill last row with blank placeholders
            val ncol = (width) / (itemWidth + padding)
            val remain = ncol - (cards.size % ncol)
            if (remain != ncol) {
                items(remain) {
                    CardRender()
                }
            }
        }
        
        // Fullscreen preview
        if (cardIsSelected) {
            Column(
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.End,
                modifier = Modifier
                    .clickable {
                        selected = -1
                    }
                    .fillMaxSize()
            ) {
                if (cardIsSelected) {
                    cardRenders[selected]()
                }
            }
        }
    }
}

Animation should only apply to specified transition

Given for example I have this component:

val container = rememberContentWithOrbitalScope {
        Box(
            modifier = Modifier
                .animateSharedElementTransition(this,
                    SpringSpec(stiffness = 500f),
                    SpringSpec(stiffness = 500f)
                )
                .fillMaxSize()
                .clip(RoundedCornerShape(16.dp))
                .background(Color.White),
        )
}

If I were to wrap this componnent into Column() the scroll animation for this component would be affected by the specified .animateSharedElementTransition(). In my opinion the animation should only apply when the specified rememberSaveable bool is updated, i.e., for the dynamic transition.

Pre-release version of Kotlin

Please complete the following information:

  • Library Version [e.g. v0.20]
  • Affected Device(s) [Samsung Galaxy A53 with Android 12.0]

Describe the Bug:

Getting this error:
is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
And i have kotlin 1.7.10, compose 1.3.0-alpha03 and compose compiler 1.3.0

Expected Behavior:

Should be able to build the project without issues when adding the orbital library.

Orbital Content does not resize correctly for updated padding

ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content)) { view, insets ->
       val bottom = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
       view.updatePadding(bottom = bottom)
       insets
}

Components wrapped into Orbital {...} do not resize if padding were to be updated by the function above due to for example the keyboard.

Not animating with screen navigation

  • Library Version [0.3.3]
  • AVD 34

Hi. I am trying to share an image between two destinations (I am using Voyager for nested navigation from "Tab" to "Screen")
Animation does not seem to work.

Screen is:

class CharacterDescriptionScreen(
    private val characterId: Int,
    private val sharedContent: @Composable () -> Unit
) : Screen {
...
sharedContent()
...
}

And here I am navigating:

     navigator.push(CharacterDescriptionScreen(
                                    characterId = character.id,
                                    sharedContent = sharedImage
                                ))

Everything seems to work locally, when not navigating. Is this a problem somewhere in the code, or the library might not be compatible with the Voyager?
Thank you

Oh actually I missed the line that its not possible with compose navigation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.