Skip to content
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

🔀 :: (#397) - 디바이스 크기에 맞게 버튼크기 맞춰지도록 코드 변경 #398

Merged
merged 2 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package com.msg.gcms.presentation.view.intro

import android.content.Intent
import android.net.Uri
import android.util.DisplayMetrics
import android.view.Display
import android.view.View
import android.widget.Toast
import androidx.activity.viewModels
import com.google.firebase.messaging.FirebaseMessaging
import androidx.compose.ui.unit.dp
import com.google.firebase.messaging.FirebaseMessaging
import com.msg.gauthsignin.GAuthSigninWebView
import com.msg.gauthsignin.component.GAuthButton
import com.msg.gauthsignin.component.utils.Types
Expand Down Expand Up @@ -38,12 +40,18 @@ class IntroActivity : BaseActivity<ActivityIntroBinding>(R.layout.activity_intro
}

private fun setGAuthButtonComponent() {
val display: Display = windowManager.defaultDisplay
val outMetrics = DisplayMetrics()
display.getMetrics(outMetrics)
val density = resources.displayMetrics.density
val dpWidth = outMetrics.widthPixels / density

binding.signInBtn.setContent {
GAuthButton(
style = Types.Style.DEFAULT,
actionType = Types.ActionType.SIGNIN,
colors = Types.Colors.OUTLINE,
horizontalPaddingValue = 80.dp
horizontalPaddingValue = (dpWidth / 2 - 120).dp
) {
binding.gAuthWebView.visibility = View.VISIBLE
setGAuthWebViewComponent()
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/layout/activity_intro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@

<androidx.compose.ui.platform.ComposeView
android:id="@+id/signInBtn"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/guideline18"
app:layout_constraintStart_toStartOf="@+id/guideline17"
app:layout_constraintTop_toTopOf="@+id/guideline21" />

<androidx.compose.ui.platform.ComposeView
Expand Down