Support for scene transition from conversation to recipient prefs.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-06-22 09:52:46 -07:00
parent dbf765ffd7
commit 408d3a964d
4 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.ConversationTitleView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -12,10 +13,12 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:transitionName="recipient_name"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
style="@style/TextSecure.TitleTextStyle"/>
style="@style/TextSecure.TitleTextStyle"
tools:ignore="UnusedAttribute"/>
<TextView android:id="@+id/subtitle"
android:layout_width="wrap_content"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -30,9 +31,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:transitionName="recipient_name"
style="@style/TextSecure.TitleTextStyle"
android:layout_toRightOf="@id/avatar"
android:layout_marginLeft="10dip"/>
android:layout_marginLeft="10dip"
tools:ignore="UnusedAttribute"/>
<TextView android:id="@+id/blocked_indicator"
android:layout_width="wrap_content"

View File

@ -1,10 +1,14 @@
package org.thoughtcrime.securesms;
import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import java.lang.reflect.Field;
@ -52,4 +56,12 @@ public abstract class BaseActionBarActivity extends AppCompatActivity {
Log.w(TAG, "Failed to force overflow menu.");
}
}
protected void startActivitySceneTransition(Intent intent, View sharedView, String transitionName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this, sharedView, transitionName).toBundle());
} else {
startActivity(intent);
}
}
}

View File

@ -27,13 +27,11 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBar.LayoutParams;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@ -750,7 +748,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
public void onClick(View v) {
Intent intent = new Intent(ConversationActivity.this, RecipientPreferenceActivity.class);
intent.putExtra(RecipientPreferenceActivity.RECIPIENTS_EXTRA, recipients.getIds());
startActivity(intent);
startActivitySceneTransition(intent, titleView.findViewById(R.id.title), "recipient_name");
}
});