Add disable lockscreen option

This commit is contained in:
Christopher Eby 2011-10-13 17:43:56 -05:00
parent 7f47b29073
commit d9d47e276f
3 changed files with 15 additions and 0 deletions

View File

@ -158,6 +158,8 @@ THE SOFTWARE.
<string name="default_action_summary">What to do when an item is tapped</string>
<string name="pref_misc">Miscellaneous Features</string>
<string name="disable_lockscreen_title">Disable Lockscreen</string>
<string name="disable_lockscreen_summary">Do not show the lockscreen with the library screen or playback screen open.</string>
<string name="use_idle_timeout_title">Enable Idle Timeout</string>
<string name="use_idle_timeout_summary">When active, playback will be stopped after the given period of inactivity</string>
<string name="idle_timeout_title">Idle Timeout</string>

View File

@ -132,6 +132,11 @@ THE SOFTWARE.
android:defaultValue="0" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_misc">
<CheckBoxPreference
android:key="disable_lockscreen"
android:title="@string/disable_lockscreen_title"
android:summary="@string/disable_lockscreen_summary"
android:defaultValue="false" />
<CheckBoxPreference
android:key="use_idle_timeout"
android:title="@string/use_idle_timeout_title"

View File

@ -36,6 +36,8 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.Toast;
@ -113,6 +115,12 @@ public class PlaybackActivity extends Activity
mDownAction = Integer.parseInt(prefs.getString("swipe_down_action", "0"));
mCoverPressAction = Integer.parseInt(prefs.getString("cover_press_action", "12"));
mCoverLongPressAction = Integer.parseInt(prefs.getString("cover_longpress_action", "2"));
Window window = getWindow();
if (prefs.getBoolean("disable_lockscreen", false))
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
else
window.clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
}
@Override