-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from MONEYMONG/epic/moneymong-123-장부
Epic/moneymong 123 장부
- Loading branch information
Showing
16 changed files
with
327 additions
and
39 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
domain/src/main/java/com/moneymong/moneymong/domain/usecase/member/AgencyDeleteUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.moneymong.moneymong.domain.usecase.member | ||
|
||
import com.moneymong.moneymong.domain.repository.member.MemberRepository | ||
import javax.inject.Inject | ||
|
||
class DeleteAgencyUseCase @Inject constructor( | ||
private val memberRepository: MemberRepository | ||
) { | ||
suspend operator fun invoke(agencyId: Int) : Result<Unit> { | ||
return memberRepository.deleteAgency(agencyId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...c/main/java/com/moneymong/moneymong/ledger/view/onboarding/popup/LedgerOnboardingPopup.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.moneymong.moneymong.ledger.view.onboarding.popup | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.DisposableEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCompositionContext | ||
import androidx.compose.runtime.rememberUpdatedState | ||
import androidx.compose.ui.platform.LocalView | ||
|
||
@Composable | ||
internal fun LedgerOnboardingPopup( | ||
content: @Composable () -> Unit | ||
) { | ||
val view = LocalView.current | ||
val parentComposition = rememberCompositionContext() | ||
val currentContent by rememberUpdatedState(content) | ||
val popupLayout = remember { | ||
LedgerOnboardingPopupLayout( | ||
composeView = view | ||
).apply { | ||
setContent(parentComposition) { | ||
currentContent() | ||
} | ||
} | ||
} | ||
|
||
DisposableEffect(key1 = popupLayout) { | ||
popupLayout.show() | ||
|
||
onDispose { | ||
popupLayout.disposeComposition() | ||
popupLayout.dismiss() | ||
} | ||
} | ||
} | ||
|
||
|
||
|
95 changes: 95 additions & 0 deletions
95
.../java/com/moneymong/moneymong/ledger/view/onboarding/popup/LedgerOnboardingPopupLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.moneymong.moneymong.ledger.view.onboarding.popup | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import android.graphics.PixelFormat | ||
import android.view.Gravity | ||
import android.view.View | ||
import android.view.WindowManager | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionContext | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.platform.AbstractComposeView | ||
import androidx.lifecycle.findViewTreeLifecycleOwner | ||
import androidx.lifecycle.findViewTreeViewModelStoreOwner | ||
import androidx.lifecycle.setViewTreeLifecycleOwner | ||
import androidx.lifecycle.setViewTreeViewModelStoreOwner | ||
import androidx.savedstate.findViewTreeSavedStateRegistryOwner | ||
import androidx.savedstate.setViewTreeSavedStateRegistryOwner | ||
|
||
|
||
@SuppressLint("ViewConstructor") | ||
internal class LedgerOnboardingPopupLayout( | ||
private val composeView: View, | ||
) : AbstractComposeView(composeView.context) { | ||
|
||
private val windowManager = | ||
composeView.context.getSystemService(Context.WINDOW_SERVICE) as WindowManager | ||
private val params = createLayoutParams() | ||
private var content: @Composable () -> Unit by mutableStateOf({}) | ||
|
||
|
||
init { | ||
id = android.R.id.content | ||
setViewTreeLifecycleOwner(composeView.findViewTreeLifecycleOwner()) | ||
setViewTreeViewModelStoreOwner(composeView.findViewTreeViewModelStoreOwner()) | ||
setViewTreeSavedStateRegistryOwner(composeView.findViewTreeSavedStateRegistryOwner()) | ||
} | ||
|
||
@Composable | ||
override fun Content() { | ||
content() | ||
} | ||
|
||
fun setContent(parent: CompositionContext, content: @Composable () -> Unit) { | ||
setParentCompositionContext(parent) | ||
this.content = content | ||
} | ||
|
||
fun show() { | ||
windowManager.addView(this, params) | ||
} | ||
|
||
fun dismiss() { | ||
setViewTreeLifecycleOwner(null) | ||
windowManager.removeViewImmediate(this) | ||
} | ||
|
||
|
||
private fun createLayoutParams(): WindowManager.LayoutParams { | ||
return WindowManager.LayoutParams().apply { | ||
// Start to position the popup in the top left corner, a new position will be calculated | ||
gravity = Gravity.START or Gravity.TOP | ||
|
||
// Flags specific to android.widget.PopupWindow | ||
flags = flags and ( | ||
WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES or | ||
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or | ||
WindowManager.LayoutParams.FLAG_SPLIT_TOUCH | ||
).inv() | ||
|
||
// Make the popup window not focusable | ||
flags = flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | ||
|
||
// Enables us to intercept outside clicks even when popup is not focusable | ||
flags = flags or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | ||
|
||
type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL | ||
|
||
// Get the Window token from the parent view | ||
token = composeView.applicationWindowToken | ||
|
||
// Set the popup window to occupy the entire screen | ||
width = WindowManager.LayoutParams.MATCH_PARENT | ||
height = WindowManager.LayoutParams.MATCH_PARENT | ||
|
||
format = PixelFormat.TRANSLUCENT | ||
|
||
// accessibilityTitle is not exposed as a public API therefore we set popup window | ||
// title which is used as a fallback by a11y services | ||
title = "LedgerOnboardingPopup" | ||
} | ||
} | ||
} |
Oops, something went wrong.