All Projects → husseinala → neon

husseinala / neon

Licence: Apache-2.0 license
Provides Jetpack Compose support for different image loading libraries.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to neon

Compose-BreakingBad
🧪 ☠︎ Jetpack Compose - Breaking Bad ☢︎
Stars: ✭ 26 (+100%)
Mutual labels:  jetpack, glide, jetpack-compose
samples
Jetpack Compose based project, used to stress-testing compose features / integrations and explore non-trivial functionality
Stars: ✭ 21 (+61.54%)
Mutual labels:  jetpack, compose, jetpack-compose
bitcoin-market-android
Bitcoin Market app shows you the current Bitcoin market price and price chart of different time intervals 💰
Stars: ✭ 284 (+2084.62%)
Mutual labels:  jetpack, compose, jetpack-compose
arkitekt
Arkitekt is a set of architectural tools based on Android Architecture Components, which gives you a solid base to implement the concise, testable and solid application.
Stars: ✭ 114 (+776.92%)
Mutual labels:  jetpack, compose, jetpack-compose
Jetpack-compose-sample
Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Android’s modern toolkit for building native UI. Here is a small example to get started.
Stars: ✭ 29 (+123.08%)
Mutual labels:  jetpack, compose, jetpack-compose
ComposeBird
Flappy Bird game
Stars: ✭ 193 (+1384.62%)
Mutual labels:  jetpack, compose, jetpack-compose
Delish
Delish, a Food Recipes App in Jetpack Compose and Hilt based on modern Android tech-stacks and MVI clean architecture.
Stars: ✭ 356 (+2638.46%)
Mutual labels:  jetpack, compose, jetpack-compose
JetComposer
Collection of UIs and Animations built with Jetpack Compose for Android
Stars: ✭ 294 (+2161.54%)
Mutual labels:  jetpack, compose, jetpack-compose
compose-charts
Simple Jetpack Compose Charts for multi-platform. Including Android, Web, Desktop.
Stars: ✭ 30 (+130.77%)
Mutual labels:  jetpack, compose, jetpack-compose
Coffeegram
Android app using Jetpack Compose together with StateFlow and MVI
Stars: ✭ 155 (+1092.31%)
Mutual labels:  jetpack, compose, jetpack-compose
Compose-Settings
Android #JetpackCompose Settings library
Stars: ✭ 188 (+1346.15%)
Mutual labels:  jetpack, compose, jetpack-compose
Composecookbook
A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential
Stars: ✭ 3,516 (+26946.15%)
Mutual labels:  jetpack, compose, jetpack-compose
PCard
Demo project to showcase adding payment card details using JetPack Compose
Stars: ✭ 61 (+369.23%)
Mutual labels:  jetpack, compose, jetpack-compose
Glidepalette
Android Lollipop Palette is now easy to use with Glide
Stars: ✭ 1,670 (+12746.15%)
Mutual labels:  picasso, glide
Transformers
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.
Stars: ✭ 167 (+1184.62%)
Mutual labels:  picasso, glide
Wiggles
🐶 Beautiful Puppy adoption app with Jetpack Compose #AndroidDevChallenge
Stars: ✭ 365 (+2707.69%)
Mutual labels:  jetpack, jetpack-compose
Composable Images
The Composable Images is a library providing Jetpack Compose wrapper for Glide, Picasso, and Coil.
Stars: ✭ 107 (+723.08%)
Mutual labels:  picasso, glide
SuperheroLexicon
Simple superhero lexicon app to demonstrate Jetpack Compose.
Stars: ✭ 22 (+69.23%)
Mutual labels:  compose, jetpack-compose
AvatarImageGenerator
Android library to generate image avatar from the first letter of a username. Letter avatar like Gmail Android best practice
Stars: ✭ 61 (+369.23%)
Mutual labels:  picasso, glide
Scout
Scout is a kotlin multiplatform application that allows users to search and save games to lists to be browsed later.
Stars: ✭ 28 (+115.38%)
Mutual labels:  jetpack, jetpack-compose

Compose Neon Latest Version

A small Jetpack Compose library that provides Compose support for different image loading libraries.

Setup

Integrating with Glide:

To add Glide support, import the Neon Glide library:

implementation 'com.husseinala.neon:glide:0.1.6'

Provide a Glide RequestManager instance to your root Compose tree:

class MainActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Create a new `RequestManager` instance or re-use your existing instance
    val glide = Glide.with(applicationContext)

    setContent { GlideApp(glide) }

  }
}

@Composable
fun GlideApp(requestManager: RequestManager) {
  ProvideGlideLoader(requestManager) {
    SampleScreen()
  }
}

Integrating with Picasso:

To add Picasso support, import the Neon Picasso library:

implementation 'com.husseinala.neon:picasso:0.1.6'

Provide a Picasso instance to your root Compose tree:

class MainActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Create a new `Picasso` instance or re-use your existing instance
    val picasso = Picasso.Builder(applicationContext).build()

    setContent { PicassoApp(picasso) }

  }
}

@Composable
fun PicassoApp(picasso: Picasso) {
  ProvidePicassoLoader(picasso) {
    SampleScreen()
  }
}

Usage

After providing your image loader, you can simply use the Neon Composable function to directly load images:

@Composable
fun UserListItem(user: User) {
  Column {
    Neon(
      url = user.profileImage,
      // Optional: Any Transformations to be applied to the image, such as rounded corners or scale type.
      transformation = Transformation.centerCrop(),
      // Optional: Any Modifiers to be applied to the image container, such as view size or paddings.
      modifier = Modifier.fillMaxWidth().aspectRatio(1.7f).padding(horizontal = 16.dp, vertical = 8.dp),
      onLoading = { /* Optional: the widget to be displayed while the image is being downloaded */ },
      onError = { /* Optional: the widget to be displayed if an error occurs */ }
    )
    Text(text = user.name)
  }
}

License

Copyright 2020 Hussein Aladeen

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

   https://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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].