Example usage for android.view Window STATUS_BAR_BACKGROUND_TRANSITION_NAME

List of usage examples for android.view Window STATUS_BAR_BACKGROUND_TRANSITION_NAME

Introduction

In this page you can find the example usage for android.view Window STATUS_BAR_BACKGROUND_TRANSITION_NAME.

Prototype

String STATUS_BAR_BACKGROUND_TRANSITION_NAME

To view the source code for android.view Window STATUS_BAR_BACKGROUND_TRANSITION_NAME.

Click Source Link

Document

The transitionName for the status bar background View when a custom background is used.

Usage

From source file:com.google.android.apps.forscience.whistlepunk.TransitionUtils.java

public static Pair<View, String>[] getTransitionPairs(Activity activity, View v, String transitionName) {
    ArrayList<Pair<View, String>> list = new ArrayList<>();
    list.add(Pair.create(v, transitionName));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View statusBar = activity.findViewById(android.R.id.statusBarBackground);
        if (statusBar != null) {
            list.add(Pair.create(statusBar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME));
        }/*from w w w  . j a  v a2s  . c  om*/
        View navigationBar = activity.findViewById(android.R.id.navigationBarBackground);
        if (navigationBar != null) {
            list.add(Pair.create(navigationBar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME));
        }
    }
    return list.toArray(new Pair[list.size()]);
}

From source file:pl.ipebk.tabi.presentation.ui.search.SearchActivity.java

public void goToPlaceDetails(View view, AggregateId placeId, String searchedPlate, SearchType searchType,
        PlaceListItemType itemType, int position) {

    indicator.setVisibility(View.GONE);

    Intent intent = new Intent(this, DetailsSearchActivity.class);
    intent.putExtra(DetailsSearchActivity.PARAM_PLACE_ID, placeId.getValue());
    intent.putExtra(DetailsSearchActivity.PARAM_SEARCHED_PLATE, searchedPlate);
    intent.putExtra(DetailsSearchActivity.PARAM_SEARCHED_TYPE, searchType);
    intent.putExtra(DetailsSearchActivity.PARAM_ITEM_TYPE, itemType);
    intent.putExtra(DetailsSearchActivity.PARAM_ADAPTER_POSITION, position);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        List<Pair<View, String>> transitions = new ArrayList<>();
        // shared elements
        transitions.add(Pair.create(indicator, getString(R.string.trans_tab_indicator)));
        transitions.add(Pair.create(searchInputWrap, getString(R.string.trans_search_input)));
        transitions.add(Pair.create(view,
                SharedTransitionNaming.getName(getString(R.string.trans_row_background), position)));
        transitions.add(Pair.create(view.findViewById(R.id.txt_voivodeship),
                SharedTransitionNaming.getName(getString(R.string.trans_voivodeship_name), position)));
        transitions.add(Pair.create(view.findViewById(R.id.txt_powiat),
                SharedTransitionNaming.getName(getString(R.string.trans_powiat_name), position)));
        transitions.add(Pair.create(view.findViewById(R.id.txt_place_name),
                SharedTransitionNaming.getName(getString(R.string.trans_place_name), position)));
        transitions.add(Pair.create(view.findViewById(R.id.ic_row),
                SharedTransitionNaming.getName(getString(R.string.trans_place_icon), position)));
        transitions.add(Pair.create(view.findViewById(R.id.txt_plate),
                SharedTransitionNaming.getName(getString(R.string.trans_place_plate), position)));
        // status and nav bar
        View statusBar = findViewById(android.R.id.statusBarBackground);
        if (statusBar != null) {
            transitions.add(Pair.create(statusBar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME));
        }//from   ww w  .j  a  v  a 2  s  .co m
        View navigationBar = findViewById(android.R.id.navigationBarBackground);
        if (navigationBar != null) {
            transitions.add(Pair.create(navigationBar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME));
        }

        Pair<View, String>[] transitionsArray = transitions.toArray(new Pair[transitions.size()]);

        ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(this,
                transitionsArray);
        startActivity(intent, transitionActivityOptions.toBundle());
    } else {
        startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link SearchActivity}./*ww w  . j a v a  2s. c om*/
 *
 * @param activity The context used to start this intent
 * @param textView search textview to animate
 * @param menu     hamburger icon to animate
 */
public static void launchSearchActivity(Activity activity, @NonNull View container, @NonNull View textView,
        @NonNull View menu) {
    Intent intent = new Intent(Intents.ACTION_SEARCH_VIEW);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        View statusbar = activity.findViewById(android.R.id.statusBarBackground);
        View actionbar = activity.findViewById(android.R.id.navigationBarBackground);

        Pair<View, String> pair1 = Pair.create(textView, textView.getTransitionName());
        Pair<View, String> pair2 = Pair.create(menu, menu.getTransitionName());
        Pair<View, String> pair3 = Pair.create(container, container.getTransitionName());

        Pair<View, String> pair4 = Pair.create(statusbar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME);
        Pair<View, String> pair5 = Pair.create(actionbar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME);

        ActivityOptionsCompat options = makeSceneTransitionAnimation(activity, pair1, pair2, pair3, pair4,
                pair5);
        activity.startActivity(intent, options.toBundle());
    } else {
        activity.startActivity(intent);
    }

}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link UserContactActivity}.
 *
 * @param activity The context used to start this intent
 * @param user     that was selected//from   w  ww.j  av a2 s . c  o  m
 */
public static void launchUserProfileActivity(Activity activity, User user, String loggedInUserId,
        View profileImage, View userName) {
    Intent intent = getUserProfileIntent(user, loggedInUserId);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        View statusbar = activity.findViewById(android.R.id.statusBarBackground);
        View actionbar = activity.findViewById(android.R.id.navigationBarBackground);

        Pair<View, String> pair1 = Pair.create(profileImage, profileImage.getTransitionName());
        Pair<View, String> pair2 = Pair.create(userName, userName.getTransitionName());
        Pair<View, String> pair3 = Pair.create(statusbar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME);
        Pair<View, String> pair4 = Pair.create(actionbar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME);

        ActivityOptionsCompat options = makeSceneTransitionAnimation(activity, pair1, pair2, pair3, pair4);
        activity.startActivity(intent, options.toBundle());
    } else {
        activity.startActivity(intent);
    }
}