Updated on 2026-08-14

This commit is contained in:
Tangem 2022-02-20 15:22:54 +03:00
parent 011156ac16
commit 13ff70b270
10 changed files with 90 additions and 54 deletions

View file

@ -16,6 +16,7 @@ import com.tangem.tangem_sdk_new.ui.widget.leapfrogWidget.LeapfrogWidget
*/
class TwinsCardWidget(
val leapfrogWidget: LeapfrogWidget,
private val deviceScaleFactor: Float = 1f,
val getTopOfAnchorViewForActivateState: () -> Float
) {
@ -87,20 +88,20 @@ class TwinsCardWidget(
return when (cardNumber) {
TwinCardNumber.First -> {
TwinsCardProperties(
xTranslation = -120f,
yTranslation = -220f,
xTranslation = -120f * deviceScaleFactor,
yTranslation = -220f * deviceScaleFactor,
rotation = -3f,
elevation = 1f,
scale = 1f,
scale = deviceScaleFactor,
)
}
TwinCardNumber.Second -> {
TwinsCardProperties(
xTranslation = 170f,
yTranslation = 170f,
xTranslation = 170f * deviceScaleFactor,
yTranslation = 170f * deviceScaleFactor,
rotation = -3f,
elevation = 0f,
scale = 1f,
scale = deviceScaleFactor,
)
}
}
@ -123,7 +124,7 @@ class TwinsCardWidget(
xTranslation = twinProperties.xTranslation,
yTranslation = twinProperties.yTranslation - topOfAnchorView,
rotation = 0f,
scale = twinProperties.scale - 0.5f,
scale = (twinProperties.scale - 0.5f) * deviceScaleFactor,
)
}

View file

@ -1,6 +1,7 @@
package com.tangem.tap.features.onboarding.products.twins.ui
import android.os.Bundle
import android.util.TypedValue
import android.view.View
import android.view.animation.OvershootInterpolator
import androidx.annotation.LayoutRes
@ -38,6 +39,7 @@ import kotlinx.android.synthetic.main.view_bg_twins_welcome.*
import kotlinx.android.synthetic.main.view_onboarding_progress.*
import kotlinx.android.synthetic.main.view_onboarding_tv_balance.*
class TwinsCardsFragment : BaseOnboardingFragment<TwinCardsState>() {
private var previousStep = TwinCardsStep.None
@ -75,7 +77,14 @@ class TwinsCardsFragment : BaseOnboardingFragment<TwinCardsState>() {
addBackPressHandler(this)
reconfigureLayoutForTwins()
twinsWidget = TwinsCardWidget(LeapfrogWidget(cards_container)) { 285f }
val typedValue = TypedValue()
resources.getValue(R.dimen.device_scale_factor_for_twins_welcome, typedValue, true)
val deviceScaleFactorForWelcomeState = typedValue.float
twinsWidget = TwinsCardWidget(LeapfrogWidget(cards_container), deviceScaleFactorForWelcomeState) {
285f * deviceScaleFactorForWelcomeState
}
btnRefreshBalanceWidget = RefreshBalanceWidget(onboarding_main_container)
toolbar.title = getText(R.string.twins_recreate_toolbar)

View file

@ -37,7 +37,7 @@
android:id="@+id/onboarding_top_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:layout_weight="@dimen/home_top_weight"
android:clipChildren="false" />
<include
@ -45,7 +45,7 @@
layout="@layout/layout_onboarding_container_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
android:layout_weight="@dimen/home_bottom_weight" />
</androidx.appcompat.widget.LinearLayoutCompat>

View file

@ -10,14 +10,14 @@
android:id="@+id/linearLayoutCompat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/linearLayoutCompat_marginBottom"
android:layout_marginBottom="@dimen/home_bottom_llCompat_margin_bottom"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/fl_scan_card_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="@dimen/linearLayoutCompat_constraintVertical_bias">
app:layout_constraintVertical_bias="@dimen/home_bottom_llCompat_constraint_vertical_bias">
<TextView
android:id="@+id/tv_header"
@ -35,9 +35,9 @@
style="@style/TextViewOnboarding.Body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/tv_body_marginStart"
android:layout_marginTop="@dimen/tv_body_marginTop"
android:layout_marginEnd="@dimen/tv_body_marginEnd"
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:minLines="3"
app:layout_constraintBottom_toTopOf="@+id/fl_scan_card_container"
app:layout_constraintEnd_toEndOf="parent"
@ -65,7 +65,7 @@
android:id="@+id/fl_scan_card_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/fl_scan_card_container_marginBottom"
android:layout_marginBottom="@dimen/home_bottom_fl_scan_card_container_margin_bottom"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
@ -92,7 +92,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_alternative_action"
style="@style/TapButtonText"
android:layout_marginBottom="@dimen/btn_alternative_action_marginBottom"
android:layout_marginBottom="@dimen/home_bottom_btn_alternative_action_margin_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -71,6 +71,8 @@
android:layout_height="174dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:scaleX="@dimen/home_top_back_card_scaleX"
android:scaleY="@dimen/home_top_back_card_scaleY"
android:src="@drawable/card_placeholder_white" />
<androidx.appcompat.widget.AppCompatImageView

View file

@ -6,7 +6,11 @@
android:layout_height="match_parent"
android:clipChildren="false">
<include layout="@layout/view_bg_home" />
<include
layout="@layout/view_bg_home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imv_back_card"
@ -16,8 +20,10 @@
android:elevation="0dp"
android:rotation="-21"
android:scaleType="fitXY"
android:scaleX="@dimen/home_top_back_card_scaleX"
android:scaleY="@dimen/home_top_back_card_scaleY"
android:src="@drawable/card_placeholder_white"
android:translationY="@dimen/home_back_card_translationY"
android:translationY="@dimen/home_top_back_card_translationY"
app:layout_constraintEnd_toEndOf="@+id/imv_front_card"
app:layout_constraintStart_toStartOf="@+id/imv_front_card"
app:layout_constraintTop_toBottomOf="@+id/imv_front_card" />
@ -29,8 +35,10 @@
android:elevation="1dp"
android:rotation="-3"
android:scaleType="fitXY"
android:scaleX="@dimen/home_top_front_card_scaleX"
android:scaleY="@dimen/home_top_front_card_scaleY"
android:src="@drawable/card_placeholder_black"
android:translationY="@dimen/home_front_card_translationY"
android:translationY="@dimen/home_top_front_card_translationY"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -25,7 +25,7 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imv_card_background"
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_height="@dimen/onboarding_square_background_height"
android:layout_marginStart="32dp"
android:layout_marginTop="@dimen/onboarding_square_background_margin_top"
android:layout_marginEnd="32dp"

View file

@ -25,7 +25,7 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imv_card_background"
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_height="@dimen/onboarding_square_background_height"
android:layout_marginStart="32dp"
android:layout_marginTop="@dimen/onboarding_square_background_margin_top"
android:layout_marginEnd="32dp"

View file

@ -1,22 +1,29 @@
<resources>
<dimen name="home_back_card_translationY">-10dp</dimen>
<dimen name="home_front_card_translationY">0dp</dimen>
<dimen name="device_scale_factor_for_twins_welcome">1.0</dimen>
<!-- Home - TOP -->
<dimen name="home_top_weight">1.1</dimen>
<dimen name="home_top_back_card_translationY">-10dp</dimen>
<dimen name="home_top_back_card_scaleX">1</dimen>
<dimen name="home_top_back_card_scaleY">1</dimen>
<dimen name="home_top_front_card_translationY">0dp</dimen>
<dimen name="home_top_front_card_scaleY">1</dimen>
<dimen name="home_top_front_card_scaleX">1</dimen>
<!-- Home - bottom -->
<dimen name="home_bottom_weight">1</dimen>
<dimen name="home_bottom_llCompat_margin_bottom">16dp</dimen>
<dimen name="home_bottom_llCompat_constraint_vertical_bias">0.4</dimen>>
<dimen name="home_bottom_tv_body_margin_top">14dp</dimen>
<dimen name="home_bottom_tv_body_margin_start">64dp</dimen>
<dimen name="home_bottom_tv_body_margin_end">64dp</dimen>
<dimen name="home_bottom_fl_scan_card_container_margin_bottom">90dp</dimen>
<dimen name="home_bottom_btn_alternative_action_margin_bottom">14dp</dimen>
<!-- Onboarding -->
<dimen name="onboarding_progress_margin_top">16dp</dimen>
<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>
<!-- onboarding bottom container-->
<dimen name="linearLayoutCompat_marginBottom">16dp</dimen>
<dimen name="linearLayoutCompat_constraintVertical_bias">0.4</dimen>>
<dimen name="tv_body_marginTop">10dp</dimen>
<dimen name="tv_body_marginStart">64dp</dimen>
<dimen name="tv_body_marginEnd">64dp</dimen>
<dimen name="fl_scan_card_container_marginBottom">90dp</dimen>
<dimen name="btn_alternative_action_marginBottom">14dp</dimen>
</resources>

View file

@ -35,22 +35,31 @@
<dimen name="text_size_amount_to_send">32sp</dimen>
<dimen name="dimen16">16dp</dimen>
<dimen name="home_back_card_translationY">-30dp</dimen>
<dimen name="home_front_card_translationY">-20dp</dimen>
<dimen name="onboarding_progress_margin_top">8dp</dimen>
<dimen name="onboarding_card_margin_top">70dp</dimen>
<item name="device_scale_factor_for_twins_welcome" format="float" type="dimen">0.85</item>
<!-- Home - TOP -->
<item name="home_top_weight" format="float" type="dimen">0.9</item>
<dimen name="home_top_back_card_translationY">-60dp</dimen>
<item name="home_top_back_card_scaleX" format="float" type="dimen">0.9</item>
<item name="home_top_back_card_scaleY" format="float" type="dimen">0.9</item>
<dimen name="home_top_front_card_translationY">-40dp</dimen>
<item name="home_top_front_card_scaleY" format="float" type="dimen">0.9</item>
<item name="home_top_front_card_scaleX" format="float" type="dimen">0.9</item>
<!-- Home - bottom -->
<item name="home_bottom_weight" format="float" type="dimen">1</item>
<dimen name="home_bottom_llCompat_margin_bottom">8dp</dimen>
<item name="home_bottom_llCompat_constraint_vertical_bias" format="float" type="dimen">0.1</item>>
<dimen name="home_bottom_tv_body_margin_top">10dp</dimen>
<dimen name="home_bottom_tv_body_margin_start">34dp</dimen>
<dimen name="home_bottom_tv_body_margin_end">34dp</dimen>
<dimen name="home_bottom_fl_scan_card_container_margin_bottom">72dp</dimen>
<dimen name="home_bottom_btn_alternative_action_margin_bottom">12dp</dimen>
<!-- Onboarding -->
<dimen name="onboarding_progress_margin_top">0dp</dimen>
<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>
<!-- onboarding bottom container-->
<dimen name="linearLayoutCompat_marginBottom">8dp</dimen>
<dimen name="linearLayoutCompat_constraintVertical_bias">0.1</dimen>>
<dimen name="tv_body_marginTop">14dp</dimen>
<dimen name="tv_body_marginStart">14dp</dimen>
<dimen name="tv_body_marginEnd">14dp</dimen>
<dimen name="fl_scan_card_container_marginBottom">72dp</dimen>
<dimen name="btn_alternative_action_marginBottom">12dp</dimen>
</resources>