From da3004e9f3af74a50331aef1ba3dacffda2d4300 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 30 Nov 2022 16:49:39 +0100 Subject: [PATCH 01/33] Log files manager Signed-off-by: Aleksandr Vakhtin --- .../android/wallet/di/ApplicationComponent.kt | 91 +++++++------------ .../wallet/service/service/WalletService.kt | 3 + .../wallet/ui/common/CommonActivity.kt | 8 -- .../send/activity/SendTariActivity.kt | 8 +- .../send/activity/SendTariViewModel.kt | 11 ++- .../backup/EnterCurrentPasswordFragment.kt | 13 +-- .../deleteWallet/DeleteWalletActivity.kt | 7 +- .../fragment/settings/logs/LogFilesManager.kt | 36 ++++++++ .../fragment/tx/details/TxDetailsFragment.kt | 8 +- 9 files changed, 88 insertions(+), 97 deletions(-) create mode 100644 app/src/main/java/com/tari/android/wallet/ui/fragment/settings/logs/LogFilesManager.kt diff --git a/app/src/main/java/com/tari/android/wallet/di/ApplicationComponent.kt b/app/src/main/java/com/tari/android/wallet/di/ApplicationComponent.kt index e933dc4a1..bd4acd3ca 100644 --- a/app/src/main/java/com/tari/android/wallet/di/ApplicationComponent.kt +++ b/app/src/main/java/com/tari/android/wallet/di/ApplicationComponent.kt @@ -35,7 +35,6 @@ package com.tari.android.wallet.di import android.content.ClipboardManager import com.tari.android.wallet.application.TariWalletApplication import com.tari.android.wallet.application.deeplinks.DeeplinkViewModel -import com.tari.android.wallet.service.BootDeviceReceiver import com.tari.android.wallet.service.service.WalletService import com.tari.android.wallet.ui.common.CommonViewModel import com.tari.android.wallet.ui.component.networkStateIndicator.ConnectionIndicatorViewModel @@ -54,6 +53,7 @@ import com.tari.android.wallet.ui.fragment.restore.enterRestorationPassword.Ente import com.tari.android.wallet.ui.fragment.restore.inputSeedWords.InputSeedWordsViewModel import com.tari.android.wallet.ui.fragment.restore.walletRestoringFromSeedWords.WalletRestoringFromSeedWordsViewModel import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity +import com.tari.android.wallet.ui.fragment.send.activity.SendTariViewModel import com.tari.android.wallet.ui.fragment.send.addAmount.AddAmountViewModel import com.tari.android.wallet.ui.fragment.send.addNote.AddNoteFragment import com.tari.android.wallet.ui.fragment.send.addNote.gif.ChooseGIFDialogFragment @@ -74,6 +74,7 @@ import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.addBaseNode.A import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode.ChangeBaseNodeViewModel import com.tari.android.wallet.ui.fragment.settings.bugReporting.BugsReportingViewModel import com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletActivity +import com.tari.android.wallet.ui.fragment.settings.logs.LogFilesManager import com.tari.android.wallet.ui.fragment.settings.logs.logFiles.LogFilesViewModel import com.tari.android.wallet.ui.fragment.settings.logs.logs.LogsViewModel import com.tari.android.wallet.ui.fragment.settings.networkSelection.NetworkSelectionViewModel @@ -82,7 +83,6 @@ import com.tari.android.wallet.ui.fragment.settings.torBridges.customBridges.Cus import com.tari.android.wallet.ui.fragment.settings.userAutorization.BiometricAuthenticationViewModel import com.tari.android.wallet.ui.fragment.splash.SplashActivity import com.tari.android.wallet.ui.fragment.tx.TxListViewModel -import com.tari.android.wallet.ui.fragment.tx.details.TxDetailsFragment import com.tari.android.wallet.ui.fragment.tx.details.gif.GIFViewModel import com.tari.android.wallet.ui.fragment.utxos.list.UtxosListViewModel import dagger.Component @@ -108,68 +108,50 @@ import javax.inject.Singleton interface ApplicationComponent { - /** - * Application. - */ fun inject(application: TariWalletApplication) - /** - * Activities. - */ + fun inject(service: WalletService) + fun inject(activity: SplashActivity) fun inject(activity: OnboardingFlowActivity) fun inject(activity: AuthActivity) fun inject(activity: HomeActivity) fun inject(activity: QRScannerActivity) - fun inject(activity: SendTariActivity) - fun inject(fragment: TxDetailsFragment) fun inject(activity: DeleteWalletActivity) + fun inject(activity: WalletRestoreActivity) - /** - * Fragments. - */ fun inject(fragment: AddRecipientFragment) fun inject(fragment: AddNoteFragment) fun inject(fragment: ChooseGIFDialogFragment) - /** - * Backup. - */ fun inject(fragment: ChangeSecurePasswordFragment) fun inject(fragment: EnterCurrentPasswordFragment) - /** - * Restore. - */ - fun inject(activity: WalletRestoreActivity) - /** - * ViewModels. - */ fun inject(commonViewModel: CommonViewModel) - fun inject(thumbnailGIFsViewModel: ThumbnailGIFsViewModel) - fun inject(gifViewModel: GIFViewModel) - fun inject(backgroundServiceSettingsViewModel: BackgroundServiceSettingsViewModel) - fun inject(connectionIndicatorViewModel: ConnectionIndicatorViewModel) - fun inject(chooseRestoreOptionViewModel: ChooseRestoreOptionViewModel) - fun inject(enterRestorationPasswordViewModel: EnterRestorationPasswordViewModel) - fun inject(walletRestoringFromSeedWordsViewModel: WalletRestoringFromSeedWordsViewModel) - fun inject(inputSeedWordsViewModel: InputSeedWordsViewModel) - fun inject(verifySeedPhraseViewModel: VerifySeedPhraseViewModel) - fun inject(backupSettingsViewModel: BackupSettingsViewModel) - fun inject(biometricAuthenticationViewModel: BiometricAuthenticationViewModel) - fun inject(txListViewModel: TxListViewModel) - fun inject(changeBaseNodeViewModel: ChangeBaseNodeViewModel) - fun inject(addCustomBaseNodeViewModel: AddCustomBaseNodeViewModel) - fun inject(networkSelectionViewModel: NetworkSelectionViewModel) - fun inject(allSettingsViewModel: AllSettingsViewModel) - fun inject(addRecipientViewModel: AddRecipientViewModel) - fun inject(finalizeSentTxListViewModel: FinalizeSendTxViewModel) - fun inject(walletInfoViewModel: WalletInfoViewModel) - fun inject(requestTariViewModel: RequestTariViewModel) - fun inject(addAmountViewModel: AddAmountViewModel) - fun inject(torBridgesSelectionViewModel: TorBridgesSelectionViewModel) - fun inject(customTorBridgeViewModel: CustomTorBridgesViewModel) - fun inject(deeplinkViewModel: DeeplinkViewModel) - fun inject(localAuthViewModel: LocalAuthViewModel) + fun inject(viewModel: ThumbnailGIFsViewModel) + fun inject(viewModel: GIFViewModel) + fun inject(viewModel: BackgroundServiceSettingsViewModel) + fun inject(viewModel: ConnectionIndicatorViewModel) + fun inject(viewModel: ChooseRestoreOptionViewModel) + fun inject(viewModel: EnterRestorationPasswordViewModel) + fun inject(viewModel: WalletRestoringFromSeedWordsViewModel) + fun inject(viewModel: InputSeedWordsViewModel) + fun inject(viewModel: VerifySeedPhraseViewModel) + fun inject(viewModel: BackupSettingsViewModel) + fun inject(viewModel: BiometricAuthenticationViewModel) + fun inject(viewModel: TxListViewModel) + fun inject(viewModel: ChangeBaseNodeViewModel) + fun inject(viewModel: AddCustomBaseNodeViewModel) + fun inject(viewModel: NetworkSelectionViewModel) + fun inject(viewModel: AllSettingsViewModel) + fun inject(viewModel: AddRecipientViewModel) + fun inject(viewModel: FinalizeSendTxViewModel) + fun inject(viewModel: WalletInfoViewModel) + fun inject(viewModel: RequestTariViewModel) + fun inject(viewModel: AddAmountViewModel) + fun inject(viewModel: TorBridgesSelectionViewModel) + fun inject(viewModel: CustomTorBridgesViewModel) + fun inject(viewModel: DeeplinkViewModel) + fun inject(viewModel: LocalAuthViewModel) fun inject(viewModel: CreateWalletViewModel) fun inject(viewModel: IntroductionViewModel) fun inject(viewModel: AuthViewModel) @@ -178,16 +160,9 @@ interface ApplicationComponent { fun inject(viewModel: BugsReportingViewModel) fun inject(viewModel: LogFilesViewModel) fun inject(viewModel: LogsViewModel) - fun inject(backupOptionViewModel: BackupOptionViewModel) - /** - * Service(s). - */ - fun inject(service: WalletService) - - /** - * Broadcast receiver - */ - fun inject(receiver: BootDeviceReceiver) + fun inject(viewModel: BackupOptionViewModel) + fun inject(viewModel: LogFilesManager) + fun inject(viewModel: SendTariViewModel) fun getClipboardManager(): ClipboardManager } diff --git a/app/src/main/java/com/tari/android/wallet/service/service/WalletService.kt b/app/src/main/java/com/tari/android/wallet/service/service/WalletService.kt index df2ab2aad..c500758d9 100644 --- a/app/src/main/java/com/tari/android/wallet/service/service/WalletService.kt +++ b/app/src/main/java/com/tari/android/wallet/service/service/WalletService.kt @@ -57,6 +57,7 @@ import com.tari.android.wallet.service.service.WalletServiceLauncher.Companion.s import com.tari.android.wallet.service.service.WalletServiceLauncher.Companion.stopAction import com.tari.android.wallet.service.service.WalletServiceLauncher.Companion.stopAndDeleteAction import com.tari.android.wallet.ui.common.domain.ResourceManager +import com.tari.android.wallet.ui.fragment.settings.logs.LogFilesManager import com.tari.android.wallet.util.Constants import com.tari.android.wallet.util.WalletUtil import io.reactivex.Observable @@ -107,6 +108,8 @@ class WalletService : Service() { private var lifecycleObserver: ServiceLifecycleCallbacks? = null private val stubProxy = TariWalletServiceStubProxy() + @Suppress("unused") + private val logFilesManager = LogFilesManager() private lateinit var wallet: FFIWallet private val logger diff --git a/app/src/main/java/com/tari/android/wallet/ui/common/CommonActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/common/CommonActivity.kt index 14aea4740..eda8de12f 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/common/CommonActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/common/CommonActivity.kt @@ -127,13 +127,5 @@ abstract class CommonActivity : App dialogManager.dismiss() DebugActivity.launch(this, navigation) } - - companion object { - enum class Priority(val value: Int) { - PRIORITY_SYSTEM(-1), - PRIORITY_DEFAULT(0), - PRIORITY_OVERLAY(1000000), - } - } } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt index 99cd15637..30a31630e 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt @@ -63,10 +63,8 @@ import com.tari.android.wallet.ui.fragment.send.finalize.FinalizeSendTxListener import com.tari.android.wallet.ui.fragment.send.finalize.TxFailureReason import com.tari.android.wallet.ui.fragment.send.makeTransaction.MakeTransactionFragment import com.tari.android.wallet.util.Constants -import com.tari.android.wallet.yat.YatAdapter import com.tari.android.wallet.yat.YatUser import java.lang.ref.WeakReference -import javax.inject.Inject /** @@ -80,12 +78,8 @@ class SendTariActivity : CommonActivity(this) { manage() } + EventBus.subscribe(this) { manage() } + } + + private fun manage() = viewModelScope.launch { + val files = WalletUtil.getLogFilesFromDirectory(walletConfig.getWalletLogFilesDirPath()).toMutableList() + if (files.size > MAX_FILES) { + files.sortedByDescending { it.lastModified() }.drop(10).forEach { fileToDelete -> + runCatching { fileToDelete.delete() } + } + } + } + + companion object { + const val MAX_FILES = 10 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/details/TxDetailsFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/details/TxDetailsFragment.kt index 779311a72..5813926d0 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/details/TxDetailsFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/details/TxDetailsFragment.kt @@ -46,7 +46,6 @@ import com.tari.android.wallet.R.dimen.add_amount_element_text_size import com.tari.android.wallet.R.dimen.add_amount_gem_size import com.tari.android.wallet.R.string.* import com.tari.android.wallet.databinding.FragmentTxDetailsBinding -import com.tari.android.wallet.di.DiContainer.appComponent import com.tari.android.wallet.extension.observe import com.tari.android.wallet.extension.txFormattedDate import com.tari.android.wallet.model.* @@ -88,15 +87,12 @@ class TxDetailsFragment : CommonFragment Date: Tue, 6 Dec 2022 19:54:15 +0100 Subject: [PATCH 02/33] Added palettes and styles for three modes Signed-off-by: Aleksandr Vakhtin --- .../wallet/ui/fragment/tx/TxListViewModel.kt | 11 - .../main/res/layout/palette_current_theme.xml | 1230 +++++++++++++++++ .../main/res/values/dark_colors_palette.xml | 57 + .../main/res/values/light_colors_palette.xml | 58 + app/src/main/res/values/palette_attrs.xml | 55 + app/src/main/res/values/palette_styles.xml | 172 +++ .../main/res/values/purple_colors_palette.xml | 57 + app/src/main/res/values/styles.xml | 3 - 8 files changed, 1629 insertions(+), 14 deletions(-) create mode 100644 app/src/main/res/layout/palette_current_theme.xml create mode 100644 app/src/main/res/values/dark_colors_palette.xml create mode 100644 app/src/main/res/values/light_colors_palette.xml create mode 100644 app/src/main/res/values/palette_attrs.xml create mode 100644 app/src/main/res/values/palette_styles.xml create mode 100644 app/src/main/res/values/purple_colors_palette.xml diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListViewModel.kt index 3fffddcb1..2a879a74c 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListViewModel.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListViewModel.kt @@ -422,17 +422,6 @@ class TxListViewModel : CommonViewModel() { _modularDialog.postValue(args.getModular(resourceManager)) } - private fun sendTariToUser(tariWalletAddress: TariWalletAddress) { - val error = WalletError() - val contacts = walletService.getContacts(error) - val recipientUser = when (error) { - WalletError.NoError -> contacts.firstOrNull { it.walletAddress == tariWalletAddress } ?: User(tariWalletAddress) - else -> User(tariWalletAddress) - } - - _navigation.postValue(TxListNavigation.ToSendTariToUser(recipientUser)) - } - companion object { private const val LIST_UPDATE_DEBOUNCE = 500L private const val SECOND_UTXO_STORE_OPEN_DELAY = 3000L diff --git a/app/src/main/res/layout/palette_current_theme.xml b/app/src/main/res/layout/palette_current_theme.xml new file mode 100644 index 000000000..796a24473 --- /dev/null +++ b/app/src/main/res/layout/palette_current_theme.xml @@ -0,0 +1,1230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dark_colors_palette.xml b/app/src/main/res/values/dark_colors_palette.xml new file mode 100644 index 000000000..02bc66dfc --- /dev/null +++ b/app/src/main/res/values/dark_colors_palette.xml @@ -0,0 +1,57 @@ + + + + + #060606 + #181818 + #222222 + #28292D + + + #9330FF + #E320BC + #40388A + + + #9330FF + #3A0470 + #222222 + #FFFFFF + #545454 + + + #FFFFFF + #C3C7D7 + #646B84 + #9330FF + + + #FFFFFF + #9330FF + #646B84 + + + #FFFFFF + #28292D + #FFFFFF + + + #D85240 + #C36928 + #D18A18 + #5F9C91 + #4D6FE8 + #222222 + #222222 + #222222 + #222222 + #222222 + + + #060606 + #181818 + + + #181818 + + diff --git a/app/src/main/res/values/light_colors_palette.xml b/app/src/main/res/values/light_colors_palette.xml new file mode 100644 index 000000000..0c39225ec --- /dev/null +++ b/app/src/main/res/values/light_colors_palette.xml @@ -0,0 +1,58 @@ + + + + #FFFFFF + #F6F6F6 + #ECECEC + #E1E1E1 + + + #9330FF + #E320BC + #40388A + + + #6239FF + #E320BC + #40388A + #FFFFFF + #B6B6B6 + + + #000000 + #7F8599 + #C3C7D7 + #9330FF + + + #000000 + #9330FF + #C3C7D7 + + + #FFFFFF + #FFFFFF + #9330FF + + + #D32C44 + #FF631F + #FCAA2F + #23BE90 + #2399BE + #F9E1E4 + #FFDCCD + #FBE7C0 + #C8F5E4 + #A8E5F8 + + + #FFFFFF + #F6F6F6 + + + #E8DEEB + + + + diff --git a/app/src/main/res/values/palette_attrs.xml b/app/src/main/res/values/palette_attrs.xml new file mode 100644 index 000000000..631062630 --- /dev/null +++ b/app/src/main/res/values/palette_attrs.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/palette_styles.xml b/app/src/main/res/values/palette_styles.xml new file mode 100644 index 000000000..5620082dc --- /dev/null +++ b/app/src/main/res/values/palette_styles.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + diff --git a/app/src/main/res/values/purple_colors_palette.xml b/app/src/main/res/values/purple_colors_palette.xml new file mode 100644 index 000000000..33d6b7805 --- /dev/null +++ b/app/src/main/res/values/purple_colors_palette.xml @@ -0,0 +1,57 @@ + + + + + #1D003E + #280055 + #3A007B + #3A007B + + + #9330FF + #E320BC + #40388A + + + #9330FF + #3A0470 + #2B0557 + #FFFFFF + #4E257A + + + #FFFFFF + #C3C7D7 + #646B84 + #9330FF + + + #FFFFFF + #9330FF + #646B84 + + + #FFFFFF + #28292D + #FFFFFF + + + #D85240 + #C36928 + #D18A18 + #5F9C91 + #4D6FE8 + #310068 + #310068 + #310068 + #310068 + #310068 + + + #1D003E + #280055 + + + #280055 + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7cda7483a..05df73082 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,7 +7,6 @@ @color/primary_dark @color/accent - @android:color/black @android:color/black @style/AlertDialogTheme @@ -16,8 +15,6 @@ - - - --> + + + - @@ -61,7 +61,7 @@ @null - From 6f4fec990c2cb7050fc9f4df78758c622483f10b Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 01:10:12 +0100 Subject: [PATCH 04/33] Added tari toolbar view and replaced with it all ui stuff Signed-off-by: Aleksandr Vakhtin --- .../wallet/ui/component/CustomFontButton.kt | 3 +- .../wallet/ui/component/tari/TariToolbar.kt | 28 ++++++++++ .../wallet/ui/extension/ViewExtensions.kt | 12 +++++ .../ChooseRestoreOptionFragment.kt | 1 - .../EnterRestorationPasswordFragment.kt | 2 +- .../inputSeedWords/InputSeedWordsFragment.kt | 1 - .../BackgroundServiceSettingsActivity.kt | 1 - .../backup/ChangeSecurePasswordFragment.kt | 3 -- .../backup/EnterCurrentPasswordFragment.kt | 1 - .../backupSettings/BackupSettingsFragment.kt | 1 - .../VerifySeedPhraseFragment.kt | 1 - .../WriteDownSeedPhraseFragment.kt | 1 - .../addBaseNode/AddCustomBaseNodeFragment.kt | 1 - .../bugReporting/BugsReportingFragment.kt | 1 - .../deleteWallet/DeleteWalletActivity.kt | 2 - .../logs/logFiles/LogFilesFragment.kt | 1 - .../NetworkSelectionFragment.kt | 1 - .../themeSelector/ThemeSelectorFragment.kt | 1 - .../main/res/drawable/back_button_vector.xml | 9 ++++ .../activity_background_service_settings.xml | 30 ++--------- .../res/layout/activity_delete_wallet.xml | 35 +++---------- .../res/layout/fragment_base_node_add.xml | 40 ++------------ .../res/layout/fragment_bugs_reporting.xml | 37 ++----------- .../fragment_change_secure_password.xml | 46 ++-------------- .../layout/fragment_choose_restore_option.xml | 42 ++------------- .../layout/fragment_enter_backup_password.xml | 46 ++-------------- .../fragment_enter_restore_password.xml | 41 ++------------- .../main/res/layout/fragment_log_files.xml | 38 ++------------ .../res/layout/fragment_network_selection.xml | 37 ++----------- .../main/res/layout/fragment_tari_about.xml | 51 ++---------------- .../main/res/layout/fragment_theme_change.xml | 48 ++--------------- .../layout/fragment_verify_seed_phrase.xml | 50 ++---------------- .../fragment_wallet_backup_settings.xml | 33 ++---------- .../fragment_wallet_input_seed_words.xml | 40 ++------------ .../fragment_write_down_seed_phrase.xml | 52 ++----------------- app/src/main/res/layout/tari_toolbar.xml | 51 ++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/tari_elements.xml | 5 ++ 38 files changed, 172 insertions(+), 622 deletions(-) create mode 100644 app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt create mode 100644 app/src/main/res/drawable/back_button_vector.xml create mode 100644 app/src/main/res/layout/tari_toolbar.xml create mode 100644 app/src/main/res/values/tari_elements.xml diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/CustomFontButton.kt b/app/src/main/java/com/tari/android/wallet/ui/component/CustomFontButton.kt index 1e8fb514a..e5fa01c68 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/component/CustomFontButton.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/component/CustomFontButton.kt @@ -41,8 +41,7 @@ import androidx.appcompat.widget.AppCompatButton * * @author The Tari Development Team */ -class CustomFontButton(context: Context, attrs: AttributeSet) : - AppCompatButton(context, attrs) { +class CustomFontButton(context: Context, attrs: AttributeSet) : AppCompatButton(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt new file mode 100644 index 000000000..b74eb5d54 --- /dev/null +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt @@ -0,0 +1,28 @@ +package com.tari.android.wallet.ui.component.tari + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.FrameLayout +import com.tari.android.wallet.R +import com.tari.android.wallet.databinding.TariToolbarBinding +import com.tari.android.wallet.ui.extension.obtain +import com.tari.android.wallet.ui.extension.runRecycle +import com.tari.android.wallet.ui.extension.setOnThrottledClickListener + +class TariToolbar(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) { + + var backPressedAction: () -> Unit = { (context as? Activity)?.onBackPressed() } + + init { + val ui = TariToolbarBinding.inflate(LayoutInflater.from(context), this, false) + addView(ui.root) + + ui.backCtaView.setOnThrottledClickListener { backPressedAction.invoke() } + + obtain(attrs, R.styleable.TariToolbar).runRecycle { + ui.toolbarTitle.text = getString(R.styleable.TariToolbar_text) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt b/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt index 770278574..d7597b533 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt @@ -35,7 +35,9 @@ package com.tari.android.wallet.ui.extension import android.animation.AnimatorSet import android.animation.ValueAnimator import android.content.Context +import android.content.res.TypedArray import android.graphics.drawable.Drawable +import android.util.AttributeSet import android.util.TypedValue import android.view.View import android.view.ViewGroup @@ -347,4 +349,14 @@ fun FragmentTransaction.addFadeInAnimation(): FragmentTransaction { fun FragmentTransaction.addEnterLeftAnimation(): FragmentTransaction { this.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right) return this +} + +fun View.obtain(attrs: AttributeSet, styleable: IntArray): TypedArray = context.theme.obtainStyledAttributes(attrs, styleable, 0, 0) + +fun TypedArray.runRecycle(action: TypedArray.() -> Unit) { + try { + action.invoke(this) + } finally { + recycle() + } } \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/restore/chooseRestoreOption/ChooseRestoreOptionFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/restore/chooseRestoreOption/ChooseRestoreOptionFragment.kt index be30a8112..8acbb419c 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/restore/chooseRestoreOption/ChooseRestoreOptionFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/restore/chooseRestoreOption/ChooseRestoreOptionFragment.kt @@ -75,7 +75,6 @@ class ChooseRestoreOptionFragment : CommonFragment updateContinueButtonState(isChecked) } - ui.backCtaView.setOnClickListener { requireActivity().onBackPressed() } ui.continueCtaView.setOnClickListener(ThrottleClick { it.animateClick { (requireActivity() as BackupSettingsRouter).toSeedPhraseVerification(this, viewModel.seedWords.value!!) } }) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/addBaseNode/AddCustomBaseNodeFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/addBaseNode/AddCustomBaseNodeFragment.kt index 27e1ecb26..fc62045d6 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/addBaseNode/AddCustomBaseNodeFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/addBaseNode/AddCustomBaseNodeFragment.kt @@ -85,7 +85,6 @@ class AddCustomBaseNodeFragment : CommonFragment viewModel.onNameChanged(text?.toString().orEmpty()) }) publicKeyHexEditText.addTextChangedListener(onTextChanged = { text, _, _, _ -> viewModel.onPublicKeyHexChanged(text?.toString().orEmpty()) }) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt index a997b82db..429e9d89f 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt @@ -26,7 +26,6 @@ class BugsReportingFragment : CommonFragment + + diff --git a/app/src/main/res/layout/activity_background_service_settings.xml b/app/src/main/res/layout/activity_background_service_settings.xml index 1e813b5a0..63c859fc3 100644 --- a/app/src/main/res/layout/activity_background_service_settings.xml +++ b/app/src/main/res/layout/activity_background_service_settings.xml @@ -6,33 +6,11 @@ android:background="@color/settings_background" android:orientation="vertical"> - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/background_service_title"/> - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/delete_wallet_title" /> diff --git a/app/src/main/res/layout/fragment_base_node_add.xml b/app/src/main/res/layout/fragment_base_node_add.xml index 2aec55fb4..d5b0f7478 100644 --- a/app/src/main/res/layout/fragment_base_node_add.xml +++ b/app/src/main/res/layout/fragment_base_node_add.xml @@ -7,43 +7,11 @@ android:background="@color/white" android:orientation="vertical"> - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/debug_custom_base_node" /> - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/debug_logs_title" /> - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/back_up_wallet_page_title" /> - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/restore_wallet_page_title"/> diff --git a/app/src/main/res/layout/fragment_enter_backup_password.xml b/app/src/main/res/layout/fragment_enter_backup_password.xml index f34a238d2..fd5ec1cd5 100644 --- a/app/src/main/res/layout/fragment_enter_backup_password.xml +++ b/app/src/main/res/layout/fragment_enter_backup_password.xml @@ -7,49 +7,11 @@ android:background="@color/white" android:orientation="vertical"> - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/back_up_wallet_page_title" /> - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/back_up_wallet_page_title"/> - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/debug_logs_title" /> - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/all_settings_select_network"/> - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/tari_about_title" /> + app:customFont="@string/font_medium" /> - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/select_theme_title" /> - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + app:text="@string/verify_seed_phrase_page_title" /> - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/back_up_wallet_page_title"/> - - - - - - - - - - - + app:text="@string/restore_from_seed_words_title"/> - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + app:text="@string/back_up_seed_phrase_page_title" /> + app:layout_constraintTop_toBottomOf="@+id/toolbar" /> + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a93cd233f..310fad0d1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,6 +49,7 @@ Thanks again for helping with my move Thanks again for helping with my move. Thanks again for helping with my move. Thanks again for helping with my move. Thanks again for helping with my move 🍀 + Test text Tari Aurora Service Notification Channel diff --git a/app/src/main/res/values/tari_elements.xml b/app/src/main/res/values/tari_elements.xml new file mode 100644 index 000000000..33bf69143 --- /dev/null +++ b/app/src/main/res/values/tari_elements.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 2f852d314c7b3fa3205b365f6d1759639aca1022 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 01:28:20 +0100 Subject: [PATCH 05/33] Transfer delete wallet activity to local fragment Signed-off-by: Aleksandr Vakhtin --- app/src/main/AndroidManifest.xml | 6 -- .../android/wallet/di/ApplicationComponent.kt | 4 +- .../wallet/ui/common/CommonActivity.kt | 4 +- .../wallet/ui/fragment/home/HomeActivity.kt | 6 +- ...letActivity.kt => DeleteWalletFragment.kt} | 75 +++++++------------ .../deleteWallet/DeleteWalletViewModel.kt | 37 ++++++++- ..._wallet.xml => fragment_delete_wallet.xml} | 0 7 files changed, 70 insertions(+), 62 deletions(-) rename app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/{DeleteWalletActivity.kt => DeleteWalletFragment.kt} (50%) rename app/src/main/res/layout/{activity_delete_wallet.xml => fragment_delete_wallet.xml} (100%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7e4d5e846..700d15add 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -153,12 +153,6 @@ android:parentActivityName=".ui.fragment.home.HomeActivity" android:theme="@style/AppTheme.Light" android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> - : App fun bindViewModel(viewModel: VM) = with(viewModel) { this@CommonActivity.viewModel = viewModel + setTariTheme(viewModel.tariSettingsSharedRepository.currentTheme!!) + subscribeToCommon(viewModel) } @@ -57,8 +59,6 @@ abstract class CommonActivity : App observe(dismissDialog) { dialogManager.dismiss() } observe(loadingDialog) { dialogManager.handleProgress(it) } - - observe(currentTheme) { setTariTheme(it) } } private fun setTariTheme(theme: TariTheme) { diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeActivity.kt index ce24b9e8a..ec4dcc291 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeActivity.kt @@ -88,7 +88,7 @@ import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettin import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.BaseNodeRouter import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.addBaseNode.AddCustomBaseNodeFragment import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode.ChangeBaseNodeFragment -import com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletActivity +import com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletFragment import com.tari.android.wallet.ui.fragment.settings.networkSelection.NetworkSelectionFragment import com.tari.android.wallet.ui.fragment.settings.themeSelector.ThemeSelectorFragment import com.tari.android.wallet.ui.fragment.settings.torBridges.TorBridgesSelectionFragment @@ -132,7 +132,7 @@ class HomeActivity : CommonActivity(), AllSe val viewModel: HomeViewModel by viewModels() bindViewModel(viewModel) - + setContainerId(R.id.nav_container) overridePendingTransition(0, 0) @@ -330,7 +330,7 @@ class HomeActivity : CommonActivity(), AllSe override fun toBackupSettings() = startActivity(Intent(this, BackupSettingsActivity::class.java)) - override fun toDeleteWallet() = startActivity(Intent(this, DeleteWalletActivity::class.java)) + override fun toDeleteWallet() = addFragment(DeleteWalletFragment()) override fun toBackgroundService() = startActivity(Intent(this, BackgroundServiceSettingsActivity::class.java)) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletFragment.kt similarity index 50% rename from app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletActivity.kt rename to app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletFragment.kt index 9c6d119ed..b04f7693d 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/deleteWallet/DeleteWalletFragment.kt @@ -34,69 +34,47 @@ package com.tari.android.wallet.ui.fragment.settings.deleteWallet import android.content.Intent import android.os.Bundle -import androidx.activity.viewModels -import androidx.lifecycle.ViewModelProvider +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.viewModels import androidx.lifecycle.lifecycleScope import com.tari.android.wallet.R -import com.tari.android.wallet.databinding.ActivityDeleteWalletBinding -import com.tari.android.wallet.di.DiContainer.appComponent -import com.tari.android.wallet.service.connection.TariWalletServiceConnection -import com.tari.android.wallet.service.service.WalletServiceLauncher -import com.tari.android.wallet.ui.common.CommonActivity -import com.tari.android.wallet.ui.dialog.modular.DialogArgs -import com.tari.android.wallet.ui.dialog.modular.ModularDialog -import com.tari.android.wallet.ui.dialog.modular.ModularDialogArgs -import com.tari.android.wallet.ui.dialog.modular.modules.body.BodyModule -import com.tari.android.wallet.ui.dialog.modular.modules.button.ButtonModule -import com.tari.android.wallet.ui.dialog.modular.modules.button.ButtonStyle -import com.tari.android.wallet.ui.dialog.modular.modules.head.HeadModule -import com.tari.android.wallet.ui.extension.* +import com.tari.android.wallet.databinding.FragmentDeleteWalletBinding +import com.tari.android.wallet.extension.observe +import com.tari.android.wallet.ui.common.CommonFragment +import com.tari.android.wallet.ui.extension.ThrottleClick +import com.tari.android.wallet.ui.extension.color +import com.tari.android.wallet.ui.extension.setColor +import com.tari.android.wallet.ui.extension.visible import com.tari.android.wallet.ui.fragment.onboarding.activity.OnboardingFlowActivity import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import javax.inject.Inject -// todo refactor to regular fragment -class DeleteWalletActivity : CommonActivity() { +class DeleteWalletFragment : CommonFragment() { - @Inject - lateinit var walletServiceLauncher: WalletServiceLauncher + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = + FragmentDeleteWalletBinding.inflate(inflater, container, false).also { ui = it }.root - private lateinit var serviceConnection: TariWalletServiceConnection - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - ui = ActivityDeleteWalletBinding.inflate(layoutInflater).apply { setContentView(root) } - overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left) - appComponent.inject(this) + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) val viewModel: DeleteWalletViewModel by viewModels() bindViewModel(viewModel) - serviceConnection = ViewModelProvider(this)[TariWalletServiceConnection::class.java] setupUI() + + observeUI() } - private fun setupUI() { - ui.deleteWalletProgress.setColor(color(R.color.common_error)) - ui.deleteWalletCtaView.setOnClickListener(ThrottleClick { confirmDeleteWallet() }) + private fun setupUI() = with(ui) { + deleteWalletProgress.setColor(color(R.color.common_error)) + deleteWalletCtaView.setOnClickListener(ThrottleClick { viewModel.confirmDeleteWallet() }) } - private fun confirmDeleteWallet() { - val dialog = ModularDialog(this) - val args = ModularDialogArgs( - DialogArgs(), listOf( - HeadModule(string(R.string.delete_wallet_confirmation_title)), - BodyModule(string(R.string.delete_wallet_confirmation_description)), - ButtonModule(string(R.string.common_confirm), ButtonStyle.Warning) { - deleteWallet() - dialog.dismiss() - }, - ButtonModule(string(R.string.common_cancel), ButtonStyle.Close) - )) - dialog.applyArgs(args) - dialog.show() + private fun observeUI() = with(viewModel) { + observe(deleteWallet) { deleteWallet() } } private fun deleteWallet() { @@ -105,7 +83,8 @@ class DeleteWalletActivity : CommonActivity() + + @Inject + lateinit var walletServiceLauncher: WalletServiceLauncher + + init { + component.inject(this) + } + + fun confirmDeleteWallet() { + val args = ModularDialogArgs( + DialogArgs(), listOf( + HeadModule(resourceManager.getString(R.string.delete_wallet_confirmation_title)), + BodyModule(resourceManager.getString(R.string.delete_wallet_confirmation_description)), + ButtonModule(resourceManager.getString(R.string.common_confirm), ButtonStyle.Warning) { + deleteWallet.postValue(Unit) + _dismissDialog.postValue(Unit) + }, + ButtonModule(resourceManager.getString(R.string.common_cancel), ButtonStyle.Close) + ) + ) + _modularDialog.postValue(args) + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_delete_wallet.xml b/app/src/main/res/layout/fragment_delete_wallet.xml similarity index 100% rename from app/src/main/res/layout/activity_delete_wallet.xml rename to app/src/main/res/layout/fragment_delete_wallet.xml From 3683b49c62b82212478f2e241d65e7773e46ef40 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 01:37:38 +0100 Subject: [PATCH 06/33] Trnasfered background service activity to local fragment Signed-off-by: Aleksandr Vakhtin --- app/src/main/AndroidManifest.xml | 6 ---- .../wallet/ui/fragment/home/HomeActivity.kt | 4 +-- ...t => BackgroundServiceSettingsFragment.kt} | 28 ++++++++----------- .../backup/activity/BackupSettingsActivity.kt | 5 ---- ... fragment_background_service_settings.xml} | 0 5 files changed, 13 insertions(+), 30 deletions(-) rename app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/{BackgroundServiceSettingsActivity.kt => BackgroundServiceSettingsFragment.kt} (73%) rename app/src/main/res/layout/{activity_background_service_settings.xml => fragment_background_service_settings.xml} (100%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 700d15add..9486075e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -153,12 +153,6 @@ android:parentActivityName=".ui.fragment.home.HomeActivity" android:theme="@style/AppTheme.Light" android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> - (), AllSe override fun toDeleteWallet() = addFragment(DeleteWalletFragment()) - override fun toBackgroundService() = startActivity(Intent(this, BackgroundServiceSettingsActivity::class.java)) + override fun toBackgroundService() = addFragment(BackgroundServiceSettingsFragment()) override fun toAbout() = addFragment(TariAboutFragment()) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsFragment.kt similarity index 73% rename from app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsActivity.kt rename to app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsFragment.kt index 290cfd9a1..caa18c840 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backgroundService/BackgroundServiceSettingsFragment.kt @@ -32,22 +32,22 @@ */ package com.tari.android.wallet.ui.fragment.settings.backgroundService -import android.content.Context -import android.content.Intent import android.os.Bundle -import androidx.activity.viewModels -import com.tari.android.wallet.databinding.ActivityBackgroundServiceSettingsBinding +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.viewModels +import com.tari.android.wallet.databinding.FragmentBackgroundServiceSettingsBinding import com.tari.android.wallet.extension.observe -import com.tari.android.wallet.ui.common.CommonActivity -import com.tari.android.wallet.ui.extension.ThrottleClick +import com.tari.android.wallet.ui.common.CommonFragment -class BackgroundServiceSettingsActivity : CommonActivity() { +class BackgroundServiceSettingsFragment : CommonFragment() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = + FragmentBackgroundServiceSettingsBinding.inflate(inflater, container, false).also { ui = it }.root - ui = ActivityBackgroundServiceSettingsBinding.inflate(layoutInflater) - setContentView(ui.root) + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) val viewModel: BackgroundServiceSettingsViewModel by viewModels() bindViewModel(viewModel) @@ -64,11 +64,5 @@ class BackgroundServiceSettingsActivity : CommonActivity Date: Wed, 7 Dec 2022 02:00:36 +0100 Subject: [PATCH 07/33] Transferred backup activity to local fragment Signed-off-by: Aleksandr Vakhtin --- app/src/main/AndroidManifest.xml | 6 - .../wallet/ui/fragment/home/HomeActivity.kt | 34 ++++- .../{activity => }/BackupSettingsRouter.kt | 14 +- .../backup/ChangeSecurePasswordFragment.kt | 6 +- .../backup/EnterCurrentPasswordFragment.kt | 5 +- .../backup/activity/BackupSettingsActivity.kt | 120 ------------------ .../activity/BackupSettingsViewModel.kt | 5 - .../backupSettings/BackupSettingsFragment.kt | 8 +- .../VerifySeedPhraseFragment.kt | 4 +- .../WriteDownSeedPhraseFragment.kt | 6 +- .../res/layout/activity_backup_settings.xml | 8 -- 11 files changed, 48 insertions(+), 168 deletions(-) rename app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/{activity => }/BackupSettingsRouter.kt (78%) delete mode 100644 app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsActivity.kt delete mode 100644 app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsViewModel.kt delete mode 100644 app/src/main/res/layout/activity_backup_settings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9486075e8..87df20715 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -147,12 +147,6 @@ android:parentActivityName=".ui.fragment.home.HomeActivity" android:theme="@style/AppTheme.Light" android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> - (), AllSettingsRouter, TxListRouter, BaseNodeRouter { +class HomeActivity : CommonActivity(), AllSettingsRouter, TxListRouter, BaseNodeRouter, BackupSettingsRouter { @Inject lateinit var sharedPrefsWrapper: SharedPrefsRepository @@ -328,7 +333,7 @@ class HomeActivity : CommonActivity(), AllSe override fun toAllSettings() = ui.viewPager.setCurrentItem(INDEX_SETTINGS, NO_SMOOTH_SCROLL) - override fun toBackupSettings() = startActivity(Intent(this, BackupSettingsActivity::class.java)) + override fun toBackupSettings() = addFragment(BackupSettingsFragment()) override fun toDeleteWallet() = addFragment(DeleteWalletFragment()) @@ -350,6 +355,29 @@ class HomeActivity : CommonActivity(), AllSe override fun toAddCustomBaseNode() = addFragment(AddCustomBaseNodeFragment()) + override fun toWalletBackupWithRecoveryPhrase() = addFragment(WriteDownSeedPhraseFragment()) + + override fun toSeedPhraseVerification(seedWords: List) = addFragment(VerifySeedPhraseFragment.newInstance(seedWords)) + + override fun toConfirmPassword() = addFragment(EnterCurrentPasswordFragment()) + + override fun toChangePassword() = addFragment(ChangeSecurePasswordFragment()) + + override fun onPasswordChanged() { + if (supportFragmentManager.findFragmentByTag(EnterCurrentPasswordFragment::class.java.simpleName) != null) { + supportFragmentManager.popBackStackImmediate( + EnterCurrentPasswordFragment::class.java.simpleName, + FragmentManager.POP_BACK_STACK_INCLUSIVE + ) + } else { + onBackPressed() + } + } + + override fun onSeedPhraseVerificationComplete() { + supportFragmentManager.popBackStackImmediate(WriteDownSeedPhraseFragment::class.java.simpleName, FragmentManager.POP_BACK_STACK_INCLUSIVE) + } + fun willNotifyAboutNewTx(): Boolean = ui.viewPager.currentItem == INDEX_HOME private fun processIntentDeepLink(service: TariWalletService, intent: Intent) { diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsRouter.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/BackupSettingsRouter.kt similarity index 78% rename from app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsRouter.kt rename to app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/BackupSettingsRouter.kt index 52faed863..1de762d05 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsRouter.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/BackupSettingsRouter.kt @@ -30,22 +30,22 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.tari.android.wallet.ui.fragment.settings.backup.activity +package com.tari.android.wallet.ui.fragment.settings.backup import androidx.fragment.app.Fragment interface BackupSettingsRouter { - fun toWalletBackupWithRecoveryPhrase(sourceFragment: Fragment) + fun toWalletBackupWithRecoveryPhrase() - fun toSeedPhraseVerification(sourceFragment: Fragment, seedWords: List) + fun toSeedPhraseVerification(seedWords: List) - fun toConfirmPassword(sourceFragment: Fragment) + fun toConfirmPassword() - fun toChangePassword(sourceFragment: Fragment) + fun toChangePassword() - fun onPasswordChanged(sourceFragment: Fragment) + fun onPasswordChanged() - fun onSeedPhraseVerificationComplete(sourceFragment: Fragment) + fun onSeedPhraseVerificationComplete() } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/ChangeSecurePasswordFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/ChangeSecurePasswordFragment.kt index caa49483c..831864275 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/ChangeSecurePasswordFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/ChangeSecurePasswordFragment.kt @@ -64,7 +64,6 @@ import com.tari.android.wallet.ui.common.domain.ResourceManager import com.tari.android.wallet.ui.dialog.error.ErrorDialogArgs import com.tari.android.wallet.ui.dialog.modular.ModularDialog import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsRouter import com.tari.android.wallet.ui.fragment.settings.backup.data.BackupSettingsRepository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -281,7 +280,7 @@ class ChangeSecurePasswordFragment : Fragment() { when (backupState) { is BackupUpToDate -> { allowExitAndPasswordEditing() - (requireActivity() as BackupSettingsRouter).onPasswordChanged(this) + (requireActivity() as BackupSettingsRouter).onPasswordChanged() } is BackupFailed -> { // backup failed showBackupErrorDialog(deductBackupErrorMessage(backupState.backupException)) { @@ -310,9 +309,6 @@ class ChangeSecurePasswordFragment : Fragment() { } companion object { - @Suppress("DEPRECATION") - fun newInstance() = ChangeSecurePasswordFragment() - private const val KEYBOARD_SHOW_UP_DELAY_AFTER_LOCAL_AUTH = 500L private const val KEYBOARD_ANIMATION_TIME = 100L } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/EnterCurrentPasswordFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/EnterCurrentPasswordFragment.kt index dbbf8f457..c68d6c32b 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/EnterCurrentPasswordFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/EnterCurrentPasswordFragment.kt @@ -46,7 +46,6 @@ import com.tari.android.wallet.R.color.white import com.tari.android.wallet.databinding.FragmentEnterBackupPasswordBinding import com.tari.android.wallet.di.DiContainer.appComponent import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsRouter import com.tari.android.wallet.ui.fragment.settings.backup.data.BackupSettingsRepository import javax.inject.Inject @@ -75,7 +74,7 @@ class EnterCurrentPasswordFragment : Fragment() { val input = (ui.passwordEditText.text?.toString() ?: "").toCharArray() val backupPassword = backupSettingsRepository.backupPassword?.toCharArray() ?: charArrayOf() if (input.contentEquals(backupPassword)) { - (requireActivity() as BackupSettingsRouter).toChangePassword(this) + (requireActivity() as BackupSettingsRouter).toChangePassword() } else { ui.changePasswordCtaTextView.isEnabled = false ui.changePasswordCtaTextView.setTextColor(color(change_password_cta_disabled)) @@ -111,8 +110,6 @@ class EnterCurrentPasswordFragment : Fragment() { } companion object { - fun newInstance() = EnterCurrentPasswordFragment() - private const val DISABLE_BUTTON_TIME = 1000L private const val LOCAL_AUTH_DELAY_TIME = 500L } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsActivity.kt deleted file mode 100644 index b6a6c1617..000000000 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsActivity.kt +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright 2020 The Tari Project - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the - * following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package com.tari.android.wallet.ui.fragment.settings.backup.activity - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.activity.viewModels -import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentManager -import com.tari.android.wallet.R -import com.tari.android.wallet.databinding.ActivityBackupSettingsBinding -import com.tari.android.wallet.ui.common.CommonActivity -import com.tari.android.wallet.ui.fragment.settings.backup.ChangeSecurePasswordFragment -import com.tari.android.wallet.ui.fragment.settings.backup.EnterCurrentPasswordFragment -import com.tari.android.wallet.ui.fragment.settings.backup.backupSettings.BackupSettingsFragment -import com.tari.android.wallet.ui.fragment.settings.backup.verifySeedPhrase.VerifySeedPhraseFragment -import com.tari.android.wallet.ui.fragment.settings.backup.writeDownSeedWords.WriteDownSeedPhraseFragment - -class BackupSettingsActivity : CommonActivity(), BackupSettingsRouter { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - ui = ActivityBackupSettingsBinding.inflate(layoutInflater).apply { setContentView(root) } - - val viewModel: BackupSettingsViewModel by viewModels() - bindViewModel(viewModel) - - setContentView(R.layout.activity_backup_settings) - overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left) - if (savedInstanceState == null) { - loadBackupSettingsFragment() - } - } - - private fun loadBackupSettingsFragment() { - supportFragmentManager.beginTransaction() - .add(R.id.settings_fragment_container, BackupSettingsFragment.newInstance()) - .commit() - } - - override fun toWalletBackupWithRecoveryPhrase(sourceFragment: Fragment) = addFragment(sourceFragment, WriteDownSeedPhraseFragment.newInstance()) - - override fun toSeedPhraseVerification(sourceFragment: Fragment, seedWords: List) = - addFragment(sourceFragment, VerifySeedPhraseFragment.newInstance(seedWords)) - - override fun toConfirmPassword(sourceFragment: Fragment) = - addFragment(sourceFragment, EnterCurrentPasswordFragment.newInstance(), allowStateLoss = true) - - override fun toChangePassword(sourceFragment: Fragment) = - addFragment(sourceFragment, ChangeSecurePasswordFragment.newInstance(), allowStateLoss = true) - - override fun onPasswordChanged(sourceFragment: Fragment) { - if (supportFragmentManager.findFragmentByTag(EnterCurrentPasswordFragment::class.java.simpleName) != null) { - supportFragmentManager.popBackStackImmediate( - EnterCurrentPasswordFragment::class.java.simpleName, - FragmentManager.POP_BACK_STACK_INCLUSIVE - ) - } else { - onBackPressed() - } - } - - override fun onSeedPhraseVerificationComplete(sourceFragment: Fragment) { - supportFragmentManager.popBackStackImmediate(WriteDownSeedPhraseFragment::class.java.simpleName, FragmentManager.POP_BACK_STACK_INCLUSIVE) - } - - // nyarian: - // allowStateLoss parameter is necessary to resolve device-specific issues like one - // for samsung devices with biometrics enabled, as after launching the biometric prompt - // onSaveInstanceState is called, and commit()ing any stuff after onSaveInstanceState is called - // results into IllegalStateException: Can not perform this action after onSaveInstanceState - private fun addFragment(sourceFragment: Fragment, fragment: Fragment, allowStateLoss: Boolean = false) { - supportFragmentManager - .beginTransaction() - .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right) - .hide(sourceFragment) - .add(R.id.settings_fragment_container, fragment, fragment.javaClass.simpleName) - .addToBackStack(fragment.javaClass.simpleName) - .apply { if (allowStateLoss) commitAllowingStateLoss() else commit() } - } - - - companion object { - fun launch(context: Context) { - context.startActivity(Intent(context, BackupSettingsActivity::class.java)) - } - } - -} diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsViewModel.kt deleted file mode 100644 index 4458d0749..000000000 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/activity/BackupSettingsViewModel.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.tari.android.wallet.ui.fragment.settings.backup.activity - -import com.tari.android.wallet.ui.common.CommonViewModel - -class BackupSettingsViewModel : CommonViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/backupSettings/BackupSettingsFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/backupSettings/BackupSettingsFragment.kt index b5a0c0421..441ec0d0e 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/backupSettings/BackupSettingsFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/backupSettings/BackupSettingsFragment.kt @@ -43,7 +43,7 @@ import com.tari.android.wallet.extension.observe import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.extension.ThrottleClick import com.tari.android.wallet.ui.extension.setVisible -import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsRouter +import com.tari.android.wallet.ui.fragment.settings.backup.BackupSettingsRouter import com.tari.android.wallet.ui.fragment.settings.backup.backupSettings.option.BackupOptionView import com.tari.android.wallet.ui.fragment.settings.backup.backupSettings.option.BackupOptionViewModel import com.tari.android.wallet.ui.fragment.settings.userAutorization.BiometricAuthenticationViewModel @@ -104,9 +104,9 @@ class BackupSettingsFragment : CommonFragment router.toChangePassword(this) - BackupSettingsNavigation.ToConfirmPassword -> router.toConfirmPassword(this) - BackupSettingsNavigation.ToWalletBackupWithRecoveryPhrase -> router.toWalletBackupWithRecoveryPhrase(this) + BackupSettingsNavigation.ToChangePassword -> router.toChangePassword() + BackupSettingsNavigation.ToConfirmPassword -> router.toConfirmPassword() + BackupSettingsNavigation.ToWalletBackupWithRecoveryPhrase -> router.toWalletBackupWithRecoveryPhrase() } } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/verifySeedPhrase/VerifySeedPhraseFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/verifySeedPhrase/VerifySeedPhraseFragment.kt index a2f403729..40be4fee5 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/verifySeedPhrase/VerifySeedPhraseFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/verifySeedPhrase/VerifySeedPhraseFragment.kt @@ -46,7 +46,7 @@ import com.tari.android.wallet.databinding.FragmentVerifySeedPhraseBinding import com.tari.android.wallet.extension.observe import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsRouter +import com.tari.android.wallet.ui.fragment.settings.backup.BackupSettingsRouter class VerifySeedPhraseFragment : CommonFragment() { @@ -85,7 +85,7 @@ class VerifySeedPhraseFragment : CommonFragment router.onSeedPhraseVerificationComplete(this) + VerifySeedPhraseNavigation.ToSeedPhraseVerificationComplete -> router.onSeedPhraseVerificationComplete() } } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/writeDownSeedWords/WriteDownSeedPhraseFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/writeDownSeedWords/WriteDownSeedPhraseFragment.kt index 96f276455..c5a867922 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/writeDownSeedWords/WriteDownSeedPhraseFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/backup/writeDownSeedWords/WriteDownSeedPhraseFragment.kt @@ -49,7 +49,7 @@ import com.tari.android.wallet.databinding.FragmentWriteDownSeedPhraseBinding import com.tari.android.wallet.extension.observe import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsRouter +import com.tari.android.wallet.ui.fragment.settings.backup.BackupSettingsRouter import com.tari.android.wallet.ui.fragment.settings.backup.writeDownSeedWords.adapter.PhraseWordsAdapter import com.tari.android.wallet.util.Constants @@ -75,7 +75,7 @@ class WriteDownSeedPhraseFragment : CommonFragment updateContinueButtonState(isChecked) } ui.continueCtaView.setOnClickListener(ThrottleClick { - it.animateClick { (requireActivity() as BackupSettingsRouter).toSeedPhraseVerification(this, viewModel.seedWords.value!!) } + it.animateClick { (requireActivity() as BackupSettingsRouter).toSeedPhraseVerification(viewModel.seedWords.value!!) } }) ui.phraseWordsRecyclerView.layoutManager = GridLayoutManager(requireContext(), WORD_COLUMNS_COUNT) ui.phraseWordsRecyclerView.adapter = adapter @@ -186,8 +186,6 @@ class WriteDownSeedPhraseFragment : CommonFragment - - \ No newline at end of file From 4eed78e800b9a351f7c1fadbc5f526cfc330b3b3 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 02:20:22 +0100 Subject: [PATCH 08/33] Replaced send tari activity with local fragments Signed-off-by: Aleksandr Vakhtin --- app/src/main/AndroidManifest.xml | 6 - .../android/wallet/di/ApplicationComponent.kt | 4 +- .../wallet/ui/fragment/home/HomeActivity.kt | 122 +++++++++--- .../wallet/ui/fragment/home/HomeViewModel.kt | 12 +- .../send/activity/SendTariActivity.kt | 187 ------------------ .../send/activity/SendTariViewModel.kt | 14 -- .../send/addAmount/AddAmountFragment.kt | 6 +- .../fragment/send/addNote/AddNoteFragment.kt | 4 +- .../finalize/YatFinalizeSendTxActivity.kt | 10 +- .../wallet/ui/fragment/tx/TxListFragment.kt | 11 +- .../wallet/ui/fragment/tx/TxListRouter.kt | 3 + .../main/res/layout/activity_send_tari.xml | 16 -- 12 files changed, 125 insertions(+), 270 deletions(-) delete mode 100644 app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt delete mode 100644 app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariViewModel.kt delete mode 100644 app/src/main/res/layout/activity_send_tari.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 87df20715..5606e4129 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -128,12 +128,6 @@ android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/AppTheme.Light" android:windowSoftInputMode="stateAlwaysHidden" /> - (), AllSettingsRouter, TxListRouter, BaseNodeRouter, BackupSettingsRouter { +class HomeActivity : CommonActivity(), AllSettingsRouter, TxListRouter, BaseNodeRouter, BackupSettingsRouter, + AddRecipientListener, + AddAmountListener, + AddNodeListener, + FinalizeSendTxListener { @Inject lateinit var sharedPrefsWrapper: SharedPrefsRepository @@ -209,11 +217,7 @@ class HomeActivity : CommonActivity(), AllSe if (EventBus.networkConnectionState.publishSubject.value != NetworkConnectionState.CONNECTED) { showInternetConnectionErrorDialog(this) } else { - startActivity(Intent(this, SendTariActivity::class.java)) - overridePendingTransition( - R.anim.enter_from_right, - R.anim.exit_to_left - ) + sendToUser(null) } } } @@ -363,6 +367,69 @@ class HomeActivity : CommonActivity(), AllSe override fun toChangePassword() = addFragment(ChangeSecurePasswordFragment()) + override fun toSendTari(user: User?) = sendToUser(user) + + override fun continueToAmount(user: User, amount: MicroTari?) { + if (EventBus.networkConnectionState.publishSubject.value != NetworkConnectionState.CONNECTED) { + showInternetConnectionErrorDialog(this) + return + } + hideKeyboard() + val bundle = Bundle().apply { + putParcelable(PARAMETER_USER, user) + putParcelable(PARAMETER_AMOUNT, amount) + } + ui.rootView.postDelayed({ addFragment(AddAmountFragment(), bundle) }, Constants.UI.keyboardHideWaitMs) + } + + override fun onAmountExceedsActualAvailableBalance(fragment: AddAmountFragment) { + val args = ModularDialogArgs( + DialogArgs(), listOf( + HeadModule(string(R.string.error_balance_exceeded_title)), + BodyModule(string(R.string.error_balance_exceeded_description)), + ButtonModule(string(R.string.common_close), ButtonStyle.Close), + ) + ) + ModularDialog(this, args).show() + } + + override fun continueToAddNote(transactionData: TransactionData) { + if (EventBus.networkConnectionState.publishSubject.value != NetworkConnectionState.CONNECTED) { + showInternetConnectionErrorDialog(this) + return + } + val bundle = Bundle().apply { + putParcelable("transactionData", transactionData) + intent.getStringExtra(PARAMETER_NOTE)?.let { putString(PARAMETER_NOTE, it) } + } + addFragment(AddNoteFragment(), bundle) + } + + override fun continueToFinalizing(transactionData: TransactionData) { + continueToFinalizeSendTx(transactionData) + } + + override fun continueToFinalizeSendTx(transactionData: TransactionData) { + if (transactionData.recipientUser is YatUser) { + viewModel.yatAdapter.showOutcomingFinalizeActivity(this, transactionData) + } else { + addFragment(FinalizeSendTxFragment.create(transactionData)) + ui.rootView.post { ui.rootView.setBackgroundColor(color(R.color.white)) } + } + } + + override fun onSendTxFailure(transactionData: TransactionData, txFailureReason: TxFailureReason) { + EventBus.post(Event.Transaction.TxSendFailed(txFailureReason)) + finish() + overridePendingTransition(R.anim.fade_in, R.anim.fade_out) + } + + override fun onSendTxSuccessful(txId: TxId, transactionData: TransactionData) { + EventBus.post(Event.Transaction.TxSendSuccessful(txId)) + finish() + overridePendingTransition(R.anim.fade_in, R.anim.fade_out) + } + override fun onPasswordChanged() { if (supportFragmentManager.findFragmentByTag(EnterCurrentPasswordFragment::class.java.simpleName) != null) { supportFragmentManager.popBackStackImmediate( @@ -396,12 +463,19 @@ class HomeActivity : CommonActivity(), AllSe WalletError.NoError -> contacts.firstOrNull { it.walletAddress == walletAddress } ?: User(walletAddress) else -> User(walletAddress) } - val intent = Intent(this, SendTariActivity::class.java) - intent.putExtra("recipientUser", recipientUser as Parcelable) - sendDeeplink.note.let { intent.putExtra(SendTariActivity.PARAMETER_NOTE, it) } - sendDeeplink.amount?.let { intent.putExtra(SendTariActivity.PARAMETER_AMOUNT, it.tariValue) } - startActivity(intent) - overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left) + sendToUser(recipientUser) + } + + private fun sendToUser(recipientUser: User?) { + if (recipientUser != null) { + val bundle = Bundle().apply { + putParcelable("recipientUser", recipientUser) + intent.getDoubleExtra(PARAMETER_AMOUNT, Double.MIN_VALUE).takeIf { it > 0 }?.let { putDouble(PARAMETER_AMOUNT, it) } + } + addFragment(AddAmountFragment(), bundle) + } else { + addFragment(MakeTransactionFragment(), null) + } } override fun onDestroy() { @@ -424,6 +498,10 @@ class HomeActivity : CommonActivity(), AllSe } companion object { + const val PARAMETER_NOTE = "note" + const val PARAMETER_AMOUNT = "amount" + const val PARAMETER_USER = "recipientUser" + private const val KEY_PAGE = "key_page" private const val INDEX_HOME = 0 private const val INDEX_STORE = 1 diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeViewModel.kt index f5dea99ab..1d5ba925c 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeViewModel.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/home/HomeViewModel.kt @@ -1,5 +1,15 @@ package com.tari.android.wallet.ui.fragment.home import com.tari.android.wallet.ui.common.CommonViewModel +import com.tari.android.wallet.yat.YatAdapter +import javax.inject.Inject -class HomeViewModel: CommonViewModel() \ No newline at end of file +class HomeViewModel: CommonViewModel() { + + @Inject + lateinit var yatAdapter: YatAdapter + + init { + component.inject(this) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt deleted file mode 100644 index 30a31630e..000000000 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariActivity.kt +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright 2020 The Tari Project - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the - * following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package com.tari.android.wallet.ui.fragment.send.activity - -import android.os.Bundle -import androidx.activity.viewModels -import com.tari.android.wallet.R -import com.tari.android.wallet.databinding.ActivitySendTariBinding -import com.tari.android.wallet.di.DiContainer.appComponent -import com.tari.android.wallet.event.Event -import com.tari.android.wallet.event.EventBus -import com.tari.android.wallet.model.MicroTari -import com.tari.android.wallet.model.TxId -import com.tari.android.wallet.model.User -import com.tari.android.wallet.network.NetworkConnectionState -import com.tari.android.wallet.ui.common.CommonActivity -import com.tari.android.wallet.ui.dialog.modular.DialogArgs -import com.tari.android.wallet.ui.dialog.modular.ModularDialog -import com.tari.android.wallet.ui.dialog.modular.ModularDialogArgs -import com.tari.android.wallet.ui.dialog.modular.modules.body.BodyModule -import com.tari.android.wallet.ui.dialog.modular.modules.button.ButtonModule -import com.tari.android.wallet.ui.dialog.modular.modules.button.ButtonStyle -import com.tari.android.wallet.ui.dialog.modular.modules.head.HeadModule -import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.send.addAmount.AddAmountFragment -import com.tari.android.wallet.ui.fragment.send.addAmount.AddAmountListener -import com.tari.android.wallet.ui.fragment.send.addNote.AddNodeListener -import com.tari.android.wallet.ui.fragment.send.addNote.AddNoteFragment -import com.tari.android.wallet.ui.fragment.send.addRecepient.AddRecipientListener -import com.tari.android.wallet.ui.fragment.send.common.TransactionData -import com.tari.android.wallet.ui.fragment.send.finalize.FinalizeSendTxFragment -import com.tari.android.wallet.ui.fragment.send.finalize.FinalizeSendTxListener -import com.tari.android.wallet.ui.fragment.send.finalize.TxFailureReason -import com.tari.android.wallet.ui.fragment.send.makeTransaction.MakeTransactionFragment -import com.tari.android.wallet.util.Constants -import com.tari.android.wallet.yat.YatUser -import java.lang.ref.WeakReference - - -/** - * The host activity for all send-related fragments. - * - * @author The Tari Development Team - */ -class SendTariActivity : CommonActivity(), - AddRecipientListener, - AddAmountListener, - AddNodeListener, - FinalizeSendTxListener { - - override fun onCreate(savedInstanceState: Bundle?) { - instance = WeakReference(this) - super.onCreate(savedInstanceState) - ui = ActivitySendTariBinding.inflate(layoutInflater).apply { setContentView(root) } - - val viewModel: SendTariViewModel by viewModels() - bindViewModel(viewModel) - - setContainerId(R.id.send_tari_fragment_container_view) - - if (savedInstanceState == null) { - loadRootFragment() - } - } - - /** - * Loads initial fragment. - */ - private fun loadRootFragment() { - val recipientUser = intent.parcelable("recipientUser") - if (recipientUser != null) { - val bundle = Bundle().apply { - putParcelable("recipientUser", recipientUser) - intent.getDoubleExtra(PARAMETER_AMOUNT, Double.MIN_VALUE).takeIf { it > 0 }?.let { putDouble(PARAMETER_AMOUNT, it) } - } - addFragment(AddAmountFragment(), bundle, true) - } else { - addFragment(MakeTransactionFragment(), null, true) - } - ui.rootView.postDelayed({ ui.rootView.setBackgroundColor(color(R.color.black)) }, 1000) - } - - override fun continueToAmount(user: User, amount: MicroTari?) { - if (EventBus.networkConnectionState.publishSubject.value != NetworkConnectionState.CONNECTED) { - showInternetConnectionErrorDialog(this) - return - } - hideKeyboard() - val bundle = Bundle().apply { - putParcelable(PARAMETER_USER, user) - putParcelable(PARAMETER_AMOUNT, amount) - } - ui.rootView.postDelayed({ addFragment(AddAmountFragment(), bundle) }, Constants.UI.keyboardHideWaitMs) - } - - override fun onAmountExceedsActualAvailableBalance(fragment: AddAmountFragment) { - val args = ModularDialogArgs( - DialogArgs(), listOf( - HeadModule(string(R.string.error_balance_exceeded_title)), - BodyModule(string(R.string.error_balance_exceeded_description)), - ButtonModule(string(R.string.common_close), ButtonStyle.Close), - ) - ) - ModularDialog(this, args).show() - } - - override fun continueToAddNote(transactionData: TransactionData) { - if (EventBus.networkConnectionState.publishSubject.value != NetworkConnectionState.CONNECTED) { - showInternetConnectionErrorDialog(this) - return - } - val bundle = Bundle().apply { - putParcelable("transactionData", transactionData) - intent.getStringExtra(PARAMETER_NOTE)?.let { putString(PARAMETER_NOTE, it) } - } - addFragment(AddNoteFragment(), bundle) - } - - override fun continueToFinalizing(transactionData: TransactionData) { - continueToFinalizeSendTx(transactionData) - } - - override fun continueToFinalizeSendTx(transactionData: TransactionData) { - if (transactionData.recipientUser is YatUser) { - viewModel.yatAdapter.showOutcomingFinalizeActivity(this, transactionData) - } else { - addFragment(FinalizeSendTxFragment.create(transactionData)) - ui.rootView.post { ui.rootView.setBackgroundColor(color(R.color.white)) } - } - } - - override fun onSendTxFailure(transactionData: TransactionData, txFailureReason: TxFailureReason) { - EventBus.post(Event.Transaction.TxSendFailed(txFailureReason)) - finish() - overridePendingTransition(R.anim.fade_in, R.anim.fade_out) - } - - override fun onSendTxSuccessful(txId: TxId, transactionData: TransactionData) { - EventBus.post(Event.Transaction.TxSendSuccessful(txId)) - finish() - overridePendingTransition(R.anim.fade_in, R.anim.fade_out) - } - - override fun onDestroy() { - hideKeyboard() - super.onDestroy() - } - - companion object { - const val PARAMETER_NOTE = "note" - const val PARAMETER_AMOUNT = "amount" - const val PARAMETER_USER = "recipientUser" - - var instance: WeakReference = WeakReference(null) - private set - } -} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariViewModel.kt deleted file mode 100644 index ea7ad9fc1..000000000 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/activity/SendTariViewModel.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.tari.android.wallet.ui.fragment.send.activity - -import com.tari.android.wallet.ui.common.CommonViewModel -import com.tari.android.wallet.yat.YatAdapter -import javax.inject.Inject - -class SendTariViewModel : CommonViewModel() { - @Inject - lateinit var yatAdapter: YatAdapter - - init { - component.inject(this) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt index 4aa019a74..62a6dccac 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt @@ -58,7 +58,7 @@ import com.tari.android.wallet.ui.dialog.error.ErrorDialogArgs import com.tari.android.wallet.ui.dialog.modular.ModularDialog import com.tari.android.wallet.ui.dialog.tooltipDialog.TooltipDialogArgs import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity +import com.tari.android.wallet.ui.fragment.home.HomeActivity import com.tari.android.wallet.ui.fragment.send.addAmount.feeModule.NetworkSpeed import com.tari.android.wallet.ui.fragment.send.addAmount.keyboard.KeyboardController import com.tari.android.wallet.ui.fragment.send.amountView.AmountStyle @@ -118,9 +118,9 @@ class AddAmountFragment : CommonFragment(SendTariActivity.PARAMETER_AMOUNT) + val amount = arguments?.parcelable(HomeActivity.PARAMETER_AMOUNT) keyboardController.setup(requireContext(), AmountCheckRunnable(), ui.numpad, ui.amount, amount?.tariValue?.toDouble() ?: Double.MIN_VALUE) - recipientUser = arguments?.parcelable(SendTariActivity.PARAMETER_USER) + recipientUser = arguments?.parcelable(HomeActivity.PARAMETER_USER) // hide tx fee ui.txFeeContainerView.invisible() // hide/disable continue button diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addNote/AddNoteFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addNote/AddNoteFragment.kt index ffbd267f2..e7f9ac195 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addNote/AddNoteFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addNote/AddNoteFragment.kt @@ -74,7 +74,7 @@ import com.tari.android.wallet.ui.common.gyphy.repository.GIFItem import com.tari.android.wallet.ui.component.EmojiIdSummaryViewController import com.tari.android.wallet.ui.component.FullEmojiIdViewController import com.tari.android.wallet.ui.extension.* -import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity +import com.tari.android.wallet.ui.fragment.home.HomeActivity import com.tari.android.wallet.ui.fragment.send.addNote.gif.* import com.tari.android.wallet.ui.fragment.send.addNote.gif.ThumbnailGIFsViewModel.Companion.REQUEST_CODE_GIF import com.tari.android.wallet.ui.fragment.send.common.TransactionData @@ -226,7 +226,7 @@ class AddNoteFragment : Fragment(), View.OnTouchListener { amount = transactionData.amount!! isOneSidePayment = transactionData.isOneSidePayment if (savedInstanceState == null) { - requireArguments().getString(SendTariActivity.PARAMETER_NOTE) + requireArguments().getString(HomeActivity.PARAMETER_NOTE) ?.let { ui.noteEditText.setText(it) } } } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/finalize/YatFinalizeSendTxActivity.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/finalize/YatFinalizeSendTxActivity.kt index ea1e1396b..111424744 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/finalize/YatFinalizeSendTxActivity.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/finalize/YatFinalizeSendTxActivity.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.lifecycleScope import com.google.gson.Gson import com.tari.android.wallet.extension.observe import com.tari.android.wallet.extension.observeOnLoad -import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity +import com.tari.android.wallet.ui.fragment.home.HomeActivity import com.tari.android.wallet.ui.fragment.send.common.TransactionData import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -50,12 +50,8 @@ class YatFinalizeSendTxActivity : YatLibOutcomingTransactionActivity() { override fun onStop() { super.onStop() - viewModel.sentTxId.value?.let { - SendTariActivity.instance.get()?.onSendTxSuccessful(it, viewModel.transactionData) - } + viewModel.sentTxId.value?.let { HomeActivity.instance.get()?.onSendTxSuccessful(it, viewModel.transactionData) } - viewModel.txFailureReason.value?.let { - SendTariActivity.instance.get()?.onSendTxFailure(viewModel.transactionData, it) - } + viewModel.txFailureReason.value?.let { HomeActivity.instance.get()?.onSendTxFailure(viewModel.transactionData, it) } } } \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListFragment.kt index 459279890..5833ee38a 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListFragment.kt @@ -36,7 +36,6 @@ import android.animation.AnimatorSet import android.animation.ObjectAnimator import android.animation.ValueAnimator import android.annotation.SuppressLint -import android.content.Intent import android.graphics.drawable.GradientDrawable import android.os.* import android.view.LayoutInflater @@ -58,7 +57,6 @@ import com.tari.android.wallet.event.EventBus import com.tari.android.wallet.extension.observe import com.tari.android.wallet.extension.observeOnLoad import com.tari.android.wallet.model.BalanceInfo -import com.tari.android.wallet.model.User import com.tari.android.wallet.ui.common.CommonActivity import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.common.recyclerView.CommonAdapter @@ -66,7 +64,6 @@ import com.tari.android.wallet.ui.common.recyclerView.CommonViewHolderItem import com.tari.android.wallet.ui.component.networkStateIndicator.ConnectionIndicatorViewModel import com.tari.android.wallet.ui.extension.* import com.tari.android.wallet.ui.extension.PermissionExtensions.runWithPermission -import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity import com.tari.android.wallet.ui.fragment.tx.adapter.TxListAdapter import com.tari.android.wallet.ui.fragment.tx.questionMark.QuestionMarkViewModel import com.tari.android.wallet.ui.fragment.tx.ui.CustomScrollView @@ -243,18 +240,12 @@ class TxListFragment : CommonFragment(), when (navigation) { TxListNavigation.ToTTLStore -> router.toTTLStore() is TxListNavigation.ToTxDetails -> router.toTxDetails(navigation.tx) - is TxListNavigation.ToSendTariToUser -> navigateToSendTari(navigation.user) + is TxListNavigation.ToSendTariToUser -> router.toSendTari(navigation.user) TxListNavigation.ToUtxos -> router.toUtxos() TxListNavigation.ToAllSettings -> router.toAllSettings() } } - private fun navigateToSendTari(user: User) { - val intent = Intent(requireContext(), SendTariActivity::class.java).apply { putExtra("recipientUser", user as Parcelable) } - startActivity(intent) - requireActivity().overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left) - } - private fun updateTxListUI(list: MutableList) { recyclerViewAdapter.update(list) if (list.isEmpty()) { diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListRouter.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListRouter.kt index 427ff1bec..773ec205a 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListRouter.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/tx/TxListRouter.kt @@ -2,10 +2,13 @@ package com.tari.android.wallet.ui.fragment.tx import com.tari.android.wallet.model.Tx import com.tari.android.wallet.model.TxId +import com.tari.android.wallet.model.User interface TxListRouter { fun toTxDetails(tx: Tx? = null, txId: TxId? = null) + fun toSendTari(user: User?) + fun toTTLStore() fun toAllSettings() diff --git a/app/src/main/res/layout/activity_send_tari.xml b/app/src/main/res/layout/activity_send_tari.xml deleted file mode 100644 index acbadf79f..000000000 --- a/app/src/main/res/layout/activity_send_tari.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - From 34336446d9bdbe7917c639dacd4798b583285f16 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 02:50:57 +0100 Subject: [PATCH 09/33] Replaced toolbar with right action Signed-off-by: Aleksandr Vakhtin --- .../wallet/ui/component/tari/TariToolbar.kt | 17 +++++ .../changeBaseNode/ChangeBaseNodeFragment.kt | 19 ++---- .../torBridges/TorBridgesSelectionFragment.kt | 4 +- .../customBridges/CustomTorBridgesFragment.kt | 3 +- .../res/layout/fragment_base_node_change.xml | 63 ++--------------- .../layout/fragment_custom_tor_bridges.xml | 67 ++----------------- .../layout/fragment_tor_bridge_selection.xml | 67 ++----------------- app/src/main/res/layout/tari_toolbar.xml | 39 +++++++++-- .../main/res/menu/change_base_node_menu.xml | 10 --- app/src/main/res/values/tari_elements.xml | 2 + 10 files changed, 75 insertions(+), 216 deletions(-) delete mode 100644 app/src/main/res/menu/change_base_node_menu.xml diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt index b74eb5d54..1a2e2ed9b 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt @@ -2,6 +2,7 @@ package com.tari.android.wallet.ui.component.tari import android.app.Activity import android.content.Context +import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.LayoutInflater import android.widget.FrameLayout @@ -10,10 +11,12 @@ import com.tari.android.wallet.databinding.TariToolbarBinding import com.tari.android.wallet.ui.extension.obtain import com.tari.android.wallet.ui.extension.runRecycle import com.tari.android.wallet.ui.extension.setOnThrottledClickListener +import com.tari.android.wallet.ui.extension.visible class TariToolbar(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) { var backPressedAction: () -> Unit = { (context as? Activity)?.onBackPressed() } + var rightAction: () -> Unit = { } init { val ui = TariToolbarBinding.inflate(LayoutInflater.from(context), this, false) @@ -23,6 +26,20 @@ class TariToolbar(context: Context, attrs: AttributeSet) : FrameLayout(context, obtain(attrs, R.styleable.TariToolbar).runRecycle { ui.toolbarTitle.text = getString(R.styleable.TariToolbar_text) + getString(R.styleable.TariToolbar_rightText)?.let { setupRightButton(ui, it) } + getDrawable(R.styleable.TariToolbar_rightIcon)?.let { setupRightIcon(ui, it) } } } + + private fun setupRightButton(ui: TariToolbarBinding, newText: String) = with(ui.toolbarRightText) { + visible() + text = newText + setOnThrottledClickListener { rightAction() } + } + + private fun setupRightIcon(ui: TariToolbarBinding, icon: Drawable) = with(ui.toolbarRightIcon) { + visible() + setImageDrawable(icon) + setOnThrottledClickListener { rightAction() } + } } \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/changeBaseNode/ChangeBaseNodeFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/changeBaseNode/ChangeBaseNodeFragment.kt index ae06d1874..55808bf6f 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/changeBaseNode/ChangeBaseNodeFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/baseNodeConfig/changeBaseNode/ChangeBaseNodeFragment.kt @@ -33,15 +33,15 @@ package com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode import android.os.Bundle -import android.view.* +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup import androidx.fragment.app.viewModels import androidx.recyclerview.widget.LinearLayoutManager -import com.tari.android.wallet.R import com.tari.android.wallet.databinding.FragmentBaseNodeChangeBinding import com.tari.android.wallet.extension.observe import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.common.recyclerView.CommonAdapter -import com.tari.android.wallet.ui.extension.setOnThrottledClickListener import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.BaseNodeRouter import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode.adapter.BaseNodeViewHolderItem import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode.adapter.ChangeBaseNodeAdapter @@ -56,7 +56,6 @@ class ChangeBaseNodeFragment : CommonFragment (requireActivity() as BaseNodeRouter).toAddCustomBaseNode() - } - return super.onOptionsItemSelected(item) - } - private fun setupUI() = with(ui) { - backCtaView.setOnThrottledClickListener { requireActivity().onBackPressed() } - addBaseNodeButton.setOnThrottledClickListener { (requireActivity() as BaseNodeRouter).toAddCustomBaseNode() } + toolbar.rightAction = { (requireActivity() as BaseNodeRouter).toAddCustomBaseNode() } baseNodeList.adapter = adapter baseNodeList.layoutManager = LinearLayoutManager(requireContext()) adapter.setClickListener(CommonAdapter.ItemClickListener { viewModel.selectBaseNode((it as BaseNodeViewHolderItem).baseNodeDto) }) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/torBridges/TorBridgesSelectionFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/torBridges/TorBridgesSelectionFragment.kt index 2894049b2..48fc5c4ec 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/torBridges/TorBridgesSelectionFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/torBridges/TorBridgesSelectionFragment.kt @@ -10,7 +10,6 @@ import com.tari.android.wallet.databinding.FragmentTorBridgeSelectionBinding import com.tari.android.wallet.extension.observe import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.common.recyclerView.CommonAdapter -import com.tari.android.wallet.ui.extension.setOnThrottledClickListener import com.tari.android.wallet.ui.fragment.settings.allSettings.AllSettingsRouter import com.tari.android.wallet.ui.fragment.settings.torBridges.torItem.TorBridgesAdapter @@ -38,11 +37,10 @@ class TorBridgesSelectionFragment : CommonFragment - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:rightIcon="@drawable/ic_plus" + app:text="@string/debug_change_base_node" /> - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:text="@string/tor_bridges_custom_bridges" + app:rightText="@string/tor_bridges_connect"/> - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + app:rightText="@string/tor_bridges_connect" + app:text="@string/tor_bridges_title" /> + android:layout_height="wrap_content" + android:background="?attr/palette_background_primary"> + android:src="@drawable/back_button_vector" + android:tint="?attr/palette_text_heading" /> @@ -39,6 +39,37 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + - - - - \ No newline at end of file diff --git a/app/src/main/res/values/tari_elements.xml b/app/src/main/res/values/tari_elements.xml index 33bf69143..cd967d2ee 100644 --- a/app/src/main/res/values/tari_elements.xml +++ b/app/src/main/res/values/tari_elements.xml @@ -1,5 +1,7 @@ + + \ No newline at end of file From 11be0ac2cf29542d42badeec0d9caf9eb864c9b1 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Wed, 7 Dec 2022 03:02:40 +0100 Subject: [PATCH 10/33] Replaced toolbar with right action on rest places Signed-off-by: Aleksandr Vakhtin --- .../wallet/ui/component/tari/TariToolbar.kt | 18 ++++--- .../settings/logs/logs/LogsFragment.kt | 9 ++-- .../fragment/utxos/list/UtxosListFragment.kt | 3 +- app/src/main/res/drawable/ic_logs_filter.xml | 4 +- app/src/main/res/layout/fragment_logs.xml | 52 ++----------------- .../main/res/layout/fragment_utxos_list.xml | 51 ++---------------- 6 files changed, 27 insertions(+), 110 deletions(-) diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt index 1a2e2ed9b..87a4c54b4 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt @@ -18,26 +18,32 @@ class TariToolbar(context: Context, attrs: AttributeSet) : FrameLayout(context, var backPressedAction: () -> Unit = { (context as? Activity)?.onBackPressed() } var rightAction: () -> Unit = { } + val ui: TariToolbarBinding + init { - val ui = TariToolbarBinding.inflate(LayoutInflater.from(context), this, false) + ui = TariToolbarBinding.inflate(LayoutInflater.from(context), this, false) addView(ui.root) ui.backCtaView.setOnThrottledClickListener { backPressedAction.invoke() } obtain(attrs, R.styleable.TariToolbar).runRecycle { - ui.toolbarTitle.text = getString(R.styleable.TariToolbar_text) - getString(R.styleable.TariToolbar_rightText)?.let { setupRightButton(ui, it) } - getDrawable(R.styleable.TariToolbar_rightIcon)?.let { setupRightIcon(ui, it) } + setText(getString(R.styleable.TariToolbar_text)) + getString(R.styleable.TariToolbar_rightText)?.let { setupRightButton(it) } + getDrawable(R.styleable.TariToolbar_rightIcon)?.let { setupRightIcon(it) } } } - private fun setupRightButton(ui: TariToolbarBinding, newText: String) = with(ui.toolbarRightText) { + fun setText(text: String?) { + ui.toolbarTitle.text = text + } + + fun setupRightButton(newText: String) = with(ui.toolbarRightText) { visible() text = newText setOnThrottledClickListener { rightAction() } } - private fun setupRightIcon(ui: TariToolbarBinding, icon: Drawable) = with(ui.toolbarRightIcon) { + fun setupRightIcon(icon: Drawable) = with(ui.toolbarRightIcon) { visible() setImageDrawable(icon) setOnThrottledClickListener { rightAction() } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/logs/logs/LogsFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/logs/logs/LogsFragment.kt index 4f1ae4b0a..9fd4f4144 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/logs/logs/LogsFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/logs/logs/LogsFragment.kt @@ -63,7 +63,7 @@ class LogsFragment : CommonFragment() { bindViewModel(viewModel) arguments?.serializable(DebugActivity.log_file)?.let { - this.ui.title.text = it.name + this.ui.toolbar.setText(it.name) viewModel.initWithFile(it) } @@ -72,9 +72,8 @@ class LogsFragment : CommonFragment() { } private fun setupUI() = with(ui) { - filterButton.setVisible(false) - backCtaView.setOnClickListener { requireActivity().onBackPressed() } - filterButton.setOnClickListener { viewModel.showFilters() } + ui.toolbar.rightAction = { viewModel.showFilters() } + ui.toolbar.ui.toolbarRightIcon.setVisible(false) recyclerViewAdapter = LogListAdapter() recyclerViewAdapter.setLongClickListener(CommonAdapter.ItemLongClickListener { viewModel.copyToClipboard(it) @@ -90,7 +89,7 @@ class LogsFragment : CommonFragment() { private fun updateData(list: MutableList) { ui.loadingState.setVisible(false) - ui.filterButton.setVisible(true) + ui.toolbar.ui.toolbarRightIcon.setVisible(true) recyclerViewAdapter.update(list) } diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/utxos/list/UtxosListFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/utxos/list/UtxosListFragment.kt index 6b140772d..54e87c0a9 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/utxos/list/UtxosListFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/utxos/list/UtxosListFragment.kt @@ -61,14 +61,13 @@ class UtxosListFragment : CommonFragment - - - - - - - - - - - - - - - - - - + app:text="@string/debug_logs_title" + app:rightIcon="@drawable/ic_logs_filter" + android:layout_height="wrap_content"/> - - - - - - - - - - - - - + app:text="@string/utxos_list_title" + app:rightIcon="@drawable/ic_wallet_group_cells" /> Date: Thu, 8 Dec 2022 20:43:36 +0100 Subject: [PATCH 11/33] Introduced tari back button and replace it every where Signed-off-by: Aleksandr Vakhtin --- .../ui/component/tari/TariBackButton.kt | 23 ++++++++++++++++ .../wallet/ui/component/tari/TariToolbar.kt | 8 ++++-- .../send/addAmount/AddAmountFragment.kt | 6 ++-- .../fragment/send/addNote/AddNoteFragment.kt | 10 +++---- .../MakeTransactionFragment.kt | 1 - .../fragment/tx/details/TxDetailsFragment.kt | 1 - app/src/main/res/drawable-hdpi/back_icon.png | Bin 246 -> 0 bytes app/src/main/res/drawable-mdpi/back_icon.png | Bin 196 -> 0 bytes app/src/main/res/drawable-xhdpi/back_icon.png | Bin 265 -> 0 bytes .../main/res/drawable-xxhdpi/back_icon.png | Bin 436 -> 0 bytes .../main/res/drawable-xxxhdpi/back_icon.png | Bin 508 -> 0 bytes .../main/res/layout/fragment_add_amount.xml | 26 ++++++++---------- app/src/main/res/layout/fragment_add_note.xml | 21 ++++++-------- .../res/layout/fragment_make_transaction.xml | 19 ++++++------- .../main/res/layout/fragment_tx_details.xml | 19 ++++++------- app/src/main/res/layout/tari_back_button.xml | 16 +++++++++++ app/src/main/res/layout/tari_toolbar.xml | 13 ++------- 17 files changed, 91 insertions(+), 72 deletions(-) create mode 100644 app/src/main/java/com/tari/android/wallet/ui/component/tari/TariBackButton.kt delete mode 100644 app/src/main/res/drawable-hdpi/back_icon.png delete mode 100644 app/src/main/res/drawable-mdpi/back_icon.png delete mode 100644 app/src/main/res/drawable-xhdpi/back_icon.png delete mode 100644 app/src/main/res/drawable-xxhdpi/back_icon.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/back_icon.png create mode 100644 app/src/main/res/layout/tari_back_button.xml diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariBackButton.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariBackButton.kt new file mode 100644 index 000000000..8d5946a52 --- /dev/null +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariBackButton.kt @@ -0,0 +1,23 @@ +package com.tari.android.wallet.ui.component.tari + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.FrameLayout +import com.tari.android.wallet.databinding.TariBackButtonBinding +import com.tari.android.wallet.ui.extension.setOnThrottledClickListener + +class TariBackButton(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) { + + var backPressedAction: () -> Unit = { (context as? Activity)?.onBackPressed() } + + val ui: TariBackButtonBinding + + init { + ui = TariBackButtonBinding.inflate(LayoutInflater.from(context), this, false) + addView(ui.root) + + ui.backCtaView.setOnThrottledClickListener { backPressedAction.invoke() } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt index 87a4c54b4..6521825dd 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariToolbar.kt @@ -1,6 +1,5 @@ package com.tari.android.wallet.ui.component.tari -import android.app.Activity import android.content.Context import android.graphics.drawable.Drawable import android.util.AttributeSet @@ -15,7 +14,12 @@ import com.tari.android.wallet.ui.extension.visible class TariToolbar(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) { - var backPressedAction: () -> Unit = { (context as? Activity)?.onBackPressed() } + var backPressedAction: () -> Unit + get() = ui.backCtaView.backPressedAction + set(value) { + ui.backCtaView.backPressedAction = value + } + var rightAction: () -> Unit = { } val ui: TariToolbarBinding diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt index 62a6dccac..360831af2 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/send/addAmount/AddAmountFragment.kt @@ -129,11 +129,11 @@ class AddAmountFragment : CommonFragmentPx#ut`KgR5%fxlt~W4FbqX|1Go`gGS6@^4hjp9m?U^!e6^~o{>YZT?8JUenyISF zZCqa3RBj2cXwr1~XhX>x{m>oN$l96;K>ZHKO3uKMIaj?e3plRl%u!6r4Ia wf>UQzaO!plZr{fTowX7rKJ^0V!y^UZ|IkZLfX+U(vj6}907*qoM6N<$f)z|*zyJUM diff --git a/app/src/main/res/drawable-mdpi/back_icon.png b/app/src/main/res/drawable-mdpi/back_icon.png deleted file mode 100644 index 8de2d087fe2dcd8a29fc5ea638c49f3658ad9ddf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRS!3HG%PBB{nq!^2X+?^QKos)S9e|2Ufnwcn{S(dqnQ|PSb2jRz?J{^!tZtasr4y^WR_NRmrNmajRWq)9 zC~D+Z$!c6V>q%?x^K&JfLTMNHtiL3jnpoG$>1i!v(6I8(lKBr_)YqL`&(FWkzFPK9 u_rsn=${n2-6RQG)r%l*1EuiMzTeek|3VSZeF7gMugu&C*&t;ucLK6VX_e$^p diff --git a/app/src/main/res/drawable-xhdpi/back_icon.png b/app/src/main/res/drawable-xhdpi/back_icon.png deleted file mode 100644 index 1a2a3b52f3388e837732872d8f1f293bf05cbfd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 265 zcmV+k0rvihP)Px#!%0LzR5%f>)mIL}Fc1XL0H@)0zzINfLa#YeZUt+^NdCy6U27~kPFcS=#p|jP zl|i9%w0=XYZDId!w}WlpzdA03_8C%))g4H}(g@vUXOS2|-k#io1#Sp(jv#A-Tq4Md zAlC@8B*-m-EC}+5AajB|?R?J*%?R>}AX9=gUZih<@*;UOjOyRZMvS{M800001b5ch_0Itp) z=>Px$Zb?KzR9FecnAuJPF$_g3_y+ns1t`fCX0c{k3Ug>jy zTs9{99_i_G-av;g3c)3yw;G^zlH8$OC2BL!5pvlY(YHuRbKXG5E(*aVpm+M6ctNWq zxIwu})MlVlFKAQ%`ltn(kVsFT^9DLYF6)Ty1AWrx+(jX{L)R!*iP{WwfflxPx$wn;=mR9Fe^*=bG!K@bICa5;h(1ignwMR4CxRK$H>uHucD}w zNu>!>X+CSdT6C+13t*>+;Cm6$Cj=0=Ix zbYgCmm<=c94)wA**SZsPuf(*SmkjlM=J)#5|*Z1}TXZ^vX+pPWys- z8D`muc~xSToR~KyX3>dxNBu0a&`75NcC3VpP`iwy6Y8KQD%5FDRHzFhQK4=fM1{J! z64k+noLdNMq|*2$# zs89=5M1@+?BP!IQr=jY|P|LzZg;_W^kcExZu=gCiW|j78;Yaj~Iz>xB+Ln$ - - + app:layout_constraintTop_toTopOf="parent" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/header_top_inset"/> + app:layout_constraintTop_toTopOf="@id/back_cta_view" /> + app:layout_constraintTop_toTopOf="@id/back_cta_view"> + app:constraint_referenced_ids="back_cta_view,title_text_view,emoji_id_summary_container_view" /> - @@ -33,10 +30,10 @@ android:textColor="@color/black" android:textSize="16sp" app:customFont="@string/font_heavy" - app:layout_constraintBottom_toBottomOf="@id/back_button" + app:layout_constraintBottom_toBottomOf="@id/back_cta_view" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/back_button" /> + app:layout_constraintTop_toTopOf="@id/back_cta_view" /> + app:layout_constraintTop_toTopOf="@id/back_cta_view"> + app:constraint_referenced_ids="back_cta_view,title_text_view,emoji_id_summary_container_view" /> - + android:layout_marginTop="@dimen/header_top_inset"/> + app:layout_constraintTop_toTopOf="@id/back_cta_view" /> + app:layout_constraintTop_toBottomOf="@id/back_cta_view"> - + app:layout_constraintTop_toTopOf="parent" + android:layout_width="@dimen/back_button_size" + android:layout_height="@dimen/back_button_size" + android:layout_marginTop="@dimen/header_top_inset"/> + app:layout_constraintTop_toTopOf="@id/back_cta_view" /> + + + + + + diff --git a/app/src/main/res/layout/tari_toolbar.xml b/app/src/main/res/layout/tari_toolbar.xml index 55ffd1d4b..1f2c89812 100644 --- a/app/src/main/res/layout/tari_toolbar.xml +++ b/app/src/main/res/layout/tari_toolbar.xml @@ -5,7 +5,7 @@ android:layout_height="wrap_content" android:background="?attr/palette_background_primary"> - - - - - + app:layout_constraintTop_toTopOf="parent"/> Date: Thu, 8 Dec 2022 20:49:37 +0100 Subject: [PATCH 12/33] Added new icon for theme selection Signed-off-by: Aleksandr Vakhtin --- .../settings/allSettings/AllSettingsViewModel.kt | 2 +- .../settings/allSettings/about/TariAboutViewModel.kt | 1 + .../res/drawable/all_settings_select_theme_icon.xml | 12 ++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/all_settings_select_theme_icon.xml diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/AllSettingsViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/AllSettingsViewModel.kt index 45623cba4..321255f9b 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/AllSettingsViewModel.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/AllSettingsViewModel.kt @@ -105,7 +105,7 @@ class AllSettingsViewModel : CommonViewModel() { _openYatOnboarding.postValue(Unit) }, SettingsTitleDto(resourceManager.getString(all_settings_advanced_settings_label)), - ButtonViewDto(resourceManager.getString(all_settings_select_theme), all_settings_background_service_icon) { + ButtonViewDto(resourceManager.getString(all_settings_select_theme), all_settings_select_theme_icon) { _navigation.postValue(AllSettingsNavigation.ToThemeSelection) }, DividerViewHolderItem(), diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/about/TariAboutViewModel.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/about/TariAboutViewModel.kt index 4834dfbfe..def491fc2 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/about/TariAboutViewModel.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/allSettings/about/TariAboutViewModel.kt @@ -26,6 +26,7 @@ class TariAboutViewModel : CommonViewModel() { TariIconViewHolderItem(R.drawable.all_settings_user_agreement_icon, tari_about_icon_text_writing, tari_about_icon_url_writing), TariIconViewHolderItem(R.drawable.all_settings_privacy_policy_icon, tari_about_icon_text_privacy, tari_about_icon_url_privacy), TariIconViewHolderItem(R.drawable.all_settings_disclaimer_icon, tari_about_icon_text_bullhorn, tari_about_icon_url_bullhorn), + TariIconViewHolderItem(R.drawable.all_settings_select_theme_icon, tari_about_icon_text_select_theme, tari_about_icon_url_select_theme), TariIconViewHolderItem(R.drawable.all_settings_background_service_icon, tari_about_icon_text_refresh, tari_about_icon_url_refresh), TariIconViewHolderItem(R.drawable.all_settings_block_explorer_icon, tari_about_icon_text_magnifier, tari_about_icon_url_magnifier), TariIconViewHolderItem(R.drawable.all_settings_bridge_configuration_icon, tari_about_icon_text_repair, tari_about_icon_url_repair), diff --git a/app/src/main/res/drawable/all_settings_select_theme_icon.xml b/app/src/main/res/drawable/all_settings_select_theme_icon.xml new file mode 100644 index 000000000..02e704635 --- /dev/null +++ b/app/src/main/res/drawable/all_settings_select_theme_icon.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 310fad0d1..bf9128fb6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -592,6 +592,7 @@ https://thenounproject.com/icon/privacy-1381695/ https://thenounproject.com/icon/bullhorn-4213159/ https://thenounproject.com/icon/refresh-1043971/ + https://thenounproject.com/icon/theme-396505/ https://thenounproject.com/icon/magnifier-4213152/ https://thenounproject.com/icon/repair-tools-4213156/ https://thenounproject.com/icon/internet-server-4213144/ @@ -606,6 +607,7 @@ Privacy by Gregor Cresnar from\nNounProject.com Bullhorn by Design Circle from\nNounProject.com Magnifier by Design Circle from\nNounProject.com (Modified) + Theme by icon 54 from\nNounProject.com (Modified) Refresh by Poombatta from\nNounProject.com Repair Tools by Design Circle from\nNounProject.com Internet Server by Design Circle from\nNounProject.com From f5ae0cafa330a51607b07dd2a9dbee55e28d6fc9 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Thu, 8 Dec 2022 23:15:10 +0100 Subject: [PATCH 13/33] Introduced primary and secondary background widgets sulution Signed-off-by: Aleksandr Vakhtin --- .../component/tari/TariPrimaryBackground.kt | 30 ++ .../component/tari/TariSecondaryBackground.kt | 15 + .../wallet/ui/dialog/modular/ModularDialog.kt | 3 +- .../wallet/ui/extension/ViewExtensions.kt | 7 + .../bugReporting/BugsReportingFragment.kt | 3 +- app/src/main/res/layout/dialog_base.xml | 17 +- app/src/main/res/layout/dialog_progress.xml | 97 ++++--- .../res/layout/fragment_bugs_reporting.xml | 265 +++++++++--------- .../main/res/layout/fragment_tari_about.xml | 55 ++-- .../main/res/layout/fragment_theme_change.xml | 51 ++-- app/src/main/res/layout/tari_toolbar.xml | 12 +- app/src/main/res/values/tari_elements.xml | 5 + 12 files changed, 322 insertions(+), 238 deletions(-) create mode 100644 app/src/main/java/com/tari/android/wallet/ui/component/tari/TariPrimaryBackground.kt create mode 100644 app/src/main/java/com/tari/android/wallet/ui/component/tari/TariSecondaryBackground.kt diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariPrimaryBackground.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariPrimaryBackground.kt new file mode 100644 index 000000000..b1ec7dbd3 --- /dev/null +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariPrimaryBackground.kt @@ -0,0 +1,30 @@ +package com.tari.android.wallet.ui.component.tari + +import android.content.Context +import android.graphics.drawable.ShapeDrawable +import android.graphics.drawable.shapes.RoundRectShape +import android.util.AttributeSet +import androidx.constraintlayout.widget.ConstraintLayout +import com.tari.android.wallet.R +import com.tari.android.wallet.ui.extension.colorFromAttribute +import com.tari.android.wallet.ui.extension.obtain +import com.tari.android.wallet.ui.extension.runRecycle + +class TariPrimaryBackground(context: Context, attrs: AttributeSet) : ConstraintLayout(context, attrs) { + + init { + val backColor = context.colorFromAttribute(R.attr.palette_background_primary) + + obtain(attrs, R.styleable.TariPrimaryBackground).runRecycle { + val r = getDimension(R.styleable.TariPrimaryBackground_cornerRadius, 0.0F) + + if (r != 0.0F) { + val shapeDrawable = ShapeDrawable(RoundRectShape(floatArrayOf(r, r, r, r, r, r, r, r), null, null)) + shapeDrawable.paint.color = backColor + background = shapeDrawable + } else { + setBackgroundColor(backColor) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariSecondaryBackground.kt b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariSecondaryBackground.kt new file mode 100644 index 000000000..7491850b3 --- /dev/null +++ b/app/src/main/java/com/tari/android/wallet/ui/component/tari/TariSecondaryBackground.kt @@ -0,0 +1,15 @@ +package com.tari.android.wallet.ui.component.tari + +import android.content.Context +import android.util.AttributeSet +import androidx.constraintlayout.widget.ConstraintLayout +import com.tari.android.wallet.R +import com.tari.android.wallet.ui.extension.colorFromAttribute + +class TariSecondaryBackground(context: Context, attrs: AttributeSet) : ConstraintLayout(context, attrs) { + + init { + val backColor = context.colorFromAttribute(R.attr.palette_background_secondary) + setBackgroundColor(backColor) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/dialog/modular/ModularDialog.kt b/app/src/main/java/com/tari/android/wallet/ui/dialog/modular/ModularDialog.kt index 42ef4e6ca..a34d3236f 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/dialog/modular/ModularDialog.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/dialog/modular/ModularDialog.kt @@ -7,6 +7,7 @@ import android.graphics.drawable.ColorDrawable import android.view.Gravity import android.view.View import android.widget.LinearLayout +import androidx.appcompat.widget.LinearLayoutCompat import com.tari.android.wallet.R import com.tari.android.wallet.ui.component.networkStateIndicator.module.ConnectionStatusesModule import com.tari.android.wallet.ui.component.networkStateIndicator.module.ConnectionStatusesModuleView @@ -63,7 +64,7 @@ open class ModularDialog(val context: Context) : TariDialog { } private fun updateModules(modules: List) { - val root = dialog.findViewById(R.id.dialog_root_view) + val root = dialog.findViewById(R.id.dialog_root_view) root.removeAllViews() for (module in modules) { module.dismissAction = dialog::dismiss diff --git a/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt b/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt index d7597b533..c0c57862e 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/extension/ViewExtensions.kt @@ -359,4 +359,11 @@ fun TypedArray.runRecycle(action: TypedArray.() -> Unit) { } finally { recycle() } +} + +fun Context.colorFromAttribute(attribute: Int): Int { + val attributes = obtainStyledAttributes(intArrayOf(attribute)) + val dimension = attributes.getColor(0, 0) + attributes.recycle() + return dimension } \ No newline at end of file diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt index 429e9d89f..b9408fc43 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/settings/bugReporting/BugsReportingFragment.kt @@ -36,6 +36,5 @@ class BugsReportingFragment : CommonFragment - + app:cornerRadius="26dp"> + - + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_progress.xml b/app/src/main/res/layout/dialog_progress.xml index d5ec10861..1f63ee27f 100644 --- a/app/src/main/res/layout/dialog_progress.xml +++ b/app/src/main/res/layout/dialog_progress.xml @@ -1,56 +1,63 @@ - - - + app:cornerRadius="26dp"> - + android:layout_marginHorizontal="@dimen/home_dialog_testnet_tari_dialog_margin" + android:layout_marginBottom="23dp" + android:orientation="vertical" + android:paddingBottom="20dp"> - + + + + + + + - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_bugs_reporting.xml b/app/src/main/res/layout/fragment_bugs_reporting.xml index 888e7d971..8139e4cf6 100644 --- a/app/src/main/res/layout/fragment_bugs_reporting.xml +++ b/app/src/main/res/layout/fragment_bugs_reporting.xml @@ -1,151 +1,156 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - - - + app:text="@string/bugs_reporting_title" /> - - - - - + - - - + android:layout_marginHorizontal="25dp" + android:orientation="vertical"> - - - + + + + + + + + + + + + + + + + + + + + app:customFont="@string/font_heavy" /> - + - - - - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_tari_about.xml b/app/src/main/res/layout/fragment_tari_about.xml index cee0cb45c..297b9c496 100644 --- a/app/src/main/res/layout/fragment_tari_about.xml +++ b/app/src/main/res/layout/fragment_tari_about.xml @@ -1,35 +1,40 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - + - + + + + + - + diff --git a/app/src/main/res/layout/fragment_theme_change.xml b/app/src/main/res/layout/fragment_theme_change.xml index 356e0b83c..d6c4404eb 100644 --- a/app/src/main/res/layout/fragment_theme_change.xml +++ b/app/src/main/res/layout/fragment_theme_change.xml @@ -1,33 +1,38 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - + - + + + + + - + diff --git a/app/src/main/res/layout/tari_toolbar.xml b/app/src/main/res/layout/tari_toolbar.xml index 1f2c89812..b0c7fbbce 100644 --- a/app/src/main/res/layout/tari_toolbar.xml +++ b/app/src/main/res/layout/tari_toolbar.xml @@ -1,9 +1,8 @@ - + android:layout_height="wrap_content"> + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/tari_elements.xml b/app/src/main/res/values/tari_elements.xml index cd967d2ee..70f2ebd1b 100644 --- a/app/src/main/res/values/tari_elements.xml +++ b/app/src/main/res/values/tari_elements.xml @@ -4,4 +4,9 @@ + + + + + \ No newline at end of file From 38beedb349ea4e819165eab0fc78ab102272f5f3 Mon Sep 17 00:00:00 2001 From: Aleksandr Vakhtin Date: Fri, 9 Dec 2022 01:25:15 +0100 Subject: [PATCH 14/33] Replaced all screens with new back widgets Signed-off-by: Aleksandr Vakhtin --- .../CustomTxNotificationViewHolder.kt | 2 +- .../notification/TxCanceledViewHolder.kt | 2 +- .../drawable/background_choose_gif_dialog.xml | 8 - .../main/res/layout/fragment_add_amount.xml | 13 +- app/src/main/res/layout/fragment_add_note.xml | 7 +- .../res/layout/fragment_add_recipient.xml | 17 +- .../main/res/layout/fragment_all_settings.xml | 95 +- .../fragment_background_service_settings.xml | 114 ++- .../res/layout/fragment_base_node_add.xml | 202 ++--- .../res/layout/fragment_base_node_change.xml | 39 +- .../fragment_change_secure_password.xml | 290 ++++--- .../main/res/layout/fragment_choose_gif.xml | 95 +- .../layout/fragment_choose_restore_option.xml | 103 ++- .../res/layout/fragment_create_wallet.xml | 722 ++++++++-------- .../layout/fragment_custom_tor_bridges.xml | 271 +++--- .../res/layout/fragment_delete_wallet.xml | 115 +-- .../layout/fragment_enter_backup_password.xml | 171 ++-- .../fragment_enter_restore_password.xml | 209 ++--- .../main/res/layout/fragment_local_auth.xml | 201 ++--- .../main/res/layout/fragment_log_files.xml | 56 +- app/src/main/res/layout/fragment_logs.xml | 82 +- .../res/layout/fragment_make_transaction.xml | 13 +- .../res/layout/fragment_network_selection.xml | 79 +- .../main/res/layout/fragment_request_tari.xml | 115 +-- app/src/main/res/layout/fragment_store.xml | 213 ++--- .../main/res/layout/fragment_tari_about.xml | 45 +- .../main/res/layout/fragment_theme_change.xml | 43 +- .../layout/fragment_tor_bridge_selection.xml | 77 +- .../main/res/layout/fragment_tx_details.xml | 809 +++++++++--------- .../main/res/layout/fragment_utxos_list.xml | 441 +++++----- .../layout/fragment_verify_seed_phrase.xml | 9 +- .../fragment_wallet_backup_settings.xml | 337 ++++---- .../main/res/layout/fragment_wallet_info.xml | 360 ++++---- .../fragment_wallet_input_seed_words.xml | 265 +++--- ...gment_wallet_restoring_from_seed_words.xml | 7 +- .../fragment_write_down_seed_phrase.xml | 7 +- ...ication.xml => notification_remote_tx.xml} | 0 ...ml => notification_remote_tx_canceled.xml} | 0 ...eme.xml => tari_palette_current_theme.xml} | 0 app/src/main/res/values/colors.xml | 5 - 40 files changed, 2918 insertions(+), 2721 deletions(-) delete mode 100644 app/src/main/res/drawable/background_choose_gif_dialog.xml rename app/src/main/res/layout/{remote_tx_notification.xml => notification_remote_tx.xml} (100%) rename app/src/main/res/layout/{remote_tx_canceled_notification.xml => notification_remote_tx_canceled.xml} (100%) rename app/src/main/res/layout/{palette_current_theme.xml => tari_palette_current_theme.xml} (100%) diff --git a/app/src/main/java/com/tari/android/wallet/notification/CustomTxNotificationViewHolder.kt b/app/src/main/java/com/tari/android/wallet/notification/CustomTxNotificationViewHolder.kt index 1cc5e839f..c2b8fb1bd 100644 --- a/app/src/main/java/com/tari/android/wallet/notification/CustomTxNotificationViewHolder.kt +++ b/app/src/main/java/com/tari/android/wallet/notification/CustomTxNotificationViewHolder.kt @@ -50,7 +50,7 @@ import com.tari.android.wallet.util.WalletUtil * @author The Tari Development Team */ class CustomTxNotificationViewHolder(val context: Context, tx: Tx) : - RemoteViews(context.packageName, R.layout.remote_tx_notification) { + RemoteViews(context.packageName, R.layout.notification_remote_tx) { init { val user = tx.user diff --git a/app/src/main/java/com/tari/android/wallet/notification/TxCanceledViewHolder.kt b/app/src/main/java/com/tari/android/wallet/notification/TxCanceledViewHolder.kt index 6aaf43475..68efb0421 100644 --- a/app/src/main/java/com/tari/android/wallet/notification/TxCanceledViewHolder.kt +++ b/app/src/main/java/com/tari/android/wallet/notification/TxCanceledViewHolder.kt @@ -40,7 +40,7 @@ import com.tari.android.wallet.model.CancelledTx import com.tari.android.wallet.util.WalletUtil class TxCanceledViewHolder(context: Context, tx: CancelledTx) : - RemoteViews(context.packageName, R.layout.remote_tx_canceled_notification) { + RemoteViews(context.packageName, R.layout.notification_remote_tx_canceled) { init { // amount - display just "NEW" if the screen is locked diff --git a/app/src/main/res/drawable/background_choose_gif_dialog.xml b/app/src/main/res/drawable/background_choose_gif_dialog.xml deleted file mode 100644 index fbe7af576..000000000 --- a/app/src/main/res/drawable/background_choose_gif_dialog.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/fragment_add_amount.xml b/app/src/main/res/layout/fragment_add_amount.xml index 3b5851e95..8f97260e2 100644 --- a/app/src/main/res/layout/fragment_add_amount.xml +++ b/app/src/main/res/layout/fragment_add_amount.xml @@ -1,19 +1,18 @@ - + android:layout_height="match_parent"> + android:layout_marginTop="@dimen/header_top_inset" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_add_note.xml b/app/src/main/res/layout/fragment_add_note.xml index 9486b897d..3d9e588d9 100644 --- a/app/src/main/res/layout/fragment_add_note.xml +++ b/app/src/main/res/layout/fragment_add_note.xml @@ -1,11 +1,10 @@ - + android:layout_height="match_parent"> - + diff --git a/app/src/main/res/layout/fragment_add_recipient.xml b/app/src/main/res/layout/fragment_add_recipient.xml index 3fe74dc3d..0955a9339 100644 --- a/app/src/main/res/layout/fragment_add_recipient.xml +++ b/app/src/main/res/layout/fragment_add_recipient.xml @@ -1,11 +1,10 @@ - + android:layout_height="match_parent"> @@ -53,7 +52,7 @@ android:src="@drawable/tari_yat_open" android:tint="@color/purple" android:visibility="gone" - tools:visibility="visible"/> + tools:visibility="visible" /> @@ -98,15 +97,15 @@ @@ -119,7 +118,7 @@ android:src="@drawable/opened_eye" android:tint="@color/purple" android:visibility="gone" - tools:visibility="visible"/> + tools:visibility="visible" /> - + diff --git a/app/src/main/res/layout/fragment_all_settings.xml b/app/src/main/res/layout/fragment_all_settings.xml index 1739d2b7c..e8fb8c394 100644 --- a/app/src/main/res/layout/fragment_all_settings.xml +++ b/app/src/main/res/layout/fragment_all_settings.xml @@ -1,82 +1,45 @@ - + android:layout_height="match_parent"> - - - - - - - - - + android:orientation="vertical"> - + android:layout_height="@dimen/header_height" + android:background="@color/white" + android:elevation="8dp" + android:paddingHorizontal="@dimen/common_horizontal_margin"> - + android:layout_gravity="center" + android:text="@string/all_settings_page_title" + android:textColor="@color/black" + android:textSize="16sp" + app:customFont="@string/font_heavy" /> - + - + - - + - + - - - + - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_background_service_settings.xml b/app/src/main/res/layout/fragment_background_service_settings.xml index 63c859fc3..e26b7a31a 100644 --- a/app/src/main/res/layout/fragment_background_service_settings.xml +++ b/app/src/main/res/layout/fragment_background_service_settings.xml @@ -1,57 +1,77 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - - - - - - - + app:text="@string/background_service_title" /> + + + + + + + + + + + + + + + + + + - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_base_node_add.xml b/app/src/main/res/layout/fragment_base_node_add.xml index d5b0f7478..52bb48be8 100644 --- a/app/src/main/res/layout/fragment_base_node_add.xml +++ b/app/src/main/res/layout/fragment_base_node_add.xml @@ -1,113 +1,123 @@ - - - + android:layout_height="match_parent"> - + android:orientation="vertical"> - + app:text="@string/debug_custom_base_node" /> - - - - - + + + android:layout_height="match_parent"> + - - - - - + + + + + + + + + + + + + + + - - + - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_base_node_change.xml b/app/src/main/res/layout/fragment_base_node_change.xml index 7e47e2f38..86807f885 100644 --- a/app/src/main/res/layout/fragment_base_node_change.xml +++ b/app/src/main/res/layout/fragment_base_node_change.xml @@ -1,23 +1,34 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - + + + + + + + - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_secure_password.xml b/app/src/main/res/layout/fragment_change_secure_password.xml index 5e2a859b4..8a0b5b78d 100644 --- a/app/src/main/res/layout/fragment_change_secure_password.xml +++ b/app/src/main/res/layout/fragment_change_secure_password.xml @@ -1,179 +1,185 @@ - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:orientation="vertical"> - + - + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:fillViewport="true"> - - - - - - - + android:orientation="vertical" + android:paddingBottom="80dp"> - + android:textSize="17sp" + app:customFont="@string/font_black" /> - - - + android:layout_marginHorizontal="25dp" + android:layout_marginTop="15dp" + android:lineSpacingMultiplier="1.5" + android:textColor="@color/dark_gray" + app:customFont="@string/font_medium" + tools:text="@string/change_password_page_description_general_part" /> + - - - + android:layout_marginHorizontal="20dp" + android:layout_marginTop="4dp"> + + + + + + app:customFont="@string/font_medium" /> - - - - - - + + + + + + + + + + - - + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|bottom" + android:layout_marginHorizontal="25dp" + android:layout_marginTop="15dp" + android:layout_marginBottom="15dp"> - + + + + + - + - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_choose_gif.xml b/app/src/main/res/layout/fragment_choose_gif.xml index 172a528a1..5cddc8e05 100644 --- a/app/src/main/res/layout/fragment_choose_gif.xml +++ b/app/src/main/res/layout/fragment_choose_gif.xml @@ -1,58 +1,65 @@ - - - + app:cornerRadius="10dp"> - - + + + android:layout_marginTop="8dp" + android:background="@drawable/grabber_choose_gif" /> - + + + + + + + - + android:layout_marginHorizontal="25dp" + android:layout_marginTop="15dp" + app:gphCellPadding="5dp" + app:gphDirection="vertical" + app:gphSpanCount="2" /> - + - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_choose_restore_option.xml b/app/src/main/res/layout/fragment_choose_restore_option.xml index 301a0647c..c9bfdb9c3 100644 --- a/app/src/main/res/layout/fragment_choose_restore_option.xml +++ b/app/src/main/res/layout/fragment_choose_restore_option.xml @@ -1,58 +1,75 @@ - - - + android:layout_height="match_parent"> - + android:layout_height="wrap_content" + app:text="@string/restore_wallet_page_title" /> - - - - - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_create_wallet.xml b/app/src/main/res/layout/fragment_create_wallet.xml index 806e4f467..fd3f17684 100644 --- a/app/src/main/res/layout/fragment_create_wallet.xml +++ b/app/src/main/res/layout/fragment_create_wallet.xml @@ -1,420 +1,426 @@ - - - + android:layout_height="match_parent"> + android:layout_height="match_parent"> + + - + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center"> - + - -