I have some animation transitions for my activities. So when an activity starts, it comes up with some fade animations. Here is the code:
Intent intent = new Intent(this, NextActivity.class);
startActivity(intent);
overridePendingTransition (android.R.anim.fade_in, android.R.anim.fade_out);
The Problem is that, these animations will not run when "Transition Animation Scale" in "Developer Options" is off. So I'm searching for a way to enable this feature programmatically to ensure that my animations shown. Is There a way to set "Transition Animation Scale" to "Animation scale 1x"?
Three of the most useful settings under the Developer Settings section are the animation scale settings. These can let you increase or decrease the duration of window and transition animations, and in some cases, will make your phone appear to perform faster.
The Android operating system often uses animations when you interact with your device. For instance, it might shrink apps into the background when you close them. If you are sensitive to these visual effects, you can use the Remove animations setting to turn them off.
Disabling the animations would give you at least this advantage: you'll save some work of your CPU (or even the GPU) that will not have to do this task (of animating things on the screen) anymore.
After a few days searching I have found the code which can enable (or disable) "Transition Animation Scale".
Settings.Global.putInt(getContentResolver(), Global.TRANSITION_ANIMATION_SCALE, 1);
But there is a big problem with this code And if you ask whats the problem? I would tell this line of code needs this permission:
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
which is only granted to the system Apps. So your app must be a system app.
This question is about making a system application : How to make my application system
UPDATE
and as @TripeHound said, we can
Display a dialog telling the user that the app will look much nicer if they turn this option on (with an option to not display the message again if they really want it off)
How to open developer options settings?
This way:
startActivityForResult(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS), 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With