Animations for activity transitions

This commit is contained in:
Anthony Restaino 2015-08-27 22:44:22 -04:00
parent 98f0daceaa
commit 1896fa6151
8 changed files with 95 additions and 0 deletions

View File

@ -13,6 +13,8 @@ import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import acr.browser.lightning.R;
/**
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
* to be used with AppCompat.
@ -26,6 +28,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
overridePendingTransition(R.anim.slide_in_from_right, R.anim.fade_out_scale);
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
@ -89,6 +92,14 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
getDelegate().onConfigurationChanged(newConfig);
}
@Override
protected void onPause() {
super.onPause();
if (isFinishing()) {
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_out_to_right);
}
}
@Override
protected void onStop() {
super.onStop();

View File

@ -782,6 +782,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
return true;
case R.id.action_incognito:
startActivity(new Intent(this, IncognitoActivity.class));
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale);
return true;
case R.id.action_share:
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) {
@ -1444,6 +1445,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
if (isIncognito() && isFinishing()) {
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_down_out);
}
}
void saveOpenTabs() {

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="@android:integer/config_mediumAnimTime"
android:fromXScale="0.85"
android:fromYScale="0.85"
android:interpolator="@android:interpolator/decelerate_cubic"
android:pivotX="50%p"
android:pivotY="50%p"
android:toXScale="1.0"
android:toYScale="1.0" />
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="@android:integer/config_mediumAnimTime"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:interpolator/decelerate_cubic"
android:pivotX="50%p"
android:pivotY="50%p"
android:toXScale="0.85"
android:toYScale="0.85" />
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0%p"
android:interpolator="@android:interpolator/accelerate_cubic"
android:toYDelta="100%p" />
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="100%p"
android:interpolator="@android:interpolator/decelerate_cubic"
android:toXDelta="0%p" />
<!--<alpha-->
<!--android:duration="@android:integer/config_mediumAnimTime"-->
<!--android:fromAlpha="0.0"-->
<!--android:toAlpha="1.0" />-->
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0%p"
android:interpolator="@android:interpolator/decelerate_cubic"
android:toXDelta="100%p" />
<!--<alpha-->
<!--android:duration="@android:integer/config_mediumAnimTime"-->
<!--android:fromAlpha="0.0"-->
<!--android:toAlpha="1.0" />-->
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%p"
android:interpolator="@android:interpolator/decelerate_cubic"
android:toYDelta="0%p" />
<!--<alpha-->
<!--android:duration="@android:integer/config_mediumAnimTime"-->
<!--android:fromAlpha="0.5"-->
<!--android:toAlpha="1.0" />-->
</set>