Checkpoint prior to build cleanup
This commit is contained in:
parent
6a8cc9bc6c
commit
c7712f58eb
Binary file not shown.
|
@ -85,10 +85,16 @@ internal object SynchronizerModule {
|
||||||
|
|
||||||
// TODO: load most of these properties in later, perhaps from settings
|
// TODO: load most of these properties in later, perhaps from settings
|
||||||
object Properties {
|
object Properties {
|
||||||
// const val COMPACT_BLOCK_SERVER = "10.0.0.26"
|
val COMPACT_BLOCK_SERVER = Servers.ZCASH_TESTNET.host
|
||||||
const val COMPACT_BLOCK_SERVER = "lightwalletd.z.cash"
|
|
||||||
const val COMPACT_BLOCK_PORT = 9067
|
const val COMPACT_BLOCK_PORT = 9067
|
||||||
const val CACHE_DB_NAME = "wallet_cache9.db"
|
const val CACHE_DB_NAME = "wallet_cache19.db"
|
||||||
const val DATA_DB_NAME = "wallet_data9.db"
|
const val DATA_DB_NAME = "wallet_data19.db"
|
||||||
val SEED_PROVIDER = SampleSeedProvider("dummyseed")
|
val SEED_PROVIDER = SampleSeedProvider("dummyseed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class Servers(val host: String) {
|
||||||
|
EMULATOR("10.0.2.2"),
|
||||||
|
WLAN("10.0.0.26"),
|
||||||
|
BOLT_TESTNET("ec2-34-228-10-162.compute-1.amazonaws.com"),
|
||||||
|
ZCASH_TESTNET("lightwalletd.z.cash")
|
||||||
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import androidx.core.view.GravityCompat
|
import androidx.core.view.GravityCompat
|
||||||
import androidx.core.view.doOnLayout
|
import androidx.core.view.doOnLayout
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.NavDestination
|
import androidx.navigation.NavDestination
|
||||||
import androidx.navigation.Navigation
|
import androidx.navigation.Navigation
|
||||||
|
@ -77,6 +78,10 @@ class MainActivity : BaseActivity() {
|
||||||
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
|
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setDrawerLocked(isLocked: Boolean) {
|
||||||
|
drawer_layout.setDrawerLockMode(if (isLocked) DrawerLayout.LOCK_MODE_LOCKED_CLOSED else DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||||
|
}
|
||||||
|
|
||||||
fun setupNavigation() {
|
fun setupNavigation() {
|
||||||
// create and setup the navController and appbarConfiguration
|
// create and setup the navController and appbarConfiguration
|
||||||
navController = Navigation.findNavController(this, R.id.nav_host_fragment).also { n ->
|
navController = Navigation.findNavController(this, R.id.nav_host_fragment).also { n ->
|
||||||
|
|
|
@ -29,8 +29,10 @@ import cash.z.android.wallet.ui.presenter.HomePresenter
|
||||||
import cash.z.android.wallet.ui.util.AlternatingRowColorDecoration
|
import cash.z.android.wallet.ui.util.AlternatingRowColorDecoration
|
||||||
import cash.z.android.wallet.ui.util.TopAlignedSpan
|
import cash.z.android.wallet.ui.util.TopAlignedSpan
|
||||||
import cash.z.android.wallet.vo.WalletTransaction
|
import cash.z.android.wallet.vo.WalletTransaction
|
||||||
|
import cash.z.wallet.sdk.data.ActiveSendTransaction
|
||||||
import cash.z.wallet.sdk.data.ActiveTransaction
|
import cash.z.wallet.sdk.data.ActiveTransaction
|
||||||
import cash.z.wallet.sdk.data.TransactionState
|
import cash.z.wallet.sdk.data.TransactionState
|
||||||
|
import cash.z.wallet.sdk.ext.toZec
|
||||||
import com.leinardi.android.speeddial.SpeedDialActionItem
|
import com.leinardi.android.speeddial.SpeedDialActionItem
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
@ -68,7 +70,7 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
private fun setupSharedElementTransitions() {
|
private fun setupSharedElementTransitions() {
|
||||||
val enterTransitionSet =
|
val enterTransitionSet =
|
||||||
TransitionInflater.from(mainActivity).inflateTransition(R.transition.transition_zec_sent).apply {
|
TransitionInflater.from(mainActivity).inflateTransition(R.transition.transition_zec_sent).apply {
|
||||||
duration = 300L
|
duration = 3000L
|
||||||
}.addListener(HomeTransitionListener())
|
}.addListener(HomeTransitionListener())
|
||||||
|
|
||||||
this.sharedElementEnterTransition = enterTransitionSet
|
this.sharedElementEnterTransition = enterTransitionSet
|
||||||
|
@ -106,22 +108,24 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
onCancelActiveTransaction()
|
onCancelActiveTransaction()
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_layout.setOnRefreshListener {
|
// refresh_layout.setOnRefreshListener {
|
||||||
val fauxRefresh = Random.nextLong(750L..3000L)
|
// val fauxRefresh = Random.nextLong(750L..3000L)
|
||||||
refresh_layout.postDelayed({
|
// refresh_layout.postDelayed({
|
||||||
refresh_layout.isRefreshing = false
|
// refresh_layout.isRefreshing = false
|
||||||
}, fauxRefresh)
|
// }, fauxRefresh)
|
||||||
|
// }
|
||||||
|
|
||||||
|
launch {
|
||||||
|
setFirstRunShown(mainActivity.synchronizer.isFirstRun())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainActivity.synchronizer.processor.dataDbExists) {
|
// refresh_layout.setProgressViewEndTarget(false, (86f * resources.displayMetrics.density).toInt())
|
||||||
container_first_run.visibility = View.GONE
|
}
|
||||||
mainActivity.findViewById<DrawerLayout>(R.id.drawer_layout).setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
|
||||||
sd_fab.visibility = View.VISIBLE
|
private fun setFirstRunShown(isShown: Boolean) {
|
||||||
} else {
|
container_first_run?.visibility = if (isShown) View.VISIBLE else View.GONE
|
||||||
container_first_run.visibility = View.VISIBLE
|
mainActivity.setDrawerLocked(isShown)
|
||||||
mainActivity.findViewById<DrawerLayout>(R.id.drawer_layout).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
sd_fab?.visibility = if (!isShown) View.VISIBLE else View.GONE
|
||||||
sd_fab.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -180,6 +184,7 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
Log.e("TWIG-t", "submitList called with ${transactions.size} transactions")
|
Log.e("TWIG-t", "submitList called with ${transactions.size} transactions")
|
||||||
transactionAdapter.submitList(transactions)
|
transactionAdapter.submitList(transactions)
|
||||||
recycler_transactions.smoothScrollToPosition(0)
|
recycler_transactions.smoothScrollToPosition(0)
|
||||||
|
if (transactions.isNotEmpty()) setFirstRunShown(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
var snackbar: Snackbar? = null
|
var snackbar: Snackbar? = null
|
||||||
|
@ -202,12 +207,6 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
snackbar?.setText(message)
|
snackbar?.setText(message)
|
||||||
if(progress == 100 && snackbar?.isShownOrQueued != true) snackbar?.show()
|
if(progress == 100 && snackbar?.isShownOrQueued != true) snackbar?.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress >= 100) {
|
|
||||||
container_first_run.visibility = View.GONE
|
|
||||||
mainActivity.findViewById<DrawerLayout>(R.id.drawer_layout).setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
|
||||||
sd_fab.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setActiveTransactions(activeTransactionMap: Map<ActiveTransaction, TransactionState>) {
|
override fun setActiveTransactions(activeTransactionMap: Map<ActiveTransaction, TransactionState>) {
|
||||||
|
@ -229,13 +228,13 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
var subtitle = "Processing..."
|
var subtitle = "Processing..."
|
||||||
when (transactionState) {
|
when (transactionState) {
|
||||||
TransactionState.Creating -> {
|
TransactionState.Creating -> {
|
||||||
title = "Preparing ${transaction.value} ZEC"
|
title = "Preparing ${transaction.value.toZec(2)} ZEC"
|
||||||
subtitle = "to ********"
|
subtitle = "to ${(transaction as ActiveSendTransaction).toAddress}"
|
||||||
button_active_transaction_cancel.text = "cancel"
|
button_active_transaction_cancel.text = "cancel"
|
||||||
}
|
}
|
||||||
TransactionState.SendingToNetwork -> {
|
TransactionState.SendingToNetwork -> {
|
||||||
title = "Sending Transaction"
|
title = "Sending Transaction"
|
||||||
subtitle = "to ********"
|
subtitle = "to ${(transaction as ActiveSendTransaction).toAddress}"
|
||||||
button_active_transaction_cancel.text = "${transaction.value/1000L}"
|
button_active_transaction_cancel.text = "${transaction.value/1000L}"
|
||||||
}
|
}
|
||||||
is TransactionState.Failure -> {
|
is TransactionState.Failure -> {
|
||||||
|
@ -336,11 +335,12 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
if (situationHasChanged) {
|
if (situationHasChanged) {
|
||||||
Log.e("TWIG-t", "The situation has changed! toggling views!")
|
Log.e("TWIG-t", "The situation has changed! toggling views!")
|
||||||
toggleViews(isEmpty)
|
toggleViews(isEmpty)
|
||||||
|
if (!isEmpty) setFirstRunShown(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onActiveTransactionTransitionStart() {
|
private fun onActiveTransactionTransitionStart() {
|
||||||
|
button_active_transaction_cancel.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onActiveTransactionTransitionEnd() {
|
private fun onActiveTransactionTransitionEnd() {
|
||||||
|
@ -348,6 +348,7 @@ class HomeFragment : BaseFragment(), HomePresenter.HomeView {
|
||||||
header_active_transaction.translationZ = 10.0f
|
header_active_transaction.translationZ = 10.0f
|
||||||
button_active_transaction_cancel.apply {
|
button_active_transaction_cancel.apply {
|
||||||
postDelayed({text = "cancel"}, 50L)
|
postDelayed({text = "cancel"}, 50L)
|
||||||
|
visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,13 +102,6 @@ class HomePresenter(
|
||||||
|
|
||||||
private fun bind(progress: Int) = onMain {
|
private fun bind(progress: Int) = onMain {
|
||||||
view.showProgress(progress)
|
view.showProgress(progress)
|
||||||
if (progress == 100) {
|
|
||||||
launch {
|
|
||||||
// TODO: remove this behavior and pull it down into the synchronizer
|
|
||||||
Log.e("@TWIG-t", "triggering manual scan!")
|
|
||||||
synchronizer.processor.scanBlocks()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bind(activeTransactionMap: Map<ActiveTransaction, TransactionState>) = onMain {
|
private fun bind(activeTransactionMap: Map<ActiveTransaction, TransactionState>) = onMain {
|
||||||
|
|
|
@ -18,17 +18,20 @@
|
||||||
android:id="@+id/container_first_run"
|
android:id="@+id/container_first_run"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone"
|
android:background="#81CAFF"
|
||||||
android:background="#81CAFF">
|
android:clickable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<cash.z.android.wallet.ui.util.ViewpagerHeader
|
<cash.z.android.wallet.ui.util.ViewpagerHeader
|
||||||
|
android:id="@+id/scenic_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="230dp"
|
android:layout_height="260dp"
|
||||||
app:layoutDescription="@xml/scene_15"
|
app:layoutDescription="@xml/scene_15"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/mountains"
|
android:id="@+id/mountains"
|
||||||
|
@ -62,4 +65,28 @@
|
||||||
tools:layout_editor_absoluteY="194dp" />
|
tools:layout_editor_absoluteY="194dp" />
|
||||||
|
|
||||||
</cash.z.android.wallet.ui.util.ViewpagerHeader>
|
</cash.z.android.wallet.ui.util.ViewpagerHeader>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/first_run_message"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="36dp"
|
||||||
|
android:text="Initializing first run!"
|
||||||
|
android:textColor="@color/zcashBlack_40"
|
||||||
|
android:textSize="@dimen/text_size_h6"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/scenic_view" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/first_run_submessage"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Enjoy the view because this may take a while..."
|
||||||
|
android:textColor="@color/zcashBlack_40"
|
||||||
|
android:textSize="@dimen/text_size_subtitle_1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/first_run_message" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -9,10 +9,10 @@
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<!--<androidx.swiperefreshlayout.widget.SwipeRefreshLayout-->
|
||||||
android:id="@+id/refresh_layout"
|
<!--android:id="@+id/refresh_layout"-->
|
||||||
android:layout_width="wrap_content"
|
<!--android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content">
|
<!--android:layout_height="wrap_content">-->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/content_home"
|
android:id="@+id/content_home"
|
||||||
|
@ -156,5 +156,5 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="image_empty_wallet,text_wallet_message" />
|
app:constraint_referenced_ids="image_empty_wallet,text_wallet_message" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
<!--</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>-->
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
Loading…
Reference in New Issue