Skip to content

Commit

Permalink
Option to view sent timestamps instead of received
Browse files Browse the repository at this point in the history
  • Loading branch information
moezbhatti committed Feb 18, 2016
1 parent b4096a1 commit 44afddb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions QKSMS/src/main/java/com/moez/QKSMS/enums/QKPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public enum QKPreference {
BLOCKED_FUTURE("pref_key_block_future", new HashSet<String>()),
MOBILE_ONLY("pref_key_mobile_only", false),
ENTER_BUTTON("pref_key_enter_button", "0"),
SENT_TIMESTAMPS("pref_key_sent_timestamps", false),
STARRED_CONTACTS("pref_key_compose_favorites", true),
PROXIMITY_SENSOR("pref_key_prox_sensor_calling", false),
YAPPY_INTEGRATION("pref_key_endlessjabber", false),
Expand Down
16 changes: 10 additions & 6 deletions QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
import android.annotation.SuppressLint;
import android.content.ContentUris;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.provider.Telephony.Mms;
import android.provider.Telephony.MmsSms;
import android.provider.Telephony.Sms;
import android.text.TextUtils;
import android.util.Log;

import com.android.mms.util.DownloadManager;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu_alt.EncodedStringValue;
Expand All @@ -39,15 +40,16 @@
import com.moez.QKSMS.QKSMSApp;
import com.moez.QKSMS.R;
import com.moez.QKSMS.common.formatter.FormatterFactory;
import com.moez.QKSMS.data.Contact;
import com.moez.QKSMS.model.SlideModel;
import com.moez.QKSMS.model.SlideshowModel;
import com.moez.QKSMS.model.TextModel;
import com.moez.QKSMS.common.google.ItemLoadedCallback;
import com.moez.QKSMS.common.google.ItemLoadedFuture;
import com.moez.QKSMS.common.google.PduLoaderManager;
import com.moez.QKSMS.common.utils.AddressUtils;
import com.moez.QKSMS.common.utils.DateFormatter;
import com.moez.QKSMS.data.Contact;
import com.moez.QKSMS.enums.QKPreference;
import com.moez.QKSMS.model.SlideModel;
import com.moez.QKSMS.model.SlideshowModel;
import com.moez.QKSMS.model.TextModel;
import com.moez.QKSMS.transaction.SmsHelper;

import java.util.regex.Pattern;
Expand Down Expand Up @@ -119,6 +121,7 @@ public MessageItem(Context context, String type, final Cursor cursor,
mHighlight = highlight;
mType = type;
mColumnsMap = columnsMap;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);

if ("sms".equals(type)) {
mReadReport = false; // No read reports in sms
Expand Down Expand Up @@ -157,7 +160,8 @@ public MessageItem(Context context, String type, final Cursor cursor,
// Unless the message is currently in the progress of being sent, it gets a time stamp.
if (!isOutgoingMessage()) {
// Set "received" or "sent" time stamp
mDate = cursor.getLong(columnsMap.mColumnSmsDate);
boolean sent = prefs.getBoolean(QKPreference.SENT_TIMESTAMPS.getKey(), false);
mDate = cursor.getLong(sent ? columnsMap.mColumnSmsDateSent : columnsMap.mColumnSmsDate);
mTimestamp = DateFormatter.getMessageTimestamp(context, mDate);
}

Expand Down
2 changes: 2 additions & 0 deletions QKSMS/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="pref_sliding_tab">Sliding panel tab</string>
<string name="pref_sliding_tab_summary">Sliding tab that allows you to quickly view your last conversation</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_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_prox_sensor_call">Proximity sensor</string>
Expand Down
7 changes: 7 additions & 0 deletions QKSMS/src/main/res/xml/settings_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
android:layout="@layout/list_item_preference"
android:summary="@string/pref_enter_button_summary"
android:title="@string/pref_enter_button" />
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_key_sent_timestamps"
android:layout="@layout/list_item_preference"
android:summary="@string/pref_sent_timestamps_summary"
android:title="@string/pref_sent_timestamps"
android:widgetLayout="@layout/view_switch" />
<CheckBoxPreference
android:defaultValue="true"
android:key="pref_key_compose_favorites"
Expand Down

0 comments on commit 44afddb

Please sign in to comment.