Search in sources :

Example 11 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project SeeWeather by xcc3641.

the class BaseActivity method setStatusBarColorForKitkat.

public void setStatusBarColorForKitkat(int color) {
    /**
         * Android4.4
         */
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(color);
    }
}
Also used : SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager)

Example 12 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project smartmodule by carozhu.

the class BaseSimpleAppCompatActivity method setStatusBarTintResource.

/**
     * @param resColorID
     */
public void setStatusBarTintResource(int resColorID) {
    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    activity = this;
    context = this;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        setTranslucentStatus(true);
    }
    if (mTintManager == null) {
        mTintManager = new SystemBarTintManager(this);
        mTintManager.setStatusBarTintEnabled(true);
    }
    mTintManager.setStatusBarTintResource(resColorID);
}
Also used : SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager)

Example 13 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project Tapad by berict.

the class ToolbarHelper method setStatusBarTint.

public void setStatusBarTint(Activity activity) {
    SystemBarTintManager tintManager = new SystemBarTintManager(activity);
    // enable status bar tint
    tintManager.setStatusBarTintEnabled(true);
    // enable navigation bar tint
    tintManager.setNavigationBarTintEnabled(true);
    // set the transparent color of the status bar, 20% darker
    tintManager.setTintColor(activity.getResources().getColor(R.color.dark_status_bar));
}
Also used : SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager)

Example 14 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project SystemBarTint by jgilfelt.

the class ColorActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_color);
    mTintManager = new SystemBarTintManager(this);
    mTintManager.setStatusBarTintEnabled(true);
    mTintManager.setNavigationBarTintEnabled(true);
    mColorPicker = (ColorPicker) findViewById(R.id.color_picker);
    applySelectedColor();
    mButton = (Button) findViewById(R.id.button);
    mButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            applySelectedColor();
        }
    });
}
Also used : OnClickListener(android.view.View.OnClickListener) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) View(android.view.View)

Example 15 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project FastDev4Android by jiangqqlmj.

the class TranslucentActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.translucent_layout);
    tv = (TextView) this.findViewById(R.id.tv);
    int mode = getIntent().getIntExtra("mode", 0);
    Log.d(TAG, "MODE:" + mode);
    //当系统版本为4.4或者4.4以上时可以使用沉浸式状态栏
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //透明状态栏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //透明导航栏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        if (mode == 0) {
            LinearLayout linear_bar = (LinearLayout) findViewById(R.id.linear_bar);
            linear_bar.setVisibility(View.VISIBLE);
            int statusHeight = getStatusBarHeight();
            android.widget.LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams) linear_bar.getLayoutParams();
            params.height = statusHeight;
            linear_bar.setLayoutParams(params);
            tv.setText("系统方法沉浸式实现");
        } else if (mode == 1) {
            // create our manager instance after the content view is set
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            // 激活状态栏
            tintManager.setStatusBarTintEnabled(true);
            // enable navigation bar tint 激活导航栏
            tintManager.setNavigationBarTintEnabled(true);
            //设置系统栏设置颜色
            //tintManager.setTintColor(R.color.red);
            //给状态栏设置颜色
            tintManager.setStatusBarTintResource(R.color.middle_red);
            // 设置导航栏设置资源
            tintManager.setNavigationBarTintResource(R.color.color_nav);
            tv.setText("第三方库沉浸式实现");
        }
    }
}
Also used : SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) LinearLayout(android.widget.LinearLayout)

Aggregations

SystemBarTintManager (com.readystatesoftware.systembartint.SystemBarTintManager)23 TargetApi (android.annotation.TargetApi)5 View (android.view.View)5 SuppressLint (android.annotation.SuppressLint)4 ActionBar (android.support.v7.app.ActionBar)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Toolbar (android.support.v7.widget.Toolbar)2 ViewGroup (android.view.ViewGroup)2 LinearLayout (android.widget.LinearLayout)2 TextView (android.widget.TextView)2 Dialog (android.app.Dialog)1 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Drawable (android.graphics.drawable.Drawable)1 InsetDrawable (android.graphics.drawable.InsetDrawable)1 AudioEffect (android.media.audiofx.AudioEffect)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1