Java Code Examples for com.readystatesoftware.systembartint.SystemBarTintManager#setStatusBarTintEnabled()

The following examples show how to use com.readystatesoftware.systembartint.SystemBarTintManager#setStatusBarTintEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PagerSlidingTabStripActivity.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pager_sliding_tab_activity_main);
    ButterKnife.inject(this);
    setSupportActionBar(toolbar);
    // create our manager instance after the content view is set
    mTintManager = new SystemBarTintManager(this);
    // enable status bar tint
    mTintManager.setStatusBarTintEnabled(true);

    adapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(adapter);
    tabs.setViewPager(pager);

    final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
            .getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    changeColor(getResources().getColor(R.color.Green));
}
 
Example 2
Source File: BaseActivity.java    From bleYan with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(19)
	public void setTranslucentStatus(Activity activity, boolean on) {
		if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
			Window win = activity.getWindow();
			WindowManager.LayoutParams winParams = win.getAttributes();
			final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
			if (on) {
				winParams.flags |= bits;
			} else {
				winParams.flags &= ~bits;
			}
			win.setAttributes(winParams);

			SystemBarTintManager tintManager = new SystemBarTintManager(activity);
			tintManager.setStatusBarTintEnabled(true);
			tintManager.setNavigationBarTintEnabled(false);
			tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
			//tintManager.setNavigationBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
//			tintManager.setStatusBarTintResource(R.color.colorPrimary);
		}
	}
 
Example 3
Source File: SystemBarUtils.java    From likequanmintv with Apache License 2.0 6 votes vote down vote up
public static void setStatusBarTranslate(AppCompatActivity mActivity, int resId){

        SystemBarTintManager tintManager = new SystemBarTintManager(mActivity);
        if (resId== R.color.transparent){
            // enable status bar tint
            tintManager.setStatusBarTintEnabled(false);
            // enable navigation bar tint
            tintManager.setNavigationBarTintEnabled(false);
            //noinspection deprecation
        }else {
            // enable status bar tint
            tintManager.setStatusBarTintEnabled(true);
            // enable navigation bar tint
            tintManager.setNavigationBarTintEnabled(true);
            // enable navigation bar tint
        }
        tintManager.setStatusBarTintColor(mActivity.getResources().getColor(resId));

    }
 
Example 4
Source File: PreferencesActivity.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences Sp = PreferenceManager.getDefaultSharedPreferences(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.prefsfrag);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (SDK_INT >= 21) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze",
                ((BitmapDrawable) getResources().getDrawable(R.drawable.ic_launcher)).getBitmap(),
                getColorPreference().getColor(ColorUsage.PRIMARY));
        setTaskDescription(taskDescription);
    }
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_HOME_AS_UP | android.support.v7.app.ActionBar.DISPLAY_SHOW_TITLE);
    getSupportActionBar().setBackgroundDrawable(getColorPreference().getDrawable(ColorUsage.PRIMARY));

    if (SDK_INT == 20 || SDK_INT == 19) {
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintColor(getColorPreference().getColor(ColorUsage.PRIMARY));

        FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.preferences).getLayoutParams();
        SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
        p.setMargins(0, config.getStatusBarHeight(), 0, 0);
    } else if (SDK_INT >= 21) {
        boolean colourednavigation = Sp.getBoolean("colorednavigation", true);
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(PreferenceUtils.getStatusColor(getColorPreference().getColorAsString(ColorUsage.PRIMARY)));
        if (colourednavigation)
            window.setNavigationBarColor(PreferenceUtils.getStatusColor(getColorPreference().getColorAsString(ColorUsage.PRIMARY)));

    }
    if (savedInstanceState != null){
        selectedItem = savedInstanceState.getInt(KEY_CURRENT_FRAG_OPEN, 0);
    }
    selectItem(selectedItem);
}
 
Example 5
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
Example 6
Source File: Utility.java    From BlackLight with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(19)
public static void enableTint(Activity activity) {
	if (Build.VERSION.SDK_INT < 19) return;
	
	Window w = activity.getWindow();
	WindowManager.LayoutParams p = w.getAttributes();
	p.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
	w.setAttributes(p);
	
	SystemBarTintManager m = new SystemBarTintManager(activity);
	m.setStatusBarTintEnabled(true);
	m.setStatusBarTintResource(R.color.action_gray);
}
 
