Fixed AccountsFragment theme and almost fixed sharedElementTransition
This commit is contained in:
parent
899d5fcc53
commit
9b07c5cb88
9 changed files with 28 additions and 35 deletions
|
@ -36,7 +36,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"
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,25 +180,21 @@ 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);
|
||||||
|
|
||||||
Pair p1 = Pair.create(userImage, "gravatarTransition");
|
// SharedElementTransition is only available from API level 21
|
||||||
Pair p2 = Pair.create(lightning, "lightningTransition");
|
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
|
ActivityOptions options = ActivityOptions
|
||||||
.makeSceneTransitionAnimation(this, userImage, "gravatarTransition");
|
.makeSceneTransitionAnimation(this, p1, p2, p3);
|
||||||
//ActivityCompat.startActivity(this, intent, options.toBundle());
|
|
||||||
startActivity(intent);
|
startActivity(intent, options.toBundle());
|
||||||
|
} else {
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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" />
|
||||||
|
|
|
@ -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"/>
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue