mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
fix stuff
This commit is contained in:
@@ -153,6 +153,12 @@
|
||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ConversationListRelayingActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/TextSecure.LightNoActionBar"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
||||
|
||||
<activity android:name=".ConversationActivity"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static com.b44t.messenger.DcContact.DC_CONTACT_ID_SELF;
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.setForwardingMessageIds;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -77,10 +80,6 @@ import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static com.b44t.messenger.DcContact.DC_CONTACT_ID_SELF;
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.setForwardingMessageIds;
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public class ConversationFragment extends MessageSelectorFragment
|
||||
{
|
||||
@@ -433,10 +432,10 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
}
|
||||
|
||||
private void handleForwardMessage(final Set<DcMsg> messageRecords) {
|
||||
Intent composeIntent = new Intent(getActivity(), ConversationListActivity.class);
|
||||
Intent composeIntent = new Intent();
|
||||
int[] msgIds = DcMsg.msgSetToIds(messageRecords);
|
||||
setForwardingMessageIds(composeIntent, msgIds);
|
||||
startActivityForResult(composeIntent, REQUEST_RELAY);
|
||||
ConversationListRelayingActivity.start(this, composeIntent);
|
||||
getActivity().overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
/**
|
||||
* "Relaying" means "Forwarding or Sharing".
|
||||
*
|
||||
* When forwarding or sharing, we show the ConversationListActivity to the user.
|
||||
* However, ConversationListActivity has `launchMode="singleTask"`, which means that this will
|
||||
* destroy the existing ConversationListActivity.
|
||||
*
|
||||
* In API 20-29, `startActivityForResult()` could be used instead of `startActivity()`
|
||||
* to override this behavior and get two instances of ConversationListActivity.
|
||||
*
|
||||
* As this is not possible anymore starting with API 30, we needed another solution, and created
|
||||
* this activity here.
|
||||
*
|
||||
* See https://github.com/deltachat/deltachat-android/issues/1704.
|
||||
*/
|
||||
|
||||
public class ConversationListRelayingActivity extends ConversationListActivity {
|
||||
public static void start(Fragment fragment, Intent intent) {
|
||||
intent.setComponent(new ComponentName(fragment.getContext(), ConversationListRelayingActivity.class));
|
||||
fragment.startActivityForResult(intent, REQUEST_RELAY);
|
||||
}
|
||||
|
||||
public static void start(Activity activity, Intent intent) {
|
||||
intent.setComponent(new ComponentName(activity, ConversationListRelayingActivity.class));
|
||||
activity.startActivityForResult(intent, REQUEST_RELAY);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
||||
import static org.thoughtcrime.securesms.util.RelayUtil.setSharedText;
|
||||
|
||||
import android.Manifest;
|
||||
@@ -263,11 +262,13 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
|
||||
if (chatId != -1) {
|
||||
composeIntent = getBaseShareIntent(ConversationActivity.class);
|
||||
composeIntent.putExtra(EXTRA_CHAT_ID, chatId);
|
||||
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
|
||||
startActivity(composeIntent);
|
||||
} else {
|
||||
composeIntent = getBaseShareIntent(ConversationListActivity.class);
|
||||
composeIntent = getBaseShareIntent(ConversationListRelayingActivity.class);
|
||||
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
|
||||
ConversationListRelayingActivity.start(this, composeIntent);
|
||||
}
|
||||
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
|
||||
startActivityForResult(composeIntent, REQUEST_RELAY);
|
||||
// We use startActivityForResult() here so that the conversations list is correctly updated. (hide "Device messages", ...)a
|
||||
// With startActivity() the list was not always updated before and after sharing and incorrectly showed or did not show the device talk.
|
||||
finish();
|
||||
|
||||
Reference in New Issue
Block a user