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] 포켓몬 상세 화면 가로 화면 대응 #426

Merged
merged 27 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9fbf180
refactor: PokemonDetailActivity koin 의 by viewmodel 사용
sh1mj1 Oct 23, 2024
efed136
refactor: PokemonDetailActivity koin 의 by viewmodel 사용
sh1mj1 Oct 23, 2024
5dfded0
test(PokemonDetailActivityTest): 액티비티 실행 테스트
sh1mj1 Oct 23, 2024
c07b3ae
fix(KoinAndroidUnitTestRule): stopKoin -> unloadKoinModules
sh1mj1 Oct 23, 2024
3829061
test(PokemonDetailActivityTest): 액티비티 실행, 구성변경 테스트
sh1mj1 Oct 23, 2024
103e201
build: 프래그먼트 테스팅 매니페스트 번들 버전에 추가
sh1mj1 Oct 23, 2024
a4fffaa
refactor(PokemonIntroActivity): 뷰모델 koin 주입으로
sh1mj1 Oct 23, 2024
ed42f0a
refactor: 포켓몬 상세에서 사용하는 프래그먼트들의 activityViewModel 을 코인의 것으로
sh1mj1 Oct 23, 2024
f45562d
test: 포켓몬 상세에서 사용하는 프래그먼트들의 실행 테스트
sh1mj1 Oct 23, 2024
5157ac1
refactor: 포켓몬 상세에서 사용하는 프래그먼트의 onRequestLayout 제거
sh1mj1 Oct 23, 2024
96dd578
test(PokemonStatFragmentTest): 구성 변경시에도 뷰모델 유지 테스트
sh1mj1 Oct 23, 2024
d2b0c14
test: 포켓몬 상세에서 사용하는 프래그먼트들의 구성 변경이 발생해도 같은 뷰모델 인스턴스 사용
sh1mj1 Oct 23, 2024
3ef8ff4
refactor: koin 사용 이전 instance 를 생성하는 팩토리 메서드들 삭제
sh1mj1 Oct 23, 2024
83dcb4a
feat: 가로 화면 1차
sh1mj1 Oct 23, 2024
c4547ba
feat: 가로 화면 2차
sh1mj1 Oct 24, 2024
5bbfa37
feat: 가로 화면 3차
sh1mj1 Oct 24, 2024
8272932
style(activity_pokemon_detai): 일반 세로 dimensions 적용
sh1mj1 Oct 24, 2024
381fb0a
Merging an/feat/pokemon-detail-landscape
sh1mj1 Oct 24, 2024
c9aa375
style: 포켓몬 상세 세로, 가로 화면 dimension
sh1mj1 Oct 24, 2024
4cd3a2c
style: 포켓몬 진화 dimensions
sh1mj1 Oct 24, 2024
d4809ec
style: 태블릿 적용 포켓몬 상세 액티비티
sh1mj1 Oct 24, 2024
239e9dc
style: 포켓몬 상세 태블릿 적용 능력치, 진화, 기술
sh1mj1 Oct 24, 2024
ce36fd7
style: 포켓몬 상세 태블릿 사이즈 대응 체중, 키, 바이옴
sh1mj1 Oct 24, 2024
d1acea1
Merging an/feat/pokemon-detail-landscape
sh1mj1 Oct 24, 2024
841d6c5
style: 포켓몬 상세 화면 포켓몬 이미지 조정
sh1mj1 Oct 24, 2024
4aeacec
chore: koin 이전의 사용하지 않던 모듈 제거, ktlint, 꿀팁 테스트 제거
sh1mj1 Oct 24, 2024
8fa4bd9
style: 포켓몬 상세의 프래그먼트들에 바텀 패딩
sh1mj1 Oct 24, 2024
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 @@ -54,18 +54,4 @@ class HomeActivityTest {
onView(withId(R.id.cv_home_land_type))
.check(matches(isDisplayed()))
}

