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

View File

@ -1,4 +1,13 @@
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
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.recyclerview.widget.LinearLayoutManager
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.extention.toAppColor
import cash.z.android.wallet.extention.toAppString
@ -50,6 +53,19 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
savedInstanceState: Bundle?
): View? {
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)
}
@ -69,10 +85,10 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
group_empty_view_items.visibility = View.GONE
group_full_view_items.visibility = View.GONE
image_logo.setOnClickListener {
forceRedraw()
toggleViews(false)
}
// image_logo.setOnClickListener {
// forceRedraw()
// toggleViews(false)
// }
}
override fun onResume() {

View File

@ -1,4 +1,13 @@
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 cash.z.android.wallet.R
import cash.z.android.wallet.ui.activity.MainActivity
import dagger.Module
import dagger.android.ContributesAndroidInjector
// 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.ViewGroup
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.extention.Toaster
import cash.z.android.wallet.extention.afterTextChanged
@ -76,7 +79,8 @@ class SendFragment : BaseFragment(), SendPresenter.SendView {
}
button_send_zec.setOnClickListener {
onSendZec()
// onSendZec()
onSendSuccess()
}
// onBalanceUpdated(12.82129334)
@ -102,7 +106,23 @@ class SendFragment : BaseFragment(), SendPresenter.SendView {
override fun onSendSuccess() {
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() {

View File

@ -1,4 +1,13 @@
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"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" />
<solid android:color="@color/zcashWhite" />
<solid android:color="@color/zcashBlue" />
<!--<solid android:color="@color/zcashWhite_87" />-->
</shape>

View File

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

View File

@ -11,20 +11,33 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="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 -->
<TextView
android:id="@+id/text_transaction_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Past Activity"
android:textColor="@color/text_dark"
android:textSize="@dimen/text_size_body_2"
android:textStyle="bold"
android:paddingBottom="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/transition_active_transaction_bg" />
<!-- Transactions -->
<androidx.recyclerview.widget.RecyclerView

View File

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