mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #6310 from mahdihijazi/fix_animation
Android: Fix settings screen animation if Animator Duration Scale is Off
This commit is contained in:
commit
c3dc8bf1c0
@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@ -106,11 +107,14 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
|
||||
if (addToStack)
|
||||
{
|
||||
transaction.setCustomAnimations(
|
||||
R.animator.settings_enter,
|
||||
R.animator.settings_exit,
|
||||
R.animator.settings_pop_enter,
|
||||
R.animator.setttings_pop_exit);
|
||||
if (areSystemAnimationsEnabled())
|
||||
{
|
||||
transaction.setCustomAnimations(
|
||||
R.animator.settings_enter,
|
||||
R.animator.settings_exit,
|
||||
R.animator.settings_pop_enter,
|
||||
R.animator.setttings_pop_exit);
|
||||
}
|
||||
|
||||
transaction.addToBackStack(null);
|
||||
mPresenter.addToStack();
|
||||
@ -120,6 +124,17 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
private boolean areSystemAnimationsEnabled()
|
||||
{
|
||||
float duration = Settings.Global.getFloat(
|
||||
getContentResolver(),
|
||||
Settings.Global.ANIMATOR_DURATION_SCALE, 1);
|
||||
float transition = Settings.Global.getFloat(
|
||||
getContentResolver(),
|
||||
Settings.Global.TRANSITION_ANIMATION_SCALE, 1);
|
||||
return duration != 0 && transition != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDirectoryInitializationService(DirectoryStateReceiver receiver, IntentFilter filter)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user