From 4638425b641e165130d18408a7b53f2ad5871db7 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 11 Jan 2018 19:15:50 -0600 Subject: [PATCH] Step back to fix sharedelementtransition later --- .../activities/AccountsActivity.java | 5 +- .../activities/BoardActivity.java | 36 +-- app/src/main/res/layout/activity_accounts.xml | 253 +++++++++--------- app/src/main/res/layout/board.xml | 2 + .../res/transition/change_image_transform.xml | 4 +- app/src/main/res/values/styles.xml | 10 + 6 files changed, 169 insertions(+), 141 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountsActivity.java index 71489e5..f0b0aa8 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountsActivity.java @@ -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) @@ -43,4 +42,4 @@ public class AccountsActivity extends Activity{ public void cancel(){ onBackPressed(); } -} +} \ No newline at end of file diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index 7bfb357..6ae880b 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -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); } diff --git a/app/src/main/res/layout/activity_accounts.xml b/app/src/main/res/layout/activity_accounts.xml index f1d7d36..0cd3176 100644 --- a/app/src/main/res/layout/activity_accounts.xml +++ b/app/src/main/res/layout/activity_accounts.xml @@ -1,145 +1,156 @@ - + app:layout_constraintTop_toTopOf="parent"> - + - + - + - + - + - + - + - + - + - + - + - + + + + + diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index 47c1b7c..a226a85 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -71,9 +71,11 @@ app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/transition/change_image_transform.xml b/app/src/main/res/transition/change_image_transform.xml index c56e8c5..655608d 100644 --- a/app/src/main/res/transition/change_image_transform.xml +++ b/app/src/main/res/transition/change_image_transform.xml @@ -1,4 +1,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 3eb5f25..7ab8ddb 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -32,12 +32,22 @@ @color/white @font/opensans @font/opensans + + true + + + + @transition/change_image_transform + + @transition/change_image_transform +