Street Mode
This commit is contained in:
@@ -23,6 +23,7 @@ object Const {
|
||||
const val FEEDBACK_ENABLED = "const.pref.feedback_enabled"
|
||||
const val SERVER_HOST = "const.pref.server_host"
|
||||
const val SERVER_PORT = "const.pref.server_port"
|
||||
const val STREET_MODE = "const.pref.street_mode"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,8 @@ import cash.z.ecc.android.R
|
||||
import cash.z.ecc.android.ZcashWalletApp
|
||||
import cash.z.ecc.android.databinding.DialogSolicitFeedbackRatingBinding
|
||||
import cash.z.ecc.android.databinding.FragmentHomeBinding
|
||||
import cash.z.ecc.android.di.DependenciesHolder
|
||||
import cash.z.ecc.android.di.DependenciesHolder.lockBox
|
||||
import cash.z.ecc.android.ext.*
|
||||
import cash.z.ecc.android.feedback.Report
|
||||
import cash.z.ecc.android.feedback.Report.Tap.*
|
||||
@@ -320,6 +322,14 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
else -> getString(R.string.home_instruction_enter_amount)
|
||||
}
|
||||
}
|
||||
|
||||
// Hide balance and history if Street Mode is enabled
|
||||
if(lockBox.getBoolean(Const.Pref.STREET_MODE)) {
|
||||
binding.textBalanceAvailable.visibility = View.INVISIBLE
|
||||
binding.labelBalance.visibility = View.INVISIBLE
|
||||
binding.textHistory.visibility = View.INVISIBLE
|
||||
binding.textSendAmount.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
fun setBanner(message: String = "", action: BannerAction = CLEAR) {
|
||||
|
||||
@@ -343,8 +343,13 @@ class ScanFragment : BaseFragment<FragmentScanBinding>() {
|
||||
} else { /* continue scanning*/
|
||||
_fragmentCameraBinding?.textScanError?.text = ""
|
||||
sendViewModel.toAddress = address
|
||||
sendViewModel.zatoshiAmount = amt.safelyConvertToBigDecimal().convertZecToZatoshi()
|
||||
sendViewModel.memo = memo
|
||||
if(amt!=null){
|
||||
sendViewModel.zatoshiAmount =
|
||||
amt.safelyConvertToBigDecimal().convertZecToZatoshi()
|
||||
}
|
||||
if(memo!=null){
|
||||
sendViewModel.memo = memo
|
||||
}
|
||||
mainActivity?.safeNavigate(R.id.action_nav_scan_to_nav_send)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package cash.z.ecc.android.ui.settings
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.ViewCompat.jumpDrawablesToCurrentState
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.fragment.app.viewModels
|
||||
import cash.z.ecc.android.R
|
||||
import cash.z.ecc.android.ZcashWalletApp
|
||||
import cash.z.ecc.android.databinding.FragmentSettingsBinding
|
||||
import cash.z.ecc.android.di.DependenciesHolder.lockBox
|
||||
import cash.z.ecc.android.di.DependenciesHolder.prefs
|
||||
import cash.z.ecc.android.ext.*
|
||||
import cash.z.ecc.android.sdk.exception.LightWalletException
|
||||
import cash.z.ecc.android.sdk.ext.collectWith
|
||||
@@ -37,6 +41,15 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>() {
|
||||
hitAreaExit.onClickNavBack()
|
||||
buttonReset.setOnClickListener(::onResetClicked)
|
||||
buttonUpdate.setOnClickListener(::onUpdateClicked)
|
||||
streetMode.setOnClickListener(::onStreetModeChecked)
|
||||
|
||||
val streetmode = lockBox.getBoolean(Const.Pref.STREET_MODE)
|
||||
if(streetmode){
|
||||
streetMode.isChecked = true
|
||||
}
|
||||
|
||||
Log.d("SilentDragon", "streetMode: $streetmode")
|
||||
|
||||
buttonUpdate.isActivated = true
|
||||
buttonReset.isActivated = true
|
||||
inputHost.doAfterTextChanged {
|
||||
@@ -79,6 +92,17 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun onStreetModeChecked(unused: View?) {
|
||||
val streetmode = lockBox.getBoolean(Const.Pref.STREET_MODE)
|
||||
Log.d("SilentDragon", "streetModeChecked! streetmode = $streetmode")
|
||||
if(streetmode) {
|
||||
lockBox.setBoolean(Const.Pref.STREET_MODE, false)
|
||||
}
|
||||
else{
|
||||
lockBox.setBoolean(Const.Pref.STREET_MODE, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onUiModelUpdated(uiModel: SettingsViewModel.UiModel) {
|
||||
twig("onUiModelUpdated:::::$uiModel")
|
||||
binding.apply {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cash.z.ecc.android.ui.settings
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.ViewModel
|
||||
import cash.z.ecc.android.di.DependenciesHolder
|
||||
import cash.z.ecc.android.ext.Const
|
||||
|
||||
@@ -109,30 +109,56 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/streetMode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:checked="false"
|
||||
android:text="Street Mode (Hides balance and tx list)"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_reset"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_input_layout_port" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_reset"
|
||||
style="@style/Zcash.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
style="@style/Zcash.Button.OutlinedButton"
|
||||
android:text="@string/settings_reset"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:textColor="@color/selector_secondary_button_activatable"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_update"
|
||||
app:layout_constraintTop_toTopOf="@id/button_update"
|
||||
app:layout_constraintTop_toBottomOf="@+id/streetMode"
|
||||
app:strokeColor="@color/selector_secondary_button_activatable" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/button_reset"
|
||||
app:layout_constraintStart_toStartOf="@id/icon_exit"
|
||||
app:layout_constraintTop_toTopOf="@id/button_reset"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_update"
|
||||
style="@style/Zcash.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
style="@style/Zcash.Button"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:text="@string/settings_update"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
app:layout_constraintEnd_toEndOf="@id/text_input_layout_host"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_input_layout_port" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/streetMode" />
|
||||
|
||||
<View
|
||||
android:id="@+id/loading_view"
|
||||
@@ -142,16 +168,9 @@
|
||||
android:clickable="true"
|
||||
android:elevation="8dp"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/button_reset"
|
||||
app:layout_constraintStart_toStartOf="@id/icon_exit"
|
||||
app:layout_constraintTop_toTopOf="@id/button_reset" />
|
||||
android:focusableInTouchMode="true"
|
||||
tools:layout_editor_absoluteX="81dp"
|
||||
tools:layout_editor_absoluteY="16dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_loading"
|
||||
|
||||
Reference in New Issue
Block a user