Theme the HMS picker.

// FREEBIE

Closes #2353
This commit is contained in:
Moxie Marlinspike 2015-02-13 15:06:50 -08:00
parent d36d33f837
commit 224b06f05a
3 changed files with 14 additions and 1 deletions

View File

@ -96,4 +96,6 @@
<attr name="pref_ic_appearance" format="reference" /> <attr name="pref_ic_appearance" format="reference" />
<attr name="pref_ic_storage" format="reference" /> <attr name="pref_ic_storage" format="reference" />
<attr name="pref_ic_advanced" format="reference" /> <attr name="pref_ic_advanced" format="reference" />
<attr name="app_protect_timeout_picker_color" format="reference"/>
</resources> </resources>

View File

@ -103,6 +103,8 @@
<item name="pref_ic_appearance">@drawable/ic_brightness_6_black</item> <item name="pref_ic_appearance">@drawable/ic_brightness_6_black</item>
<item name="pref_ic_storage">@drawable/ic_delete_black</item> <item name="pref_ic_storage">@drawable/ic_delete_black</item>
<item name="pref_ic_advanced">@drawable/ic_advanced_black</item> <item name="pref_ic_advanced">@drawable/ic_advanced_black</item>
<item name="app_protect_timeout_picker_color">@style/BetterPickersDialogFragment.Light</item>
</style> </style>
<style name="TextSecure.DarkTheme" parent="@style/Theme.AppCompat"> <style name="TextSecure.DarkTheme" parent="@style/Theme.AppCompat">
@ -200,6 +202,8 @@
<item name="pref_ic_appearance">@drawable/ic_brightness_6_gray</item> <item name="pref_ic_appearance">@drawable/ic_brightness_6_gray</item>
<item name="pref_ic_storage">@drawable/ic_delete_gray</item> <item name="pref_ic_storage">@drawable/ic_delete_gray</item>
<item name="pref_ic_advanced">@drawable/ic_advanced_gray</item> <item name="pref_ic_advanced">@drawable/ic_advanced_gray</item>
<item name="app_protect_timeout_picker_color">@style/BetterPickersDialogFragment</item>
</style> </style>
<style name="TextSecure.Light.Dialog" <style name="TextSecure.Light.Dialog"

View File

@ -4,6 +4,7 @@ import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
@ -91,10 +92,16 @@ public class AppProtectionPreferenceFragment extends PreferenceFragment {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
int[] attributes = {R.attr.app_protect_timeout_picker_color};
TypedArray hmsStyle = getActivity().obtainStyledAttributes(attributes);
new HmsPickerBuilder().setFragmentManager(getFragmentManager()) new HmsPickerBuilder().setFragmentManager(getFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment_Light) .setStyleResId(hmsStyle.getResourceId(0, R.style.BetterPickersDialogFragment_Light))
.addHmsPickerDialogHandler(this) .addHmsPickerDialogHandler(this)
.show(); .show();
hmsStyle.recycle();
return true; return true;
} }