add new preference to keep the screen on when the board's visible (per

request).  Off by default, of course.
This commit is contained in:
Andy2 2011-07-06 18:50:11 -07:00
parent b233136df3
commit ebdf4cce87
5 changed files with 22 additions and 0 deletions

View file

@ -45,6 +45,7 @@
<string name="key_notify_sound">key_notify_sound</string>
<string name="key_notify_vibrate">key_notify_vibrate</string>
<string name="key_hide_intro">key_hide_intro</string>
<string name="key_keep_screenon">key_keep_screenon</string>
<string name="key_notagain_sync">key_notagain_sync</string>
<string name="key_notagain_chat">key_notagain_chat</string>

View file

@ -211,6 +211,8 @@
<string name="show_arrow">Show board arrow</string>
<string name="show_arrow_summary">Tapped rack tiles land on this
arrow when it is visible</string>
<string name="keep_screenon">Keep screen on</string>
<string name="keep_screenon_summary">Never dim or lock board screen</string>
<string name="explain_robot">Explain other moves</string>
<string name="explain_robot_summary">Display score summary after
every robot or remote turn</string>

View file

@ -81,6 +81,11 @@
android:summary="@string/show_arrow_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_keep_screenon"
android:title="@string/keep_screenon"
android:summary="@string/keep_screenon_summary"
android:defaultValue="false"
/>
<PreferenceScreen android:title="@string/prefs_colors"
android:summary="@string/prefs_colors_summary"

View file

@ -291,6 +291,7 @@ public class BoardActivity extends XWActivity
m_name = getIntent().getStringExtra( INTENT_KEY_NAME );
setBackgroundColor();
setKeepScreenOn();
} // onCreate
@Override
@ -332,7 +333,9 @@ public class BoardActivity extends XWActivity
if ( null != m_jniThread ) {
m_jniThread.handle( JNIThread.JNICmd.CMD_PREFS_CHANGE );
}
// in case of change...
setBackgroundColor();
setKeepScreenOn();
}
}
}
@ -1286,4 +1289,10 @@ public class BoardActivity extends XWActivity
m_view.getRootView().setBackgroundColor( back );
}
private void setKeepScreenOn()
{
boolean keepOn = CommonPrefs.getKeepScreenOn( this );
m_view.setKeepScreenOn( keepOn );
}
} // class BoardActivity

View file

@ -275,6 +275,11 @@ public class CommonPrefs {
return getPrefsBoolean( context, R.string.key_hide_intro, false );
}
public static boolean getKeepScreenOn( Context context )
{
return getPrefsBoolean( context, R.string.key_keep_screenon, false );
}
public static boolean getPrefsBoolean( Context context, int keyID,
boolean defaultValue )
{