Animations for activity transitions
This commit is contained in:
parent
98f0daceaa
commit
1896fa6151
@ -13,6 +13,8 @@ import android.view.MenuInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import acr.browser.lightning.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||||
* to be used with AppCompat.
|
* to be used with AppCompat.
|
||||||
@ -26,6 +28,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
overridePendingTransition(R.anim.slide_in_from_right, R.anim.fade_out_scale);
|
||||||
getDelegate().installViewFactory();
|
getDelegate().installViewFactory();
|
||||||
getDelegate().onCreate(savedInstanceState);
|
getDelegate().onCreate(savedInstanceState);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -89,6 +92,14 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||||||
getDelegate().onConfigurationChanged(newConfig);
|
getDelegate().onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (isFinishing()) {
|
||||||
|
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_out_to_right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
@ -782,6 +782,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
return true;
|
return true;
|
||||||
case R.id.action_incognito:
|
case R.id.action_incognito:
|
||||||
startActivity(new Intent(this, IncognitoActivity.class));
|
startActivity(new Intent(this, IncognitoActivity.class));
|
||||||
|
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_share:
|
case R.id.action_share:
|
||||||
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) {
|
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) {
|
||||||
@ -1444,6 +1445,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if (isIncognito() && isFinishing()) {
|
||||||
|
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_down_out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveOpenTabs() {
|
void saveOpenTabs() {
|
||||||
|
16
app/src/main/res/anim/fade_in_scale.xml
Normal file
16
app/src/main/res/anim/fade_in_scale.xml
Normal 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>
|
16
app/src/main/res/anim/fade_out_scale.xml
Normal file
16
app/src/main/res/anim/fade_out_scale.xml
Normal 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>
|
12
app/src/main/res/anim/slide_down_out.xml
Normal file
12
app/src/main/res/anim/slide_down_out.xml
Normal 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>
|
12
app/src/main/res/anim/slide_in_from_right.xml
Normal file
12
app/src/main/res/anim/slide_in_from_right.xml
Normal 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>
|
12
app/src/main/res/anim/slide_out_to_right.xml
Normal file
12
app/src/main/res/anim/slide_out_to_right.xml
Normal 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>
|
12
app/src/main/res/anim/slide_up_in.xml
Normal file
12
app/src/main/res/anim/slide_up_in.xml
Normal 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>
|
Loading…
x
Reference in New Issue
Block a user