Android: Fix settings screen animation if Animator Duration Scale is Off
If Animator Duration Scale is Off, the Enhancements/Hacks screens were not visible unless you enable the Animator Duration Scale back. This make sure screens will be visible regardless of your animation settings.
This commit is contained in:
parent
55584bf456
commit
53f2fcb571
|
@ -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;
|
||||
|
@ -105,12 +106,15 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
|||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
|
||||
if (addToStack)
|
||||
{
|
||||
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