Example 7
Source File: DefaultActivity.java    From SystemBarTint with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_default);

	SystemBarTintManager tintManager = new SystemBarTintManager(this);
	tintManager.setStatusBarTintEnabled(true);
	tintManager.setNavigationBarTintEnabled(true);
}
 
Example 8
Source File: LocalPlayerActivity.java    From android with Apache License 2.0 5 votes vote down vote up
private void updateControlersVisibility(boolean show) {
    if (show) {

        mControllers.setVisibility(View.VISIBLE);
        if (mFull == 1) {
            mActionBar.show();
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            if (AppUtils.hasKitKat()) {
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                tintManager = new SystemBarTintManager(LocalPlayerActivity.this);
                tintManager.setStatusBarTintColor(Color.parseColor("#5A33b5e5"));
                tintManager.setStatusBarTintEnabled(true);
            }
            mFull = 0;
        }
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
            //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

        }
        mControllers.setVisibility(View.INVISIBLE);
        if (AppUtils.hasKitKat()) {
            tintManager.setStatusBarTintEnabled(false);
        }
    }
}
 
Example 9
Source File: StatusBarUtil.java    From PaintView with MIT License 5 votes vote down vote up
/**
 * 修改状态栏颜色,支持4.4以上版本
 * @param activity
 * @param colorId
 */
public static void setStatusBarColor(Activity activity,int colorId) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.setStatusBarColor(activity.getResources().getColor(colorId));
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明
        transparencyBar(activity);
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(colorId);
    }
}
 
Example 10
Source File: SwipeBackAppCompatFragmentActivity.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // mHelper = new SwipeBackActivityHelper(this);
    // mHelper.onActivityCreate();

    final SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setStatusBarTintResource(R.color.actionbar_bg);
    if (!Utils.hasSmartBar()) {
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setNavigationBarTintResource(R.color.statusbar_bg);
    } else {
        // Meizu 手机
        // 设置状态栏图标文字为深色
        Utils.setStatusBarDarkIcon(getWindow(), true);
        // 设置状态栏不透明
        Utils.setImmersedWindow(getWindow(), false);

        final ActionBar bar = this.getSupportActionBar();
        // 设置ActionBar顶栏背景
        bar.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.ab_solid_tupdota2));
        // 设置SmartBar背景
        bar.setSplitBackgroundDrawable(this.getResources()
                .getDrawable(R.drawable.ab_bottom_solid_tupdota2));
    }
}
 
Example 11
Source File: BaseActivity.java    From NMSAlphabetAndroidApp with MIT License 5 votes vote down vote up
private void tintBars(){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        setTranslucentStatusAndNavigationBar();
    }
    tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setNavigationBarTintEnabled(true);
    tintManager.setTintColor(ThemeUtil.getPrimaryColor(this));
}
 
Example 12
Source File: BaseFragmentActivity.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * use SytemBarTintManager
 *
 * @param tintDrawable
 */
protected void setSystemBarTintDrawable(Drawable tintDrawable) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        SystemBarTintManager mTintManager = new SystemBarTintManager(this);
        if (tintDrawable != null) {
            mTintManager.setStatusBarTintEnabled(true);
            mTintManager.setTintDrawable(tintDrawable);
        } else {
            mTintManager.setStatusBarTintEnabled(false);
            mTintManager.setTintDrawable(null);
        }
    }

}
 
Example 13
Source File: AboutActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_about);

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
    if(getSupportActionBar() != null && upArrow != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        upArrow.setColorFilter(getResources().getColor(R.color.default_white), PorterDuff.Mode.SRC_ATOP);
        getSupportActionBar().setHomeAsUpIndicator(upArrow);
    }

    // change status bar color tint, and this require SDK16
    if (Build.VERSION.SDK_INT >= 16 ) {
        // create our manager instance after the content view is set
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        // enable all tint
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setTintAlpha(0.15f);
        tintManager.setNavigationBarAlpha(0.0f);
        // set all color
        tintManager.setTintColor(getResources().getColor(android.R.color.black));
        // set Navigation bar color
        if(Build.VERSION.SDK_INT >= 21)
            getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColor));
    }

    // get version code
    TextView tvVersion = findViewById(R.id.app_version);
    tvVersion.setText(String.format(getResources().getString(R.string.about_version_template), BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
}
 
Example 14
Source File: NewsDisplayActivity.java    From Netease with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(19)
private void initWindow() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintColor(getResources().getColor(R.color.tab_top_background));
        tintManager.setStatusBarTintEnabled(true);
    }
}
 
