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

[1.1.1/AN-UI] 바이옴 화면 반응형 UI 대응 #417

Merged
merged 10 commits into from
Oct 24, 2024
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package poke.rogue.helper.presentation.biome

import android.content.res.Configuration
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.widget.Toolbar
import androidx.core.view.isVisible
import androidx.recyclerview.widget.GridLayoutManager
import poke.rogue.helper.R
import poke.rogue.helper.data.repository.DefaultBiomeRepository
import poke.rogue.helper.databinding.ActivityBiomeBinding
Expand Down Expand Up @@ -54,10 +56,13 @@ class BiomeActivity : ErrorHandleActivity<ActivityBiomeBinding>(R.layout.activit

private fun initAdapter() {
binding.rvBiomeList.apply {
val spanCount =
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) 3 else 2
adapter = biomeAdapter
layoutManager = GridLayoutManager(context, spanCount)
addItemDecoration(
GridSpacingItemDecoration(
2,
spanCount,
9.dp,
false,
),
Expand Down
120 changes: 120 additions & 0 deletions android/app/src/main/res/layout-land/activity_biome_detail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

<variable
name="vm"
type="poke.rogue.helper.presentation.biome.detail.BiomeDetailViewModel" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_biome_detail"
style="@style/CustomToolbarStyle"
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:contentInsetStartWithNavigation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="@{vm.uiState.name}" />

<ImageView
android:id="@+id/iv_biome_detail_image"
imageUrl="@{vm.uiState.imageUrl}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingHorizontal="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toStartOf="@id/gl_start"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars" />

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="@{vm.uiState.name}"
android:textAppearance="@style/TextAppearance.Poke.TitleLargeBold"
android:textSize="@dimen/biome_item_tv_size"
app:layout_constraintBottom_toTopOf="@id/iv_biome_detail_image"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toStartOf="@id/gl_start" />

<TextView
android:id="@+id/tv_navigation_mode"
style="@style/TextAppearance.Poke.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:drawablePadding="4dp"
android:gravity="center"
android:text="@string/biome_navigation_mode_setting"
android:textSize="@dimen/biome_navigation_mode_tv_size"
app:drawableStartCompat="@drawable/icon_info"
app:layout_constraintBottom_toBottomOf="@id/switch_navigation_mode"
app:layout_constraintEnd_toStartOf="@id/switch_navigation_mode"
app:layout_constraintTop_toTopOf="@id/switch_navigation_mode" />

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_navigation_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:checked="@{vm.isInBattleNavigationMode}"
android:onCheckedChanged="@{(buttonView, isChecked) -> vm.changeNavigationMode(isChecked)}"
android:thumb="@drawable/shape_toggle_thumb"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintTop_toBottomOf="@id/iv_biome_detail_image"
app:thumbTint="@null"
app:track="@drawable/selector_toggle_btn"
app:trackTint="@null" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout_biome_detail"
style="@style/TabLayoutStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_tab_background"
android:paddingVertical="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/gl_end"
app:layout_constraintTop_toBottomOf="@id/toolbar_biome_detail"
app:layout_constraintTop_toTopOf="parent"
app:tabIndicatorFullWidth="false" />

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_biome"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/tablayout_biome_detail"
app:layout_constraintTop_toBottomOf="@id/tablayout_biome_detail" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.05" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.35" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
7 changes: 4 additions & 3 deletions android/app/src/main/res/layout/activity_biome_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:drawablePadding="4dp"
android:gravity="center"
android:text="@string/biome_navigation_mode_setting"
android:drawablePadding="4dp"
android:textSize="@dimen/biome_navigation_mode_tv_size"
app:drawableStartCompat="@drawable/icon_info"
app:layout_constraintBottom_toBottomOf="@id/switch_navigation_mode"
app:layout_constraintEnd_toStartOf="@id/switch_navigation_mode"
Expand All @@ -53,10 +54,10 @@
android:id="@+id/switch_navigation_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:checked="@{vm.isInBattleNavigationMode}"
android:onCheckedChanged="@{(buttonView, isChecked) -> vm.changeNavigationMode(isChecked)}"
android:thumb="@drawable/shape_toggle_thumb"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toTopOf="@id/tablayout_biome_detail"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintTop_toBottomOf="@id/iv_biome_detail_image"
Expand All @@ -69,9 +70,9 @@
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/bg_tab_background"
android:paddingVertical="5dp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/switch_navigation_mode"
app:tabIndicatorFullWidth="false" />

Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/res/layout/item_biome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{biome.name}"
android:textSize="@dimen/biome_item_tv_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="화산" />
Expand All @@ -43,8 +44,8 @@
<ImageView
android:id="@+id/iv_biome"
imageUrl="@{biome.imageUrl}"
android:layout_width="200dp"
android:layout_height="100dp"
android:layout_width="@dimen/biome_item_iv_width"
android:layout_height="@dimen/biome_item_iv_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
14 changes: 8 additions & 6 deletions android/app/src/main/res/layout/item_biome_gym.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

<TextView
android:id="@+id/tv_biome_detail_leader_name"
style="@style/TextAppearance.Poke.TitleLargeBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:text="@{gymLeader.grade}"
android:textSize="@dimen/biome_gym_item_tv_size"
app:layout_constraintBottom_toTopOf="@id/vw_divider"
app:layout_constraintEnd_toStartOf="@id/fl_biome_detail_grade_type"
tools:text="꼬상 관장" />
Expand All @@ -30,10 +32,10 @@
imageRes="@{gymLeader.type.typeIconResId}"
android:layout_width="18dp"
android:layout_height="18dp"
app:layout_constraintTop_toTopOf="@id/tv_biome_detail_leader_name"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
app:layout_constraintBottom_toBottomOf="@id/tv_biome_detail_leader_name"
app:layout_constraintEnd_toStartOf="@id/iv_biome_detail_leader_avatar" />
app:layout_constraintEnd_toStartOf="@id/iv_biome_detail_leader_avatar"
app:layout_constraintTop_toTopOf="@id/tv_biome_detail_leader_name" />

<View
android:id="@+id/vw_divider"
Expand All @@ -46,8 +48,8 @@
<ImageView
android:id="@+id/iv_biome_detail_leader_avatar"
imageUrl="@{gymLeader.gymLeaderUrl}"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_width="@dimen/biome_gym_item_iv_width"
android:layout_height="@dimen/biome_gym_item_iv_height"
android:layout_marginHorizontal="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
Expand Down
10 changes: 10 additions & 0 deletions android/app/src/main/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
<dimen name="ability_tv_title_height">100dp</dimen>
<dimen name="ability_tv_title_size">20sp</dimen>
<dimen name="ability_tv_description_size">20sp</dimen>
<!-- biome screen -->
<dimen name="biome_item_tv_size">20sp</dimen>
<dimen name="biome_item_iv_width">300dp</dimen>
<dimen name="biome_item_iv_height">150dp</dimen>
<dimen name="biome_navigation_mode_tv_size">20sp</dimen>
<dimen name="biome_gym_item_iv_width">100dp</dimen>
<dimen name="biome_gym_item_iv_height">200dp</dimen>
<dimen name="biome_gym_item_tv_size">24sp</dimen>

<!-- tablayout -->
<dimen name="tablayout_text_size">20sp</dimen>
</resources>
10 changes: 10 additions & 0 deletions android/app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
<dimen name="ability_tv_title_height">67dp</dimen>
<dimen name="ability_tv_title_size">15sp</dimen>
<dimen name="ability_tv_description_size">15sp</dimen>
<!-- biome screen -->
<dimen name="biome_item_tv_size">16sp</dimen>
<dimen name="biome_item_iv_width">200dp</dimen>
<dimen name="biome_item_iv_height">100dp</dimen>
<dimen name="biome_navigation_mode_tv_size">11sp</dimen>
<dimen name="biome_gym_item_iv_width">50dp</dimen>
<dimen name="biome_gym_item_iv_height">100dp</dimen>
<dimen name="biome_gym_item_tv_size">16sp</dimen>

<!-- tablayout -->
<dimen name="tablayout_text_size">12sp</dimen>
</resources>
6 changes: 6 additions & 0 deletions android/app/src/main/res/values/style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@
</style>

<style name="TabLayoutStyle" parent="Widget.Design.TabLayout">
<item name="tabGravity">fill</item>
<item name="tabMode">fixed</item>
<item name="tabSelectedTextColor">@color/poke_white</item>
<item name="tabBackground">@color/tablayout_background</item>
<item name="tabIndicatorColor">@color/poke_electric</item>
<item name="tabTextAppearance">@style/CustomTabTextAppearance</item>
</style>

<style name="CustomTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">@dimen/tablayout_text_size</item>
</style>

<style name="HighlightTextStyle">
Expand Down
Loading