Skip to content

Commit

Permalink
[FEATURE] #26 : BottomNaivgationView 로직 디버깅
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Oct 11, 2023
1 parent c4ccf59 commit 4d4f5d0
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 43 deletions.
14 changes: 7 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ dependencies {
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
}

tasks.getByPath(":app:preBuild").dependsOn("makeFileExecutable")

tasks.register<Exec>("makeFileExecutable") {
commandLine("chmod", "+x", "${rootProject.rootDir}/.git/hooks/pre-commit")
dependsOn("installGitHook")
}
/**
tasks.getByPath(":app:preBuild").dependsOn("installGitHook")
tasks.register<Copy>("installGitHook") {
dependsOn("deletePreviousGitHook")
from("${rootProject.rootDir}/script/pre-commit")
into("${rootProject.rootDir}/.git/hooks")
eachFile {
fileMode = 777
}
}
tasks.register<Delete>("deletePreviousGitHook") {
val prePush = "${rootProject.rootDir}/.git/hooks/pre-commit"
if (file(prePush).exists()) {
delete(prePush)
}
}
**/
19 changes: 11 additions & 8 deletions app/src/main/java/com/wap/wapp/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.wap.wapp

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import com.wap.wapp.databinding.ActivityMainBinding
Expand Down Expand Up @@ -32,18 +34,19 @@ class MainActivity : AppCompatActivity() {
}

private fun setBottomNavigationVisiblity() {
val hideBottomNavigationFragments =
resources.getIntArray(R.array.hide_bottomNavigation_fragmnets)
val hideBottomNavigationFragments = mutableListOf<Int>()

val bottomNavigationView = binding.bnvMainBottomNaviView
val typedArray = resources.obtainTypedArray(R.array.hide_bottomNavigation_fragments)

navController.addOnDestinationChangedListener { _, destination, _ ->
for (index in 0..typedArray.length()) {
hideBottomNavigationFragments.add(typedArray.getResourceId(index, 0))
}

if (destination.id in hideBottomNavigationFragments) {
bottomNavigationView.visibility = View.INVISIBLE
}
typedArray.recycle()

navController.addOnDestinationChangedListener { _, destination, _ ->

bottomNavigationView.visibility = View.VISIBLE
binding.bnvMainBottomNaviView.isVisible = !(destination.id in hideBottomNavigationFragments)
}
}
}
9 changes: 5 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/gray_2"
android:visibility="gone"
app:itemActiveIndicatorStyle="@style/Style.BottomNavigationView.Custom.Indicator"
app:itemTextColor="@drawable/selector_text_color"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:itemTextColor="@drawable/selector_text_color"
app:layout_constraintStart_toStartOf="parent"
app:labelVisibilityMode="labeled"
app:itemActiveIndicatorStyle="@style/Style.BottomNavigationView.Custom.Indicator"
app:menu="@menu/menu_main" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</layout>
10 changes: 3 additions & 7 deletions app/src/main/res/navigation/nav_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_nav"
app:startDestination="@id/splashFragment">
app:startDestination="@id/nav_splash">

<include app:graph="@navigation/nav_manage" />
<include app:graph="@navigation/nav_notice" />
<include app:graph="@navigation/nav_profile" />
<include app:graph="@navigation/nav_survey" />

<fragment
android:id="@+id/splashFragment"
android:name="com.wap.wapp.feature.splash.SplashFragment"
android:label="SplashFragment" />
</navigation>
<include app:graph="@navigation/nav_splash" />
</navigation>
2 changes: 1 addition & 1 deletion app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="hide_bottomNavigation_fragmnets">
<array name="hide_bottomNavigation_fragments">
<item>@id/splashFragment</item>
</array>
</resources>
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ plugins{
id("groovy-gradle-plugin")
}

kotlin {
jvmToolchain(17)
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
18 changes: 12 additions & 6 deletions feature/notice/src/main/res/layout/fragment_notice.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NoticeFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notice"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
31 changes: 21 additions & 10 deletions feature/splash/src/main/res/layout/fragment_splash.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
<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="viewModel"
type="com.wap.wapp.feature.splash.SplashViewModel"/>
type="com.wap.wapp.feature.splash.SplashViewModel" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_black"
tools:context=".SplashFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_black"
tools:context=".SplashFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="splash"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

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

0 comments on commit 4d4f5d0

Please sign in to comment.