Use single instance of MessageListActivity

This commit is contained in:
Moez Bhatti
2016-04-10 00:10:34 -04:00
parent 9422ec6cbd
commit 6abbcfc0d2
2 changed files with 24 additions and 20 deletions
+2 -1
View File
@@ -81,7 +81,8 @@
</activity> </activity>
<activity <activity
android:name=".ui.messagelist.MessageListActivity" android:name=".ui.messagelist.MessageListActivity"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
@@ -45,29 +45,32 @@ public class MessageListActivity extends QKSwipeBackActivity {
setContentView(R.layout.activity_fragment); setContentView(R.layout.activity_fragment);
showBackButton(true); showBackButton(true);
Intent intent = getIntent(); onNewIntent(getIntent());
if (intent != null) { }
mThreadId = intent.getLongExtra(ARG_THREAD_ID, -1);
mRowId = intent.getLongExtra(ARG_ROW_ID, -1);
mHighlight = intent.getStringExtra(ARG_HIGHLIGHT);
mShowImmediate = intent.getBooleanExtra(ARG_SHOW_IMMEDIATE, false);
if (mThreadId == -1 && intent.getData() != null) { @Override
String data = intent.getData().toString(); protected void onNewIntent(Intent intent) {
String scheme = intent.getData().getScheme(); super.onNewIntent(intent);
mThreadId = intent.getLongExtra(ARG_THREAD_ID, -1);
mRowId = intent.getLongExtra(ARG_ROW_ID, -1);
mHighlight = intent.getStringExtra(ARG_HIGHLIGHT);
mShowImmediate = intent.getBooleanExtra(ARG_SHOW_IMMEDIATE, false);
String address = null; if (mThreadId == -1 && intent.getData() != null) {
if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) { String data = intent.getData().toString();
address = data.replace("smsto:", "").replace("mmsto:", ""); String scheme = intent.getData().getScheme();
} else if (scheme.startsWith("sms") || (scheme.startsWith("mms"))) {
address = data.replace("sms:", "").replace("mms:", "");
}
address = URLDecoder.decode(address); String address = null;
address = "" + Html.fromHtml(address); if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) {
address = PhoneNumberUtils.formatNumber(address); address = data.replace("smsto:", "").replace("mmsto:", "");
mThreadId = Utils.getOrCreateThreadId(this, address); } else if (scheme.startsWith("sms") || (scheme.startsWith("mms"))) {
address = data.replace("sms:", "").replace("mms:", "");
} }
address = URLDecoder.decode(address);
address = "" + Html.fromHtml(address);
address = PhoneNumberUtils.formatNumber(address);
mThreadId = Utils.getOrCreateThreadId(this, address);
} }
if (mThreadId != -1) { if (mThreadId != -1) {