Step back to fix sharedelementtransition later

This commit is contained in:
Severiano Jaramillo 2018-01-11 19:15:50 -06:00
parent 718f770465
commit 0c2e2361ef
6 changed files with 169 additions and 141 deletions

View file

@ -16,7 +16,7 @@ import cy.agorise.crystalwallet.R;
*
*/
public class AccountsActivity extends Activity{
public class AccountsActivity extends Activity {
@BindView(R.id.tvSettings)
TextView tvSettings;
@ -29,7 +29,6 @@ public class AccountsActivity extends Activity{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accounts);
ButterKnife.bind(this);
}
@OnClick(R.id.tvSettings)

View file

@ -3,42 +3,40 @@ package cy.agorise.crystalwallet.activities;
import android.app.ActivityOptions;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.PagerAdapter;
import android.support.v4.util.Pair;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.ImageButton;
import android.widget.ImageView;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.fragments.AccountsFragment;
import cy.agorise.crystalwallet.fragments.BalanceFragment;
import cy.agorise.crystalwallet.fragments.ContactsFragment;
import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment;
import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
import cy.agorise.crystalwallet.util.CircularImageView;
/**
* Created by Henry Varona on 7/10/2017.
*
*/
public class BoardActivity extends AppCompatActivity {
@ -70,7 +68,10 @@ public class BoardActivity extends AppCompatActivity {
public SurfaceView mSurfaceView;
@BindView(R.id.toolbar_user_img)
public ImageView userImage;
public CircularImageView userImage;
@BindView(R.id.lightning)
public ImageView lightning;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -129,7 +130,7 @@ public class BoardActivity extends AppCompatActivity {
// Hide Add Contact fab, it won't hide until first page changed...
// Convert 72dp to pixels (fab is 56dp in diameter + 16dp margin)
final int fabDistanceToHide = (int) (72 * Resources.getSystem().getDisplayMetrics().density);;
final int fabDistanceToHide = (int) (72 * Resources.getSystem().getDisplayMetrics().density);
fabAddContact.animate().translationY(fabDistanceToHide)
.setInterpolator(new LinearInterpolator()).start();
@ -188,18 +189,21 @@ public class BoardActivity extends AppCompatActivity {
// Create and show the dialog.
AccountsFragment newFragment = AccountsFragment.newInstance(this.cryptoNetAccountId);
newFragment.show(ft, "AccountsDialog");*/
Intent intent = new Intent(new Intent(this, AccountsActivity.class));
Intent intent = new Intent(this, AccountsActivity.class);
ActivityOptions options = ActivityOptions
Pair p1 = Pair.create(userImage, "gravatarTransition");
Pair p2 = Pair.create(lightning, "lightningTransition");
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(this, userImage, "gravatarTransition");
startActivity(intent, options.toBundle());
//startActivity(intent);
//ActivityCompat.startActivity(this, intent, options.toBundle());
startActivity(intent);
}
/*
* dispatch the user to the receive fragment using this account
*/
public void receiveToThisAccount(){
public void receiveToThisAccount() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("ReceiveDialog");
if (prev != null) {
@ -215,7 +219,7 @@ public class BoardActivity extends AppCompatActivity {
/*
* dispatch the user to the send fragment using this account
*/
public void sendFromThisAccount(){
public void sendFromThisAccount() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("SendDialog");
if (prev != null) {
@ -229,7 +233,7 @@ public class BoardActivity extends AppCompatActivity {
}
private class BoardPagerAdapter extends FragmentStatePagerAdapter {
public BoardPagerAdapter(FragmentManager fm) {
BoardPagerAdapter(FragmentManager fm) {
super(fm);
}

View file

@ -1,145 +1,156 @@
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<View
android:id="@+id/topView"
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:background="@color/colorPrimary"
android:layout_height="120dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="45dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/user_img"
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ken_code_gravatar"
android:transitionName="gravatarTransition"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/topView"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="45dp"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="24dp"
android:layout_height="45dp"
app:srcCompat="@drawable/ic_lightning_24dp"
app:layout_constraintStart_toStartOf="@id/user_img"
app:layout_constraintBottom_toBottomOf="@id/user_img"/>
<cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/user_img"
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ken_code_gravatar"
android:transitionName="gravatarTransition"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_name_placeholder"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginTop="20dp"
app:layout_constraintTop_toTopOf="@id/topView"
app:layout_constraintBottom_toBottomOf="@id/topView"
app:layout_constraintStart_toStartOf="@id/topView"
app:layout_constraintEnd_toEndOf="@id/topView"/>
<ImageView
android:layout_width="24dp"
android:layout_height="45dp"
app:layout_constraintBottom_toBottomOf="@id/user_img"
app:layout_constraintStart_toStartOf="@id/user_img"
app:srcCompat="@drawable/ic_lightning_24dp" />
<View
android:id="@+id/secondView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/lightGray"
app:layout_constraintTop_toBottomOf="@id/topView"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/user_name_placeholder"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/topView"
app:layout_constraintEnd_toEndOf="@id/topView"
app:layout_constraintStart_toStartOf="@id/topView"
app:layout_constraintTop_toTopOf="@id/topView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_accounts"
android:textColor="@color/darkGray"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginStart="32dp"
app:layout_constraintTop_toTopOf="@id/secondView"
app:layout_constraintStart_toStartOf="@id/secondView"
app:layout_constraintBottom_toBottomOf="@id/secondView"/>
<View
android:id="@+id/secondView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/lightGray"
app:layout_constraintTop_toBottomOf="@id/topView" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddAccount"
android:layout_width="55dp"
android:layout_height="55dp"
app:fabSize="normal"
app:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/ic_add_24dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="32dp"
app:layout_constraintTop_toTopOf="@id/secondView"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:text="@string/my_accounts"
android:textColor="@color/darkGray"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/secondView"
app:layout_constraintStart_toStartOf="@id/secondView"
app:layout_constraintTop_toTopOf="@id/secondView" />
<View
android:id="@+id/thirdView"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/secondView"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddAccount"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginEnd="32dp"
android:layout_marginTop="12dp"
app:backgroundTint="@color/colorPrimary"
app:fabSize="normal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/secondView"
app:srcCompat="@drawable/ic_add_24dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_have_multiple_accounts"
android:textSize="16sp"
android:textAlignment="center"
android:layout_marginEnd="64dp"
android:layout_marginStart="64dp"
app:layout_constraintEnd_toEndOf="@id/thirdView"
app:layout_constraintStart_toStartOf="@id/thirdView"
app:layout_constraintTop_toTopOf="@id/thirdView"
app:layout_constraintBottom_toBottomOf="@id/thirdView"/>
<View
android:id="@+id/thirdView"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/secondView" />
<View
android:id="@+id/forthView"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/lightGray"
app:layout_constraintTop_toBottomOf="@id/thirdView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="64dp"
android:layout_marginStart="64dp"
android:text="@string/dont_have_multiple_accounts"
android:textAlignment="center"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/thirdView"
app:layout_constraintEnd_toEndOf="@id/thirdView"
app:layout_constraintStart_toStartOf="@id/thirdView"
app:layout_constraintTop_toTopOf="@id/thirdView" />
<ImageView
android:id="@+id/ivSettings"
android:layout_width="20dp"
android:layout_height="20dp"
app:srcCompat="@drawable/ic_settings_24dp"
android:layout_marginStart="24dp"
app:layout_constraintTop_toTopOf="@id/forthView"
app:layout_constraintBottom_toBottomOf="@id/forthView"
app:layout_constraintStart_toStartOf="@id/forthView"/>
<View
android:id="@+id/forthView"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/lightGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/thirdView" />
<TextView
android:id="@+id/tvSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings"
android:textStyle="bold"
android:layout_marginStart="8dp"
app:layout_constraintStart_toEndOf="@id/ivSettings"
app:layout_constraintTop_toTopOf="@id/forthView"
app:layout_constraintBottom_toBottomOf="@id/forthView"/>
<ImageView
android:id="@+id/ivSettings"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toBottomOf="@id/forthView"
app:layout_constraintStart_toStartOf="@id/forthView"
app:layout_constraintTop_toTopOf="@id/forthView"
app:srcCompat="@drawable/ic_settings_24dp" />
<TextView
android:id="@+id/tvClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/close"
android:textStyle="bold"
android:layout_marginEnd="24dp"
app:layout_constraintEnd_toEndOf="@id/forthView"
app:layout_constraintTop_toTopOf="@id/forthView"
app:layout_constraintBottom_toBottomOf="@id/forthView"/>
<TextView
android:id="@+id/tvSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/settings"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/forthView"
app:layout_constraintStart_toEndOf="@id/ivSettings"
app:layout_constraintTop_toTopOf="@id/forthView" />
<TextView
android:id="@+id/tvClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="@string/close"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/forthView"
app:layout_constraintEnd_toEndOf="@id/forthView"
app:layout_constraintTop_toTopOf="@id/forthView" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -71,9 +71,11 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/lightning"
android:layout_width="16dp"
android:layout_height="30dp"
app:srcCompat="@drawable/ic_lightning_24dp"
android:transitionName="lightningTransition"
android:contentDescription="@string/lightning_icon"
app:layout_constraintStart_toStartOf="@id/toolbar_user_img"
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>

View file

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeImageTransform />
<changeImageTransform
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="400"/>
</transitionSet>

View file

@ -32,12 +32,22 @@
<item name="android:colorButtonNormal">@color/white</item>
<item name="android:fontFamily">@font/opensans</item>
<item name="fontFamily">@font/opensans</item> <!-- target android sdk versions < 26 and > 14 if theme other than AppCompat -->
<!-- enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<!-- specify shared element transitions -->
<item name="android:windowSharedElementEnterTransition">
@transition/change_image_transform</item>
<item name="android:windowSharedElementExitTransition">
@transition/change_image_transform</item>
</style>
<style name="AppTheme.Transparent" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>