Example usage for android.transition Fade Fade

List of usage examples for android.transition Fade Fade

Introduction

In this page you can find the example usage for android.transition Fade Fade.

Prototype

public Fade() 

Source Link

Document

Constructs a Fade transition that will fade targets in and out.

Usage

From source file:com.example.android.unsplash.DetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_detail);

    postponeEnterTransition();//from  w  w  w  . ja v a 2  s.c o m

    TransitionSet transitions = new TransitionSet();
    Slide slide = new Slide(Gravity.BOTTOM);
    slide.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
    slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
    transitions.addTransition(slide);
    transitions.addTransition(new Fade());
    getWindow().setEnterTransition(transitions);

    Intent intent = getIntent();
    sharedElementCallback = new DetailSharedElementEnterCallback(intent);
    setEnterSharedElementCallback(sharedElementCallback);
    try {
        initialItem = Integer.parseInt(intent.getData().getLastPathSegment());
    } catch (NumberFormatException e) {
        initialItem = 0;
    }
    PhotoService.getInstance().getPhotosAsync(new PhotoService.PhotoCallback() {
        @Override
        public void success(ArrayList<Photo> photos) {
            setUpViewPager(photos);
            findViewById(android.R.id.empty).setVisibility(View.GONE);
        }

        @Override
        public void error() {
            finishAfterTransition();
        }
    });

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(navigationOnClickListener);

    super.onCreate(savedInstanceState);
}

From source file:org.anoopam.main.thakorjitoday.TempleGalleryActivity.java

@Override
public void setAnimations() {
    super.setAnimations();
    getWindow().setEnterTransition(new Fade());
    getWindow().setExitTransition(new Fade());
}

From source file:com.melkir.ourstreets.fragment.DetailFragment.java

/**
 * Create a new instance with details for a given {@link Gallery}.
 *
 * @param context The context this runs in.
 * @param gallery The gallery of which the details should be displayed.
 * @return A newly instantiated fragment.
 *//*from w  w  w.j  av  a  2  s  . c o m*/
public static DetailFragment newInstance(@NonNull Context context, @NonNull Gallery gallery,
        @NonNull CameraPosition cameraPosition) {
    DetailFragment fragment = new DetailFragment();
    Bundle args = new Bundle();
    args.putParcelable(IntentKeys.GALLERY, gallery);
    args.putParcelable(IntentKeys.CAMERA_POSITION, cameraPosition);
    fragment.setArguments(args);
    final TransitionInflater inflater = TransitionInflater.from(context);
    fragment.setSharedElementEnterTransition(inflater.inflateTransition(R.transition.detail_shared_enter));
    fragment.setEnterTransition(new Fade());
    return fragment;
}

From source file:com.melkir.ourstreets.fragment.GalleryFragment.java

public GalleryFragment() {

    final Fade fade = new Fade();
    fade.addTarget(R.id.appbar);/*from   ww w .j av  a  2s .  co  m*/

    Explode explode = new Explode();
    explode.excludeTarget(R.id.appbar, true);

    Elevation elevation = new Elevation();
    elevation.addTarget(R.id.gallery_card);
    elevation.setStartDelay(250); // arbitrarily chosen delay

    TransitionSet exit = new TransitionSet();
    exit.addTransition(fade);
    exit.addTransition(explode);
    exit.addTransition(elevation);

    setExitTransition(exit);
}

