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" >
</activity>
<activity android:name=".activities.AccountsActivity"
android:theme="@style/AppTheme.Transparent"
android:theme="@style/ActivityDialog"
android:parentActivityName=".activities.BoardActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
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)
TextView tvSettings;

View file

@ -7,16 +7,14 @@ import android.media.MediaPlayer;
import android.os.Bundle;
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.util.Pair;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Pair;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
@ -73,6 +71,9 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.lightning)
public ImageView lightning;
@BindView(R.id.triangle)
public ImageView triangle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -179,25 +180,21 @@ public class BoardActivity extends AppCompatActivity {
*/
@OnClick(R.id.toolbar_user_img)
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);
Pair p1 = Pair.create(userImage, "gravatarTransition");
Pair p2 = Pair.create(lightning, "lightningTransition");
// 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 p2 = Pair.create(lightning, "lightningTransition");
Pair p3 = Pair.create(triangle, "triangleTransition");
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(this, userImage, "gravatarTransition");
//ActivityCompat.startActivity(this, intent, options.toBundle());
startActivity(intent);
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(this, p1, p2, p3);
startActivity(intent, options.toBundle());
} else {
startActivity(intent);
}
}
/*

View file

@ -53,7 +53,7 @@ public class AccountsFragment extends DialogFragment {
@NonNull
@Override
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();
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"
android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/bounce_interpolator"
android:interpolator="@android:anim/anticipate_overshoot_interpolator"
android:fromXScale="1.0"
android:toXScale="1.0"
android:fromYScale="0.0"

View file

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

View file

@ -81,9 +81,11 @@
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>
<ImageView
android:id="@+id/triangle"
android:layout_width="20dp"
android:layout_height="20dp"
app:srcCompat="@drawable/ic_arrow_24dp"
android:transitionName="triangleTransition"
android:contentDescription="@string/small_triangle_icon"
app:layout_constraintEnd_toEndOf="@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"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeImageTransform
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="400"/>
<changeImageTransform/>
</transitionSet>

View file

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