Added Always setting (from 28a958535a69e1f2a8131582b54db807cd63ab95)
This commit is contained in:
parent
9ca1dbd9cf
commit
b202b7ac6d
4 changed files with 19 additions and 8 deletions
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="shared_string_always">Always</string>
|
||||
<string name="unsupported_type_error">Unsupported type</string>
|
||||
<string name="index_item_world_basemap_detailed">World overview map (detailed)</string>
|
||||
<string name="profiles_for_action_not_found">Could not find any such profiles.</string>
|
||||
|
|
|
@ -1968,7 +1968,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
}
|
||||
|
||||
public void changeKeyguardFlags() {
|
||||
boolean enabled = settings.TURN_SCREEN_ON_ENABLED.get() && settings.TURN_SCREEN_ON_TIME_INT.get() > 0;
|
||||
boolean turnScreenOnEnabled = settings.TURN_SCREEN_ON_ENABLED.get() && getRoutingHelper().isFollowingMode();
|
||||
int turnScreenOnTime = settings.TURN_SCREEN_ON_TIME_INT.get();
|
||||
boolean enabled = turnScreenOnEnabled && (turnScreenOnTime > 0 || turnScreenOnTime == -1);
|
||||
boolean keepScreenOn = !settings.USE_SYSTEM_SCREEN_TIMEOUT.get();
|
||||
changeKeyguardFlags(enabled, keepScreenOn);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,8 @@ public class LockHelper implements SensorEventListener {
|
|||
|
||||
private void lock() {
|
||||
releaseWakeLocks();
|
||||
if (lockUIAdapter != null && isFollowingMode()) {
|
||||
int unlockTime = turnScreenOnTime.get();
|
||||
if (lockUIAdapter != null && isFollowingMode() && unlockTime != -1) {
|
||||
lockUIAdapter.lock();
|
||||
}
|
||||
}
|
||||
|
@ -125,13 +126,19 @@ public class LockHelper implements SensorEventListener {
|
|||
}
|
||||
});
|
||||
}
|
||||
uiHandler.postDelayed(lockRunnable, millis);
|
||||
if (millis > 0) {
|
||||
uiHandler.postDelayed(lockRunnable, millis);
|
||||
}
|
||||
}
|
||||
|
||||
private void unlockEvent() {
|
||||
int unlockTime = turnScreenOnTime.get();
|
||||
if (unlockTime > 0 && turnScreenOnEnabled.get()) {
|
||||
timedUnlock(unlockTime * 1000L);
|
||||
if (turnScreenOnEnabled.get()) {
|
||||
if (unlockTime > 0) {
|
||||
timedUnlock(unlockTime * 1000L);
|
||||
} else if (unlockTime == -1) {
|
||||
timedUnlock(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,12 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
private void setupTurnScreenOnTimePref() {
|
||||
Integer[] entryValues = new Integer[] {0, 5, 10, 15, 20, 30, 45, 60};
|
||||
Integer[] entryValues = new Integer[] {-1, 0, 5, 10, 15, 20, 30, 45, 60};
|
||||
String[] entries = new String[entryValues.length];
|
||||
|
||||
entries[0] = getString(R.string.shared_string_never);
|
||||
for (int i = 1; i < entryValues.length; i++) {
|
||||
entries[0] = getString(R.string.shared_string_always);
|
||||
entries[1] = getString(R.string.shared_string_never);
|
||||
for (int i = 2; i < entryValues.length; i++) {
|
||||
entries[i] = entryValues[i] + " " + getString(R.string.int_seconds);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue