andreluizreis
6/7/2017 - 8:43 PM

Status bar. Font: http://blog.raffaeu.com/archive/2015/04/11/android-and-the-transparent-status-bar.aspx |||||| https://github.com/jgilfelt/

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // Dagger injection
    ((MyApplication)getApplication()).getAppComponent().inject(this);

    setStatusBarTranslucent(true);

    // create our manager instance after the content view is set
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    // enable status bar tint
    tintManager.setStatusBarTintEnabled(true);

    // set the transparent color of the status bar, 30% darker
    tintManager.setTintColor(Color.parseColor("#30000000"));
}
  
/**
 * Make status bar transparent
 * @param makeTranslucent
 */
private void setStatusBarTranslucent(boolean makeTranslucent) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (makeTranslucent) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        } else {
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }
}