Step back to fix sharedelementtransition later

This commit is contained in:
Severiano Jaramillo 2018-01-11 19:15:50 -06:00
parent 4980700366
commit 4638425b64
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) @BindView(R.id.tvSettings)
TextView tvSettings; TextView tvSettings;
@ -29,7 +29,6 @@ public class AccountsActivity extends Activity{
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accounts); setContentView(R.layout.activity_accounts);
ButterKnife.bind(this); ButterKnife.bind(this);
} }
@OnClick(R.id.tvSettings) @OnClick(R.id.tvSettings)

View file

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

View file

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

View file

@ -71,9 +71,11 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/lightning"
android:layout_width="16dp" android:layout_width="16dp"
android:layout_height="30dp" android:layout_height="30dp"
app:srcCompat="@drawable/ic_lightning_24dp" app:srcCompat="@drawable/ic_lightning_24dp"
android:transitionName="lightningTransition"
android:contentDescription="@string/lightning_icon" android:contentDescription="@string/lightning_icon"
app:layout_constraintStart_toStartOf="@id/toolbar_user_img" app:layout_constraintStart_toStartOf="@id/toolbar_user_img"
app:layout_constraintBottom_toBottomOf="@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"?> <?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> <transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeImageTransform /> <changeImageTransform
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="400"/>
</transitionSet> </transitionSet>

View file

@ -32,12 +32,22 @@
<item name="android:colorButtonNormal">@color/white</item> <item name="android:colorButtonNormal">@color/white</item>
<item name="android:fontFamily">@font/opensans</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 --> <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>
<style name="AppTheme.Transparent" parent="AppTheme"> <style name="AppTheme.Transparent" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item> <item name="android:backgroundDimEnabled">true</item>
</style> </style>