Changed Accounts from Fragment to Activity to use the SharedElementTransition

This commit is contained in:
Severiano Jaramillo 2018-01-09 01:22:08 -06:00
parent 93976cadd2
commit 4980700366
7 changed files with 220 additions and 2 deletions

View file

@ -37,6 +37,13 @@
<activity android:name=".activities.SettingsActivity"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
<activity android:name=".activities.AccountsActivity"
android:theme="@style/AppTheme.Transparent"
android:parentActivityName=".activities.BoardActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.BoardActivity" />
</activity>
<service android:name=".service.CrystalWalletService"
android:exported="false"/>

View file

@ -0,0 +1,46 @@
package cy.agorise.crystalwallet.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cy.agorise.crystalwallet.R;
/**
* Created by xd on 1/9/18.
*
*/
public class AccountsActivity extends Activity{
@BindView(R.id.tvSettings)
TextView tvSettings;
@BindView(R.id.tvClose)
TextView tvClose;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accounts);
ButterKnife.bind(this);
}
@OnClick(R.id.tvSettings)
public void onTvSettingsClick(){
onBackPressed();
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
}
@OnClick(R.id.tvClose)
public void cancel(){
onBackPressed();
}
}

View file

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.activities;
import android.app.ActivityOptions;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.AnimationDrawable;
@ -177,7 +178,7 @@ public class BoardActivity extends AppCompatActivity {
*/
@OnClick(R.id.toolbar_user_img)
public void accounts() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
/*FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("AccountsDialog");
if (prev != null) {
ft.remove(prev);
@ -186,7 +187,13 @@ public class BoardActivity extends AppCompatActivity {
// Create and show the dialog.
AccountsFragment newFragment = AccountsFragment.newInstance(this.cryptoNetAccountId);
newFragment.show(ft, "AccountsDialog");
newFragment.show(ft, "AccountsDialog");*/
Intent intent = new Intent(new Intent(this, AccountsActivity.class));
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(this, userImage, "gravatarTransition");
startActivity(intent, options.toBundle());
//startActivity(intent);
}
/*

View file

@ -0,0 +1,145 @@
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<View
android:id="@+id/topView"
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"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="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" />
<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"/>
<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"/>
<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: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"/>
<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" />
<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"/>
<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/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"/>
<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"/>
<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"/>
<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"/>
</android.support.constraint.ConstraintLayout>

View file

@ -65,6 +65,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_marginEnd="32dp"
android:src="@drawable/ken_code_gravatar"
android:transitionName="gravatarTransition"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

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

View file

@ -34,6 +34,14 @@
<item name="fontFamily">@font/opensans</item> <!-- target android sdk versions < 26 and > 14 if theme other than AppCompat -->
</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="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>