Skip to content
This repository was archived by the owner on Jun 8, 2024. It is now read-only.

Commit 2af3992

Browse files
committed
SearchActivity: Exit animation
Signed-off-by: Fung <fython@163.com>
1 parent 46e655a commit 2af3992

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536m
22
BUILD_TOOLS_VERSION=26.0.0
3-
VERSION_NAME=2.6.0
3+
VERSION_NAME=2.6.1
44
TARGET_SDK_VERSION=26
5-
VERSION_CODE=35
6-
MIN_SDK_VERSION=19
5+
VERSION_CODE=36
6+
MIN_SDK_VERSION=21

mobile/src/main/java/info/papdt/express/helper/ui/SearchActivity.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import android.support.v7.app.ActionBar;
1515
import android.support.v7.app.AppCompatActivity;
1616
import android.support.v7.widget.AppCompatEditText;
17-
import android.support.v7.widget.DrawableUtils;
1817
import android.support.v7.widget.LinearLayoutManager;
1918
import android.support.v7.widget.RecyclerView;
2019
import android.text.Editable;
@@ -183,6 +182,30 @@ private void circularRevealActivity() {
183182
circularReveal.start();
184183
}
185184

185+
@Override
186+
public void onBackPressed() {
187+
Intent intent = getIntent();
188+
189+
int cx = intent.getIntExtra(EXTRA_CX, rootLayout.getWidth() / 2);
190+
int cy = intent.getIntExtra(EXTRA_CY, rootLayout.getHeight() / 2);
191+
192+
float finalRadius = Math.max(rootLayout.getWidth(), rootLayout.getHeight());
193+
Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, finalRadius, 0);
194+
195+
circularReveal.addListener(new Animator.AnimatorListener() {
196+
@Override public void onAnimationStart(Animator animator) {}
197+
@Override public void onAnimationCancel(Animator animator) {}
198+
@Override public void onAnimationRepeat(Animator animator) {}
199+
@Override
200+
public void onAnimationEnd(Animator animator) {
201+
rootLayout.setVisibility(View.INVISIBLE);
202+
finish();
203+
}
204+
});
205+
circularReveal.setDuration(400);
206+
circularReveal.start();
207+
}
208+
186209
private synchronized ArrayList<SearchResultAdapter.ItemType> buildItems() {
187210
ArrayList<SearchResultAdapter.ItemType> items = new ArrayList<>();
188211
items.add(new SearchResultAdapter.ItemType(SearchResultAdapter.ItemType.TYPE_SUBHEADER));

0 commit comments

Comments
 (0)