Java Code Examples for androidx.appcompat.widget.Toolbar#getAlpha()

The following examples show how to use androidx.appcompat.widget.Toolbar#getAlpha() . 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: WhatIfFragment.java    From Easy_xkcd with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPostExecute(Void dummy) {
    prefHelper.setNewestWhatif(mTitles.size());
    setupAdapter(prefHelper.hideReadWhatIf());

    Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
    if (toolbar.getAlpha() == 0) {
        toolbar.setTranslationY(-300);
        toolbar.animate().setDuration(300).translationY(0).alpha(1);
        View view;
        for (int i = 0; i < toolbar.getChildCount(); i++) {
            view = toolbar.getChildAt(i);
            view.setTranslationY(-300);
            view.animate().setStartDelay(50 * (i + 1)).setDuration(70 * (i + 1)).translationY(0);
        }
    }
    if (newIntent) {
        Intent intent = new Intent(getActivity(), WhatIfActivity.class);
        startActivity(intent);
        newIntent = false;
    }
}
 
Example 2
Source File: OverviewBaseFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
protected void animateToolbar() {
    Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
    if (toolbar.getAlpha() == 0) {
        toolbar.setTranslationY(-300);
        toolbar.animate().setDuration(300).translationY(0).alpha(1);
        View view;
        for (int i = 2; i < toolbar.getChildCount(); i++) {
            view = toolbar.getChildAt(i);
            view.setTranslationY(-300);
            view.animate().setStartDelay(50 * (i + 1)).setDuration(70 * (i + 1)).translationY(0);
        }
    }
}
 
Example 3
Source File: ComicFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
protected void animateToolbar() {
    Toolbar toolbar = getMainActivity().getToolbar();
    if (toolbar.getAlpha() == 0) {
        toolbar.setTranslationY(-300);
        toolbar.animate().setDuration(380).translationY(0).alpha(1);
        View view;
        for (int i = 0; i < toolbar.getChildCount(); i++) {
            view = toolbar.getChildAt(i);
            view.setTranslationY(-300);
            view.animate().setStartDelay(50 * (i + 1)).setDuration(70 * (i + 1)).translationY(0);
        }
    }
}