mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 12:28:53 +01:00
Added preferences for auto-delete feature
This commit is contained in:
@@ -43,6 +43,10 @@ public enum QKPreference {
|
|||||||
DELIVERY_TOAST("pref_key_delivery_toast", true),
|
DELIVERY_TOAST("pref_key_delivery_toast", true),
|
||||||
DELIVERY_VIBRATE("pref_key_delivery_vibrate", true),
|
DELIVERY_VIBRATE("pref_key_delivery_vibrate", true),
|
||||||
|
|
||||||
|
DELETE_OLD_MESSAGES("pref_key_delete_old_messages", false),
|
||||||
|
DELETE_UNREAD_MESSAGES("pref_key_delete_old_unread_messages", "7"), // This type of preference only accepts strings
|
||||||
|
DELETE_READ_MESSAGES("pref_key_delete_old_read_messages", "7"),
|
||||||
|
|
||||||
AUTO_EMOJI("pref_key_auto_emoji", false),
|
AUTO_EMOJI("pref_key_auto_emoji", false),
|
||||||
TEXT_FORMATTING("pref_key_markdown_enabled", false),
|
TEXT_FORMATTING("pref_key_markdown_enabled", false),
|
||||||
STRIP_UNICODE("pref_key_strip_unicode", false),
|
STRIP_UNICODE("pref_key_strip_unicode", false),
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
|||||||
public static final String DELIVERY_REPORTS = "pref_key_delivery";
|
public static final String DELIVERY_REPORTS = "pref_key_delivery";
|
||||||
public static final String DELIVERY_TOAST = "pref_key_delivery_toast";
|
public static final String DELIVERY_TOAST = "pref_key_delivery_toast";
|
||||||
public static final String DELIVERY_VIBRATE = "pref_key_delivery_vibrate";
|
public static final String DELIVERY_VIBRATE = "pref_key_delivery_vibrate";
|
||||||
|
public static final String DELETE_UNREAD_MESSAGES = "pref_key_delete_old_unread_messages";
|
||||||
|
public static final String DELETE_READ_MESSAGES = "pref_key_delete_old_read_messages";
|
||||||
public static final String YAPPY = "pref_key_endlessjabber";
|
public static final String YAPPY = "pref_key_endlessjabber";
|
||||||
public static final String BLOCKED_ENABLED = "pref_key_blocked_enabled";
|
public static final String BLOCKED_ENABLED = "pref_key_blocked_enabled";
|
||||||
public static final String BLOCKED_SENDERS = "pref_key_blocked_senders";
|
public static final String BLOCKED_SENDERS = "pref_key_blocked_senders";
|
||||||
@@ -284,6 +286,16 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
|||||||
font_weight.setSummary(mFontWeights[i == 2 ? 0 : 1]);
|
font_weight.setSummary(mFontWeights[i == 2 ? 0 : 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditTextPreference deleteUnread = (EditTextPreference) findPreference(DELETE_UNREAD_MESSAGES);
|
||||||
|
if (deleteUnread != null) {
|
||||||
|
deleteUnread.setSummary(mContext.getString(R.string.pref_delete_old_messages_unread_summary, mContext.getString(QKPreference.DELETE_UNREAD_MESSAGES)));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditTextPreference deleteRead = (EditTextPreference) findPreference(DELETE_READ_MESSAGES);
|
||||||
|
if (deleteRead != null) {
|
||||||
|
deleteRead.setSummary(mContext.getString(R.string.pref_delete_old_messages_read_summary, mContext.getString(QKPreference.DELETE_READ_MESSAGES)));
|
||||||
|
}
|
||||||
|
|
||||||
Preference day_start = findPreference(DAY_START);
|
Preference day_start = findPreference(DAY_START);
|
||||||
if (day_start != null) {
|
if (day_start != null) {
|
||||||
day_start.setSummary(DateFormatter.getSummaryTimestamp(mContext, mPrefs.getString(DAY_START, "6:00")));
|
day_start.setSummary(DateFormatter.getSummaryTimestamp(mContext, mPrefs.getString(DAY_START, "6:00")));
|
||||||
@@ -440,6 +452,12 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
|||||||
case NIGHT_START:
|
case NIGHT_START:
|
||||||
updateAlarmManager(mContext, true);
|
updateAlarmManager(mContext, true);
|
||||||
break;
|
break;
|
||||||
|
case DELETE_UNREAD_MESSAGES:
|
||||||
|
preference.setSummary(mContext.getString(R.string.pref_delete_old_messages_unread_summary, newValue));
|
||||||
|
break;
|
||||||
|
case DELETE_READ_MESSAGES:
|
||||||
|
preference.setSummary(mContext.getString(R.string.pref_delete_old_messages_read_summary, newValue));
|
||||||
|
break;
|
||||||
case YAPPY:
|
case YAPPY:
|
||||||
if ((Boolean) newValue) {
|
if ((Boolean) newValue) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -169,6 +169,12 @@
|
|||||||
<string name="pref_delivery_toast_summary">Show a short toast to indicate a message being delivered</string>
|
<string name="pref_delivery_toast_summary">Show a short toast to indicate a message being delivered</string>
|
||||||
<string name="pref_delivery_vibrate">Vibrate</string>
|
<string name="pref_delivery_vibrate">Vibrate</string>
|
||||||
<string name="pref_delivery_vibrate_summary">Vibrate on message delivery</string>
|
<string name="pref_delivery_vibrate_summary">Vibrate on message delivery</string>
|
||||||
|
<string name="pref_delete_old_messages">Delete old messages</string>
|
||||||
|
<string name="pref_delete_old_messages_summary">Automatically delete messages once they\'re old enough</string>
|
||||||
|
<string name="pref_delete_old_messages_unread">Unread messages</string>
|
||||||
|
<string name="pref_delete_old_messages_unread_summary">Automatically delete unread messages after %s days</string>
|
||||||
|
<string name="pref_delete_old_messages_read">Read messages</string>
|
||||||
|
<string name="pref_delete_old_messages_read_summary">Automatically delete read messages after %s days</string>
|
||||||
<string name="pref_yappy">Yappy integration</string>
|
<string name="pref_yappy">Yappy integration</string>
|
||||||
<string name="pref_endlessjabber_summary">Enable full support for Yappy</string>
|
<string name="pref_endlessjabber_summary">Enable full support for Yappy</string>
|
||||||
<string name="pref_blocked_conversations">Blocked conversations</string>
|
<string name="pref_blocked_conversations">Blocked conversations</string>
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:defaultValue="-16746133"
|
android:defaultValue="-16746133"
|
||||||
android:key="pref_key_theme" />
|
android:key="pref_key_theme" />
|
||||||
<Preference
|
<Preference android:key="pref_key_icon" />
|
||||||
android:key="pref_key_icon" />
|
|
||||||
<Preference
|
<Preference
|
||||||
android:defaultValue="@bool/hasL"
|
android:defaultValue="@bool/hasL"
|
||||||
android:key="pref_key_status_tint" />
|
android:key="pref_key_status_tint" />
|
||||||
@@ -73,6 +72,15 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_key_mobile_only" />
|
android:key="pref_key_mobile_only" />
|
||||||
|
<Preference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_key_delete_old_messages" />
|
||||||
|
<Preference
|
||||||
|
android:defaultValue="7"
|
||||||
|
android:key="pref_key_delete_old_unread_messages" />
|
||||||
|
<Preference
|
||||||
|
android:defaultValue="7"
|
||||||
|
android:key="pref_key_delete_old_read_messages" />
|
||||||
<Preference
|
<Preference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_key_strip_unicode" />
|
android:key="pref_key_strip_unicode" />
|
||||||
|
|||||||
@@ -47,6 +47,33 @@
|
|||||||
android:title="@string/pref_delivery_vibrate"
|
android:title="@string/pref_delivery_vibrate"
|
||||||
android:widgetLayout="@layout/view_switch" />
|
android:widgetLayout="@layout/view_switch" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:layout="@layout/list_item_preference_category"
|
||||||
|
android:title="@string/pref_delete_old_messages">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_key_delete_old_messages"
|
||||||
|
android:layout="@layout/list_item_preference"
|
||||||
|
android:summary="@string/pref_delete_old_messages_summary"
|
||||||
|
android:title="@string/pref_delete_old_messages"
|
||||||
|
android:widgetLayout="@layout/view_switch" />
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="7"
|
||||||
|
android:dependency="pref_key_delete_old_messages"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="pref_key_delete_old_unread_messages"
|
||||||
|
android:layout="@layout/list_item_preference"
|
||||||
|
android:summary="@string/pref_delete_old_messages_unread_summary"
|
||||||
|
android:title="@string/pref_delete_old_messages_unread" />
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="7"
|
||||||
|
android:dependency="pref_key_delete_old_messages"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="pref_key_delete_old_read_messages"
|
||||||
|
android:layout="@layout/list_item_preference"
|
||||||
|
android:summary="@string/pref_delete_old_messages_read_summary"
|
||||||
|
android:title="@string/pref_delete_old_messages_read" />
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:layout="@layout/list_item_preference_category"
|
android:layout="@layout/list_item_preference_category"
|
||||||
android:title="@string/pref_text">
|
android:title="@string/pref_text">
|
||||||
@@ -147,12 +174,12 @@
|
|||||||
android:title="@string/pref_key_timestamp_delay" />
|
android:title="@string/pref_key_timestamp_delay" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
|
android:disableDependentsState="true"
|
||||||
android:key="pref_key_force_timestamps"
|
android:key="pref_key_force_timestamps"
|
||||||
android:layout="@layout/list_item_preference"
|
android:layout="@layout/list_item_preference"
|
||||||
android:summary="@string/pref_force_timestamps_summary"
|
android:summary="@string/pref_force_timestamps_summary"
|
||||||
android:title="@string/pref_force_timestamps"
|
android:title="@string/pref_force_timestamps"
|
||||||
android:widgetLayout="@layout/view_switch"
|
android:widgetLayout="@layout/view_switch" />
|
||||||
android:disableDependentsState="true"/>
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pref_key_compose_favorites"
|
android:key="pref_key_compose_favorites"
|
||||||
|
|||||||
Reference in New Issue
Block a user