Skip to content

Commit

Permalink
newIntent로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-xyz committed Aug 6, 2024
1 parent 156fb0c commit 33a9a48
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 24 deletions.
17 changes: 6 additions & 11 deletions app/src/main/java/com/mashup/ui/moremenu/MoreMenuActivity.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mashup.ui.moremenu

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand All @@ -19,11 +18,10 @@ import com.example.moremenu.model.Menu
import com.example.moremenu.model.MenuType
import com.example.moremenu.model.MoreMenuSideEffect
import com.example.notice.NoticeActivity
import com.mashup.constant.EXTRA_TITLE_KEY
import com.mashup.constant.EXTRA_URL_KEY
import com.mashup.core.ui.theme.MashUpTheme
import com.mashup.ui.danggn.ShakeDanggnActivity
import com.mashup.ui.setting.SettingActivity
import com.mashup.ui.webview.birthday.BirthdayActivity
import com.mashup.ui.webview.mashong.MashongActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -64,14 +62,11 @@ class MoreMenuActivity : ComponentActivity() {

private fun onNavigateMenu(menu: Menu) {
val intent = when (menu.type) {
MenuType.NOTI -> Intent(this, NoticeActivity::class.java)
MenuType.DANGGN -> Intent(this, ShakeDanggnActivity::class.java)
MenuType.MASHONG -> Intent(this, MashongActivity::class.java).apply {
putExtra(EXTRA_TITLE_KEY, "mashong")
putExtra(EXTRA_URL_KEY, "https://dev-app.mash-up.kr/mashong/")
}
MenuType.SETTING -> Intent(this, SettingActivity::class.java)
MenuType.BIRTHDAY -> Intent(this, NoticeActivity::class.java)
MenuType.NOTI -> NoticeActivity.newIntent(this)
MenuType.DANGGN -> ShakeDanggnActivity.newIntent(this)
MenuType.MASHONG -> MashongActivity.newIntent(this)
MenuType.SETTING -> SettingActivity.newIntent(this)
MenuType.BIRTHDAY -> BirthdayActivity.newIntent(this)
}
startActivity(intent)
}
Expand Down
23 changes: 10 additions & 13 deletions app/src/main/java/com/mashup/ui/webview/mashong/MashongActivity.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.mashup.ui.webview.mashong

import android.os.Build
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
Expand All @@ -14,12 +12,15 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.mashup.constant.EXTRA_TITLE_KEY
import com.mashup.constant.EXTRA_URL_KEY
import com.mashup.core.common.bridge.MashupBridge
import com.mashup.core.ui.theme.MashUpTheme
import com.mashup.ui.danggn.ShakeDanggnActivity
import com.mashup.ui.webview.WebViewScreen
import com.mashup.ui.webview.WebViewUiState
import com.mashup.ui.webview.WebViewViewModel
import com.mashup.util.setFullScreen
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand Down Expand Up @@ -54,15 +55,11 @@ class MashongActivity : ComponentActivity() {
setFullScreen()
}

private fun ComponentActivity.setFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.apply {
hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars())
systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
companion object {
fun newIntent(context: Context): Intent =
Intent(context, MashongActivity::class.java).apply {
putExtra(EXTRA_TITLE_KEY, "mashong")
putExtra(EXTRA_URL_KEY, "https://dev-app.mash-up.kr/mashong/")
}
} else {
window.decorView.systemUiVisibility =
(View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN)
}
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/mashup/util/FullScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.mashup.util

import android.os.Build
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import androidx.activity.ComponentActivity

fun ComponentActivity.setFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.apply {
hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars())
systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
} else {
window.decorView.systemUiVisibility =
(View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.notice

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand All @@ -24,4 +26,8 @@ class NoticeActivity : ComponentActivity() {
}
}
}

companion object {
fun newIntent(context: Context) = Intent(context, NoticeActivity::class.java)
}
}

0 comments on commit 33a9a48

Please sign in to comment.