From source file:net.mm2d.dmsexplorer.ServerDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.frg_server_detail, container, false);
    final String udn = getArguments().getString(Const.EXTRA_UDN);
    final DataHolder dataHolder = DataHolder.getInstance();
    final MediaServer server = dataHolder.getMsControlPoint().getMediaServer(udn);
    if (server == null) {
        getActivity().finish();//  w  ww .j a  v a2  s  .  c om
        return rootView;
    }
    final TextView titleView = (TextView) rootView.findViewById(R.id.title);
    if (titleView != null) {
        titleView.setText(server.getFriendlyName());
        titleView.setBackgroundColor(ThemeUtils.getAccentColor(server.getFriendlyName()));
    }
    final RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.server_detail);
    final PropertyAdapter adapter = new PropertyAdapter(getContext());
    setupPropertyAdapter(adapter, server);
    adapter.setOnItemLinkClickListener(this);
    recyclerView.setAdapter(adapter);

    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    if (fab == null) {
        fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    }
    if (fab != null) {
        fab.setOnClickListener(view -> {
            final Intent intent = CdsListActivity.makeIntent(getContext(), udn);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                final TransitionSet ts = new TransitionSet();
                ts.addTransition(new Slide(Gravity.START));
                ts.addTransition(new Fade());
                getActivity().getWindow().setExitTransition(ts);
                startActivity(intent,
                        ActivityOptions.makeSceneTransitionAnimation(getActivity(), view, "share").toBundle());
            } else {
                startActivity(intent);
            }
        });
    }
    return rootView;
}

From source file:com.tutosandroidfrance.designsupporttest.MainActivity.java

private void setupWindowAnimations() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        Explode explode = new Explode();
        getWindow().setExitTransition(explode);

        Fade fade = new Fade();
        getWindow().setReenterTransition(fade);
    }/*from   w w w. j  a v a 2  s.  c om*/
}

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);/*w ww .  j  ava2  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.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());
}

From source file:net.mm2d.dmsexplorer.CdsListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        final TransitionSet ts = new TransitionSet();
        ts.addTransition(new Slide(Gravity.END));
        ts.addTransition(new Fade());
        getWindow().setEnterTransition(ts);
    }/*from  w w w  .jav a 2s. co m*/
    mHandler = new Handler();
    final String udn = getIntent().getStringExtra(Const.EXTRA_UDN);
    mServer = mDataHolder.getMsControlPoint().getMediaServer(udn);
    if (mServer == null) {
        finish();
        return;
    }
    final String name = mServer.getFriendlyName();
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(ThemeUtils.getAccentDarkColor(name));
    }
    setContentView(R.layout.act_cds_list);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setBackgroundColor(ThemeUtils.getAccentColor(name));
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(name);

    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh);
    mSwipeRefreshLayout.setColorSchemeResources(R.color.progress1, R.color.progress2, R.color.progress3,
            R.color.progress4);
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        mDataHolder.popCache();
        reload();
    });
    mCdsListAdapter = new CdsListAdapter(this);
    mCdsListAdapter.setOnItemClickListener(this::onCdsItemClick);
    mRecyclerView = (RecyclerView) findViewById(R.id.cds_list);
    mRecyclerView.setAdapter(mCdsListAdapter);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this));

    if (findViewById(R.id.cds_detail_container) != null) {
        mTwoPane = true;
    }
    if (savedInstanceState == null) {
        browse(0, "0", "", true);
    }
}

From source file:org.sufficientlysecure.keychain.ui.ViewKeyFragment.java

private void showLinkedId(final int position) {
    final LinkedIdViewFragment frag;
    try {//from  w  w  w.j  av a 2s .c om
        frag = mLinkedIdsAdapter.getLinkedIdFragment(mDataUri, position, mFingerprint);
    } catch (IOException e) {
        Log.e(Constants.TAG, "IOException", e);
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Transition trans = TransitionInflater.from(getActivity())
                .inflateTransition(R.transition.linked_id_card_trans);
        // setSharedElementReturnTransition(trans);
        setExitTransition(new Fade());
        frag.setSharedElementEnterTransition(trans);
    }

    getFragmentManager().beginTransaction().add(R.id.view_key_fragment, frag).hide(frag).commit();

    frag.setOnIdentityLoadedListener(new OnIdentityLoadedListener() {
        @Override
        public void onIdentityLoaded() {
            new Handler().post(new Runnable() {
                @Override
                public void run() {
                    getFragmentManager().beginTransaction().show(frag)
                            .addSharedElement(mLinkedIdsCard, "card_linked_ids").remove(ViewKeyFragment.this)
                            .addToBackStack("linked_id").commit();
                }
            });
        }
    });

}