Example 15
Source File: MatchActionBarActivity.java    From SystemBarTint with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_match_actionbar);

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		setTranslucentStatus(true);
	}

	SystemBarTintManager tintManager = new SystemBarTintManager(this);
	tintManager.setStatusBarTintEnabled(true);
	tintManager.setStatusBarTintResource(R.color.statusbar_bg);

}
 
Example 16
Source File: NovelReviewListActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_novel_review_list);

    // fetch values
    aid = getIntent().getIntExtra("aid", 1);

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
    if(getSupportActionBar() != null && upArrow != null) {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        upArrow.setColorFilter(getResources().getColor(R.color.default_white), PorterDuff.Mode.SRC_ATOP);
        getSupportActionBar().setHomeAsUpIndicator(upArrow);
    }

    // change status bar color tint, and this require SDK16
    if (Build.VERSION.SDK_INT >= 16 ) {
        // create our manager instance after the content view is set
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        // enable all tint
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setTintAlpha(0.15f);
        tintManager.setNavigationBarAlpha(0.0f);
        // set all color
        tintManager.setTintColor(getResources().getColor(android.R.color.black));
        // set Navigation bar color
        if(Build.VERSION.SDK_INT >= 21)
            getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColor));
    }

    // get views and set title
    // get views
    mLoadingLayout = findViewById(R.id.list_loading);
    mSwipeRefreshLayout = findViewById(R.id.swipe_refresh_layout);
    mRecyclerView = findViewById(R.id.review_item_list);
    mLoadingStatusTextView = findViewById(R.id.list_loading_status);
    mLoadingButton = findViewById(R.id.btn_loading);

    mRecyclerView.setHasFixedSize(false);
    // use a linear layout manager
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    // Listener
    mRecyclerView.addOnScrollListener(new MyOnScrollListener());

    // set click event for retry and cancel loading
    mLoadingButton.setOnClickListener(v -> new AsyncReviewListLoader(this, mSwipeRefreshLayout, aid, reviewList).execute()); // retry loading

    mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myAccentColor));
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        // reload all
        reviewList = new ReviewList();
        mAdapter = null;
        new AsyncReviewListLoader(this, mSwipeRefreshLayout, aid, reviewList).execute();
    });

    // load initial content
    new AsyncReviewListLoader(this, mSwipeRefreshLayout, aid, reviewList).execute();
}
 
Example 17
Source File: SearchActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_search);

    // bind views
    toolbarSearchView = findViewById(R.id.search_view);
    View searchClearButton = findViewById(R.id.search_clear);

    // Clear search text when clear button is tapped
    searchClearButton.setOnClickListener(v -> toolbarSearchView.setText(""));

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
    }

    // change status bar color tint, and this require SDK16
    if (Build.VERSION.SDK_INT >= 16 ) { //&& Build.VERSION.SDK_INT <= 21) {
        // Android API 22 has more effects on status bar, so ignore

        // create our manager instance after the content view is set
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        // enable all tint
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setTintAlpha(0.15f);
        tintManager.setNavigationBarAlpha(0.0f);
        // set all color
        tintManager.setTintColor(getResources().getColor(android.R.color.black));
        // set Navigation bar color
        if(Build.VERSION.SDK_INT >= 21)
            getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColorWhite));
    }

    // set search clear icon color
    ImageView searchClearIcon = findViewById(R.id.search_clear_icon);
    searchClearIcon.setColorFilter(getResources().getColor(R.color.mySearchToggleColor), PorterDuff.Mode.SRC_ATOP);

    // set history list
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);

    RecyclerView mRecyclerView = this.findViewById(R.id.search_history_list);
    mRecyclerView.setHasFixedSize(true); // set variable size
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.setLayoutManager(mLayoutManager);

    historyList = GlobalConfig.getSearchHistory();
    adapter = new SearchHistoryAdapter(historyList);
    adapter.setOnItemClickListener(this); // add item click listener
    adapter.setOnItemLongClickListener(this); // add item click listener
    mRecyclerView.setAdapter(adapter);

    // set search action
    toolbarSearchView.setOnEditorActionListener((v, actionId, event) -> {
        // purify
        String temp = toolbarSearchView.getText().toString().trim();
        if(temp.length()==0) return false;

        // real action
        //Toast.makeText(MyApp.getContext(), temp, Toast.LENGTH_SHORT).show();
        GlobalConfig.addSearchHistory(temp);
        refreshHistoryList();

        // jump to search
        Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class);
        intent.putExtra("key", temp);
        intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); // long-press will cause repetitions
        startActivity(intent);
        overridePendingTransition( R.anim.fade_in, R.anim.hold);

        return false;
    });
}
 
