accompanist | A collection of extension libraries for Jetpack Compose | Android library
kandi X-RAY | accompanist Summary
kandi X-RAY | accompanist Summary
Accompanist is a group of libraries that aim to supplement Jetpack Compose with features that are commonly required by developers but not yet available. Accompanist is a labs like environment for new Compose APIs. We use it to help fill known gaps in the Compose toolkit, experiment with new APIs and to gather insight into the development experience of developing a Compose library. The goal of these libraries is to upstream them into the official toolkit, at which point they will be deprecated and removed from Accompanist.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of accompanist
accompanist Key Features
accompanist Examples and Code Snippets
Community Discussions
Trending Discussions on accompanist
QUESTION
Update: original question followed by updated sample code that triggers it as requested.
I have a list of times broken down by half hour in a lazy list
E.g 12:00, 12:30
The list is attached to a horizontal pager from the accompanist-pager library
When a user is swiping between pages, I need to update the selected time, and I want the selected time to always be in the center of the screen, if it's not near the top/bottom where that can't be the case.
The only way I've figured out how to accurately do this with the methods provided to us is as below.
Note: i have previously captured the button / list height.
...ANSWER
Answered 2022-Apr-05 at 07:00Your pager behaves strangely because you're creating its state on reach recomposition:
QUESTION
I'm using Scaffold
for my main screen with a fixed bottomBar
that is visible in every screen of the app, and I'm applying the innerPadding
of the Scaffold
to its content.
I want the keyboard to appear over the bottomBar
, and for that I'm applying the imePadding()
only to the Scaffold
's content.
However, when the keyboard is opened, both the Scaffold
's innerPading
and imePadding()
are applied to the contents padding.
I've tried to go through the Accompanist Insets migration, but no lucky.
Is there anyway that I can prevent it and apply only one or the other?
Here is a piece of my code:
...ANSWER
Answered 2022-Mar-31 at 07:20According to Accompanist Insets migration, LocalWindowInsets.current.ime
should be replaced with WindowInsets.ime
.
It doesn't have isVisible
for now, until this bug is fixed. Here's how I've re-created it for now:
QUESTION
I want to hide default action bar, so in the Manifest file I have following code:
...ANSWER
Answered 2022-Mar-24 at 08:50If you need to hide status bar completely, you need to use a full screen theme, like showed in this answer
Since Compose 1.2.0-alpha03, Accompanist Insets was mostly moved into Compose Foundation, check out migration guide for more details. The main changes to below answer is that ProvideWindowInsets
is no longer needed and some imports should be replaced.
If you need a transparent status bar, you can follow this answer, plus setup Accompanist Insets for compose like following:
QUESTION
Since version v0.19.0; offscreenLimit
parameter has been removed. How to disable preloading using some other technique?
ANSWER
Answered 2022-Mar-14 at 17:07What about something like this?
QUESTION
I have a bottom sheet dialog. For the dialog, I'm using ModalBottomSheetDialog
from the Accompanist
navigation library. In the dialog which is a composable fun that named PlatformsScreen
, I have a LazyColumn
with items that has RadioButton
. Whenever any of the radio buttons is selected I'm adding the selected item into the selectedPlatforms
which is a mutableList
:
ANSWER
Answered 2022-Mar-13 at 06:43It's a bug and I've reported it.
Until it's fixed, the easiest solution at the moment is to switch to scaleIn
/ scaleOut
transitions, they work fine.
An other option is putting AnimatedVisibility
is a Box
of FAB static size, which is 56.dp
, in this case other transitions work fine, except the clipped shadow. The shadow can be disabled by zeroing the elevation
parameter, which is not the best solution either.
QUESTION
my app crash on startup when I use animation with navigation via AnimatednavHost of accompanist with new alpha version of compose.
compose version:.2.0-alpha02
accompanist version :0.20.3
crash:
...ANSWER
Answered 2022-Mar-09 at 06:09update accompanist version to new stable one, and it will work
QUESTION
I'm writing a jetpack compose android app, I need to store some settings permanently.
I decided to use androidx.datastore:datastore-preferences:1.0.0
library, I have added this to my classpath.
According to the https://developer.android.com/topic/libraries/architecture/datastore descripton I have added this line of code to my kotline file at the top level:
val Context.prefsDataStore: DataStore by preferencesDataStore(name = "settings")
But I get a compile error:
...ANSWER
Answered 2022-Jan-13 at 09:20I got this error because of an incorrect import:
QUESTION
I need to create a reader screen for a book reader app in android and I need to have a a composable like swipe refresh that comes from the bottoms of page so the users go to next page.
I tried a google Accompanist vertical pager and swipe refresh and in all of them swipe refresh comes from top of screen. is there any alternative for swipe refresh that comes from bottom of screen? or even a something that replicate dragging from bottom of screen.
thanks in advance.
...ANSWER
Answered 2022-Feb-20 at 20:41Set the indicatorAlignment
:
QUESTION
Cant make compose run in existing kotlin/native project for month now, trying to set default Greeting example to splash instead of its ui, cant make it:
...ANSWER
Answered 2021-Oct-02 at 07:10The issue is that your compile SDK is 31, you are targetting API 31 (Android 12) and not setting the exported attribute.
You need to specify android:exported="true"
in the manifest.
If your app targets Android 12 and contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the android: exported attribute for these app components.
QUESTION
I am using a BottomNavigation
with 4 composables. All of them have a LazyColumn
with each item in the LazyColumn
having an image populated from the network using Coil for Jetpack Compose. Similar to Twitter/YouTube.
When I navigate between these items, the composables get destroyed and recompose only when navigated back to them. Even the coil images are cleared and re-fetched (from memory or local storage) when navigated between these composables. This is of course the expected behavior.
The problem is that this is causing the navigation between them to be too slow. Coil images take about 400ms to 700ms to load the image for every navigation. Apps like YouTube/LinkedIn are literally instant in their BottomBar
navigations.
When I was using XML for this, I would make the fragments(used as bottom nav items ) with an appear/disappear logic to avoid this time delay while navigating between them.
How do I achieve the same with Compose ?
I am using the following versions:
...ANSWER
Answered 2022-Feb-19 at 14:00Well I had the same problem using emulator or phone
both work well with small simplistic composables. And when I create more complex Composable and try animating the navigation, using the accompanist animation library it gets very laggy.
But then I tried building the release APK file, since it is usually optimized and way faster, and that will significantly speed up your app. Here is link on how you can generate signed APK then install it on your phone or emulator and see if that fixes your problem!
You could also check if you accidentally disabled the hardware acceleration from the manifest. Make sure you set android:hardwareAccelerated="true"
in you activity tag.
In case that does not help either, then you have to implement your own animation and use Shared ViewModel, for communication and triggering the transition from one Composable to another. The idea is that you can use modifier offset
property to show/hide the Composable by placing it outside the screen.
First set your ViewModel, and add mutable state variable, that will trigger the transition from Home to Settings and vice versa.
This is not the best practice, since there is no way to directly pass data from one composable to another as you would normally do with the normal navigation. But you can still share data using the Shared ViewModel. Using this method it will not recompose your Composable, and thus be really fast. So far I have no problem with any out of memory exceptions even on some very old/slow devices with 2GB RAM.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install accompanist
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page