diff --git a/app/src/main/java/com/m2049r/xmrwallet/SubaddressFragment.java b/app/src/main/java/com/m2049r/xmrwallet/SubaddressFragment.java index 8b377592..c42ae7ab 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/SubaddressFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/SubaddressFragment.java @@ -30,7 +30,6 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.transition.MaterialElevationScale; import com.m2049r.xmrwallet.data.Subaddress; import com.m2049r.xmrwallet.layout.SubaddressInfoAdapter; import com.m2049r.xmrwallet.ledger.LedgerProgressDialog; @@ -117,14 +116,6 @@ public class SubaddressFragment extends Fragment implements SubaddressInfoAdapte managerMode = ((b != null) && (MODE_MANAGER.equals(b.getString(KEY_MODE)))); View view = inflater.inflate(R.layout.fragment_subaddress, container, false); - - final MaterialElevationScale exitTransition = new MaterialElevationScale(false); - exitTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setExitTransition(exitTransition); - final MaterialElevationScale reenterTransition = new MaterialElevationScale(true); - reenterTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setReenterTransition(reenterTransition); - view.findViewById(R.id.fab).setOnClickListener(this); if (managerMode) { @@ -154,11 +145,6 @@ public class SubaddressFragment extends Fragment implements SubaddressInfoAdapte @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - postponeEnterTransition(); - view.getViewTreeObserver().addOnPreDrawListener(() -> { - startPostponedEnterTransition(); - return true; - }); } public void loadList() { diff --git a/app/src/main/java/com/m2049r/xmrwallet/SubaddressInfoFragment.java b/app/src/main/java/com/m2049r/xmrwallet/SubaddressInfoFragment.java index 0a784f31..3b0941a7 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/SubaddressInfoFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/SubaddressInfoFragment.java @@ -29,15 +29,15 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; +import androidx.transition.Transition; +import androidx.transition.TransitionInflater; import com.google.android.material.textfield.TextInputLayout; -import com.google.android.material.transition.MaterialContainerTransform; import com.m2049r.xmrwallet.data.Subaddress; import com.m2049r.xmrwallet.layout.TransactionInfoAdapter; import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.util.Helper; -import com.m2049r.xmrwallet.util.ThemeHelper; import com.m2049r.xmrwallet.widget.Toolbar; import java.util.ArrayList; @@ -102,10 +102,8 @@ public class SubaddressInfoFragment extends Fragment @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final MaterialContainerTransform transform = new MaterialContainerTransform(); - transform.setDrawingViewId(R.id.fragment_container); - transform.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - transform.setAllContainerColors(ThemeHelper.getThemedColor(getContext(), android.R.attr.colorBackground)); + Transition transform = TransitionInflater.from(requireContext()) + .inflateTransition(R.transition.details); setSharedElementEnterTransition(transform); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java b/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java index 2160651b..82be82be 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java @@ -36,9 +36,9 @@ import android.widget.Toast; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import androidx.transition.Transition; +import androidx.transition.TransitionInflater; -import com.google.android.material.transition.MaterialContainerTransform; -import com.google.android.material.transition.MaterialElevationScale; import com.m2049r.xmrwallet.data.Subaddress; import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.model.TransactionInfo; @@ -96,13 +96,6 @@ public class TxFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_tx_info, container, false); - final MaterialElevationScale exitTransition = new MaterialElevationScale(false); - exitTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setExitTransition(exitTransition); - final MaterialElevationScale reenterTransition = new MaterialElevationScale(true); - reenterTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setReenterTransition(reenterTransition); - cvXmrTo = view.findViewById(R.id.cvXmrTo); tvTxXmrToKey = view.findViewById(R.id.tvTxXmrToKey); tvDestinationBtc = view.findViewById(R.id.tvDestinationBtc); @@ -347,10 +340,8 @@ public class TxFragment extends Fragment { public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); - final MaterialContainerTransform transform = new MaterialContainerTransform(); - transform.setDrawingViewId(R.id.fragment_container); - transform.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - transform.setAllContainerColors(ThemeHelper.getThemedColor(getContext(), android.R.attr.colorBackground)); + Transition transform = TransitionInflater.from(requireContext()) + .inflateTransition(R.transition.details); setSharedElementEnterTransition(transform); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java index c271ec0f..515d2d8a 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java @@ -43,7 +43,6 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener; -import com.google.android.material.transition.MaterialElevationScale; import com.m2049r.xmrwallet.layout.TransactionInfoAdapter; import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.Wallet; @@ -204,11 +203,6 @@ public class WalletFragment extends Fragment @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - postponeEnterTransition(); - view.getViewTreeObserver().addOnPreDrawListener(() -> { - startPostponedEnterTransition(); - return true; - }); } void showBalance(String balance) { @@ -333,19 +327,9 @@ public class WalletFragment extends Fragment // Callbacks from TransactionInfoAdapter @Override public void onInteraction(final View view, final TransactionInfo infoItem) { - final MaterialElevationScale exitTransition = new MaterialElevationScale(false); - exitTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setExitTransition(exitTransition); - final MaterialElevationScale reenterTransition = new MaterialElevationScale(true); - reenterTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration)); - setReenterTransition(reenterTransition); - activityCallback.onTxDetailsRequest(view, infoItem); } - // called from activity - - // if account index has changed scroll to top? private int accountIndex = 0; @@ -538,8 +522,6 @@ public class WalletFragment extends Fragment @Override public void onResume() { super.onResume(); - setExitTransition(null); - setReenterTransition(null); Timber.d("onResume()"); activityCallback.setTitle(walletTitle, walletSubtitle); activityCallback.setToolbarButton(Toolbar.BUTTON_NONE); diff --git a/app/src/main/res/transition/details.xml b/app/src/main/res/transition/details.xml new file mode 100644 index 00000000..1461d6ce --- /dev/null +++ b/app/src/main/res/transition/details.xml @@ -0,0 +1,3 @@ + + +