-
Notifications
You must be signed in to change notification settings - Fork 109
Opt/landing carousel #6102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Opt/landing carousel #6102
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
edfc20a
feat: add verify-mobile reminder and gate wallet buy flow
SeniorZhai 57f457e
Code clean
SeniorZhai 153569d
Landing: refine feature carousel layout and rename resources
SeniorZhai b05c657
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai be8f47e
Merge remote-tracking branch 'origin/master' into feature/verify-mobi…
SeniorZhai adc68fb
Replace icon
SeniorZhai 62661d3
Merge branch 'feature/verify-mobile-reminder' into opt/landing_carousel
SeniorZhai 9c41848
Update safe area
SeniorZhai 724b97a
Update setup pin
SeniorZhai 21800bc
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 0c6a0f2
Update create flow
SeniorZhai 01a9bcb
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 5091252
Update account confirm
SeniorZhai 9ceeec5
Update setup name
SeniorZhai e594926
Update UI
SeniorZhai 77862b0
Update quiz page
SeniorZhai 5af5cc3
Update set pin flow
SeniorZhai 2048c72
feat: Add 12/24 words option to mnemonic phrase input
SeniorZhai be2eaa1
refactor: Restructure landing feature layou
SeniorZhai 383d980
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 300339b
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 5f415f9
Open wallet on first entry
SeniorZhai 01c53e4
Update design
SeniorZhai d19ede6
Update strings, design
SeniorZhai 212f8b4
Update analytics
SeniorZhai 5b3b91f
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 21c64a8
Update
SeniorZhai 0f0ea14
Update strings
SeniorZhai c59b992
Update design
SeniorZhai 0374d99
Merge commit 'f6decfead910fb17dd4e708beb5eb0077098e4cd' into opt/land…
SeniorZhai 3ec769d
Update
SeniorZhai d7d715b
Pop back stack
SeniorZhai 564c136
Merge remote-tracking branch 'origin/master' into opt/landing_carousel
SeniorZhai 2248a9c
Revert
SeniorZhai 4a69194
Update
SeniorZhai 43afe66
Update
SeniorZhai 69b9ae7
Merge branch 'master' into opt/landing_carousel
SeniorZhai da2f33a
Merge commit '6fb9edf11408c7f19f3f6772883ab2365caf3616' into opt/land…
SeniorZhai a769584
Update strings
SeniorZhai 3928661
Merge commit '5ed4a698156f0037b981ce67f17402804369ba35' into opt/land…
SeniorZhai ad5fa85
keep some tip comment
Tougee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
237 changes: 237 additions & 0 deletions
237
...c/main/java/one/mixin/android/ui/landing/CreateAccountConfirmBottomSheetDialogFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,237 @@ | ||
| package one.mixin.android.ui.landing | ||
|
|
||
| import android.annotation.SuppressLint | ||
| import android.app.Dialog | ||
| import android.content.ClipData | ||
| import android.view.Gravity | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.PaddingValues | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material.Button | ||
| import androidx.compose.material.ButtonDefaults | ||
| import androidx.compose.material.Icon | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.unit.sp | ||
| import dagger.hilt.android.AndroidEntryPoint | ||
| import one.mixin.android.R | ||
| import one.mixin.android.compose.theme.MixinAppTheme | ||
| import one.mixin.android.extension.booleanFromAttribute | ||
| import one.mixin.android.extension.getClipboardManager | ||
| import one.mixin.android.extension.getSafeAreaInsetsTop | ||
| import one.mixin.android.extension.heavyClickVibrate | ||
| import one.mixin.android.extension.isNightMode | ||
| import one.mixin.android.extension.screenHeight | ||
| import one.mixin.android.extension.toast | ||
| import one.mixin.android.ui.common.MixinComposeBottomSheetDialogFragment | ||
| import one.mixin.android.ui.landing.components.HighlightedTextWithClick | ||
| import one.mixin.android.util.SystemUIManager | ||
|
|
||
| @AndroidEntryPoint | ||
| class CreateAccountConfirmBottomSheetDialogFragment : MixinComposeBottomSheetDialogFragment() { | ||
| companion object { | ||
| const val TAG: String = "CreateAccountConfirmBottomSheetDialogFragment" | ||
|
|
||
| fun newInstance(): CreateAccountConfirmBottomSheetDialogFragment = CreateAccountConfirmBottomSheetDialogFragment() | ||
| } | ||
|
|
||
| private var onCreateAccount: (() -> Unit)? = null | ||
| private var onPrivacyPolicy: (() -> Unit)? = null | ||
| private var onTermsOfService: (() -> Unit)? = null | ||
|
|
||
| fun setOnCreateAccount(callback: () -> Unit): CreateAccountConfirmBottomSheetDialogFragment { | ||
| onCreateAccount = callback | ||
| return this | ||
| } | ||
|
|
||
| fun setOnPrivacyPolicy(callback: () -> Unit): CreateAccountConfirmBottomSheetDialogFragment { | ||
| onPrivacyPolicy = callback | ||
| return this | ||
| } | ||
|
|
||
| fun setOnTermsOfService(callback: () -> Unit): CreateAccountConfirmBottomSheetDialogFragment { | ||
| onTermsOfService = callback | ||
| return this | ||
| } | ||
|
|
||
| override fun getTheme() = R.style.AppTheme_Dialog | ||
|
|
||
| @Composable | ||
| override fun ComposeContent() { | ||
| MixinAppTheme { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .clip(RoundedCornerShape(topEnd = 8.dp, topStart = 8.dp)) | ||
| .background(MixinAppTheme.colors.background) | ||
| .padding(horizontal = 20.dp) | ||
| ) { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| modifier = Modifier.fillMaxWidth().padding(vertical = 32.dp)) { | ||
| Spacer(modifier = Modifier.weight(1f)) | ||
| Icon( | ||
| modifier = Modifier.clickable { | ||
| dismiss() | ||
| }, | ||
| painter = painterResource(id = R.drawable.ic_circle_close), | ||
| tint = Color.Unspecified, | ||
| contentDescription = stringResource(id = R.string.close) | ||
| ) | ||
| } | ||
| Spacer(modifier = Modifier.height(22.dp)) | ||
| Icon( | ||
| modifier = Modifier | ||
| .size(64.dp) | ||
| .align(Alignment.CenterHorizontally), | ||
| painter = painterResource(R.drawable.ic_mnemonic_phrase_creaeting), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| Spacer(modifier = Modifier.height(24.dp)) | ||
| Text( | ||
| text = stringResource(R.string.create_account_confirm_title), | ||
| modifier = Modifier.align(Alignment.CenterHorizontally), | ||
| fontSize = 20.sp, | ||
| fontWeight = FontWeight.W600, | ||
| color = MixinAppTheme.colors.textPrimary | ||
| ) | ||
| Spacer(modifier = Modifier.height(48.dp)) | ||
| FeatureRow( | ||
| iconResId = R.drawable.ic_account_truly, | ||
| titleResId = R.string.feature_truly_decentralized, | ||
| descriptionResId = R.string.feature_truly_decentralized_description, | ||
| ) | ||
| Spacer(modifier = Modifier.height(14.dp)) | ||
| FeatureRow( | ||
| iconResId = R.drawable.ic_account_privacy, | ||
| titleResId = R.string.feature_privacy_by_default, | ||
| descriptionResId = R.string.feature_privacy_by_default_description, | ||
| ) | ||
| Spacer(modifier = Modifier.height(14.dp)) | ||
| FeatureRow( | ||
| iconResId = R.drawable.ic_account_all_in_one, | ||
| titleResId = R.string.feature_all_in_one, | ||
| descriptionResId = R.string.feature_all_in_one_description, | ||
| ) | ||
| Spacer(modifier = Modifier.weight(1f)) | ||
| Button( | ||
| modifier = Modifier | ||
| .fillMaxWidth(), | ||
| onClick = { | ||
| onCreateAccount?.invoke() | ||
| dismiss() | ||
| }, | ||
| colors = ButtonDefaults.outlinedButtonColors(backgroundColor = MixinAppTheme.colors.accent), | ||
| shape = androidx.compose.foundation.shape.RoundedCornerShape(20.dp), | ||
| contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 36.dp, vertical = 11.dp), | ||
| ) { | ||
| Text(text = stringResource(R.string.create_account_confirm_action_create), color = Color.White) | ||
| } | ||
| Spacer(modifier = Modifier.height(10.dp)) | ||
| val privacyPolicyText = stringResource(R.string.Privacy_Policy) | ||
| val termsOfServiceText = stringResource(R.string.Terms_of_Service) | ||
| val landingIntroduction = stringResource(R.string.landing_introduction, privacyPolicyText, termsOfServiceText) | ||
| HighlightedTextWithClick( | ||
| fullText = landingIntroduction, | ||
| modifier = Modifier.align(Alignment.CenterHorizontally), | ||
| privacyPolicyText, | ||
| termsOfServiceText, | ||
| fontSize = 12.sp, | ||
| lineHeight = 16.8.sp, | ||
| ) { clickedText -> | ||
| when (clickedText) { | ||
| privacyPolicyText -> onPrivacyPolicy?.invoke() | ||
| termsOfServiceText -> onTermsOfService?.invoke() | ||
| } | ||
| } | ||
| Spacer(modifier = Modifier.height(30.dp)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun FeatureRow( | ||
| iconResId: Int, | ||
| titleResId: Int, | ||
| descriptionResId: Int, | ||
| ) { | ||
| Row(modifier = Modifier.fillMaxWidth()) { | ||
| Icon( | ||
| modifier = Modifier.size(48.dp), | ||
| painter = painterResource(iconResId), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| Spacer(modifier = Modifier.width(12.dp)) | ||
| Column(modifier = Modifier.weight(1f)) { | ||
| Text( | ||
| text = stringResource(titleResId), | ||
| fontSize = 16.sp, | ||
| fontWeight = FontWeight.W600, | ||
| color = MixinAppTheme.colors.textPrimary | ||
| ) | ||
| Spacer(modifier = Modifier.height(6.dp)) | ||
| Text( | ||
| text = stringResource(descriptionResId), | ||
| fontSize = 14.sp, | ||
| color = MixinAppTheme.colors.textAssist | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| override fun getBottomSheetHeight(view: View): Int { | ||
| return requireContext().screenHeight() - view.getSafeAreaInsetsTop() | ||
| } | ||
|
|
||
| override fun showError(error: String) { | ||
| } | ||
|
|
||
| @SuppressLint("RestrictedApi") | ||
| override fun setupDialog( | ||
| dialog: Dialog, | ||
| style: Int, | ||
| ) { | ||
| super.setupDialog(dialog, R.style.MixinBottomSheet) | ||
| dialog.window?.let { window -> | ||
| SystemUIManager.lightUI(window, requireContext().isNightMode()) | ||
| } | ||
| dialog.window?.setGravity(Gravity.BOTTOM) | ||
| dialog.window?.setLayout( | ||
| ViewGroup.LayoutParams.MATCH_PARENT, | ||
| ViewGroup.LayoutParams.MATCH_PARENT, | ||
| ) | ||
| } | ||
|
|
||
| override fun onStart() { | ||
| super.onStart() | ||
| dialog?.window?.let { window -> | ||
| SystemUIManager.lightUI( | ||
| window, | ||
| !requireContext().booleanFromAttribute(R.attr.flag_night), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the window insets handling, the wrong inset type is being used. The code uses
WindowInsetsCompat.Type.displayCutout()instead ofWindowInsetsCompat.Type.statusBars(). This is inconsistent with other fragments like VerificationFragment.kt and WebFragment.kt which correctly use statusBars for top padding.