Android Jetpack
UI Components
Palette
Layout
Fragment
Emoji
Animation & transitions
Jetpack Components
introduction
Foundation
Architecture
Behavior
UI
Foundation Components
Android KTX
AppCompat
Auto
Benchmark
Multidex
Security
Test
TV
Wear OS by Google
Architecture Components
Data Binding
Lifecycles
LiveData
Navigation
Paging
Room
ViewModel
WorkManager
Behavior Components
CameraX
Download manager
Media & playback
Notifications
Permissions
Preferences
Sharing
Slices

Palette



Palette, Android Jetpack UI Components, Pull useful information out of color palettes

Below are the required sdk version and dependencies for using the Palette library

compileSdkVersion 28
minSdkVersion 24
targetSdkVersion 28

dependencies 
{
    ...
    implementation 'com.android.support:palette-v7:28.0.0'
}

A Palette object gives you access to the primary colors in an image, as well as the corresponding colors for overlaid text.

palette library contains six color profiles as listed below, each method associated with that particular profile returns the color in the palette, return palette might be null.

ProfileMethod
Light VibrantgetLightVibrantSwatch()
VibrantgetVibrantSwatch()
Dark VibrantgetDarkVibrantSwatch()
Light MutedgetLightMutedSwatch()
MutedgetMutedSwatch()
Dark MutedgetDarkMutedSwatch()

Palette Code Example

Method to Generate Palette instance


    public Palette generatePalette(Bitmap bitmap)
    {
        Palette p = Palette.from(bitmap).generate();
        return p;
    }

Code to extracts prominent colors from images


Bitmap bitMap = BitmapFactory.decodeFile( picturePath);

Palette p = generatePalette( bitMap);

Palette.Swatch vibrantSwatch = p.getVibrantSwatch();

if( vibrantSwatch != null)
{
     // extracts prominent colors 
     int backgroundColor = vibrantSwatch.getRgb();
     int textColor = vibrantSwatch.getTitleTextColor();
}

The Sample Project is available for Download from GitHub.



Animation & transitions

Animation & transitions, Android Jetpack UI Components, Move widgets and transition between screens

posted on 2019-10-25 08:04:17 - Android Jetpack Tutorials


Emoji

Emoji, Android Jetpack UI Components, Enable an up-to-date emoji font on older platforms

posted on 2019-10-25 08:03:43 - Android Jetpack Tutorials


Fragment

Fragment, Android Jetpack UI Components, A basic unit of composable UI

posted on 2019-10-25 08:03:24 - Android Jetpack Tutorials


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials