Permalink
Browse files

MediaScanner behavior on boot [3/3]

PS2: fixup strings

Change-Id: I6e0af70894207e281e4e3838411928b077fc26a7
  • Loading branch information...
corcoran authored and akhilnarang committed Nov 20, 2015
1 parent 23a542c commit 5f1dcb714164a8c5a39bda3c03a792d4f7572cb8
View
@@ -584,5 +584,18 @@ limitations under the License.
<item>2</item>
</string-array>
<!-- MediaScanner behavior on boot -->
<string-array name="media_scanner_on_boot_entries">
<item>@string/media_scanner_on_boot_enabled</item>
<item>@string/media_scanner_on_boot_ask</item>
<item>@string/media_scanner_on_boot_disabled</item>
</string-array>
<string-array name="media_scanner_on_boot_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>
View
@@ -738,4 +738,10 @@
<string name="dnd_when_call_title">In-call do not disturb</string>
<string name="dnd_when_call_summary">Auto enable DND during calls</string>
<!-- MediaScanner behavior on boot -->
<string name="media_scanner_on_boot_title">MediaScanner behavior on boot</string>
<string name="media_scanner_on_boot_enabled">Scan media</string>
<string name="media_scanner_on_boot_ask">Ask to scan (notification)</string>
<string name="media_scanner_on_boot_disabled">Do not scan media</string>
</resources>
View
@@ -25,6 +25,13 @@
android:key="aosip_settings_summary"
android:title="@string/owlsnest_settings_summary_title" />
<ListPreference
android:key="media_scanner_on_boot"
android:title="@string/media_scanner_on_boot_title"
android:entries="@array/media_scanner_on_boot_entries"
android:entryValues="@array/media_scanner_on_boot_values"
android:persistent="false" />
<ListPreference
android:key="screenrecord_chord_type"
android:title="@string/screen_record_chord_title"
@@ -41,11 +41,13 @@
private static final String SCREENSHOT_DELAY = "screenshot_delay";
private static final String SCREENRECORD_CHORD_TYPE = "screenrecord_chord_type";
private static final String PREF_AOSIP_SETTINGS_SUMMARY = "aosip_settings_summary";
private static final String PREF_MEDIA_SCANNER_ON_BOOT = "media_scanner_on_boot";
private ListPreference mMsob;
private ListPreference mScreenrecordChordType;
private Preference mCustomSummary;
private String mCustomSummaryText;
private CustomSeekBarPreference mScreenshotDelay;
private ListPreference mScreenrecordChordType;
@Override
protected int getMetricsCategory() {
@@ -60,6 +62,12 @@ public void onCreate(Bundle savedInstanceState) {
final ContentResolver resolver = getActivity().getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
mMsob = (ListPreference) findPreference(PREF_MEDIA_SCANNER_ON_BOOT);
mMsob.setValue(String.valueOf(Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.MEDIA_SCANNER_ON_BOOT, 0)));
mMsob.setSummary(mMsob.getEntry());
mMsob.setOnPreferenceChangeListener(this);
mScreenshotDelay = (CustomSeekBarPreference) findPreference(SCREENSHOT_DELAY);
int screenshotDelay = Settings.System.getInt(resolver,
Settings.System.SCREENSHOT_DELAY, 1000);
@@ -89,6 +97,14 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
handleActionListChange(mScreenrecordChordType, newValue,
Settings.System.SCREENRECORD_CHORD_TYPE);
return true;
} else if (preference == mMsob) {
Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.MEDIA_SCANNER_ON_BOOT,
Integer.valueOf(String.valueOf(newValue)));
mMsob.setValue(String.valueOf(newValue));
mMsob.setSummary(mMsob.getEntry());
return true;
}
return false;
}

0 comments on commit 5f1dcb7

Please sign in to comment.