forked from upstream-mirrors/quik
Added preferences for controlling the delay for a new timestamp and force-enabling timestamps for all messages.
This commit is contained in:
@@ -282,7 +282,9 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
|||||||
|
|
||||||
MessageItem messageItem2 = getItem(position + 1);
|
MessageItem messageItem2 = getItem(position + 1);
|
||||||
|
|
||||||
if (messageItem.mDeliveryStatus != MessageItem.DeliveryStatus.NONE) {
|
if(mPrefs.getBoolean(SettingsFragment.FORCE_TIMESTAMPS, false)) {
|
||||||
|
return true;
|
||||||
|
} else if (messageItem.mDeliveryStatus != MessageItem.DeliveryStatus.NONE) {
|
||||||
return true;
|
return true;
|
||||||
} else if (messageItem.isFailedMessage()) {
|
} else if (messageItem.isFailedMessage()) {
|
||||||
return true;
|
return true;
|
||||||
@@ -291,7 +293,7 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
|||||||
} else if (messagesFromDifferentPeople(messageItem, messageItem2)) {
|
} else if (messagesFromDifferentPeople(messageItem, messageItem2)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
int MAX_DURATION = 60 * 60 * 1000;
|
int MAX_DURATION = Integer.parseInt(mPrefs.getString(SettingsFragment.SHOW_NEW_TIMESTAMP_DELAY, "60")) * 60 * 1000;
|
||||||
return (messageItem2.mDate - messageItem.mDate >= MAX_DURATION);
|
return (messageItem2.mDate - messageItem.mDate >= MAX_DURATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,7 +319,9 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
|||||||
private boolean messagesFromDifferentPeople(MessageItem a, MessageItem b) {
|
private boolean messagesFromDifferentPeople(MessageItem a, MessageItem b) {
|
||||||
return (a.mAddress != null && b.mAddress != null &&
|
return (a.mAddress != null && b.mAddress != null &&
|
||||||
!a.mAddress.equals(b.mAddress) &&
|
!a.mAddress.equals(b.mAddress) &&
|
||||||
!a.isOutgoingMessage() && !b.isOutgoingMessage());
|
!a.isOutgoingMessage(
|
||||||
|
|
||||||
|
) && !b.isOutgoingMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBubbleBackgroundResource(boolean showAvatar, boolean isMine) {
|
private int getBubbleBackgroundResource(boolean showAvatar, boolean isMine) {
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
|||||||
public static final String AUTO_EMOJI = "pref_key_auto_emoji";
|
public static final String AUTO_EMOJI = "pref_key_auto_emoji";
|
||||||
public static final String MARKDOWN_ENABLED = "pref_key_markdown_enabled";
|
public static final String MARKDOWN_ENABLED = "pref_key_markdown_enabled";
|
||||||
public static final String ENTER_BUTTON = "pref_key_enter_button";
|
public static final String ENTER_BUTTON = "pref_key_enter_button";
|
||||||
|
public static final String FORCE_TIMESTAMPS = "pref_key_force_timestamps";
|
||||||
|
public static final String SHOW_NEW_TIMESTAMP_DELAY = "pref_key_timestamp_delay";
|
||||||
public static final String COMPOSE_FAVORITES = "pref_key_compose_favorites";
|
public static final String COMPOSE_FAVORITES = "pref_key_compose_favorites";
|
||||||
public static final String FONT_FAMILY = "pref_key_font_family";
|
public static final String FONT_FAMILY = "pref_key_font_family";
|
||||||
public static final String FONT_SIZE = "pref_key_font_size";
|
public static final String FONT_SIZE = "pref_key_font_size";
|
||||||
|
|||||||
@@ -157,6 +157,10 @@
|
|||||||
|
|
||||||
<string name="pref_sent_timestamps">Sent timestamps</string>
|
<string name="pref_sent_timestamps">Sent timestamps</string>
|
||||||
<string name="pref_sent_timestamps_summary">Show the timestamp for when a message was sent, not received</string>
|
<string name="pref_sent_timestamps_summary">Show the timestamp for when a message was sent, not received</string>
|
||||||
|
<string name="pref_force_timestamps">Force timestamps</string>
|
||||||
|
<string name="pref_force_timestamps_summary">Enable timestamps for all messages</string>
|
||||||
|
<string name="pref_key_timestamp_delay">New timestamp delay</string>
|
||||||
|
<string name="pref_key_timestamp_delay_summary">The number of minutes which must elapse between two messages in order for a new timestamp to be shown.</string>
|
||||||
<string name="pref_compose_favorites">Starred contacts</string>
|
<string name="pref_compose_favorites">Starred contacts</string>
|
||||||
<string name="pref_compose_summary_favorites">Show your starred contacts in the QK Compose window, making them only a tap away</string>
|
<string name="pref_compose_summary_favorites">Show your starred contacts in the QK Compose window, making them only a tap away</string>
|
||||||
<string name="pref_prox_sensor_call">Proximity sensor</string>
|
<string name="pref_prox_sensor_call">Proximity sensor</string>
|
||||||
|
|||||||
@@ -137,6 +137,22 @@
|
|||||||
android:summary="@string/pref_sent_timestamps_summary"
|
android:summary="@string/pref_sent_timestamps_summary"
|
||||||
android:title="@string/pref_sent_timestamps"
|
android:title="@string/pref_sent_timestamps"
|
||||||
android:widgetLayout="@layout/view_switch" />
|
android:widgetLayout="@layout/view_switch" />
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="60"
|
||||||
|
android:dependency="pref_key_force_timestamps"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="pref_key_timestamp_delay"
|
||||||
|
android:layout="@layout/list_item_preference"
|
||||||
|
android:summary="@string/pref_key_timestamp_delay_summary"
|
||||||
|
android:title="@string/pref_key_timestamp_delay" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_key_force_timestamps"
|
||||||
|
android:layout="@layout/list_item_preference"
|
||||||
|
android:summary="@string/pref_force_timestamps_summary"
|
||||||
|
android:title="@string/pref_force_timestamps"
|
||||||
|
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