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

The following examples show how to use com.readystatesoftware.systembartint.SystemBarTintManager#setNavigationBarAlpha() . 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: 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 2
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 3
Source File: UserLoginActivity.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_user_login);

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
        if(upArrow != null)
            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 ) { //&& 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.myNavigationColor));

    }

    // get views
    etUserName = findViewById(R.id.edit_username);
    etPassword = findViewById(R.id.edit_password);
    TextView tvLogin = findViewById(R.id.btn_login);
    TextView tvRegister = findViewById(R.id.btn_register);

    // listeners
    tvLogin.setOnClickListener(v -> {
        if(etUserName.getText().toString().length() == 0 || etUserName.getText().toString().length() > 30
                || etPassword.getText().toString().length() == 0 || etPassword.getText().toString().length() > 30) {
            Toast.makeText(UserLoginActivity.this, getResources().getString(R.string.system_info_fill_not_complete), Toast.LENGTH_SHORT).show();
            return;
        }

        // async login
        AsyncLoginTask alt = new AsyncLoginTask();
        alt.execute(etUserName.getText().toString(), etPassword.getText().toString());
    });

    tvRegister.setOnClickListener(v -> new MaterialDialog.Builder(UserLoginActivity.this)
            .onPositive((dialog, which) -> {
                // show browser list
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(Wenku8API.REGISTER_URL));
                String title = getResources().getString(R.string.system_choose_browser);
                Intent chooser = Intent.createChooser(intent, title);
                startActivity(chooser);
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .content(R.string.dialog_content_verify_register)
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_ok)
            .negativeText(R.string.dialog_negative_pass)
            .show());
}
 
Example 4
Source File: NovelReviewReplyListActivity.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_reply_list);

        // fetch values
        rid = getIntent().getIntExtra("rid", 1);
        reviewTitle = getIntent().getStringExtra("title");

        // 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);
        etReplyText = findViewById(R.id.review_reply_edit_text);
        LinearLayout llReplyButton = findViewById(R.id.review_reply_send);

        mRecyclerView.setHasFixedSize(false);
        DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
        Drawable horizontalDivider = ContextCompat.getDrawable(getApplication(), R.drawable.divider_horizontal);
        if (horizontalDivider != null) {
            horizontalDecoration.setDrawable(horizontalDivider);
            mRecyclerView.addItemDecoration(horizontalDecoration);
        }
        // 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 AsyncReviewReplyListLoader(this, mSwipeRefreshLayout, rid, reviewReplyList).execute()); // retry loading

        mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myAccentColor));
        mSwipeRefreshLayout.setOnRefreshListener(this::refreshReviewReplyList);

        llReplyButton.setOnClickListener(ignored -> {
            // FIXME: enable these
            Toast.makeText(getApplication(), getResources().getString(R.string.system_api_error), Toast.LENGTH_SHORT).show();

//            String temp = etReplyText.getText().toString();
//            String badWord = Wenku8API.searchBadWords(temp);
//            if (badWord != null) {
//                Toast.makeText(getApplication(), String.format(getResources().getString(R.string.system_containing_bad_word), badWord), Toast.LENGTH_SHORT).show();
//            } else if (temp.length() < Wenku8API.MIN_REPLY_TEXT) {
//                Toast.makeText(getApplication(), getResources().getString(R.string.system_review_too_short), Toast.LENGTH_SHORT).show();
//            } else {
//                // hide ime
//                InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
//                View view = getCurrentFocus();
//                if (view == null) view = new View(this);
//                if (imm != null) imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
//
//                // submit
//                new AsyncPublishReply(etReplyText, this, rid, temp).execute();
//            }
        });

        // load initial content
        new AsyncReviewReplyListLoader(this, mSwipeRefreshLayout, rid, reviewReplyList).execute();
    }
 
Example 5
Source File: MainActivity.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_main); // have 3 styles
    initialApp();

    // UIL setting
    if (ImageLoader.getInstance() == null || !ImageLoader.getInstance().isInited()) {
        GlobalConfig.initImageLoader(this);
    }

    // UMeng initialization
    UMConfigure.init(MyApp.getContext(), UMConfigure.DEVICE_TYPE_PHONE, null);

    // Update old save files ----------------


    // set Toolbar
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    // getSupportActionBar().setDisplayShowHomeEnabled(true);

    // set Tool button
    mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_drawer);
    mNavigationDrawerFragment.setup(R.id.fragment_drawer, findViewById(R.id.drawer), mToolbar);

    // find search box
    mToolbar.setOnMenuItemClickListener(item -> {
        //Toast.makeText(MyApp.getContext(),"called button",Toast.LENGTH_SHORT).show();
        if (item.getItemId() == R.id.action_search) {
            // start search activity
            startActivity(new Intent(MainActivity.this, SearchActivity.class));
            overridePendingTransition(R.anim.fade_in, R.anim.hold); // fade in animation

        }
        return 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.myNavigationColor));
    }
}
 
Example 6
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 7
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 8
Source File: SearchResultActivity.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_result);

    // get arguments
    String searchKey = getIntent().getStringExtra("key");

    // set indicator enable
    Toolbar mToolbar = (Toolbar) 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 action bat title
    TextView mTextView = (TextView) findViewById(R.id.search_result_title);
    if(mTextView != null)
        mTextView.setText(getResources().getString(R.string.title_search) + searchKey);

    // init values
    Bundle bundle = new Bundle();
    bundle.putString("type", "search");
    bundle.putString("key", searchKey);

    // UIL setting
    if(ImageLoader.getInstance() == null || !ImageLoader.getInstance().isInited()) {
        GlobalConfig.initImageLoader(this);
    }

    // This code will produce more than one activity in stack, so I jump to new SearchActivity to escape it.
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.result_fragment, NovelItemListFragment.newInstance(bundle), "fragment")
            .setTransitionStyle(FragmentTransaction.TRANSIT_NONE)
            .commit();

}
 
Example 9
Source File: UserInfoActivity.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_account_info);

    // set indicator enable
    Toolbar mToolbar = findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        final Drawable upArrow = getResources().getDrawable(R.drawable.ic_svg_back);
        if(upArrow != null)
            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 ) { //&& 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.myNavigationColor));
    }

    // get views
    rivAvatar = findViewById(R.id.user_avatar);
    tvUserName = findViewById(R.id.username);
    tvNickyName = findViewById(R.id.nickname);
    tvScore = findViewById(R.id.score);
    tvExperience = findViewById(R.id.experience);
    tvRank = findViewById(R.id.rank);
    tvLogout = findViewById(R.id.btn_logout);

    // sync get info
    agui = new AsyncGetUserInfo();
    agui.execute();

}