All Projects → laobie → Statusbarutil

laobie / Statusbarutil

Licence: apache-2.0
A util for setting status bar style on Android App.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Statusbarutil

Androidlibs
🔥正在成为史上最全分类 Android 开源大全~~~~(长期更新 Star 一下吧)
Stars: ✭ 7,148 (-18.08%)
Mutual labels:  utils
Spinnercpp
Simple header only library to add a spinner / progress indicator to any terminal application.
Stars: ✭ 37 (-99.58%)
Mutual labels:  statusbar
Gitee
Gitee, OS X status bar application for Github
Stars: ✭ 1,095 (-87.45%)
Mutual labels:  statusbar
Androidutilcode
AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥
Stars: ✭ 30,239 (+246.54%)
Mutual labels:  utils
Tools
C# 工具箱,提供Socket(TCP、UDP协议)、Redis、activemq、数据库访问等技术的封装实现
Stars: ✭ 34 (-99.61%)
Mutual labels:  utils
Dnsforwarder
Just a DNS utility.
Stars: ✭ 1,029 (-88.21%)
Mutual labels:  utils
Ofxstatusbar
Addon for openFrameworks to add icons and text to the statusbar of Mac OS X (needs support - see readme)
Stars: ✭ 11 (-99.87%)
Mutual labels:  statusbar
Countdowntask
⌛️A countdown library for Android.
Stars: ✭ 64 (-99.27%)
Mutual labels:  utils
Status Bar Compat
A compatible library for setting status bar color. Support MIUI, Flyme, EMUI3.1. 一行代码调用,布局零入侵。兼容小米,魅族,华为……
Stars: ✭ 984 (-88.72%)
Mutual labels:  statusbar
Rambda
Faster and smaller alternative to Ramda
Stars: ✭ 1,066 (-87.78%)
Mutual labels:  utils
Dialogutil
common used dialog with material style ( in support v7),ios style,get top activity automatically, invoke everywhere (any thread , any window)
Stars: ✭ 948 (-89.14%)
Mutual labels:  utils
Tina
a powerful android network library base on okhttp
Stars: ✭ 32 (-99.63%)
Mutual labels:  utils
Cfrs
Child Frame Read String
Stars: ✭ 46 (-99.47%)
Mutual labels:  utils
Ultimatebarx
Make Android transparent statusbar and navigationbar easy.
Stars: ✭ 879 (-89.93%)
Mutual labels:  statusbar
Bash Utils
utils for shell
Stars: ✭ 58 (-99.34%)
Mutual labels:  utils
Androidcommon
基于Android系统Api封装常用工具类
Stars: ✭ 870 (-90.03%)
Mutual labels:  utils
Pitaya
A simple general-purpose utility library for Java 6+
Stars: ✭ 38 (-99.56%)
Mutual labels:  utils
Schematics Utilities
🛠️ Useful exported utilities for working with Schematics
Stars: ✭ 73 (-99.16%)
Mutual labels:  utils
Css In Js Utils
Useful utility functions for CSS in JS solutions
Stars: ✭ 61 (-99.3%)
Mutual labels:  utils
Sassyfication
💅Library with sass mixins to speed up your css workflow.
Stars: ✭ 51 (-99.42%)
Mutual labels:  utils

StatusBarUtil

招人广告:

字节跳动各业务线均可内推,可直接推我现在所在的部门 TikTok/抖音 业务线,提供以下服务:

  • 简历修改
  • 面试指导
  • 进度跟进

欢迎看机会的人加我微信,也欢迎进行技术交流。

Lark20210629-164537.jpg

Android Arsenal

A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4).

中文版点我

Sample

Download StatusBarUtil-Demo

ChangeLog

CLICK ME

Usage

  1. Add the dependencies to your build.gradle file, StatusBarUtil is avaiable in JCenter:

    compile 'com.jaeger.statusbarutil:library:1.5.1'

    I fixed typo, change "statusbaruitl" to "statusbarutil", please notice this.

  2. Call method you need after setContentView(), such as :

    setContentView(R.layout.main_activity);
    ...
    StatusBarUtil.setColor(MainActivity.this, mColor);
  3. If you use this util in a page which containing a DrawerLayout, you need add android:fitsSystemWindows="true" for DrawerLayout in your layout XML:

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">
    
        ...
    
    </android.support.v4.widget.DrawerLayout>
  4. Set color for swipe back page

    Recommend using with bingoogolapple/BGASwipeBackLayout-Android: Android Activity 滑动返回

    StatusBarUtil.setColorForSwipeBack(Activity activity, @ColorInt int color, int statusBarAlpha)
  5. All statusBarAlpha value you set should between 0 ~ 255

  6. How to use in Fragment, please read UseInFragmentActivity.java

    Handle all Fragments in ViewPager as ImageViewFragment, add a fake View in your Fragment layout as StatusBar :

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <View
            android:id="@+id/fake_statusbar_view"
            android:layout_width="match_parent"
            android:layout_height="@dimen/statusbar_view_height"
            android:background="@color/colorPrimary"/>
    
        <TextView
            android:id="@+id/tv_title"
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:background="@color/colorPrimary"
            android:gravity="center"
            android:text="@string/app_name"
            android:textColor="@color/white"
            android:textSize="24sp"/>   
    </LinearLayout>

    The fake StatusBar View height value statusbar_view_height defined in dimens.xml

    ~ values-v19/dimens.xml
    
    <dimen name="statusbar_view_height">25dp</dimen>
    
    ~ values/dimens.xml
    
    <dimen name="statusbar_view_height">0dp</dimen>

    When you change StatusBarColor :

    mFakeStatusBar.setBackgroundColor(color);

    Then in the Activity which contains ViewPage, just invoke

    StatusBarUtil.setTranslucentForImageViewInFragment(UseInFragmentActivity.this, null);

    Please read UseInFragmentActivity.java

Features

  • Set status bar color

    StatusBarUtil.setColor(Activity activity, int color)

  • Set status bar translucent

    StatusBarUtil.setTranslucent(Activity activity, int statusBarAlpha)

  • Set status bar transparent

    StatusBarUtil.setTransparent(Activity activity)

  • Set status bar color for DrawerLayout

    StatusBarUtil.setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, int color)

  • Set translucent status bar for using ImageView as head view page

      StatusBarUtil.setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView)

  • Set Light or Dark mode

      StatusBarUtil.setLightMode(Activity activity)
      StatusBarUtil.setDarkMode(Activity activity)
    

  • Use in fragment

  • Set color for swipe back page

      StatusBarUtil.setColorForSwipeBack(Activity activity, @ColorInt int color, int statusBarAlpha)

  • Pass statusBarAlpha param when necessary to change your status bar alpha, which is 112 by default.

License

Copyright 2016 Jaeger Chen

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