Example usage for android.view Window FEATURE_CONTENT_TRANSITIONS

List of usage examples for android.view Window FEATURE_CONTENT_TRANSITIONS

Introduction

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

Prototype

int FEATURE_CONTENT_TRANSITIONS

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

Click Source Link

Document

Flag for requesting that window content changes should be animated using a TransitionManager.

Usage

From source file:org.xbmc.kore.ui.TVShowsActivity.java

@TargetApi(21)
@Override/*w w  w. j av a2  s  . c om*/
protected void onCreate(Bundle savedInstanceState) {
    // Request transitions on lollipop
    if (Utils.isLollipopOrLater()) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_generic_media);

    // Set up the drawer.
    navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);
    navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

    if (savedInstanceState == null) {
        TVShowListFragment tvshowListFragment = new TVShowListFragment();

        // Setup animations
        if (Utils.isLollipopOrLater()) {
            //Fade added to prevent shared element from disappearing very shortly at the start of the transition.
            Transition fade = TransitionInflater.from(this).inflateTransition(android.R.transition.fade);
            tvshowListFragment.setExitTransition(fade);
            tvshowListFragment.setReenterTransition(fade);

            tvshowListFragment.setSharedElementReturnTransition(
                    TransitionInflater.from(this).inflateTransition(R.transition.change_image));

            android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() {
                @Override
                public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
                    if (clearSharedElements) {
                        names.clear();
                        sharedElements.clear();
                        clearSharedElements = false;
                    }
                }
            };
            tvshowListFragment.setExitSharedElementCallback(seCallback);
        }
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, tvshowListFragment)
                .commit();
    } else {
        selectedTVShowId = savedInstanceState.getInt(TVSHOWID, -1);
        selectedTVShowTitle = savedInstanceState.getString(TVSHOWTITLE, null);
        selectedEpisodeId = savedInstanceState.getInt(EPISODEID, -1);
    }

    setupActionBar(selectedTVShowTitle);

    //        // Setup system bars and content padding, allowing averlap with the bottom bar
    //        setupSystemBarsColors();
    //        UIUtils.setPaddingForSystemBars(this, findViewById(R.id.fragment_container), true, true, true);
    //        UIUtils.setPaddingForSystemBars(this, findViewById(R.id.drawer_layout), true, true, true);
}

From source file:com.twolinessoftware.smarterlist.activity.BaseActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//from  w  w  w.j  a  va2  s. c  o m
protected void onCreate(final Bundle savedInstanceState) {

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);

    setContentView(getContentView());

    if (getSupportActionBar() != null) {
        getSupportActionBar().setElevation(getResources().getDimensionPixelSize(R.dimen.toolbar_elevation));
        getSupportActionBar().setHomeButtonEnabled(true);
    }
    Injector.inject(this);
}

From source file:com.fowlcorp.homebank4android.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

    super.onCreate(savedInstanceState); //restore the saved state

    setContentView(R.layout.toolbar_layout); //invoke the layout

    toolBar = (Toolbar) findViewById(R.id.toolbar);

    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    setSupportActionBar(toolBar);/*from www  .j a  va  2  s .  co m*/

    //invoke the fragment
    mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);
    mNavigationDrawerFragment.setRetainInstance(true); //use for orientation change
    mTitle = getTitle(); //set the title of the fragment (name of the app by default)

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    if (sharedPreferences.getBoolean("isFirstLaunch", true)) {
        Intent intent = new Intent(getApplicationContext(), firstLaunchActivity.class);
        startActivityForResult(intent, FIRST_OK); //start an activity to select a valide file
    } else {

        AsyncTask<String, String, String> asyncTask = new AsyncTask<String, String, String>() {

            @Override
            protected void onPreExecute() {
                progressBar.setVisibility(View.VISIBLE);
                drawerLayout.setVisibility(View.GONE);
                super.onPreExecute();
            }

            @Override
            protected String doInBackground(String... params) {

                try {
                    initParserFile();
                    doTEst();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                return null;
            }

            @Override
            protected void onPostExecute(String result) {
                // TODO Auto-generated method stub
                super.onPostExecute(result);
                progressBar.setVisibility(View.GONE);
                drawerLayout.setVisibility(View.VISIBLE);
                //               Log.d("Debug", "End of parsing");
                //               Log.d("Debug", String.valueOf(model.getGrandTotalBank()));
                //model.updateGrandTotal();
                try {
                    updateGUI();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };

        asyncTask.execute("");
    }
}

From source file:com.massivedisaster.activitymanager.activity.AbstractFragmentActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        requestWindowFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
        requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }/*from   w  w  w. j  av  a2  s.c o m*/

    super.onCreate(savedInstanceState);

    View rootView = LayoutInflater.from(this).inflate(getLayoutResId(), null);
    setContentView(rootView);
    initializeDataBinding(rootView);

    if (getSupportFragmentManager().getFragments().isEmpty()
            && getSupportFragmentManager().getBackStackEntryCount() == 0) {
        if (getIntent().hasExtra(ACTIVITY_MANAGER_FRAGMENT)) {
            performInitialTransaction(getFragment(getIntent().getStringExtra(ACTIVITY_MANAGER_FRAGMENT)),
                    getFragmentTag());
        } else if (getDefaultFragment() != null) {
            performInitialTransaction(getFragment(getDefaultFragment().getCanonicalName()), null);
        }
    }
}

From source file:com.freshdigitable.udonroad.UserInfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }//from ww w.jav a 2s  . c om
    binding = DataBindingUtil.setContentView(this, R.layout.activity_user_info);
    InjectionUtil.getComponent(this).inject(this);

    binding.userInfoIffab.hide();

    long userId = parseIntent();
    setUpAppbar();
    setUpUserInfoView(userId);

    viewPager = UserInfoPagerFragment.create(userId);
    getSupportFragmentManager().beginTransaction().add(binding.userInfoTimelineContainer.getId(), viewPager)
            .commit();
}

From source file:com.kyleszombathy.sms_scheduler.Home.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "Activity View Created");

    // Setting up transitions
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setExitTransition(new Fade());

    setContentView(R.layout.activity_home);

    Toolbar toolbar = (Toolbar) findViewById(R.id.SMSScheduler_Toolbar);
    setActionBar(toolbar);/*from   w  ww.j  av a  2 s.co  m*/

    populateDatasets();
    setUpRecyclerView();

    LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
            new IntentFilter("custom-event-name"));

    parentView = findViewById(R.id.Home_coordLayout);

    prefs = getSharedPreferences("com.kyleszombathy.sms_scheduler", MODE_PRIVATE);

    // Floating action button start activity
    findViewById(R.id.Home_fab).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Random alarm number
            int alarmNumber = getRandomInt(MIN_INT, MAX_INT);

            Intent intent = new Intent(new Intent(Home.this, AddMessage.class));
            Bundle extras = new Bundle();
            extras.putInt(ALARM_EXTRA, alarmNumber);
            extras.putBoolean(EDIT_MESSAGE_EXTRA, false);
            intent.putExtras(extras);

            TaskStackBuilder stackBuilder = TaskStackBuilder.create(Home.this);
            stackBuilder.addParentStack(AddMessage.class);
            stackBuilder.addNextIntent(intent);
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
                    PendingIntent.FLAG_UPDATE_CURRENT);

            Log.d(TAG, "Starting Activity AddMessage");

            startActivityForResult(intent, NEW_MESSAGE,
                    ActivityOptions.makeSceneTransitionAnimation(Home.this).toBundle());
        }
    });
}

From source file:com.freshdigitable.udonroad.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    InjectionUtil.getComponent(this).inject(this);
    if (!twitterApi.loadAccessToken()) {
        startActivity(new Intent(this, OAuthActivity.class));
        finish();/*from w w  w  . j a  va  2  s  . com*/
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    binding.navDrawer.setNavigationItemSelectedListener(new OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            int itemId = item.getItemId();
            if (itemId == R.id.menu_home) {
                Log.d(TAG, "home is selected");
                binding.navDrawerLayout.closeDrawer(binding.navDrawer);
            } else if (itemId == R.id.menu_mention) {
                Log.d(TAG, "mention is selected");
                binding.navDrawerLayout.closeDrawer(binding.navDrawer);
            } else if (itemId == R.id.menu_fav) {
                Log.d(TAG, "fav is selected");
                binding.navDrawerLayout.closeDrawer(binding.navDrawer);
            } else if (itemId == R.id.menu_license) {
                startActivity(new Intent(getApplicationContext(), LicenseActivity.class));
                binding.navDrawerLayout.closeDrawer(binding.navDrawer);
            }
            return false;
        }
    });

    binding.ffab.hide();
    setupHomeTimeline();
    setupTweetInputView();
}

From source file:org.xbmc.kore.ui.BaseMediaActivity.java

@Override
@TargetApi(21)/*w  w w.j a  v a  2  s .  c om*/
protected void onCreate(Bundle savedInstanceState) {
    // Request transitions on lollipop
    if (Utils.isLollipopOrLater()) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_generic_media);
    ButterKnife.inject(this);

    // Set up the drawer.
    navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);
    navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

    Toolbar toolbar = (Toolbar) findViewById(R.id.default_toolbar);
    setSupportActionBar(toolbar);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        String actionBarTitle;
        boolean naviconIsArrow = false;
        if (savedInstanceState != null) {
            actionBarTitle = savedInstanceState.getString(ACTIONBAR_TITLE);
            naviconIsArrow = savedInstanceState.getBoolean(NAVICON_ISARROW);
        } else {
            actionBarTitle = getActionBarTitle();
        }

        actionBar.setDisplayHomeAsUpEnabled(true);
        updateActionBar(actionBarTitle, naviconIsArrow);
    }

    String fragmentTitle = getActionBarTitle();
    Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
    if (fragment == null) {
        fragment = createFragment();

        if (Utils.isLollipopOrLater()) {
            fragment.setExitTransition(null);
            fragment.setReenterTransition(
                    TransitionInflater.from(this).inflateTransition(android.R.transition.fade));
        }

        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment, fragmentTitle)
                .commit();
    }

    if (Utils.isLollipopOrLater()) {
        sharedElementTransition.setupExitTransition(this, fragment);
    }

    hostManager = HostManager.getInstance(this);
}

From source file:com.kyleszombathy.sms_scheduler.AddMessage.java

/**Set the animation from Home*/
private void setWindowTransitionAnimation() {
    getWindow().setAllowEnterTransitionOverlap(true);
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setEnterTransition(new Fade());
}