GithubHelp home page GithubHelp logo

omico / androidx-compose-material3-pullrefresh Goto Github PK

View Code? Open in Web Editor NEW
59.0 3.0 6.0 266 KB

A temporary solution for Jetpack Compose Material 3 pull refresh.

Home Page: https://issuetracker.google.com/issues/261760718

License: Apache License 2.0

Kotlin 100.00%
android jetpack jetpack-compose material material-components material3

androidx-compose-material3-pullrefresh's Introduction

androidx-compose-material3-pullrefresh

Important

Since Compose Material3 1.2.0-alpha11, the compose team has been officially supported an experimental implementation of this component. Please take a look at example/migrated-app or visit the official documentation for more information.

Hope this library can be deprecated soon. :)

This is a simple wrapper for Jetpack Compose Material3's PullRefreshIndicator. The official implementation is not compatible with Material 3 theme.

Official documentation for androidx.compose.material.pullrefresh see here.

Note

If you already used the pull refresh component from Compose Material.

You only need to modify the package name from androidx.compose.material.pullrefresh into androidx.compose.material3.pullrefresh to complete the migration.

Usage

This library only supports using composite build to import to your project because it will be archived when the official library is released.

Note

<androidx-compose-material3-pullrefresh-path> is the path to this library.

For example, if you put this library in <your-app>/libraries/androidx-compose-material3-pullrefresh, then the path is libraries/androidx-compose-material3-pullrefresh.

Or you can use absolute path too.

Copy <androidx-compose-material3-pullrefresh-path>/library/local.properties.template to <androidx-compose-material3-pullrefresh-path>/library/local.properties and follow the instructions in the file to fit your environment.

For try it out or contribution purpose

Open <androidx-compose-material3-pullrefresh-path> in Android Studio.

Use it in your project

Note

If you cannot figure out the instructions below, the easiest way is just to copy the source code from <androidx-compose-material3-pullrefresh-path>/library/src/main/kotlin to your project as well.

In your root project's settings.gradle.kts or settings.gradle file, add the following:

includeBuild("<androidx-compose-material3-pullrefresh-path>/library") {
    dependencySubstitution {
        substitute(module("me.omico.compose:compose-material3-pullrefresh")).using(project(":"))
    }
}

In your app module's build.gradle.kts or build.gradle file, add the following:

dependencies {
    implementation("me.omico.compose:compose-material3-pullrefresh")
}

License

Copyright 2022 The Android Open Source Project
Copyright 2022-2024 Omico

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.

androidx-compose-material3-pullrefresh's People

Contributors

omico 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

Watchers

 avatar  avatar  avatar

androidx-compose-material3-pullrefresh's Issues

Type androidx.compose.material3.pullrefresh.ArrowValues is defined multiple times

Hi,

when I try to build a release error the task :app:minifyReleaseWithR8 fails with the following error message: Type androidx.compose.material3.pullrefresh.ArrowValues is defined multiple times: {my_project_location}/androidx-compose-material3-pullrefresh/library/build/intermediates/runtime_library_classes_jar/release/classes.jar:androidx/compose/material3/pullrefresh/ArrowValues.class,{my_home_dir}/.gradle/caches/transforms-3/ad60cd5cf5c1564926bb7f06eb667f86/transformed/material3-release-runtime.jar:androidx/compose/material3/pullrefresh/ArrowValues.class

Could this mean that they have internally started implementing this functionality, but just haven't released it yet?

Using Kotlin 1.9.10,
Compose BOM 2023.10.0,
Compose Compiler 1.5.3,
material3-android:1.2.0-alpha09 (it seems like they have started implementing pullrefresh here)
material3:1.2.2

Failed to resolve in groovy build.gradle:app

Failed to resolve: me.omico.lux:lux-androidx-compose-material3-pullrefresh

Could you support me to use your library thourgh implemetation please ?
Now I am using by download your release directly ...

null cannot be cast to non-null type kotlin.String

I tried doing the following:

In my settings.gradle.kt:

includeBuild("libraries/androidx-compose-material3-pullrefresh") {
    dependencySubstitution {
        substitute(module("me.omico.lux:lux-androidx-compose-material3-pullrefresh")).using(project(":library"))
    }
}

I downloaded, and added the git project into the libraries folder

and then in build.gradle.kt:

implementation("me.omico.lux:lux-androidx-compose-material3-pullrefresh")

and Syncing it I get the followning message:

null cannot be cast to non-null type kotlin.String
null cannot be cast to non-null type kotlin.String

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Compose Material3 1.2.0 release version is very poor

fun PullToRefreshSample() {
    var itemCount by remember { mutableStateOf(15) }
    val state = rememberPullToRefreshState()
    if (state.isRefreshing) {
        LaunchedEffect(true) {
            // fetch something
            delay(1500)
            itemCount += 5
            state.endRefresh()
        }
    }
    Box(Modifier.nestedScroll(state.nestedScrollConnection)) {
        LazyColumn(Modifier.fillMaxSize()) {
            if (!state.isRefreshing) {
                items(itemCount) {
                    ListItem({ Text(text = "Item ${itemCount - it}") })
                }
            }
        }
        PullToRefreshContainer(
            modifier = Modifier.align(Alignment.TopCenter),
            state = state,
        )
    }
}

The display of the refresh header and the triggering of the refresh operation are very difficult to control.

I still choose to use your library

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.