All Projects → lopspower → Saveinsta

lopspower / Saveinsta

Licence: apache-2.0
Example dynamic update of your theme based on a main color

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Saveinsta

Redpaper
A tool to download and set desktop wallpapers from Reddit
Stars: ✭ 64 (-22.89%)
Mutual labels:  style
Instatrack
Convert Instagram user ID to username & vice versa
Stars: ✭ 70 (-15.66%)
Mutual labels:  instagram
Ownyourgram
📷 Save your Instagram photos to your own website!
Stars: ✭ 78 (-6.02%)
Mutual labels:  instagram
Torch Models
Stars: ✭ 65 (-21.69%)
Mutual labels:  style
Emojireactionview
Instagram's emoji reaction for android!
Stars: ✭ 68 (-18.07%)
Mutual labels:  instagram
Network Avatar Picker
A npm module that returns user's social network avatar. Supported providers: facebook, instagram, twitter, tumblr, vimeo, github, youtube and gmail
Stars: ✭ 74 (-10.84%)
Mutual labels:  instagram
Instagram Unfollowers
Who unfollowed you, who followed you, who doesn't follow you back, who liked your pics the most and who never? Don't worry I got all the answers. Also this can used for non-private users too.
Stars: ✭ 62 (-25.3%)
Mutual labels:  instagram
Igql
Unofficial Instagram GraphQL API to collet data without authentication
Stars: ✭ 80 (-3.61%)
Mutual labels:  instagram
Bash2mp4
Video Downloader for Termux .
Stars: ✭ 68 (-18.07%)
Mutual labels:  instagram
Instaburst
Brute force Instagram
Stars: ✭ 76 (-8.43%)
Mutual labels:  instagram
Snacks
The Instacart Component Library
Stars: ✭ 65 (-21.69%)
Mutual labels:  style
Computed Style To Inline Style
Convert a HTML element's computed CSS to inline CSS.
Stars: ✭ 67 (-19.28%)
Mutual labels:  style
Tiza
Console styling for browsers
Stars: ✭ 74 (-10.84%)
Mutual labels:  style
Linearicons
Linearicons is the highest quality set of line icons, matching with minimalist UI designs in iOS.
Stars: ✭ 64 (-22.89%)
Mutual labels:  style
Unfollow Plus
Automated Instagram Unfollower Bot
Stars: ✭ 79 (-4.82%)
Mutual labels:  instagram
Insta Downloader Extension
A browser extension that injects download buttons ⬇️ for media on Instagram Web
Stars: ✭ 63 (-24.1%)
Mutual labels:  instagram
Skraper
Kotlin/Java library and cli tool for scraping posts and media from various sources with neither authorization nor full page rendering (Facebook, Instagram, Twitter, Youtube, Tiktok, Telegram, Twitch, Reddit, 9GAG, Pinterest, Flickr, Tumblr, IFunny, VK, Pikabu)
Stars: ✭ 72 (-13.25%)
Mutual labels:  instagram
Social Login Helper Deprecated
A simple android library to easily implement social login into your android project
Stars: ✭ 81 (-2.41%)
Mutual labels:  instagram
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-4.82%)
Mutual labels:  instagram
Instascrape
🚀 A fast and lightweight utility and Python library for downloading posts, stories, and highlights from Instagram.
Stars: ✭ 76 (-8.43%)
Mutual labels:  instagram
sample

SaveInsta

Platform API Twitter

With SaveInsta download all Instagram photos and videos that you love.

This application is an example of the implementation of the dynamic update of your theme based on a main color. The application retrieve the dominant color of an image and change the theme of the activity in runtime.

Guidelines Example

3 Steps to download photo/video from Instagram:

  1. Open your Instagram, choose Copy Share URL on photo/video you want to save
  2. Open SaveInsta and let it do the magic
  3. Back to SaveInsta, download Photo/Video you love by click to Save button at the bottom right of SaveInsta, or click to Close button at the top right to remove. Open Gallery to see the result!

Get Dominant Color of ImageView

You need to Download DominantImageColor and write this method in your project:

public static int getDominantColor(ImageView imageView) {
  int color = 0;
  try {
    Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
    String dominantColor = DominantImageColor.getDominantColorOfImage(bitmap);
    color = Color.parseColor(dominantColor);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
  return color;
}

Set Theme Programmatically

3 components must be modified for best possible immersion:

  • mToolbar.setBackgroundColor(dominantColor);
  • getWindow().setStatusBarColor(dominantColor);
  • getWindow().setNavigationBarColor(dominantColor);

For a better visual you need to add animation for each change:

For that, you also get the current color of the theme colorPrimary. To do that just call ContextCompat.getColor(this, R.color.colorPrimary);.

ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorPrimary, dominantColor);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animator) {
      mToolbar.setBackgroundColor((int) animator.getAnimatedValue());
    }
});
colorAnimation.start();

⚠️ Please note that the status bar is not the same color as your toolbar. So you have to darken to meet the best practices of Android Material Design. For that use this method:

public static int darkerColor(int color) {
  float[] hsv = new float[3];
  Color.colorToHSV(color, hsv);
  hsv[2] *= 0.8f; // value component
  return Color.HSVToColor(hsv);
}

⚠️ Attention to the color of the text and icons on your toolbar. You must detect if the dominant color is a dark color or not. If this is the case the color of your text should be light and vice versa.

public static boolean isColorDark(int color) {
  double darkness = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255;
  if (darkness < 0.5) {
    return false; // It's a light color
  } else {
    return true; // It's a dark color
  }
}

Update in Runtime

This treatment can be long, so it is best not to leave it in the UI thread. The following example retrieves the dominant color in a separate thread, and then returns to the UI thread to change the theme:

mCurrentThemeColor is the main color theme of your application. To recover just do ContextCompat.getColor(this, R.color.colorPrimary);.

final Handler handler = new Handler();
new Thread(new Runnable() {
  @Override
  public void run() {
    // Get Dominant Color
    final int color = getDominantColor(mImageToDownload);
    if (color != 0) {
        handler.post(new Runnable() {
            @Override
            public void run() {
              // Set Theme Color
              setThemeColor(mCurrentThemeColor, color);
            }
        });
    } else if (BuildConfig.DEBUG) {
        Log.e(getClass().getName(), "Color Unknown");
    }
  }
}).start();

👉 You can see a full implementation here

License

SaveInsta by Lopez Mikhael is licensed under a Apache License 2.0.

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].