Skip to content

Commit

Permalink
Add option to enable/disable the ICS rotation animation
Browse files Browse the repository at this point in the history
Usefull for people who's devices are to slow, or for them
who simply not like the animation as to ICS-ish

Requires a reboot of the device.

Change-Id: I58db6dde05b72edc744e48cc3db444da0a0e2146
  • Loading branch information
ErwinP authored and kasperhettinga committed Mar 3, 2012
1 parent 0d377fb commit 72b2401
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions res/values-de/strings.xml
Expand Up @@ -37,6 +37,8 @@

<string name="pref_electron_beam_animation_on">Einschalten animieren</string>
<string name="pref_electron_beam_animation_off">Ausschalten animieren</string>
<string name="pref_rotation_animation_title">Drehungs-Animation</string>
<string name="pref_rotation_animation_summary">Drehung des Bildschirminhaltes bei Drehung des Gerätes animieren (benötigt Neustart)</string>

<!-- User interface: Tablet tweaks -->
<string name="tablet_tweaks_title_head">Tablet-Einstellungen</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-es/strings.xml
Expand Up @@ -37,6 +37,8 @@

<string name="pref_electron_beam_animation_on">Animación al encender pantalla</string>
<string name="pref_electron_beam_animation_off">Animación al apagar pantalla</string>
<string name="pref_rotation_animation_title">Animación para rotación</string>
<string name="pref_rotation_animation_summary">Animación para las rotaciones de la pantalla (requiere reiniciar)</string>

<!-- User interface: Tablet tweaks -->
<string name="tablet_tweaks_title_head">Ajustes Tablet</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-ja/strings.xml
Expand Up @@ -37,6 +37,8 @@

<string name="pref_electron_beam_animation_on">スクリーンオンアニメ</string>
<string name="pref_electron_beam_animation_off">スクリーンオフアニメ</string>
<string name="pref_rotation_animation_title">回転アニメ</string>
<string name="pref_rotation_animation_summary">再起動が必要</string>

<!-- User interface: Tablet tweaks -->
<string name="tablet_tweaks_title_head">タブレット調整</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-nl/strings.xml
Expand Up @@ -37,6 +37,8 @@

<string name="pref_electron_beam_animation_on">Animatie bij aanzetten scherm</string>
<string name="pref_electron_beam_animation_off">Animatie bij uitschakelen scherm</string>
<string name="pref_rotation_animation_title">Rotatie-animatie</string>
<string name="pref_rotation_animation_summary">Vereist een herstart van het toestel</string>

<!-- User interface: Tablet tweaks -->
<string name="tablet_tweaks_title_head">Tablet-tweaks</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values/strings.xml
Expand Up @@ -38,6 +38,8 @@

<string name="pref_electron_beam_animation_on">Screen-on animation</string>
<string name="pref_electron_beam_animation_off">Screen-off animation</string>
<string name="pref_rotation_animation_title">Rotation animation</string>
<string name="pref_rotation_animation_summary">Requires a reboot</string>

<!-- User interface: Tablet tweaks -->
<string name="tablet_tweaks_title_head">Tablet tweaks</string>
Expand Down
5 changes: 5 additions & 0 deletions res/xml/display_settings.xml
Expand Up @@ -19,6 +19,11 @@
<CheckBoxPreference android:key="electron_beam_animation_off"
android:title="@string/pref_electron_beam_animation_off" />

<!-- Rotation animation -->
<CheckBoxPreference android:key="pref_rotation_animation"
android:title="@string/pref_rotation_animation_title"
android:summary="@string/pref_rotation_animation_summary"/>

</PreferenceCategory>

<!-- Rotation -->
Expand Down
17 changes: 17 additions & 0 deletions src/com/cyanogenmod/cmparts/activities/DisplayActivity.java
Expand Up @@ -30,6 +30,7 @@
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.os.SystemProperties;

public class DisplayActivity extends PreferenceActivity implements OnPreferenceChangeListener {

Expand All @@ -42,9 +43,13 @@ public class DisplayActivity extends PreferenceActivity implements OnPreferenceC

private static final String ELECTRON_BEAM_ANIMATION_OFF = "electron_beam_animation_off";

private static final String ROTATION_ANIMATION_PREF = "pref_rotation_animation";

private PreferenceScreen mBacklightScreen;

/* Other */
private static final String ROTATION_ANIMATION_PROP = "persist.sys.rotationanimation";

private static final String ROTATION_0_PREF = "pref_rotation_0";
private static final String ROTATION_90_PREF = "pref_rotation_90";
private static final String ROTATION_180_PREF = "pref_rotation_180";
Expand All @@ -59,6 +64,8 @@ public class DisplayActivity extends PreferenceActivity implements OnPreferenceC

private CheckBoxPreference mElectronBeamAnimationOff;

private CheckBoxPreference mRotationAnimationPref;

private CheckBoxPreference mRotation0Pref;
private CheckBoxPreference mRotation90Pref;
private CheckBoxPreference mRotation180Pref;
Expand Down Expand Up @@ -101,6 +108,10 @@ public void onCreate(Bundle savedInstanceState) {
.removePreference(mElectronBeamAnimationOff);
}

/* Rotation animation */
mRotationAnimationPref = (CheckBoxPreference) prefSet.findPreference(ROTATION_ANIMATION_PREF);
mRotationAnimationPref.setChecked(SystemProperties.getBoolean(ROTATION_ANIMATION_PROP, true));

/* Rotation */
mRotation0Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_0_PREF);
mRotation90Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_90_PREF);
Expand Down Expand Up @@ -144,6 +155,12 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
Settings.System.ELECTRON_BEAM_ANIMATION_OFF, value ? 1 : 0);
}

if (preference == mRotationAnimationPref) {
SystemProperties.set(ROTATION_ANIMATION_PROP,
mRotationAnimationPref.isChecked() ? "1" : "0");
return true;
}

if (preference == mRotation0Pref ||
preference == mRotation90Pref ||
preference == mRotation180Pref ||
Expand Down

0 comments on commit 72b2401

Please sign in to comment.