2015-06-22 15:46:43 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
2015-06-08 18:07:46 +00:00
|
|
|
import android.os.Build.VERSION;
|
|
|
|
import android.os.Build.VERSION_CODES;
|
2015-06-22 15:46:43 +00:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
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;
|
2015-11-19 19:43:17 +00:00
|
|
|
import android.view.View;
|
2015-06-22 15:46:43 +00:00
|
|
|
import android.view.WindowManager;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
|
|
|
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, @NonNull MasterSecret masterSecret) {
|
|
|
|
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, masterSecret);
|
2015-07-01 15:24:47 +00:00
|
|
|
|
|
|
|
titleView.setOnClickListener(null);
|
2015-06-22 15:46:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
composeText.requestFocus();
|
2015-07-09 00:33:03 +00:00
|
|
|
quickAttachmentToggle.disable();
|
2015-06-22 15:46:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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:
|
|
|
|
saveDraft().addListener(new ListenableFuture.Listener<Long>() {
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Long result) {
|
|
|
|
ActivityOptionsCompat transition = ActivityOptionsCompat.makeScaleUpAnimation(getWindow().getDecorView(), 0, 0, getWindow().getAttributes().width, getWindow().getAttributes().height);
|
|
|
|
Intent intent = new Intent(ConversationPopupActivity.this, ConversationActivity.class);
|
2017-07-26 16:59:15 +00:00
|
|
|
intent.putExtra(ConversationActivity.ADDRESSES_EXTRA, getRecipients().getAddresses());
|
2015-06-22 15:46:43 +00:00
|
|
|
intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, result);
|
|
|
|
|
2015-06-08 18:07:46 +00:00
|
|
|
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
|
2015-06-22 15:46:43 +00:00
|
|
|
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(long threadId) {
|
|
|
|
super.sendComplete(threadId);
|
|
|
|
finish();
|
|
|
|
}
|
2015-11-19 19:43:17 +00:00
|
|
|
|
|
|
|
@Override
|
2016-02-06 00:10:33 +00:00
|
|
|
protected void updateInviteReminder(boolean seenInvite) {
|
2017-01-19 02:46:40 +00:00
|
|
|
if (reminderView.resolved()) {
|
|
|
|
reminderView.get().setVisibility(View.GONE);
|
|
|
|
}
|
2015-11-19 19:43:17 +00:00
|
|
|
}
|
2015-06-22 15:46:43 +00:00
|
|
|
}
|