bugfixes and transition animation

This commit is contained in:
Kevin Gorham 2019-02-01 11:10:43 -05:00 committed by Kevin Gorham
parent 77931bf143
commit fd59c36f99
12 changed files with 142 additions and 32 deletions

View File

@ -4,9 +4,7 @@ import cash.z.android.wallet.ui.activity.MainActivityModule
import cash.z.android.wallet.ZcashWalletApplication import cash.z.android.wallet.ZcashWalletApplication
import cash.z.android.wallet.di.module.ApplicationModule import cash.z.android.wallet.di.module.ApplicationModule
import cash.z.android.wallet.di.module.SynchronizerModule import cash.z.android.wallet.di.module.SynchronizerModule
import cash.z.android.wallet.ui.fragment.HomeFragmentModule import cash.z.android.wallet.ui.fragment.*
import cash.z.android.wallet.ui.fragment.ReceiveFragmentModule
import cash.z.android.wallet.ui.fragment.SendFragmentModule
import dagger.Component import dagger.Component
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.support.AndroidSupportInjectionModule import dagger.android.support.AndroidSupportInjectionModule
@ -23,9 +21,16 @@ import javax.inject.Singleton
ApplicationModule::class, ApplicationModule::class,
SynchronizerModule::class, SynchronizerModule::class,
MainActivityModule::class, MainActivityModule::class,
// Injected Fragments
AboutFragmentModule::class,
HistoryFragmentModule::class,
HomeFragmentModule::class, HomeFragmentModule::class,
ImportFragmentModule::class,
ReceiveFragmentModule::class, ReceiveFragmentModule::class,
SendFragmentModule::class RequestFragmentModule::class,
SendFragmentModule::class,
SettingsFragmentModule::class
] ]
) )
interface ApplicationComponent : AndroidInjector<ZcashWalletApplication> { interface ApplicationComponent : AndroidInjector<ZcashWalletApplication> {

View File

@ -1,4 +1,13 @@
package cash.z.android.wallet.ui.fragment package cash.z.android.wallet.ui.fragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
class AboutFragment : PlaceholderFragment()
class AboutFragment : PlaceholderFragment()
@Module
abstract class AboutFragmentModule {
@ContributesAndroidInjector
abstract fun contributeAboutFragment(): AboutFragment
}

View File

@ -1,4 +1,13 @@
package cash.z.android.wallet.ui.fragment package cash.z.android.wallet.ui.fragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
class HistoryFragment : PlaceholderFragment()
class HistoryFragment : PlaceholderFragment()
@Module
abstract class HistoryFragmentModule {
@ContributesAndroidInjector
abstract fun contributeHistoryFragment(): HistoryFragment
}

View File

@ -14,6 +14,9 @@ import androidx.annotation.IdRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.transition.ChangeBounds
import androidx.transition.TransitionInflater
import androidx.transition.TransitionSet
import cash.z.android.wallet.R import cash.z.android.wallet.R
import cash.z.android.wallet.extention.toAppColor import cash.z.android.wallet.extention.toAppColor
import cash.z.android.wallet.extention.toAppString import cash.z.android.wallet.extention.toAppString
@ -50,6 +53,19 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
viewsInitialized = false viewsInitialized = false
val enterTransitionSet = TransitionSet().apply {
addTransition(TransitionInflater.from(mainActivity).inflateTransition(android.R.transition.move))
duration = 400L
}
this.sharedElementEnterTransition = enterTransitionSet
this.sharedElementReturnTransition = enterTransitionSet
// sharedElementEnterTransition = ChangeBounds().apply {
// duration = 750
// }
// sharedElementReturnTransition= ChangeBounds().apply {
// duration = 750
// }
return inflater.inflate(R.layout.fragment_home, container, false) return inflater.inflate(R.layout.fragment_home, container, false)
} }
@ -69,10 +85,10 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
group_empty_view_items.visibility = View.GONE group_empty_view_items.visibility = View.GONE
group_full_view_items.visibility = View.GONE group_full_view_items.visibility = View.GONE
image_logo.setOnClickListener { // image_logo.setOnClickListener {
forceRedraw() // forceRedraw()
toggleViews(false) // toggleViews(false)
} // }
} }
override fun onResume() { override fun onResume() {

View File

@ -1,4 +1,13 @@
package cash.z.android.wallet.ui.fragment package cash.z.android.wallet.ui.fragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
class ImportFragment : PlaceholderFragment()
class ImportFragment : PlaceholderFragment()
@Module
abstract class ImportFragmentModule {
@ContributesAndroidInjector
abstract fun contributeImportFragment(): ImportFragment
}

View File

@ -9,6 +9,8 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import cash.z.android.wallet.R import cash.z.android.wallet.R
import cash.z.android.wallet.ui.activity.MainActivity import cash.z.android.wallet.ui.activity.MainActivity
import dagger.Module
import dagger.android.ContributesAndroidInjector
// TODO: Rename parameter arguments, choose names that match // TODO: Rename parameter arguments, choose names that match
@ -108,3 +110,9 @@ class RequestFragment : BaseFragment() {
} }
} }
} }
@Module
abstract class RequestFragmentModule {
@ContributesAndroidInjector
abstract fun contributeRequestFragment(): RequestFragment
}

