Skip to content

Commit

Permalink
[0.2.0.alpha/AN_UI] 홈 화면 메뉴 추가 (#204)
Browse files Browse the repository at this point in the history
* ui: 홈 메뉴와 관련된 아이콘 추가

* ui: 추가된 메뉴 xml 작성

* feat: 바이옴 화면 추가

* feat: 아이템 화면 추가

* feat: 홈 화면과 연결

* style: ktFormat
  • Loading branch information
kkosang authored Aug 12, 2024
1 parent 5d7f9a6 commit c0942e8
Show file tree
Hide file tree
Showing 14 changed files with 362 additions and 56 deletions.
10 changes: 8 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
android:exported="true" />
<activity
android:name=".presentation.home.HomeActivity"
android:launchMode="singleTask"
android:exported="true">
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -39,6 +39,12 @@
<activity
android:name=".presentation.ability.AbilityActivity"
android:exported="false" />
<activity
android:name=".presentation.biome.BiomeActivity"
android:exported="false" />
<activity
android:name=".presentation.item.ItemActivity"
android:exported="false" />
<activity
android:name=".presentation.error.NetworkErrorActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package poke.rogue.helper.presentation.biome

import android.content.Context
import android.content.Intent
import androidx.appcompat.widget.Toolbar
import poke.rogue.helper.R
import poke.rogue.helper.databinding.ActivityBiomeBinding
import poke.rogue.helper.presentation.toolbar.ToolbarActivity

class BiomeActivity : ToolbarActivity<ActivityBiomeBinding>(R.layout.activity_biome) {
override val toolbar: Toolbar
get() = binding.toolbarBiome

companion object {
fun intent(context: Context): Intent {
return Intent(context, BiomeActivity::class.java)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ interface HomeActionHandler {
fun navigateToTip()

fun navigateToPokeRogue()

fun navigateToBiome()

fun navigateToItem()

fun navigateToBattle()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import poke.rogue.helper.analytics.AnalyticsLogger
import poke.rogue.helper.analytics.analyticsLogger
import poke.rogue.helper.databinding.ActivityHomeBinding
import poke.rogue.helper.presentation.ability.AbilityActivity
import poke.rogue.helper.presentation.biome.BiomeActivity
import poke.rogue.helper.presentation.dex.PokemonActivity
import poke.rogue.helper.presentation.item.ItemActivity
import poke.rogue.helper.presentation.tip.TipActivity
import poke.rogue.helper.presentation.toolbar.ToolbarActivity
import poke.rogue.helper.presentation.type.TypeActivity
Expand Down Expand Up @@ -64,6 +66,19 @@ class HomeActivity : ToolbarActivity<ActivityHomeBinding>(R.layout.activity_home
logger.logClickEvent(NAVIGATE_TO_TIP)
}

is HomeNavigateEvent.ToBiome ->
startActivity<BiomeActivity> {
logger.logClickEvent(NAVIGATE_TO_BIOME)
}

is HomeNavigateEvent.ToItem -> {
startActivity<ItemActivity> {
logger.logClickEvent(NAVIGATE_TO_ITEM)
}
}

is HomeNavigateEvent.ToBattle -> {}

is HomeNavigateEvent.ToLogo -> navigateToPokeRogue()
}
}
Expand All @@ -86,6 +101,9 @@ class HomeActivity : ToolbarActivity<ActivityHomeBinding>(R.layout.activity_home
private const val NAVIGATE_TO_DEX = "Nav_Dex"
private const val NAVIGATE_TO_ABILITY = "Nav_Ability"
private const val NAVIGATE_TO_TIP = "Nav_Tip"
private const val NAVIGATE_TO_BIOME = "Nav_Biome"
private const val NAVIGATE_TO_ITEM = "Nav_Item"
private const val NAVIGATE_TO_BATTLE = "Nav_Battle" // todo 배틀 화면

fun intent(context: Context): Intent {
return Intent(context, HomeActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ sealed interface HomeNavigateEvent {
data object ToTip : HomeNavigateEvent

data object ToLogo : HomeNavigateEvent

data object ToBiome : HomeNavigateEvent

data object ToItem : HomeNavigateEvent

data object ToBattle : HomeNavigateEvent
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,22 @@ class HomeViewModel : ViewModel(), HomeActionHandler {
_navigationEvent.emit(HomeNavigateEvent.ToLogo)
}
}

override fun navigateToBiome() {
viewModelScope.launch {
_navigationEvent.emit(HomeNavigateEvent.ToBiome)
}
}

override fun navigateToItem() {
viewModelScope.launch {
_navigationEvent.emit(HomeNavigateEvent.ToItem)
}
}

override fun navigateToBattle() {
viewModelScope.launch {
_navigationEvent.emit(HomeNavigateEvent.ToBattle)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package poke.rogue.helper.presentation.item

import android.content.Context
import android.content.Intent
import androidx.appcompat.widget.Toolbar
import poke.rogue.helper.R
import poke.rogue.helper.databinding.ActivityItemBinding
import poke.rogue.helper.presentation.toolbar.ToolbarActivity

class ItemActivity : ToolbarActivity<ActivityItemBinding>(R.layout.activity_item) {
override val toolbar: Toolbar
get() = binding.toolbarItem

companion object {
fun intent(context: Context): Intent {
return Intent(context, ItemActivity::class.java)
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions android/app/src/main/res/layout/activity_biome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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">

<data>

</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"
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="@string/biome_title_name" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading

0 comments on commit c0942e8

Please sign in to comment.