forked from upstream-mirrors/quik
Merge remote-tracking branch 'qklabs/master'
This commit is contained in:
+2
-2
@@ -25,8 +25,8 @@ android {
|
||||
buildToolsVersion '23.0.0'
|
||||
|
||||
defaultConfig {
|
||||
versionCode 110
|
||||
versionName "2.0.1"
|
||||
versionCode 111
|
||||
versionName "2.1.0"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 22
|
||||
}
|
||||
|
||||
@@ -50,18 +50,6 @@
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/AppThemeLightDialog"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<action android:name="android.intent.action.SENDTO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="sms" />
|
||||
<data android:scheme="smsto" />
|
||||
<data android:scheme="mms" />
|
||||
<data android:scheme="mmsto" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
||||
@@ -85,7 +73,19 @@
|
||||
android:logo="@color/transparent"
|
||||
android:windowSoftInputMode="stateUnchanged|adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<action android:name="android.intent.action.SENDTO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="sms" />
|
||||
<data android:scheme="smsto" />
|
||||
<data android:scheme="mms" />
|
||||
<data android:scheme="mmsto" />
|
||||
<data android:scheme="sms_body" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
@@ -282,7 +282,6 @@ public class Utils {
|
||||
*/
|
||||
public static long getOrCreateThreadId(Context context, String recipient) {
|
||||
Set<String> recipients = new HashSet<>();
|
||||
|
||||
recipients.add(recipient);
|
||||
return getOrCreateThreadId(context, recipients);
|
||||
}
|
||||
@@ -293,8 +292,31 @@ public class Utils {
|
||||
* @param recipients is the set of people message is being sent to
|
||||
* @return the thread_id to use in the database
|
||||
*/
|
||||
public static long getOrCreateThreadId(
|
||||
Context context, Set<String> recipients) {
|
||||
public static long getOrCreateThreadId(Context context, Set<String> recipients) {
|
||||
long threadId = getThreadId(context, recipients);
|
||||
Random random = new Random();
|
||||
return threadId == -1 ? random.nextLong() : threadId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current thread_id or -1 if none found
|
||||
* @param context is the context of the activity or service
|
||||
* @param recipient is the person message is being sent to
|
||||
* @return the thread_id to use in the database, -1 if none found
|
||||
*/
|
||||
public static long getThreadId(Context context, String recipient) {
|
||||
Set<String> recipients = new HashSet<>();
|
||||
recipients.add(recipient);
|
||||
return getThreadId(context, recipients);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current thread_id or -1 if none found
|
||||
* @param context is the context of the activity or service
|
||||
* @param recipients is the set of people message is being sent to
|
||||
* @return the thread_id to use in the database, -1 if none found
|
||||
*/
|
||||
public static long getThreadId(Context context, Set<String> recipients) {
|
||||
Uri.Builder uriBuilder = Uri.parse("content://mms-sms/threadID").buildUpon();
|
||||
|
||||
for (String recipient : recipients) {
|
||||
@@ -320,9 +342,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
return random.nextLong();
|
||||
//throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static boolean isEmailAddress(String address) {
|
||||
|
||||
@@ -16,6 +16,8 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -33,6 +35,7 @@ import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||
import com.moez.QKSMS.common.utils.MessageUtils;
|
||||
import com.moez.QKSMS.common.utils.Units;
|
||||
import com.moez.QKSMS.data.Conversation;
|
||||
import com.moez.QKSMS.mmssms.Utils;
|
||||
import com.moez.QKSMS.receiver.IconColorReceiver;
|
||||
import com.moez.QKSMS.transaction.NotificationManager;
|
||||
import com.moez.QKSMS.transaction.SmsHelper;
|
||||
@@ -53,25 +56,31 @@ import com.moez.QKSMS.ui.welcome.WelcomeActivity;
|
||||
import com.nispok.snackbar.Snackbar;
|
||||
import com.nispok.snackbar.listeners.ActionClickListener;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Collection;
|
||||
|
||||
public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListener,
|
||||
SlidingMenu.OnCloseListener, SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener,
|
||||
ActionClickListener {
|
||||
public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListener, SlidingMenu.OnCloseListener,
|
||||
SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener, ActionClickListener {
|
||||
|
||||
private final String TAG = "MainActivity";
|
||||
|
||||
public final static String EXTRA_THREAD_ID = "thread_id";
|
||||
|
||||
private final String KEY_TYPE = "type";
|
||||
private final String KEY_POSITION = "position";
|
||||
private final String KEY_THREADID = "thread_id";
|
||||
|
||||
private final int TYPE_COMPOSE = 0;
|
||||
private final int TYPE_CONVERSATION = 1;
|
||||
private final int TYPE_SETTINGS = 2;
|
||||
private final int TYPE_SEARCH = 3;
|
||||
|
||||
private static final int THREAD_LIST_QUERY_TOKEN = 1701;
|
||||
private static final int UNREAD_THREADS_QUERY_TOKEN = 1702;
|
||||
public static final int DELETE_CONVERSATION_TOKEN = 1801;
|
||||
public static final int HAVE_LOCKED_MESSAGES_TOKEN = 1802;
|
||||
private static final int DELETE_OBSOLETE_THREADS_TOKEN = 1803;
|
||||
|
||||
public final static String MENU_FRAGMENT_TAG = "menu";
|
||||
public final static String CONTENT_FRAGMENT_TAG = "content";
|
||||
|
||||
public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain";
|
||||
|
||||
// thread IDs are always nonnegative
|
||||
@@ -83,7 +92,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
private static SharedPreferences prefs;
|
||||
|
||||
private SlidingMenu mSlidingMenu;
|
||||
private Fragment menuFragment;
|
||||
private ConversationListFragment menuFragment;
|
||||
private Fragment content;
|
||||
private long mWaitingForThreadId = -1;
|
||||
|
||||
@@ -108,9 +117,55 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
mSlidingMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
|
||||
setupSlidingMenu();
|
||||
|
||||
setupFragments(savedInstanceState);
|
||||
onNewIntent(getIntent());
|
||||
|
||||
showDialogIfNeeded(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up menu and content fragments
|
||||
* If the fragments are stored in the bundle, use those. Otherwise, instantiate new ones
|
||||
*/
|
||||
private void setupFragments(Bundle savedInstanceState) {
|
||||
int type = 0;
|
||||
int position = 0;
|
||||
threadId = 0;
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
type = savedInstanceState.getInt(KEY_TYPE, 0);
|
||||
position = savedInstanceState.getInt(KEY_POSITION, 0);
|
||||
threadId = savedInstanceState.getLong(KEY_THREADID, 0);
|
||||
}
|
||||
|
||||
menuFragment = new ConversationListFragment();
|
||||
menuFragment.setPosition(position);
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.menu_frame, menuFragment)
|
||||
.commit();
|
||||
|
||||
switch (type) {
|
||||
case TYPE_COMPOSE:
|
||||
content = new ComposeFragment();
|
||||
break;
|
||||
case TYPE_CONVERSATION:
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(MessageListFragment.ARG_THREAD_ID, threadId);
|
||||
content = MessageListFragment.getInstance(args);
|
||||
break;
|
||||
case TYPE_SETTINGS:
|
||||
content = SettingsFragment.newInstance(R.xml.settings_simple);
|
||||
break;
|
||||
case TYPE_SEARCH:
|
||||
content = new SearchFragment();
|
||||
break;
|
||||
}
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.content_frame, content)
|
||||
.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows at most one dialog using the intent extras and the restored state of the activity.
|
||||
*
|
||||
@@ -380,33 +435,6 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
isShowing = true;
|
||||
ThemeManager.loadThemeProperties(this);
|
||||
|
||||
if (menuFragment == null || content == null) {
|
||||
menuFragment = new ConversationListFragment();
|
||||
|
||||
if (getIntent().getExtras() != null) {
|
||||
content = getFragmentManager().getFragment(getIntent().getExtras(), "content");
|
||||
}
|
||||
|
||||
threadId = getIntent().getLongExtra(EXTRA_THREAD_ID, -1);
|
||||
if (threadId != -1) {
|
||||
// Open the conversation if a thread ID exists
|
||||
setConversation(threadId);
|
||||
} else {
|
||||
// Otherwise, show the ConversationList and put a compose fragment as the content
|
||||
// fragment.
|
||||
mSlidingMenu.showMenu(false);
|
||||
content = new ComposeFragment();
|
||||
}
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.content_frame, content)
|
||||
.commitAllowingStateLoss();
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.menu_frame, menuFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
if (!mSlidingMenu.isMenuShowing()) {
|
||||
QKContentFragment.notifyOnContentOpened(content);
|
||||
}
|
||||
@@ -429,17 +457,44 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
setIntent(intent);
|
||||
|
||||
// This method is called whenever a MainActivity intent is started. Sometimes this is from a
|
||||
// notifications; other times it's from the user clicking on the app icon in the home
|
||||
// screen. If it has a thread id, then we know it's from a notification and we can set the
|
||||
// notification; other times it's from the user clicking on the app icon in the home screen
|
||||
long threadId = intent.getLongExtra(EXTRA_THREAD_ID, -1);
|
||||
|
||||
// The activity can also be launched by clicking on the message button from the contacts app
|
||||
// Check for {sms,mms}{,to}: schemes, in which case we know to open a conversation
|
||||
if (intent.getData() != null) {
|
||||
String data = intent.getData().toString();
|
||||
String scheme = intent.getData().getScheme();
|
||||
|
||||
if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) {
|
||||
String address = data.replace("smsto:", "").replace("mmsto:", "");
|
||||
threadId = Utils.getThreadId(this, formatPhoneNumber(address));
|
||||
} else if (scheme.startsWith("sms") || (scheme.startsWith("mms"))) {
|
||||
String address = data.replace("sms:", "").replace("mms:", "");
|
||||
threadId = Utils.getThreadId(this, formatPhoneNumber(address));
|
||||
}
|
||||
}
|
||||
|
||||
// If it has a thread id, then we know it's from a notification and we can set the
|
||||
// conversation.
|
||||
long threadId = getIntent().getLongExtra(EXTRA_THREAD_ID, -1);
|
||||
if (threadId != -1) {
|
||||
Log.v(TAG, "Opening thread: " + threadId);
|
||||
setConversation(threadId);
|
||||
mSlidingMenu.showContent();
|
||||
} else {
|
||||
mSlidingMenu.showMenu(false);
|
||||
}
|
||||
|
||||
// Otherwise we'll just resume what was previously there, which doesn't require any code.
|
||||
}
|
||||
|
||||
private String formatPhoneNumber(String address) {
|
||||
address = URLDecoder.decode(address);
|
||||
address = "" + Html.fromHtml(address);
|
||||
address = PhoneNumberUtils.formatNumber(address);
|
||||
return address;
|
||||
}
|
||||
|
||||
private void beginMmsSetup() {
|
||||
if (!prefs.getBoolean(MMS_SETUP_DONT_ASK_AGAIN, false) &&
|
||||
TextUtils.isEmpty(prefs.getString(SettingsFragment.MMSC_URL, "")) &&
|
||||
@@ -470,27 +525,15 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
FragmentManager m = getFragmentManager();
|
||||
|
||||
// Save whether or not the mms setup fragment was dismissed
|
||||
if (getFragmentManager().findFragmentByTag(MMSSetupFragment.TAG) == null) {
|
||||
if (m.findFragmentByTag(MMSSetupFragment.TAG) == null) {
|
||||
outState.putBoolean(KEY_MMS_SETUP_FRAGMENT_DISMISSED, true);
|
||||
}
|
||||
|
||||
// Check to make sure that the fragments we're looking to save are actually in the fragment
|
||||
// manager before saving them. This bug is hard to reproduce, but it's one of the most
|
||||
// reported issues on the Play dev console.
|
||||
if (content != null && m.findFragmentById(R.id.content_frame) != null) {
|
||||
m.putFragment(outState, CONTENT_FRAGMENT_TAG, content);
|
||||
}
|
||||
if (menuFragment != null && m.findFragmentById(R.id.menu_frame) != null) {
|
||||
m.putFragment(outState, MENU_FRAGMENT_TAG, menuFragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
|
||||
menuFragment = getFragmentManager().getFragment(savedInstanceState, MENU_FRAGMENT_TAG);
|
||||
content = getFragmentManager().getFragment(savedInstanceState, CONTENT_FRAGMENT_TAG);
|
||||
outState.putInt(KEY_TYPE, content instanceof MessageListFragment ? TYPE_CONVERSATION :
|
||||
content instanceof SettingsFragment ? TYPE_SETTINGS :
|
||||
content instanceof SearchFragment ? TYPE_SEARCH : TYPE_COMPOSE);
|
||||
outState.putInt(KEY_POSITION, menuFragment.getPosition());
|
||||
outState.putLong(KEY_THREADID, threadId);
|
||||
}
|
||||
|
||||
public void switchContent(Fragment fragment, boolean animate) {
|
||||
@@ -538,7 +581,6 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
args.putString(MessageListFragment.ARG_HIGHLIGHT, pattern);
|
||||
args.putBoolean(MessageListFragment.ARG_SHOW_IMMEDIATE, !animate);
|
||||
|
||||
Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content_frame);
|
||||
MessageListFragment fragment = MessageListFragment.getInstance(args);
|
||||
|
||||
// Save the thread ID here and switch the content
|
||||
|
||||
@@ -61,6 +61,10 @@ public abstract class RecyclerCursorAdapter<VH extends RecyclerView.ViewHolder,
|
||||
return mCursor;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return mCursor == null ? 0 : mCursor.getColumnCount();
|
||||
}
|
||||
|
||||
protected abstract DataType getItem(int position);
|
||||
|
||||
public boolean isInMultiSelectMode() {
|
||||
|
||||
+19
-1
@@ -62,6 +62,9 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
private ConversationDetailsDialog mConversationDetailsDialog;
|
||||
private QKActivity mContext;
|
||||
|
||||
// This does not hold the current position of the list, rather the position the list is pending being set to
|
||||
private int mPosition;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -244,7 +247,18 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
break;
|
||||
}
|
||||
}
|
||||
}).show(((MainActivity) mContext).getFragmentManager(), "conversation options");
|
||||
}).show(mContext.getFragmentManager(), "conversation options");
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
mPosition = position;
|
||||
if (mLayoutManager != null && mAdapter != null) {
|
||||
mLayoutManager.scrollToPosition(Math.min(mPosition, mAdapter.getCount() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return mLayoutManager.findFirstVisibleItemPosition();
|
||||
}
|
||||
|
||||
private void initLoaderManager() {
|
||||
@@ -277,6 +291,10 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
if (mAdapter != null) {
|
||||
// Swap the new cursor in. (The framework will take care of closing the, old cursor once we return.)
|
||||
mAdapter.changeCursor(data);
|
||||
if (mPosition != 0) {
|
||||
mRecyclerView.scrollToPosition(Math.min(mPosition, data.getCount() - 1));
|
||||
mPosition = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ public class MessageColumns {
|
||||
};
|
||||
|
||||
public static class ColumnsMap {
|
||||
private final String TAG = "ColumnsMap";
|
||||
private final boolean DEBUG = false;
|
||||
|
||||
public int mColumnMsgType;
|
||||
public int mColumnMsgId;
|
||||
public int mColumnSmsAddress;
|
||||
@@ -123,121 +126,121 @@ public class MessageColumns {
|
||||
try {
|
||||
mColumnMsgType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.TYPE_DISCRIMINATOR_COLUMN);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMsgId = cursor.getColumnIndexOrThrow(BaseColumns._ID);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsAddress = cursor.getColumnIndexOrThrow(Telephony.Sms.ADDRESS);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsBody = cursor.getColumnIndexOrThrow(Telephony.Sms.BODY);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsDate = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsDateSent = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE_SENT);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsType = cursor.getColumnIndexOrThrow(Telephony.Sms.TYPE);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsStatus = cursor.getColumnIndexOrThrow(Telephony.Sms.STATUS);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsLocked = cursor.getColumnIndexOrThrow(Telephony.Sms.LOCKED);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnSmsErrorCode = cursor.getColumnIndexOrThrow(Telephony.Sms.ERROR_CODE);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsSubject = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsSubjectCharset = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT_CHARSET);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsMessageType = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_TYPE);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsMessageBox = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_BOX);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsDeliveryReport = cursor.getColumnIndexOrThrow(Telephony.Mms.DELIVERY_REPORT);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsReadReport = cursor.getColumnIndexOrThrow(Telephony.Mms.READ_REPORT);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsErrorType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.PendingMessages.ERROR_TYPE);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsLocked = cursor.getColumnIndexOrThrow(Telephony.Mms.LOCKED);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsStatus = cursor.getColumnIndexOrThrow(Telephony.Mms.STATUS);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
mColumnMmsTextOnly = cursor.getColumnIndexOrThrow(Telephony.Mms.TEXT_ONLY);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w("colsMap", e.getMessage());
|
||||
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
|
||||
private long mLastMessageId;
|
||||
private BackgroundQueryHandler mBackgroundQueryHandler;
|
||||
private LoadConversationTask mLoadConversationTask;
|
||||
|
||||
public static final String ARG_THREAD_ID = "threadId";
|
||||
public static final String ARG_ROW_ID = "rowId";
|
||||
@@ -325,8 +326,7 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
* Note: This will have no effect if the context has not been initialized yet.
|
||||
*/
|
||||
private void onOpenConversation() {
|
||||
Log.d(TAG, "onOpenConversation with threadId: " + mThreadId);
|
||||
new LoadConversationTask().execute((Void[]) null);
|
||||
new LoadConversationTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null);
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
@@ -745,7 +745,9 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
|
||||
@Override
|
||||
protected void onContentClosed() {
|
||||
mSensorManager.unregisterListener(this);
|
||||
if (mSensorManager != null) {
|
||||
mSensorManager.unregisterListener(this);
|
||||
}
|
||||
|
||||
if (mOpened) {
|
||||
if (mConversationLegacy != null) {
|
||||
@@ -1372,6 +1374,10 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
|
||||
private class LoadConversationTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
public LoadConversationTask() {
|
||||
Log.d(TAG, "LoadConversationTask");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
Log.d(TAG, "Loading conversation");
|
||||
|
||||
@@ -3,25 +3,19 @@ package com.moez.QKSMS.ui.popup;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import com.android.ex.chips.recipientchip.DrawableRecipientChip;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.data.Contact;
|
||||
import com.moez.QKSMS.data.ContactHelper;
|
||||
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||
import com.moez.QKSMS.interfaces.ActivityLauncher;
|
||||
import com.moez.QKSMS.interfaces.RecipientProvider;
|
||||
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||
import com.moez.QKSMS.ui.base.QKPopupActivity;
|
||||
import com.moez.QKSMS.ui.view.AutoCompleteContactView;
|
||||
import com.moez.QKSMS.ui.view.ComposeView;
|
||||
import com.moez.QKSMS.ui.view.StarredContactsView;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class QKComposeActivity extends QKPopupActivity implements ComposeView.OnSendListener, RecipientProvider,
|
||||
ActivityLauncher, AdapterView.OnItemClickListener {
|
||||
|
||||
@@ -54,40 +48,6 @@ public class QKComposeActivity extends QKPopupActivity implements ComposeView.On
|
||||
|
||||
// Apply different attachments based on the type.
|
||||
mCompose.loadMessageFromIntent(getIntent());
|
||||
|
||||
// Check for {sms,mms}{,to}: schemes, in which case we can set the recipients.
|
||||
if (getIntent().getData() != null) {
|
||||
String data = getIntent().getData().toString();
|
||||
String scheme = getIntent().getData().getScheme();
|
||||
|
||||
if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) {
|
||||
String address = data.replace("smsto:", "").replace("mmsto:", "");
|
||||
final Contact contact = Contact.get(formatPhoneNumber(address), true);
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mRecipients.submitItem(contact.getName(), contact.getNumber(),
|
||||
ContactHelper.getPhotoUri(mContext, contact.getUri()));
|
||||
}
|
||||
}, 100);
|
||||
|
||||
} else if (scheme.startsWith("sms") || (scheme.startsWith("mms"))) {
|
||||
String address = data.replace("sms:", "").replace("mms:", "");
|
||||
final Contact contact = Contact.get(formatPhoneNumber(address), true);
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mRecipients.submitItem(contact.getName(), contact.getNumber(),
|
||||
ContactHelper.getPhotoUri(mContext, contact.getUri()));
|
||||
}
|
||||
}, 100);
|
||||
|
||||
}
|
||||
|
||||
mCompose.requestReplyTextFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,13 +55,6 @@ public class QKComposeActivity extends QKPopupActivity implements ComposeView.On
|
||||
return R.layout.activity_qkcompose;
|
||||
}
|
||||
|
||||
private String formatPhoneNumber(String address) {
|
||||
address = URLDecoder.decode(address);
|
||||
address = "" + Html.fromHtml(address);
|
||||
address = PhoneNumberUtils.formatNumber(address);
|
||||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="changelog_versions">
|
||||
<item>2.1.0</item>
|
||||
<item>2.0.1</item>
|
||||
<item>1.13.1</item>
|
||||
<item>1.13.0</item>
|
||||
@@ -159,6 +160,7 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="changelog_dates">
|
||||
<item>August 31, 2015</item>
|
||||
<item>August 16, 2015</item>
|
||||
<item>August 16, 2015</item>
|
||||
<item>August 16, 2015</item>
|
||||
@@ -267,6 +269,7 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="changelog_changes">
|
||||
<item>" • Added option to delete failed messages\n • Fixed send button animations\n • Improved timestamps\n • New font option\n • Improved unicode stripping\n • Crash fixes\n • Updated translations\n • Improved 24 hour time compatibility\n • Improved sharing functionality\n • Improved rotation support"</item>
|
||||
<item>" • QKSMS is now open source. View the source code at https://github.com/qklabs/qksms"</item>
|
||||
<item>" • Multiple crash fixes"</item>
|
||||
<item>" • Updated messaging UI\n • Fixed phone number showing up instead of name for contacts\n • Fixed delete conversation option\n • Crash fixes"</item>
|
||||
|
||||
Reference in New Issue
Block a user