StatusBarCompat


Source link: https://github.com/niorgai/StatusBarCompat

StatusBarCompat

Only work for SDK >= 19.

Demo Download

Usage

Add it in your root build.gradle at the end of repositories:

 allprojects {

repositories {

 ...
 maven {
 url "https://jitpack.io" 
}

}
  
}

Add the dependency

 dependencies {

 compile ('com.github.niorgai:StatusBarCompat:2.1.4', {

  exclude group: 'com.android.support'

 
}
)  
}
SDK KITKAT(19) LOLLIPOP(21)
TranslucentStatusBar SetStatusBarColor

This is a utils for status bar, And you do not need to change your style.xml file. The most feature is you can toggle setStatusBarColor and translucentStatusBar without recreate activity.

 //set color for status bar  StatusBarCompat.setStatusBarColor(Activity activity, int color)  //add alpha to color  StatusBarCompat.setStatusBarColor(Activity activity, int statusColor, int alpha)
 //translucent status bar  StatusBarCompat.translucentStatusBar(activity);
  //should hide status bar background (default black background) when SDK >= 21  StatusBarCompat.translucentStatusBar(Activity activity, boolean hideStatusBarBackground);

//set color for CollapsingToolbarLayout  setStatusBarColorForCollapsingToolbar(Activity activity, AppBarLayout appBarLayout, CollapsingToolbarLayout collapsingToolbarLayout,

  Toolbar toolbar, int statusColor)  

How to use

  1. Use it after call setContentView
  2. If use FullScreen Activity, must call StatusBarCompat.translucentStatusBar(activity);

About Demo:

Demo shows One Activity with four Fragments.

  1. CommonFragment call setStatusBarColor method, SeekBar can change statusBar's alpha.
  2. TranslucentFragment call translucentStatusBar method, when sdk >= 21, button can toggle hide/show statusBar's shadow.
  3. DrawerFragment call setStatusBarColor method, show how to compat for DrawerLayout and CoordinatorLayout.
  4. CollapsingFragment call setStatusBarColorForCollapsingToolbar method, compat for CollapsingToolbarLayout.

Issues:

These problem only show in SDK between 19 and 21:

  1. If work with TabActivity, It will show a black line in contentView, so you can call StatusBarCompat.setStatusBarColor(Activity activity, int statusColor, int alpha) and the suggest alpha is 112.
  2. If first view is DrawerLayout, let its child view set fitsSystemWindow to false.

Link:

  1. Blog Android-translucent-status-bar.

???

???????? SDK >= 19 (Android 4.4) ????.

????? ????????
)

?????????????????,?????????? style.xml??,???????????**??? Activity ?????? setStatusBarColor ? translucentStatusBar **. ???? API :

  //????????

StatusBarCompat.setStatusBarColor(Activity activity, int color)

//??alpha?

StatusBarCompat.setStatusBarColor(Activity activity, int statusColor, int alpha)

 //?????

StatusBarCompat.translucentStatusBar(activity);

//SDK >= 21?, ????????

StatusBarCompat.translucentStatusBar(Activity activity, boolean hideStatusBarBackground);

 //? CollapsingToolbarLayout ????

setStatusBarColorForCollapsingToolbar(Activity activity, AppBarLayout appBarLayout, CollapsingToolbarLayout collapsingToolbarLayout,

 Toolbar toolbar, int statusColor)

????

  1. ? setContentView ????????.
  2. ??????? Activity ,???? StatusBarCompat.translucentStatusBar(activity);

Demo ??:

Demo ???? Activity , ??? Tab.

  1. CommonFragment ?????, ???? SeekBar ????????? alpha ?. ?????: setStatusBarColor.
  2. TranslucentFragment ?????, ?????????, SDK >= 21?, ????????\?? statusBar ? shadow, ?????: translucentStatusBar.
  3. DrawerFragment ?? DrawerLayout + CoordinatorLayout, ?????: setStatusBarColor.
  4. CollapsingFragment ?? CollapsingLayout ?????, ?????: setStatusBarColorForCollapsingToolbar.

????

????????? 4.4 ?

  1. ???? TabActivity ?, ????????????, ???? StatusBarCompat.setStatusBarColor(Activity activity, int statusColor, int alpha) ??, ??????? 112.
  2. ?? layout ???? View ? DrawerLayout, ????? View ? fitsSystemWindow ????? false.

??

????? Android-translucent-status-bar?????????.

License

The MIT License (MIT)  Copyright (c) 2016 JQ  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

Resources

A fun to play quiz that showcases material design on Android.

Modern, easy and customizable app manager for Android with Material Design.

Features:

  • Extract installed & system apps.
  • Share APK with friends using Dropbox, Telegram, email, etc.
  • Uninstall apps easily.
  • Customization options available in Settings.
  • No root required.
  • Material Design.
  • Really easy to use.

Gradle plugin to simplify loading project properties from external environment specific files.

CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card.

Library that provide easy way make a communication between remote application (such wear and phone application, processes, etc) using a common interface.

RetroFacebook turns Facebook API into a Java interface using RxJava. Easy to add API and model.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes