Fixed AccountsFragment theme and almost fixed sharedElementTransition

This commit is contained in:
Severiano Jaramillo 2018-01-16 17:26:35 -06:00
parent a0db8f8a4f
commit 692a39d16e
9 changed files with 28 additions and 35 deletions

View file

@ -38,7 +38,7 @@
android:theme="@style/AppTheme.NoActionBar" > android:theme="@style/AppTheme.NoActionBar" >
</activity> </activity>
<activity android:name=".activities.AccountsActivity" <activity android:name=".activities.AccountsActivity"
android:theme="@style/AppTheme.Transparent" android:theme="@style/ActivityDialog"
android:parentActivityName=".activities.BoardActivity" > android:parentActivityName=".activities.BoardActivity" >
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView; import android.widget.TextView;
import butterknife.BindView; import butterknife.BindView;
@ -16,7 +17,7 @@ import cy.agorise.crystalwallet.R;
* *
*/ */
public class AccountsActivity extends Activity { public class AccountsActivity extends AppCompatActivity {
@BindView(R.id.tvSettings) @BindView(R.id.tvSettings)
TextView tvSettings; TextView tvSettings;

View file

@ -7,16 +7,14 @@ import android.media.MediaPlayer;
import android.os.Bundle; import android.os.Bundle;
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.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.Pair;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View; import android.view.View;
@ -73,6 +71,9 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.lightning) @BindView(R.id.lightning)
public ImageView lightning; public ImageView lightning;
@BindView(R.id.triangle)
public ImageView triangle;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -179,26 +180,22 @@ public class BoardActivity extends AppCompatActivity {
*/ */
@OnClick(R.id.toolbar_user_img) @OnClick(R.id.toolbar_user_img)
public void accounts() { public void accounts() {
/*FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("AccountsDialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
AccountsFragment newFragment = AccountsFragment.newInstance(this.cryptoNetAccountId);
newFragment.show(ft, "AccountsDialog");*/
Intent intent = new Intent(this, AccountsActivity.class); Intent intent = new Intent(this, AccountsActivity.class);
// SharedElementTransition is only available from API level 21
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Pair p1 = Pair.create(userImage, "gravatarTransition"); Pair p1 = Pair.create(userImage, "gravatarTransition");
Pair p2 = Pair.create(lightning, "lightningTransition"); Pair p2 = Pair.create(lightning, "lightningTransition");
Pair p3 = Pair.create(triangle, "triangleTransition");
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(this, userImage, "gravatarTransition"); .makeSceneTransitionAnimation(this, p1, p2, p3);
//ActivityCompat.startActivity(this, intent, options.toBundle());
startActivity(intent, options.toBundle());
} else {
startActivity(intent); startActivity(intent);
} }
}
/* /*
* dispatch the user to the receive fragment using this account * dispatch the user to the receive fragment using this account

View file

@ -53,7 +53,7 @@ public class AccountsFragment extends DialogFragment {
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AccountsTheme); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_accounts, null); View view = inflater.inflate(R.layout.fragment_accounts, null);

View file

@ -2,7 +2,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"> android:shareInterpolator="false">
<scale <scale
android:interpolator="@android:anim/bounce_interpolator" android:interpolator="@android:anim/anticipate_overshoot_interpolator"
android:fromXScale="1.0" android:fromXScale="1.0"
android:toXScale="1.0" android:toXScale="1.0"
android:fromYScale="0.0" android:fromYScale="0.0"

View file

@ -40,6 +40,7 @@
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="45dp" android:layout_height="45dp"
android:transitionName="lightningTransition"
app:layout_constraintBottom_toBottomOf="@id/user_img" app:layout_constraintBottom_toBottomOf="@id/user_img"
app:layout_constraintStart_toStartOf="@id/user_img" app:layout_constraintStart_toStartOf="@id/user_img"
app:srcCompat="@drawable/ic_lightning_24dp" /> app:srcCompat="@drawable/ic_lightning_24dp" />

View file

@ -81,9 +81,11 @@
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>
<ImageView <ImageView
android:id="@+id/triangle"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
app:srcCompat="@drawable/ic_arrow_24dp" app:srcCompat="@drawable/ic_arrow_24dp"
android:transitionName="triangleTransition"
android:contentDescription="@string/small_triangle_icon" android:contentDescription="@string/small_triangle_icon"
app:layout_constraintEnd_toEndOf="@id/toolbar_user_img" app:layout_constraintEnd_toEndOf="@id/toolbar_user_img"
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>

View file

@ -1,6 +1,4 @@
<?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

@ -35,19 +35,18 @@
<!-- enable window content transitions --> <!-- enable window content transitions -->
<item name="android:windowContentTransitions">true</item> <item name="android:windowContentTransitions">true</item>
<!-- specify shared element transitions --> <!-- specify shared element transitions
<item name="android:windowSharedElementEnterTransition"> <item name="android:windowSharedElementEnterTransition">
@transition/change_image_transform</item> @transition/change_image_transform</item>
<item name="android:windowSharedElementExitTransition"> <item name="android:windowSharedElementExitTransition">
@transition/change_image_transform</item> @transition/change_image_transform</item> -->
</style> </style>
<style name="AppTheme.Transparent" parent="AppTheme"> <style name="ActivityDialog" parent="Theme.AppCompat.Light.NoActionBar">
<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>
@ -93,11 +92,6 @@
<item name="android:windowExitAnimation">@anim/receive_transaction_out</item> <item name="android:windowExitAnimation">@anim/receive_transaction_out</item>
</style> </style>
<style name="AccountsTheme" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowAnimationStyle">@style/AccountsAnimation.Window</item>
</style>
<style name="AccountsAnimation.Window" parent="@android:style/Animation.Activity"> <style name="AccountsAnimation.Window" parent="@android:style/Animation.Activity">
<item name="android:windowEnterAnimation">@anim/accounts_in</item> <item name="android:windowEnterAnimation">@anim/accounts_in</item>
<item name="android:windowExitAnimation">@anim/accounts_out</item> <item name="android:windowExitAnimation">@anim/accounts_out</item>