Updated on 2026-08-14

This commit is contained in:
Tangem 2022-02-20 16:39:19 +03:00
parent 71df77dd10
commit 8b25bda266
6 changed files with 80 additions and 79 deletions

View file

@ -12,6 +12,7 @@ import com.tangem.tangem_sdk_new.ui.widget.leapfrogWidget.LeapfrogWidget
class BackupCardsWidget(
val leapfrogWidget: LeapfrogWidget,
private val deviceScaleFactor: Float = 1f,
val getTopOfAnchorViewForActivateState: () -> Float,
) {
@ -98,26 +99,26 @@ class BackupCardsWidget(
private fun createWelcomeProperties(cardType: BackupCardType): CardProperties {
return when (cardType) {
BackupCardType.ORIGIN -> CardProperties(
xTranslation = 440f,
yTranslation = 0f,
rotation = 75f,
elevation = 2f,
scale = .9f,
)
xTranslation = 440f * deviceScaleFactor,
yTranslation = 70f,
rotation = 75f,
elevation = 2f,
scale = .85f * deviceScaleFactor,
)
BackupCardType.FIRST_BACKUP -> CardProperties(
xTranslation = 10f,
yTranslation = -100f,
rotation = 100f,
elevation = 1f,
scale = .9f,
)
xTranslation = 10f * deviceScaleFactor,
yTranslation = -30f,
rotation = 100f,
elevation = 1f,
scale = .85f * deviceScaleFactor,
)
BackupCardType.SECOND_BACKUP -> CardProperties(
xTranslation = -440f,
yTranslation = -100f,
rotation = 70f,
elevation = 0f,
scale = .9f,
)
xTranslation = -440f * deviceScaleFactor,
yTranslation = -30f,
rotation = 70f,
elevation = 0f,
scale = .85f * deviceScaleFactor,
)
}
}
@ -125,24 +126,24 @@ class BackupCardsWidget(
return when (cardType) {
BackupCardType.ORIGIN -> CardProperties(
xTranslation = 0f,
yTranslation = 0f,
yTranslation = 30f,
rotation = 5f,
elevation = 2f,
scale = 1f,
scale = 1f * deviceScaleFactor,
)
BackupCardType.FIRST_BACKUP -> CardProperties(
xTranslation = 0f,
yTranslation = -80f,
yTranslation = -50f,
rotation = -5f,
elevation = 1f,
scale = 0.9f,
scale = 0.9f * deviceScaleFactor,
)
BackupCardType.SECOND_BACKUP -> CardProperties(
xTranslation = 10f,
yTranslation = -170f,
yTranslation = -120f,
rotation = -20f,
elevation = 0f,
scale = 0.8f,
scale = 0.8f * deviceScaleFactor,
)
}
}
@ -154,21 +155,21 @@ class BackupCardsWidget(
yTranslation = 0f,
rotation = 0f,
elevation = 2f,
scale = 1f,
scale = 1f * deviceScaleFactor,
)
BackupCardType.FIRST_BACKUP -> CardProperties(
xTranslation = 0f,
yTranslation = 0f,
rotation = 0f,
elevation = 1f,
scale = 0.9f,
scale = 0.9f * deviceScaleFactor,
)
BackupCardType.SECOND_BACKUP -> CardProperties(
xTranslation = 0f,
yTranslation = 0f,
rotation = 0f,
elevation = 0f,
scale = 0.8f,
scale = 0.8f * deviceScaleFactor,
)
}
}

View file

@ -1,6 +1,7 @@
package com.tangem.tap.features.onboarding.products.wallet.ui
import android.os.Bundle
import android.util.TypedValue
import android.view.*
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
@ -47,8 +48,12 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val typedValue = TypedValue()
resources.getValue(R.dimen.device_scale_factor_for_twins_welcome, typedValue, true)
val deviceScaleFactorForWelcomeState = typedValue.float
val leapfrog = LeapfrogWidget(fl_cards_container)
cardsWidget = BackupCardsWidget(leapfrog) { 200f }
cardsWidget = BackupCardsWidget(leapfrog, deviceScaleFactorForWelcomeState) { 200f * deviceScaleFactorForWelcomeState }
startPostponedEnterTransition()
view_pager_backup_info.adapter = BackupInfoAdapter()

View file

