Updated on 2026-08-14
This commit is contained in:
parent
434a8ac74f
commit
88b14a06ca
7 changed files with 161 additions and 58 deletions
|
|
@ -29,6 +29,8 @@ import com.tangem.wallet.R
|
|||
import kotlinx.android.synthetic.main.card_balance.*
|
||||
import kotlinx.android.synthetic.main.fragment_wallet.*
|
||||
import kotlinx.android.synthetic.main.layout_address.*
|
||||
import kotlinx.android.synthetic.main.layout_wallet_long_buttons.*
|
||||
import kotlinx.android.synthetic.main.layout_wallet_short_buttons.*
|
||||
import org.rekotlin.StoreSubscriber
|
||||
|
||||
|
||||
|
|
@ -39,7 +41,6 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
|
||||
private lateinit var viewAdapter: PendingTransactionsAdapter
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setHasOptionsMenu(true)
|
||||
|
|
@ -74,10 +75,6 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
toolbar.setNavigationOnClickListener {
|
||||
store.dispatch(NavigationAction.PopBackTo(AppScreen.Home))
|
||||
}
|
||||
|
||||
btn_scan.setOnClickListener {
|
||||
store.dispatch(WalletAction.Scan)
|
||||
}
|
||||
setupTransactionsRecyclerView()
|
||||
}
|
||||
|
||||
|
|
@ -161,6 +158,29 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
}
|
||||
|
||||
private fun setupButtons(state: WalletState) {
|
||||
if (state.topUpState.allowed) {
|
||||
l_buttons_long.hide()
|
||||
l_buttons_short.show()
|
||||
} else {
|
||||
l_buttons_long.show()
|
||||
l_buttons_short.hide()
|
||||
}
|
||||
|
||||
val btnConfirm = if (state.topUpState.allowed) {
|
||||
btn_confirm_short
|
||||
} else {
|
||||
btn_confirm_long
|
||||
}
|
||||
val btnScan = if (state.topUpState.allowed) {
|
||||
btn_scan_short
|
||||
} else {
|
||||
btn_scan_long
|
||||
}
|
||||
|
||||
btnScan.setOnClickListener {
|
||||
store.dispatch(WalletAction.Scan)
|
||||
}
|
||||
|
||||
btn_copy.setOnClickListener { store.dispatch(WalletAction.CopyAddress(requireContext())) }
|
||||
btn_show_qr.setOnClickListener { store.dispatch(WalletAction.ShowQrCode) }
|
||||
|
||||
|
|
@ -168,11 +188,10 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
is WalletMainButton.SendButton -> R.string.wallet_button_send
|
||||
is WalletMainButton.CreateWalletButton -> R.string.wallet_button_create_wallet
|
||||
}
|
||||
btn_confirm.text = getString(buttonTitle)
|
||||
btn_confirm.isEnabled = state.mainButton.enabled
|
||||
btn_top_up.isEnabled = state.topUpState.allowed
|
||||
btnConfirm.text = getString(buttonTitle)
|
||||
btnConfirm.isEnabled = state.mainButton.enabled
|
||||
|
||||
btn_confirm.setOnClickListener {
|
||||
btnConfirm.setOnClickListener {
|
||||
when (state.mainButton) {
|
||||
is WalletMainButton.SendButton -> store.dispatch(WalletAction.Send())
|
||||
is WalletMainButton.CreateWalletButton -> store.dispatch(WalletAction.CreateWallet)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="19dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="19">
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M11.4765,5.7026L6.7623,10.0101C6.4406,10.2874 6.412,10.8356 6.692,11.1572C6.972,11.4788 7.5063,11.5112 7.8099,11.2131L11.2146,8.1003L11.2146,18.6923C11.2146,19.1384 11.5664,19.5 12.0003,19.5C12.4342,19.5 12.7859,19.1384 12.7859,18.6923L12.7859,8.1003L16.1906,11.2131C16.4942,11.5112 17.0275,11.4709 17.3076,11.1493C17.5876,10.8277 17.5599,10.2874 17.2382,10.0101L12.524,5.7026C12.1429,5.4214 11.8008,5.4438 11.4765,5.7026L11.4765,5.7026Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
|
|
|
|||
15
app/src/main/res/drawable/ic_group_1243.xml
Normal file
15
app/src/main/res/drawable/ic_group_1243.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="13dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="13"
|
||||
android:viewportHeight="18">
|
||||
<path
|
||||
android:pathData="M11.7908,6.0129C10.9896,3.7531 9.3666,1.9247 7.1993,0.8873C5.032,-0.1502 2.5873,-0.2837 0.3275,0.5175L0.2762,0.538C0.1734,0.5791 0.081,0.651 0.0399,0.764C-0.0114,0.8667 -0.0114,0.99 0.0296,1.0927C0.1221,1.329 0.3789,1.442 0.6254,1.3598C2.6695,0.6408 4.8676,0.764 6.809,1.6988C8.7606,2.6335 10.2295,4.277 10.9485,6.3108C11.2566,7.1839 11.4107,8.0878 11.4107,9.002C11.4107,9.9162 11.2566,10.8201 10.9485,11.6932C10.2295,13.7372 8.7606,15.3704 6.809,16.3052C4.8573,17.2399 2.6592,17.3632 0.6151,16.6441C0.3789,16.562 0.1221,16.6749 0.0296,16.9112C-0.0114,17.0242 -0.0114,17.1372 0.0399,17.2399C0.0913,17.3426 0.1734,17.4248 0.2864,17.4659L0.3378,17.4864C1.3136,17.8254 2.3202,18 3.3269,18C4.6519,18 5.977,17.7021 7.2096,17.1166C9.3769,16.0792 11.0101,14.2611 11.801,11.991C12.14,11.0255 12.3146,10.0189 12.3146,9.0122C12.3044,7.9851 12.1297,6.9784 11.7908,6.0129Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M1.1703,14.0252C1.1183,14.1498 1.1287,14.2848 1.1806,14.4095C1.2326,14.5341 1.3364,14.6172 1.4715,14.6588C2.0532,14.8457 2.6556,14.9392 3.2581,14.9392C3.9644,14.9392 4.6707,14.8146 5.3251,14.5549C6.7689,14.0044 7.9115,12.9137 8.5347,11.5011C8.8671,10.7532 9.0333,9.9742 9.0333,9.1744V9.0082C9.0126,8.2499 8.8464,7.502 8.5347,6.7957C7.9011,5.383 6.7689,4.3028 5.3251,3.7419C4.0787,3.2641 2.6972,3.2329 1.4299,3.6484C1.3157,3.6899 1.2118,3.773 1.1599,3.8873C1.1079,4.0016 1.1079,4.1262 1.1495,4.2405C1.2326,4.4586 1.4819,4.5729 1.7104,4.5001C2.7803,4.147 3.954,4.1677 5.0031,4.5729C6.2184,5.0403 7.1844,5.9543 7.7142,7.1489C7.9946,7.7721 8.1296,8.4265 8.14,9.1017V9.1328C8.14,9.8184 7.9946,10.4831 7.7142,11.1167C7.1844,12.3113 6.2184,13.2253 5.0031,13.6928C3.9436,14.0979 2.7699,14.1186 1.6896,13.7551C1.4819,13.7135 1.243,13.8174 1.1703,14.0252Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M3.9148,10.5778C3.6136,10.692 3.2812,10.7128 2.9592,10.6297C2.7619,10.5778 2.5438,10.6816 2.471,10.879V10.8894C2.4191,11.014 2.4295,11.1594 2.5022,11.2841C2.5645,11.4087 2.6892,11.5022 2.8346,11.5334C3.0112,11.5749 3.1774,11.5853 3.3539,11.5853C3.6552,11.5853 3.9564,11.5334 4.2472,11.4191C5.2028,11.0556 5.8469,10.1207 5.8469,9.0924C5.8469,8.0641 5.2028,7.1396 4.2472,6.7657C3.7694,6.5787 3.2501,6.5476 2.7411,6.6722C2.6268,6.7034 2.523,6.7761 2.471,6.8903C2.4191,6.9942 2.4087,7.1188 2.4503,7.2331L2.4606,7.2539C2.5438,7.472 2.7723,7.5862 3.0008,7.5447C3.302,7.472 3.624,7.4928 3.9148,7.607C4.5277,7.8356 4.9328,8.438 4.9328,9.0924C4.9328,9.7468 4.5277,10.3492 3.9148,10.5778Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
4
app/src/main/res/drawable/ic_scan_for_short_btn.xml
Normal file
4
app/src/main/res/drawable/ic_scan_for_short_btn.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
|
||||
</selector>
|
||||
|
|
@ -85,56 +85,21 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_card_balance" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/wallet_button_scan"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:drawableTop="@drawable/ic_scan"
|
||||
|
||||
<include
|
||||
android:id="@+id/l_buttons_long"
|
||||
layout="@layout/layout_wallet_long_buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_top_up"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_top_up"
|
||||
style="@style/TapButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/wallet_button_topup"
|
||||
android:drawableTop="@drawable/ic_arrow_up_short_btn"
|
||||
app:drawableTint="@android:color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_confirm"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_scan"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
/>
|
||||
<include
|
||||
android:id="@+id/l_buttons_short"
|
||||
layout="@layout/layout_wallet_short_buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_confirm"
|
||||
style="@style/TapButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
android:drawableTop="@drawable/ic_send_short_btn"
|
||||
|
||||
android:gravity="bottom|center_horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_top_up"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
|||
45
app/src/main/res/layout/layout_wallet_long_buttons.xml
Normal file
45
app/src/main/res/layout/layout_wallet_long_buttons.xml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan_long"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/wallet_button_scan"
|
||||
app:icon="@drawable/ic_scan"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintGuide_percent="0.37" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_confirm_long"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
app:icon="@drawable/ic_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
55
app/src/main/res/layout/layout_wallet_short_buttons.xml
Normal file
55
app/src/main/res/layout/layout_wallet_short_buttons.xml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan_short"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:drawableTop="@drawable/ic_group_1243"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:paddingTop="7dp"
|
||||
android:text="@string/wallet_button_scan"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_top_up"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_top_up"
|
||||
style="@style/TapButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:drawableTop="@drawable/ic_arrow_up_short_btn"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:paddingTop="1dp"
|
||||
android:text="@string/wallet_button_topup"
|
||||
app:drawableTint="@android:color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_confirm_short"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_scan_short"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_confirm_short"
|
||||
style="@style/TapButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:drawableTop="@drawable/ic_send_short_btn"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:paddingTop="2dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_top_up"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue