Skip to content

Commit

Permalink
Feat: BottomNavigation 추가 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaemin-Yoo committed May 10, 2023
1 parent 0fbee36 commit a8d9bdf
Show file tree
Hide file tree
Showing 44 changed files with 487 additions and 440 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.infinity.omos.OnboardingActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.R
import com.infinity.omos.ui.custom.OmosViewActions
import com.infinity.omos.ui.custom.OmosViewMatchers
Expand All @@ -22,7 +22,7 @@ import org.junit.rules.RuleChain
class ForgotPasswordFragmentTest {

private val hiltRule = HiltAndroidRule(this)
private val activityTestRule = ActivityScenarioRule(OnboardingActivity::class.java)
private val activityTestRule = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val rule: RuleChain = RuleChain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isEnabled
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.infinity.omos.OnboardingActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.R
import com.infinity.omos.ui.custom.OmosViewActions
import com.infinity.omos.ui.custom.OmosViewMatchers
Expand All @@ -20,7 +20,7 @@ import org.junit.rules.RuleChain
class LoginFragmentTest {

private val hiltRule = HiltAndroidRule(this)
private val activityTestRule = ActivityScenarioRule(OnboardingActivity::class.java)
private val activityTestRule = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val rule: RuleChain = RuleChain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isEnabled
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.infinity.omos.OnboardingActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.R
import com.infinity.omos.ui.custom.OmosViewActions
import com.infinity.omos.util.SUCCESS_AUTH_CODE
Expand All @@ -21,7 +21,7 @@ import org.junit.rules.RuleChain
class NicknameFragmentTest {

private val hiltRule = HiltAndroidRule(this)
private val activityTestRule = ActivityScenarioRule(OnboardingActivity::class.java)
private val activityTestRule = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val rule: RuleChain = RuleChain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.infinity.omos.OnboardingActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.R
import com.infinity.omos.ui.custom.OmosViewActions
import com.infinity.omos.ui.custom.OmosViewMatchers
Expand All @@ -23,7 +23,7 @@ import org.junit.rules.RuleChain
class SignUpFragmentTest {

private val hiltRule = HiltAndroidRule(this)
private val activityTestRule = ActivityScenarioRule(OnboardingActivity::class.java)
private val activityTestRule = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val rule: RuleChain = RuleChain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isEnabled
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.infinity.omos.OnboardingActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.R
import com.infinity.omos.ui.custom.OmosViewActions
import com.infinity.omos.ui.custom.OmosViewMatchers
Expand All @@ -22,7 +22,7 @@ import org.junit.rules.RuleChain
class ChangePasswordFragmentTest {

private val hiltRule = HiltAndroidRule(this)
private val activityTestRule = ActivityScenarioRule(OnboardingActivity::class.java)
private val activityTestRule = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val rule: RuleChain = RuleChain
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:theme="@style/Theme.Omos.Splash"
android:usesCleartextTraffic="true">
<activity
android:name=".OnboardingActivity"
android:name=".ui.MainActivity"
android:exported="true"
android:screenOrientation="portrait">

Expand Down Expand Up @@ -160,7 +160,7 @@
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.main.MainActivity"
android:name=".ui.main.FakeMainActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/MainStatusBarStyle" />
Expand Down
19 changes: 0 additions & 19 deletions app/src/main/java/com/infinity/omos/OnboardingActivity.kt

This file was deleted.

11 changes: 6 additions & 5 deletions app/src/main/java/com/infinity/omos/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.infinity.omos.etc.Constant
import com.infinity.omos.repository.OnBoardingRepository
import com.infinity.omos.ui.main.MainActivity
import com.infinity.omos.ui.MainActivity
import com.infinity.omos.ui.main.FakeMainActivity
import com.kakao.sdk.user.UserApiClient


Expand Down Expand Up @@ -62,11 +63,11 @@ class SplashActivity : AppCompatActivity() {
// 이메일 로그인 상태 확인
if (OmosApplication.prefs.getInt("userId") == -1) {
Log.d("SplashActivity", "토큰 불러오기 실패")
val intent = Intent(activity, OnboardingActivity::class.java)
val intent = Intent(activity, MainActivity::class.java)
activity.startActivity(intent)
} else {
Log.d("SplashActivity", "토큰 불러오기 성공")
val intent = Intent(activity, MainActivity::class.java)
val intent = Intent(activity, FakeMainActivity::class.java)
activity.startActivity(intent)
}
} else if (tokenInfo != null) {
Expand All @@ -83,11 +84,11 @@ class SplashActivity : AppCompatActivity() {
}
}

val intent = Intent(activity, OnboardingActivity::class.java)
val intent = Intent(activity, MainActivity::class.java)
activity.startActivity(intent)
} else {
Log.d("SplashActivity", "토큰 불러오기 성공")
val intent = Intent(activity, MainActivity::class.java)
val intent = Intent(activity, FakeMainActivity::class.java)
activity.startActivity(intent)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.main.MainActivity.Companion.isWrite
import com.infinity.omos.ui.main.FakeMainActivity.Companion.isWrite
import com.infinity.omos.ui.record.MusicRecordActivity
import com.infinity.omos.ui.write.SelectCategoryActivity
import com.infinity.omos.data.music.Music
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.search.DetailAlbumActivity
import com.infinity.omos.ui.search.DetailArtistActivity
import com.infinity.omos.ui.main.MainActivity
import com.infinity.omos.ui.main.FakeMainActivity
import com.infinity.omos.R
import com.infinity.omos.data.Album
import com.infinity.omos.databinding.ListAlbumItemBinding
Expand Down Expand Up @@ -73,9 +73,9 @@ class AlbumListAdapter internal constructor(private val context: Context):
binding.tvAlbumTitle.text = album.albumTitle

// keyword 색상 변경
var start = album.albumTitle.lowercase().indexOf(MainActivity.keyword.lowercase())
var start = album.albumTitle.lowercase().indexOf(FakeMainActivity.keyword.lowercase())
if (start != -1 && context.javaClass != DetailArtistActivity::class.java){
GlobalFunction.changeTextColor(context, binding.tvAlbumTitle, start, start + MainActivity.keyword.length, R.color.orange)
GlobalFunction.changeTextColor(context, binding.tvAlbumTitle, start, start + FakeMainActivity.keyword.length, R.color.orange)
}

binding.executePendingBindings() //데이터가 수정되면 즉각 바인딩
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.search.DetailArtistActivity
import com.infinity.omos.ui.main.MainActivity
import com.infinity.omos.ui.main.FakeMainActivity
import com.infinity.omos.R
import com.infinity.omos.data.Artists
import com.infinity.omos.databinding.ListArtistItemBinding
Expand Down Expand Up @@ -69,9 +69,9 @@ class ArtistListAdapter internal constructor(private val context: Context):
binding.tvArtistName.text = artist.artistName

// keyword 색상 변경
var start = artist.artistName.lowercase().indexOf(MainActivity.keyword.lowercase())
var start = artist.artistName.lowercase().indexOf(FakeMainActivity.keyword.lowercase())
if (start != -1){
GlobalFunction.changeTextColor(context, binding.tvArtistName, start, start + MainActivity.keyword.length, R.color.orange)
GlobalFunction.changeTextColor(context, binding.tvArtistName, start, start + FakeMainActivity.keyword.length, R.color.orange)
}

binding.executePendingBindings() //데이터가 수정되면 즉각 바인딩
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.main.MainActivity.Companion.isWrite
import com.infinity.omos.ui.main.FakeMainActivity.Companion.isWrite
import com.infinity.omos.ui.record.MusicRecordActivity
import com.infinity.omos.ui.write.SelectCategoryActivity
import com.infinity.omos.data.ArtistMusic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.main.MainActivity.Companion.isWrite
import com.infinity.omos.ui.main.MainActivity.Companion.keyword
import com.infinity.omos.ui.main.FakeMainActivity.Companion.isWrite
import com.infinity.omos.ui.main.FakeMainActivity.Companion.keyword
import com.infinity.omos.ui.record.MusicRecordActivity
import com.infinity.omos.R
import com.infinity.omos.ui.write.SelectCategoryActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.infinity.omos.ui.main.MainActivity
import com.infinity.omos.ui.main.FakeMainActivity
import com.infinity.omos.R
import com.infinity.omos.data.SearchMusic
import com.infinity.omos.databinding.ListSearchItemBinding
Expand Down Expand Up @@ -42,9 +42,9 @@ class SearchListAdapter internal constructor(private val context: Context)
binding.tvMusicTitle.text = music.musicTitle

// keyword 색상 변경
var start = music.musicTitle.lowercase().indexOf(MainActivity.keyword.lowercase())
var start = music.musicTitle.lowercase().indexOf(FakeMainActivity.keyword.lowercase())
if (start != -1){
GlobalFunction.changeTextColor(context, binding.tvMusicTitle, start, start + MainActivity.keyword.length, R.color.orange)
GlobalFunction.changeTextColor(context, binding.tvMusicTitle, start, start + FakeMainActivity.keyword.length, R.color.orange)
}

val pos = adapterPosition
Expand Down
53 changes: 53 additions & 0 deletions app/src/main/java/com/infinity/omos/ui/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.infinity.omos.ui

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import com.infinity.omos.R
import dagger.hilt.android.AndroidEntryPoint

/**
* onboarding Navigation component 적용을 위한 Activity
* 추후 MainActivity로 변경 예정
*/
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

// setBottomNav()
}
/*
private fun setBottomNav() {
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController
binding.bottomNav.setupWithNavController(navController)
setTopLevelDestinations(navController)
binding.fab.setOnClickListener {
navController.navigate(R.id.add_moment_navigation)
}
}
private fun setTopLevelDestinations(navController: NavController) {
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.home_fragment,
R.id.globe_fragment
)
)
navController.addOnDestinationChangedListener { _, destination, _ ->
val isTopDest = appBarConfiguration.topLevelDestinations.contains(destination.id)
binding.bottomAppBar.isVisible = isTopDest
if (isTopDest) binding.fab.show() else binding.fab.hide()
}
}*/
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/infinity/omos/ui/dj/DjActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import com.infinity.omos.ui.main.MainActivity
import com.infinity.omos.ui.main.FakeMainActivity
import com.infinity.omos.R
import com.infinity.omos.adapters.MyRecordListAdapter
import com.infinity.omos.databinding.ActivityDjBinding
Expand Down Expand Up @@ -167,7 +167,7 @@ class DjActivity : AppCompatActivity() {
intent4.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING)
sendBroadcast(intent4)

val intent = Intent(this, MainActivity::class.java)
val intent = Intent(this, FakeMainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
startActivity(intent)
Toast.makeText(this, "완료", Toast.LENGTH_SHORT).show()
Expand Down Expand Up @@ -201,7 +201,7 @@ class DjActivity : AppCompatActivity() {
intent4.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING)
sendBroadcast(intent4)

val intent = Intent(this, MainActivity::class.java)
val intent = Intent(this, FakeMainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
startActivity(intent)
Toast.makeText(this, "완료", Toast.LENGTH_SHORT).show()
Expand Down
Loading

0 comments on commit a8d9bdf

Please sign in to comment.