Example 18
Source File: LinkActivity.java    From AirFree-Client with GNU General Public License v3.0 4 votes vote down vote up
private void init() {
    iLanguage();
    app = (ApplicationUtil) LinkActivity.this.getApplication();
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setNavigationBarTintEnabled(true);
    tintManager.setTintColor(Color.parseColor("#FCFCFC"));
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());
    etIP = (EditText) findViewById(R.id.et_ip);
    etIP.setHint(strIPAddressHint);
    cbRemember = (CheckBox) findViewById(R.id.cb_remember);
    cbRemember.setText(strRememberConnection);
    btnLink = (Button) findViewById(R.id.btn_link);
    btnLink.setText(strInputIPAddress);
    btnLink.setOnClickListener(onLinkClickListener);
    btnScan = (Button) findViewById(R.id.btn_scan);
    btnScan.setText(strScanQRCode);
    btnScan.setOnClickListener(onScanClickListener);
    boolean isRemember = pref.getBoolean(getString(R.string.is_remember), false);
    if (isRemember) {
        String ip = pref.getString(getString(R.string.is_ip), "");
        etIP.setText(ip);
        cbRemember.setChecked(true);
    }
    boom = ExplosionField.attach2Window(this);
    if (app.isExplosing()) {
        listen(findViewById(R.id.ll_icon));
        listen(findViewById(R.id.cb_remember));
        listen(findViewById(R.id.btn_link));
        listen(findViewById(R.id.btn_scan));
    }
}
 
Example 19
Source File: MenuBackgroundSelectorActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_menu_background_selector);

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
    if(getSupportActionBar() != null && upArrow != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        upArrow.setColorFilter(getResources().getColor(R.color.default_white), PorterDuff.Mode.SRC_ATOP);
        getSupportActionBar().setHomeAsUpIndicator(upArrow);
    }

    // change status bar color tint, and this require SDK16
    if (Build.VERSION.SDK_INT >= 16 ) {
        // create our manager instance after the content view is set
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        // enable all tint
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setTintAlpha(0.15f);
        tintManager.setNavigationBarAlpha(0.0f);
        // set all color
        tintManager.setTintColor(getResources().getColor(android.R.color.black));
        // set Navigation bar color
        if(Build.VERSION.SDK_INT >= 21)
            getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColor));
    }

    // listeners
    findViewById(R.id.bg01).setOnClickListener(v -> {
        GlobalConfig.setToAllSetting(GlobalConfig.SettingItems.menu_bg_id, "1");
        MenuBackgroundSelectorActivity.this.finish();
    });
    findViewById(R.id.bg02).setOnClickListener(v -> {
        GlobalConfig.setToAllSetting(GlobalConfig.SettingItems.menu_bg_id, "2");
        MenuBackgroundSelectorActivity.this.finish();
    });
    findViewById(R.id.bg03).setOnClickListener(v -> {
        GlobalConfig.setToAllSetting(GlobalConfig.SettingItems.menu_bg_id, "3");
        MenuBackgroundSelectorActivity.this.finish();
    });
    findViewById(R.id.bg04).setOnClickListener(v -> {
        GlobalConfig.setToAllSetting(GlobalConfig.SettingItems.menu_bg_id, "4");
        MenuBackgroundSelectorActivity.this.finish();
    });
    findViewById(R.id.bg05).setOnClickListener(v -> {
        GlobalConfig.setToAllSetting(GlobalConfig.SettingItems.menu_bg_id, "5");
        MenuBackgroundSelectorActivity.this.finish();
    });
}
 
Example 20
Source File: ExplorerActivity.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
void initialiseViews() {

//        mDrawerLinear = (ScrimInsetsRelativeLayout) findViewById(R.id.left_drawer);
//        if (getAppTheme().equals(AppTheme.DARK)) 
//			mDrawerLinear.setBackgroundColor(Utils.getColor(this, R.color.holo_dark_background));
//        else 
//			mDrawerLinear.setBackgroundColor(Color.WHITE);
//        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
//        //mDrawerLayout.setStatusBarBackgroundColor(Color.parseColor((currentTab==1 ? skinTwo : skin)));
//        mDrawerList = (ListView) findViewById(R.id.menu_drawer);
//        drawerHeaderView.setBackgroundResource(R.drawable.amaze_header);
//        //drawerHeaderParent.setBackgroundColor(Color.parseColor((currentTab==1 ? skinTwo : skin)));
//        if (findViewById(R.id.tab_frame) != null) {
//            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, mDrawerLinear);
//            mDrawerLayout.openDrawer(mDrawerLinear);
//            mDrawerLayout.setScrimColor(Color.TRANSPARENT);
//            isDrawerLocked = true;
//        } else if (findViewById(R.id.tab_frame) == null) {

//		mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerList);
//            mDrawerLayout.closeDrawer(mDrawerList);
//            isDrawerLocked = false;
////        }
//        View settingsButton = findViewById(R.id.settingsbutton);
//        if (getAppTheme().equals(AppTheme.DARK)) {
//            settingsButton.setBackgroundResource(R.drawable.safr_ripple_black);
//            ((ImageView) settingsButton.findViewById(R.id.settingicon)).setImageResource(R.drawable.ic_settings_white_48dp);
//            ((TextView) settingsButton.findViewById(R.id.settingtext)).setTextColor(Utils.getColor(this, android.R.color.white));
//        }
//        settingsButton.setOnClickListener(new View.OnClickListener() {
//				@Override
//				public void onClick(View v) {
//					Intent in = new Intent(ExplorerActivity.this, PreferencesActivity.class);
//					startActivity(in);
//					finish();
//				}
//
//			});
//        View appButton = findViewById(R.id.appbutton);
//        if (getAppTheme().equals(AppTheme.DARK)) {
//            appButton.setBackgroundResource(R.drawable.safr_ripple_black);
//            ((ImageView) appButton.findViewById(R.id.appicon)).setImageResource(R.drawable.ic_doc_apk_white);
//            ((TextView) appButton.findViewById(R.id.apptext)).setTextColor(Utils.getColor(this, android.R.color.white));
//        }
//        appButton.setOnClickListener(new View.OnClickListener() {
//				@Override
//				public void onClick(View v) {
//					android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction();
//					transaction2.replace(R.id.content_frame, new AppsList());
//					//appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
//					pending_fragmentTransaction = transaction2;
//					if (!isDrawerLocked) mDrawerLayout.closeDrawer(mDrawerList);
//					else onDrawerClosed();
//					selectedStorage = SELECT_MINUS_2;
//					adapter.toggleChecked(false);
//				}
//			});
//
//        View ftpButton = findViewById(R.id.ftpbutton);
//        if (getAppTheme().equals(AppTheme.DARK)) {
//            ftpButton.setBackgroundResource(R.drawable.safr_ripple_black);
//            ((ImageView) ftpButton.findViewById(R.id.ftpicon)).setImageResource(R.drawable.ic_ftp_dark);
//            ((TextView) ftpButton.findViewById(R.id.ftptext)).setTextColor(Utils.getColor(this, android.R.color.white));
//        }
//        ftpButton.setOnClickListener(new View.OnClickListener() {
//
//				@Override
//				public void onClick(View v) {
//					android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction();
//					transaction2.replace(R.id.content_frame, new FTPServerFragment());
//					//appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
//					pending_fragmentTransaction = transaction2;
//					if (!isDrawerLocked) mDrawerLayout.closeDrawer(mDrawerList);
//					else onDrawerClosed();
//					selectedStorage = SELECT_MINUS_2;
//					adapter.toggleChecked(false);
//				}
//			});
        //getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor((currentTab==1 ? skinTwo : skin))));

        // status bar0
        if (SDK_INT == 20 || SDK_INT == 19) {
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            tintManager.setStatusBarTintEnabled(true);
            //tintManager.setStatusBarTintColor(Color.parseColor((currentTab==1 ? skinTwo : skin)));
            FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.drawer_layout).getLayoutParams();
            SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
            if (!isDrawerLocked) p.setMargins(0, config.getStatusBarHeight(), 0, 0);
        } else if (SDK_INT >= 21) {
//            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            //window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//            if (isDrawerLocked) {
//                window.setStatusBarColor(skinStatusBar);
//            } else {
//				window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//			}
            if (colourednavigation)
                window.setNavigationBarColor(skinStatusBar);
        }
    }