Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android drag and return to previous activity like Facebook and Google Photos

I have been finding a way to implement animation like Facebook and Google Photos. When in 2nd Activity, when dragging images the images follow and the 2nd Activity started to fade out and we see 1st Activity. Images of what I was trying to ask is here. enter image description here

like image 566
Songpol LoveThailand Avatar asked Oct 05 '15 04:10

Songpol LoveThailand


People also ask

How do I go back to previous activity on android?

Android activities are stored in the activity stack. Going back to a previous activity could mean two things. You opened the new activity from another activity with startActivityForResult. In that case you can just call the finishActivity() function from your code and it'll take you back to the previous activity.

Does Android have drag and drop?

The Android drag and drop framework enables you to add interactive drag and drop capabilities to your app. With drag and drop, users can copy or move text, images, objects—any content that can be represented by a URI—from one View to another within an app or, in multi-window mode, between apps.


1 Answers

I have found some code from Nick Butcher sample code.

ElasticDragDismissFrameLayout.java

and when using it:

chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) {
        @Override
        public void onDragDismissed() {
            finishAfterTransition();
        }
    };
like image 192
Songpol LoveThailand Avatar answered Sep 27 '22 18:09

Songpol LoveThailand