View File

@ -9,6 +9,9 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.text.toSpannable import androidx.core.text.toSpannable
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.transition.TransitionInflater
import androidx.transition.TransitionSet
import cash.z.android.wallet.R import cash.z.android.wallet.R
import cash.z.android.wallet.extention.Toaster import cash.z.android.wallet.extention.Toaster
import cash.z.android.wallet.extention.afterTextChanged import cash.z.android.wallet.extention.afterTextChanged
@ -76,7 +79,8 @@ class SendFragment : BaseFragment(), SendPresenter.SendView {
} }
button_send_zec.setOnClickListener { button_send_zec.setOnClickListener {
onSendZec() // onSendZec()
onSendSuccess()
} }
// onBalanceUpdated(12.82129334) // onBalanceUpdated(12.82129334)
@ -102,7 +106,23 @@ class SendFragment : BaseFragment(), SendPresenter.SendView {
override fun onSendSuccess() { override fun onSendSuccess() {
setSendEnabled(true) setSendEnabled(true)
mainActivity.navController.navigateUp()
val enterTransitionSet = TransitionSet()
enterTransitionSet.addTransition(TransitionInflater.from(mainActivity).inflateTransition(android.R.transition.explode))
enterTransitionSet.duration = 1000L
enterTransitionSet.startDelay = 10L
this.sharedElementEnterTransition = enterTransitionSet
this.sharedElementReturnTransition = enterTransition
// mainActivity.navController.navigateUp()
val extras = FragmentNavigatorExtras(
transition_active_transaction_bg to getString(R.string.transition_active_transaction))
mainActivity.navController.navigate(R.id.nav_home_fragment,
null,
null,
extras)
} }
override fun onSendFailure() { override fun onSendFailure() {

View File

@ -1,4 +1,13 @@
package cash.z.android.wallet.ui.fragment package cash.z.android.wallet.ui.fragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
class SettingsFragment : PlaceholderFragment()
class SettingsFragment : PlaceholderFragment()
@Module
abstract class SettingsFragmentModule {
@ContributesAndroidInjector
abstract fun contributeSettingsFragment(): SettingsFragment
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" /> <corners android:radius="8dp" />
<solid android:color="@color/zcashWhite" /> <solid android:color="@color/zcashBlue" />
<!--<solid android:color="@color/zcashWhite_87" />-->
</shape> </shape>

View File

@ -63,17 +63,13 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/background_header" /> app:layout_constraintTop_toTopOf="@id/background_header" />
<TextView <View
android:id="@+id/text_amount_background" android:id="@+id/transition_active_transaction_bg"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:background="@drawable/background_rounded_corners" android:background="@drawable/background_rounded_corners"
android:backgroundTint="@color/zcashWhite_87" android:transitionName="@string/transition_active_transaction"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:text="@string/send_label_amount"
android:textColor="@color/text_dark"
app:layout_constraintBottom_toTopOf="@id/input_zcash_address" app:layout_constraintBottom_toTopOf="@id/input_zcash_address"
app:layout_constraintEnd_toEndOf="@id/guideline_content_end" app:layout_constraintEnd_toEndOf="@id/guideline_content_end"
app:layout_constraintHeight_default="percent" app:layout_constraintHeight_default="percent"
@ -82,6 +78,18 @@
app:layout_constraintTop_toBottomOf="@id/background_header" app:layout_constraintTop_toBottomOf="@id/background_header"
app:layout_constraintVertical_chainStyle="spread_inside" /> app:layout_constraintVertical_chainStyle="spread_inside" />
<TextView
android:id="@+id/text_amount_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:text="@string/send_label_amount"
android:textColor="@color/text_dark"
app:layout_constraintStart_toStartOf="@id/transition_active_transaction_bg"
app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg" />
<!-- Currency swap symbol --> <!-- Currency swap symbol -->
<ImageView <ImageView
android:id="@+id/image_swap_currency" android:id="@+id/image_swap_currency"
@ -91,9 +99,9 @@
android:backgroundTint="@color/zcashPrimaryMedium" android:backgroundTint="@color/zcashPrimaryMedium"
android:foregroundTint="@color/colorAccent" android:foregroundTint="@color/colorAccent"
android:tint="@color/zcashGray_light" android:tint="@color/zcashGray_light"
app:layout_constraintBottom_toBottomOf="@id/text_amount_background" app:layout_constraintBottom_toBottomOf="@id/transition_active_transaction_bg"
app:layout_constraintEnd_toEndOf="@id/text_amount_background" app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
app:layout_constraintTop_toTopOf="@id/text_amount_background" app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg"
app:srcCompat="@drawable/ic_import_export_black" /> app:srcCompat="@drawable/ic_import_export_black" />
<EditText <EditText
@ -107,10 +115,10 @@
android:textColor="@color/text_dark" android:textColor="@color/text_dark"
android:textSize="@dimen/text_size_h3" android:textSize="@dimen/text_size_h3"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/text_amount_background" app:layout_constraintBottom_toBottomOf="@id/transition_active_transaction_bg"
app:layout_constraintEnd_toEndOf="@id/text_amount_background" app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
app:layout_constraintStart_toStartOf="@id/text_amount_background" app:layout_constraintStart_toStartOf="@id/transition_active_transaction_bg"
app:layout_constraintTop_toTopOf="@id/text_amount_background" /> app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg" />
<TextView <TextView
android:id="@+id/text_value_subheader" android:id="@+id/text_value_subheader"
@ -178,7 +186,7 @@
app:layout_constraintEnd_toEndOf="@id/guideline_content_end" app:layout_constraintEnd_toEndOf="@id/guideline_content_end"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@id/guideline_content_start" app:layout_constraintStart_toStartOf="@id/guideline_content_start"
app:layout_constraintTop_toBottomOf="@id/text_amount_background" /> app:layout_constraintTop_toBottomOf="@id/transition_active_transaction_bg" />
<!-- Scan QR code --> <!-- Scan QR code -->
<ImageView <ImageView

View File

@ -11,20 +11,33 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="16dp"> android:paddingTop="30dp"
android:paddingBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<View
android:id="@+id/transition_active_transaction_bg"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/background_rounded_corners"
android:transitionName="@string/transition_active_transaction"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<!-- Label: Past Activity --> <!-- Label: Past Activity -->
<TextView <TextView
android:id="@+id/text_transaction_header" android:id="@+id/text_transaction_header"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Past Activity" android:text="Past Activity"
android:textColor="@color/text_dark" android:textColor="@color/text_dark"
android:textSize="@dimen/text_size_body_2" android:textSize="@dimen/text_size_body_2"
android:textStyle="bold" android:textStyle="bold"
android:paddingBottom="16dp" android:paddingBottom="16dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@id/transition_active_transaction_bg" />
<!-- Transactions --> <!-- Transactions -->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView

View File

@ -26,6 +26,9 @@
<string name="destination_menu_label_import">Import</string> <string name="destination_menu_label_import">Import</string>
<string name="destination_menu_label_settings">Settings</string> <string name="destination_menu_label_settings">Settings</string>
<!-- Transitions -->
<string name="transition_active_transaction">transition_active_transaction</string>
<!-- Screen copy --> <!-- Screen copy -->
<string name="receive_address_title">Your Zcash shielded address</string> <string name="receive_address_title">Your Zcash shielded address</string>
<string name="home_empty_wallet">Your wallet is empty.</string> <string name="home_empty_wallet">Your wallet is empty.</string>