mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove quick reply fallback #983
This commit is contained in:
@@ -141,14 +141,6 @@
|
||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ConversationPopupActivity"
|
||||
android:windowSoftInputMode="stateVisible"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:excludeFromRecents="true"
|
||||
android:theme="@style/TextSecure.LightTheme.Popup"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
||||
|
||||
<activity android:name=".GroupCreateActivity"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class ConversationPopupActivity extends ConversationActivity {
|
||||
|
||||
private static final String TAG = ConversationPopupActivity.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected void onPreCreate() {
|
||||
super.onPreCreate();
|
||||
overridePendingTransition(R.anim.slide_from_top, R.anim.slide_to_top);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle, boolean ready) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
|
||||
WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.alpha = 1.0f;
|
||||
params.dimAmount = 0.1f;
|
||||
params.gravity = Gravity.TOP;
|
||||
getWindow().setAttributes(params);
|
||||
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
int width = display.getWidth();
|
||||
int height = display.getHeight();
|
||||
|
||||
if (height > width) getWindow().setLayout((int) (width * .85), (int) (height * .5));
|
||||
else getWindow().setLayout((int) (width * .7), (int) (height * .75));
|
||||
|
||||
super.onCreate(bundle, ready);
|
||||
|
||||
titleView.setOnClickListener(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
composeText.requestFocus();
|
||||
quickAttachmentToggle.disable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (isFinishing()) overridePendingTransition(R.anim.slide_from_top, R.anim.slide_to_top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = this.getMenuInflater();
|
||||
menu.clear();
|
||||
|
||||
inflater.inflate(R.menu.conversation_popup, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_expand:
|
||||
processComposeControls(ACTION_SAVE_DRAFT).addListener(new ListenableFuture.Listener<Integer>() {
|
||||
@Override
|
||||
public void onSuccess(Integer result) {
|
||||
ActivityOptionsCompat transition = ActivityOptionsCompat.makeScaleUpAnimation(getWindow().getDecorView(), 0, 0, getWindow().getAttributes().width, getWindow().getAttributes().height);
|
||||
Intent intent = new Intent(ConversationPopupActivity.this, ConversationActivity.class);
|
||||
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, result);
|
||||
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
|
||||
startActivity(intent, transition.toBundle());
|
||||
} else {
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.fade_scale_in, R.anim.slide_to_right);
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(ExecutionException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeActionBar() {
|
||||
super.initializeActionBar();
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendComplete(int chatId) {
|
||||
super.sendComplete(chatId);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,6 @@ abstract class MessageNotifier {
|
||||
if (timestamp != 0) builder.setWhen(timestamp);
|
||||
|
||||
builder.addActions(notificationState.getMarkAsReadIntent(context, chatId, notificationId),
|
||||
notificationState.getQuickReplyIntent(context, recipient),
|
||||
notificationState.getRemoteReplyIntent(context, recipient));
|
||||
|
||||
ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
|
||||
|
||||
@@ -8,8 +8,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.ConversationPopupActivity;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Prefs.VibrateState;
|
||||
@@ -154,15 +152,5 @@ public class NotificationState {
|
||||
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
PendingIntent getQuickReplyIntent(Context context, Recipient recipient) {
|
||||
if (chats.size() != 1) throw new AssertionError("We only support replies to single chat notifications! " + chats.size());
|
||||
|
||||
Intent intent = new Intent(context, ConversationPopupActivity.class);
|
||||
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, (chats.toArray(new Integer[chats.size()]))[0]);
|
||||
intent.setData((Uri.parse("custom://"+System.currentTimeMillis())));
|
||||
|
||||
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
-9
@@ -115,25 +115,20 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
}
|
||||
|
||||
void addActions(@NonNull PendingIntent markReadIntent,
|
||||
@NonNull PendingIntent compatInNotificationReplyIntent,
|
||||
@NonNull PendingIntent inNotificationReplyIntent)
|
||||
{
|
||||
Action markAsReadAction = new Action(R.drawable.check,
|
||||
context.getString(R.string.notify_mark_read),
|
||||
markReadIntent);
|
||||
|
||||
Action replyAction;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
replyAction = new Action(R.drawable.ic_reply_white_36dp,
|
||||
context.getString(R.string.notify_reply_button),
|
||||
compatInNotificationReplyIntent);
|
||||
} else {
|
||||
replyAction = new Action.Builder(R.drawable.ic_reply_white_36dp,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Action replyAction = new Action.Builder(R.drawable.ic_reply_white_36dp,
|
||||
context.getString(R.string.notify_reply_button),
|
||||
inNotificationReplyIntent)
|
||||
.addRemoteInput(new RemoteInput.Builder(MessageNotifierCompat.EXTRA_REMOTE_REPLY)
|
||||
.setLabel(context.getString(R.string.notify_reply_button)).build())
|
||||
.build();
|
||||
addAction(replyAction);
|
||||
}
|
||||
|
||||
Action wearableReplyAction = new Action.Builder(R.drawable.ic_reply,
|
||||
@@ -144,7 +139,6 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
.build();
|
||||
|
||||
addAction(markAsReadAction);
|
||||
addAction(replyAction);
|
||||
|
||||
extend(new NotificationCompat.WearableExtender().addAction(markAsReadAction)
|
||||
.addAction(wearableReplyAction));
|
||||
|
||||
Reference in New Issue
Block a user