@ -23,9 +23,9 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:menu="@menu/shop"
app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
app:title="@string/onboarding_getting_started"
app:menu="@menu/shop"/>
app:title="@string/onboarding_getting_started" />
</com.google.android.material.appbar.AppBarLayout>
@ -33,6 +33,7 @@
android:id="@+id/onboarding_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include
@ -43,7 +44,6 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -51,28 +51,25 @@
android:id="@+id/imv_card_background"
android:layout_width="236dp"
android:layout_height="236dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:background="@drawable/shape_circle"
android:backgroundTint="@color/lightGray0"
android:elevation="0dp"
android:scaleType="fitCenter"
app:layout_constraintStart_toStartOf="@id/fl_cards_container"
app:layout_constraintEnd_toEndOf="@id/fl_cards_container"
app:layout_constraintTop_toTopOf="@id/fl_cards_container"
app:layout_constraintBottom_toBottomOf="@id/fl_cards_container"
android:layout_marginBottom="16dp"
/>
app:layout_constraintEnd_toEndOf="@id/fl_cards_container"
app:layout_constraintStart_toStartOf="@id/fl_cards_container"
app:layout_constraintTop_toTopOf="@id/fl_cards_container" />
<FrameLayout
android:id="@+id/fl_cards_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginTop="0dp"
android:clipChildren="false"
app:layout_constraintBottom_toTopOf="@id/guideline2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/pb_state">
@ -81,36 +78,33 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/card_placeholder_new"
android:visibility="gone"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:scaleType="fitCenter"
/>
android:src="@drawable/card_placeholder_new"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imv_first_backup_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/card_placeholder_new"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:scaleType="fitCenter"
android:visibility="gone"/>
android:src="@drawable/card_placeholder_new"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imv_front_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/card_placeholder_new"
android:transitionName="imv_front_card"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:scaleType="fitCenter"
/>
android:src="@drawable/card_placeholder_new"
android:transitionName="imv_front_card" />
</FrameLayout>
@ -119,12 +113,12 @@
android:layout_width="142dp"
android:layout_height="142dp"
android:src="@drawable/ic_activation_success"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/guideline2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/pb_state"
android:visibility="gone"/>
app:layout_constraintTop_toBottomOf="@id/pb_state" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll_header_body_container"
@ -146,63 +140,61 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:fontFamily="sans-serif-medium"
tools:text="Header"
android:textColor="#060606"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />
app:layout_constraintTop_toTopOf="@+id/guideline2"
tools:text="Header" />
<TextView
android:id="@+id/tv_body"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="64dp"
tools:text="Body"
android:layout_marginStart="@dimen/home_bottom_tv_body_margin_start"
android:layout_marginTop="@dimen/home_bottom_tv_body_margin_top"
android:layout_marginEnd="@dimen/home_bottom_tv_body_margin_end"
android:textAlignment="center"
android:textColor="#686868"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_header" />
app:layout_constraintTop_toBottomOf="@+id/tv_header"
tools:text="Body" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager_backup_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"
app:layout_constraintHorizontal_bias="0.504"
app:flow_verticalBias="0"
app:layout_constraintTop_toTopOf="@+id/guideline2"
android:layout_marginBottom="8dp"/>
app:layout_constraintTop_toTopOf="@+id/guideline2" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout_backup_info"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_marginBottom="16dp"
android:background="@color/backgroundLightGray"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_pager_backup_info"
app:layout_constraintBottom_toTopOf="@id/layout_buttons_common"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_pager_backup_info"
app:tabBackground="@drawable/selector_tabs_dots"
app:tabGravity="center"
app:tabIndicator="@null"
app:tabPaddingStart="8dp"
android:layout_marginBottom="16dp"
app:tabPaddingEnd="8dp"
app:tabGravity="center"/>
app:tabPaddingStart="8dp" />
<include
android:id="@+id/layout_buttons_common"
layout="@layout/layout_onboarding_buttons_common"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
/>
app:layout_constraintBottom_toBottomOf="parent" />
<include
android:id="@+id/layout_buttons_add_cards"
@ -218,7 +210,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintGuide_percent="0.60"
app:layout_constraintGuide_percent="@dimen/onboarding_wallet_top_guide_line_weight"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_main_action"
style="@style/OnboardingButton"
android:layout_width="204dp"
android:layout_height="wrap_content"
android:layout_marginBottom="92dp"
tools:text="Main Action"
android:layout_marginBottom="@dimen/home_bottom_fl_scan_card_container_margin_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:text="Main Action" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_alternative_action"
style="@style/Widget.AppCompat.Button.Borderless"
android:textSize="16sp"
android:layout_width="204dp"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
tools:text="Alternative action"
android:layout_marginBottom="@dimen/home_bottom_btn_alternative_action_margin_bottom"
android:textAllCaps="false"
android:textColor="@color/tapButtonColorBlack"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:text="Alternative action" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -26,4 +26,6 @@
<dimen name="onboarding_card_margin_top">106dp</dimen>
<dimen name="onboarding_square_background_height">230dp</dimen>
<dimen name="onboarding_square_background_margin_top">67dp</dimen>
<item name="onboarding_wallet_top_guide_line_weight" type="dimen" format="float">0.6</item>
</resources>

View file

@ -61,5 +61,6 @@
<dimen name="onboarding_card_margin_top">50dp</dimen>
<dimen name="onboarding_square_background_height">180dp</dimen>
<dimen name="onboarding_square_background_margin_top">37dp</dimen>
<item name="onboarding_wallet_top_guide_line_weight" type="dimen" format="float">0.5</item>>
</resources>