@Test
@DisplayName("화면 회전 시에도 꿀팁 메뉴 버튼이 보인다")
fun test4() {
// when
activityRule.scenario.onActivity { activity ->
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
}
onIdle()

// then
onView(withId(R.id.cv_home_land_tip))
.check(matches(isDisplayed()))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package poke.rogue.helper.presentation.dex
import android.content.Context
import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
import android.widget.LinearLayout
import android.widget.LinearLayout.LayoutParams
import poke.rogue.helper.presentation.type.model.TypeUiModel
import poke.rogue.helper.presentation.type.view.TypeChip
Expand All @@ -21,9 +20,9 @@ class PokemonTypesAdapter(private val context: Context, private val viewGroup: V
val typeChip =
TypeChip(context).apply {
layoutParams =
LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT,
LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
1f,
).apply {
setMargins(horizontalMargin = spacingBetweenTypes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,29 @@ class PokemonDetailActivity :
progressIndicatorPokemonDetail,
)

collapsingToolbarLayoutPokemonDetail.title =
collapsingToolbarLayoutPokemonDetail?.title =
stringOf(
R.string.pokemon_list_poke_name_format,
pokemonDetail.pokemon.name,
pokemonDetail.pokemon.dexNumber,
)

tvPokemonDetailPokemonName?.text =
stringOf(
R.string.pokemon_list_poke_name_format,
pokemonDetail.pokemon.name,
pokemonDetail.pokemon.dexNumber,
)
}

val typesUiConfig =
TypeChip.PokemonTypeViewConfiguration(
width = LayoutParams.WRAP_CONTENT,
nameSize = resources.getDimensionPixelSize(R.dimen.pokemon_detail_pokemon_types_name_size),
iconSize = resources.getDimensionPixelSize(R.dimen.pokemon_detail_pokemon_types_icon_size),
hasBackGround = false,
)

pokemonTypesAdapter.addTypes(
types = pokemonDetail.pokemon.types,
config = typesUiConfig,
Expand Down Expand Up @@ -237,14 +252,6 @@ class PokemonDetailActivity :

val TAG: String = PokemonDetailActivity::class.java.simpleName

private val typesUiConfig =
TypeChip.PokemonTypeViewConfiguration(
width = LayoutParams.WRAP_CONTENT,
nameSize = 16.dp,
iconSize = 20.dp,
hasBackGround = false,
)

fun intent(
context: Context,
pokemonId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ package poke.rogue.helper.presentation.dex.detail.information
import android.content.Context
import android.widget.ImageView
import com.google.android.flexbox.FlexboxLayout
import poke.rogue.helper.R
import poke.rogue.helper.presentation.type.model.TypeUiModel
import poke.rogue.helper.presentation.util.view.dp

class PokemonDetailBiomeTypesAdapter(private val context: Context, private val viewGroup: FlexboxLayout) {
fun addTypes(
types: List<TypeUiModel>,
spacingBetweenTypes: Int = 0.dp,
iconSize: Int = 18.dp,
) {
fun addTypes(types: List<TypeUiModel>) {
viewGroup.removeAllViews()

types.forEach { type ->
Expand All @@ -21,11 +17,11 @@ class PokemonDetailBiomeTypesAdapter(private val context: Context, private val v

layoutParams =
FlexboxLayout.LayoutParams(
iconSize,
iconSize,
context.resources.getDimensionPixelSize(R.dimen.pokemon_detail_item_pokemon_biome_type_icon_size),
context.resources.getDimensionPixelSize(R.dimen.pokemon_detail_item_pokemon_biome_type_icon_size),
).apply {
setMargins(
spacingBetweenTypes,
context.resources.getDimensionPixelSize(R.dimen.pokemon_detail_item_pokemon_biome_type_icon_spacing),
0,
0,
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.recyclerview.widget.RecyclerView
import poke.rogue.helper.databinding.ItemPokemonDetailInformationBiomeBinding
import poke.rogue.helper.presentation.dex.detail.PokemonDetailNavigateHandler
import poke.rogue.helper.presentation.dex.model.PokemonBiomeUiModel
import poke.rogue.helper.presentation.util.view.dp

class PokemonDetailBiomeViewHolder(
private val binding: ItemPokemonDetailInformationBiomeBinding,
Expand All @@ -24,13 +23,6 @@ class PokemonDetailBiomeViewHolder(
)
biomeTypesAdapter.addTypes(
types = biome.types,
spacingBetweenTypes = TYPES_SPACING,
iconSize = TYPE_ICON_SIZE,
)
}

companion object {
private val TYPES_SPACING = 5.dp
private val TYPE_ICON_SIZE = 18.dp
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import poke.rogue.helper.presentation.dex.detail.PokemonDetailUiState
import poke.rogue.helper.presentation.dex.detail.PokemonDetailViewModel
import poke.rogue.helper.presentation.util.repeatOnStarted
import poke.rogue.helper.presentation.util.view.GridSpacingItemDecoration
import poke.rogue.helper.presentation.util.view.dp

class PokemonInformationFragment :
BindingFragment<FragmentPokemonInformationBinding>(R.layout.fragment_pokemon_information) {
Expand All @@ -28,9 +27,12 @@ class PokemonInformationFragment :
}

private fun initAdapter() {
val spanCount = resources.getInteger(R.integer.pokemon_detail_item_pokemon_biome_span_count)
val spacing = resources.getDimensionPixelSize(R.dimen.pokemon_detail_item_pokemon_biome_spacing)

binding.rvPokemonDetailInformation.apply {
adapter = biomesAdapter
addItemDecoration(GridSpacingItemDecoration(2, 9.dp, false))
addItemDecoration(GridSpacingItemDecoration(spanCount, spacing, false))
}
}

Expand Down
200 changes: 200 additions & 0 deletions android/app/src/main/res/layout-land/activity_pokemon_detail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?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="eventHandler"
type="poke.rogue.helper.presentation.dex.detail.PokemonDetailNavigateHandler" />

<variable
name="vm"
type="poke.rogue.helper.presentation.dex.detail.PokemonDetailViewModel" />

</data>

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


<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_pokemon_detail"
android:layout_width="@dimen/stroke_width_small"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/pokemon_detail_floating_button_margin"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/layout_pokemon_detail_information"
app:layout_constraintGuide_percent="0.3"
app:layout_constraintStart_toEndOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintTop_toBottomOf="@id/toolbar_pokemon_detail" />


<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_pokemon_detail"
style="@style/CustomToolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/pokemon_list_title_name"
app:titleTextColor="@color/poke_white">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:importantForAccessibility="no"
android:onClick="@{() -> eventHandler.navigateToHome()}"
android:src="@drawable/icon_home" />
</com.google.android.material.appbar.MaterialToolbar>

<ImageView
android:id="@+id/iv_pokemon_detail_pokemon"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/pokemon_detail_pokemon_image_horizontal_margin_start"
android:paddingVertical="@dimen/pokemon_detail_pokemon_image_padding_bottom"
android:paddingStart="@dimen/pokemon_detail_pokemon_image_padding_start"
app:layout_constraintBottom_toTopOf="@id/layout_pokemon_detail_pokemon_types"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toStartOf="@id/divider_pokemon_detail"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar_pokemon_detail"
tools:ignore="ContentDescription,RtlSymmetry"
tools:src="@tools:sample/avatars" />

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/progress_indicator_pokemon_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="gone"
app:indicatorColor="@color/poke_grey_20"
app:layout_constraintBottom_toBottomOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintEnd_toEndOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintStart_toStartOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintTop_toTopOf="@id/iv_pokemon_detail_pokemon"
tools:visibility="visible" />

<TextView
android:id="@+id/tv_pokemon_detail_pokemon_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/pokemon_detail_pokemon_name_margin"
android:textSize="@dimen/pokemon_detail_pokemon_name_size"
app:layout_constraintEnd_toEndOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintTop_toBottomOf="@id/iv_pokemon_detail_pokemon"
tools:text="이상해씨 #1" />

<LinearLayout
android:id="@+id/layout_pokemon_detail_pokemon_types"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/pokemon_detail_margins_between_pokemon_name_types_"
android:background="@android:color/transparent"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="@id/iv_pokemon_detail_pokemon"
app:layout_constraintTop_toBottomOf="@id/tv_pokemon_detail_pokemon_name"
tools:layout_height="50dp"
tools:layout_width="100dp" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_pokemon_detail_information"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/pokemon_detail_margins_between_layout"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/divider_pokemon_detail"
app:layout_constraintTop_toBottomOf="@id/toolbar_pokemon_detail">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout_pokemon_detail"
style="@style/TabLayoutStyle"
visible="@{!vm.isLoading}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/tab_border_background"
app:layout_constraintBottom_toTopOf="@id/pager_pokemon_detail"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tabBackground="@color/poke_black"
app:tabGravity="fill" />

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager_pokemon_detail"
visible="@{!vm.isLoading}"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tab_layout_pokemon_detail" />


</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_pokemon_detail_battle"
style="@style/ThemeOverlay.Material3.FloatingActionButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/pokemon_detail_floating_button_margin"
android:backgroundTint="@color/poke_grey_65"
android:contentDescription="@string/battle_title_name"
android:src="@drawable/icon_home_battle"
app:fabCustomSize="@dimen/pokemon_detail_fragment_bottom_padding"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="@dimen/pokemon_detail_extended_floating_button_max_image_size"
app:tint="@null" />

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/efab_pokemon_detail_battle_with_mine"
onSingleClick="@{() -> eventHandler.navigateToBattleWithMine()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/pokemon_detail_extended_floating_button_margin"
android:layout_marginBottom="@dimen/pokemon_detail_extended_floating_button_first_bottom_margin"
android:backgroundTint="@color/poke_grey_65"
android:text="@string/pokemon_detail_to_battle_with_mine_pop_up_descriptions"
android:visibility="invisible"
app:icon="@drawable/ic_pokemon_battle_mine"
app:iconGravity="end"
app:iconTint="@null"
app:layout_constraintBottom_toTopOf="@id/fab_pokemon_detail_battle"
app:layout_constraintEnd_toEndOf="parent"
app:strokeColor="@color/poke_white"
app:strokeWidth="@dimen/stroke_width_small"
tools:text="내 포켓몬으로"
tools:visibility="visible" />

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/efab_pokemon_detail_battle_with_opponent"
onSingleClick="@{() -> eventHandler.navigateToBattleWithOpponent()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/pokemon_detail_extended_floating_button_margin"
android:layout_marginBottom="@dimen/pokemon_detail_extended_floating_button_first_bottom_margin"
android:backgroundTint="@color/poke_grey_65"
android:text="@string/pokemon_detail_to_battle_with_enemy_pop_up_descriptions"
android:visibility="invisible"
app:icon="@drawable/ic_pokemon_battle_enemy"
app:iconGravity="end"
app:iconTint="@null"
app:layout_constraintBottom_toTopOf="@id/efab_pokemon_detail_battle_with_mine"
app:layout_constraintEnd_toEndOf="parent"
app:strokeColor="@color/poke_white"
app:strokeWidth="@dimen/stroke_width_small"
tools:text="상대 포켓몬으로"
tools:visibility="visible" />

</androidx.constraintlayout.widget.ConstraintLayout>


</layout>
Loading
Loading