@@ -2,17 +2,21 @@ package org.mifos.mobilewallet.mifospay.ui
2
2
3
3
import android.content.Context
4
4
import android.content.Intent
5
+ import androidx.compose.animation.AnimatedVisibility
6
+ import androidx.compose.foundation.layout.Box
5
7
import androidx.compose.foundation.layout.Column
6
8
import androidx.compose.foundation.layout.Row
7
9
import androidx.compose.foundation.layout.WindowInsets
8
10
import androidx.compose.foundation.layout.WindowInsetsSides
9
11
import androidx.compose.foundation.layout.consumeWindowInsets
10
12
import androidx.compose.foundation.layout.fillMaxSize
13
+ import androidx.compose.foundation.layout.fillMaxWidth
11
14
import androidx.compose.foundation.layout.only
12
15
import androidx.compose.foundation.layout.padding
13
16
import androidx.compose.foundation.layout.safeDrawing
14
17
import androidx.compose.foundation.layout.safeDrawingPadding
15
18
import androidx.compose.foundation.layout.windowInsetsPadding
19
+ import androidx.compose.foundation.layout.wrapContentSize
16
20
import androidx.compose.material3.DropdownMenu
17
21
import androidx.compose.material3.DropdownMenuItem
18
22
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -33,6 +37,7 @@ import androidx.compose.runtime.mutableStateOf
33
37
import androidx.compose.runtime.remember
34
38
import androidx.compose.runtime.saveable.rememberSaveable
35
39
import androidx.compose.runtime.setValue
40
+ import androidx.compose.ui.Alignment
36
41
import androidx.compose.ui.ExperimentalComposeUiApi
37
42
import androidx.compose.ui.Modifier
38
43
import androidx.compose.ui.composed
@@ -70,6 +75,7 @@ import org.mifos.mobilewallet.mifospay.settings.ui.SettingsActivity
70
75
)
71
76
@Composable
72
77
fun MifosApp (appState : MifosAppState ) {
78
+ val context = LocalContext .current
73
79
val shouldShowGradientBackground =
74
80
appState.currentTopLevelDestination == TopLevelDestination .HOME
75
81
var showHomeMenuOption by rememberSaveable { mutableStateOf(false ) }
@@ -98,12 +104,34 @@ fun MifosApp(appState: MifosAppState) {
98
104
}
99
105
100
106
if (showHomeMenuOption) {
101
- ShowHomeMenuOptions (
102
- showHomeMenuOption = true ,
103
- onDismiss = {
104
- showHomeMenuOption = false
107
+ AnimatedVisibility (true ) {
108
+ Box (
109
+ modifier = Modifier
110
+ .fillMaxWidth()
111
+ .wrapContentSize(Alignment .TopEnd )
112
+ .padding(end = 24 .dp)
113
+ ) {
114
+ DropdownMenu (
115
+ expanded = showHomeMenuOption,
116
+ onDismissRequest = { showHomeMenuOption = false }
117
+ ) {
118
+ DropdownMenuItem (
119
+ text = { Text (stringResource(id = R .string.faq)) },
120
+ onClick = {
121
+ showHomeMenuOption = false
122
+ context.startActivity(Intent (context, FAQActivity ::class .java))
123
+ }
124
+ )
125
+ DropdownMenuItem (
126
+ text = { Text (stringResource(id = R .string.settings)) },
127
+ onClick = {
128
+ showHomeMenuOption = false
129
+ context.startActivity(Intent (context, SettingsActivity ::class .java))
130
+ }
131
+ )
132
+ }
105
133
}
106
- )
134
+ }
107
135
}
108
136
109
137
// TODO unread destinations to show dot indicator
@@ -121,7 +149,7 @@ fun MifosApp(appState: MifosAppState) {
121
149
if (appState.shouldShowBottomBar) {
122
150
MifosBottomBar (
123
151
destinations = appState.topLevelDestinations,
124
- destinationsWithUnreadResources = emptySet() ,
152
+ destinationsWithUnreadResources = emptySet(),
125
153
onNavigateToDestination = appState::navigateToTopLevelDestination,
126
154
currentDestination = appState.currentDestination,
127
155
modifier = Modifier .testTag(" NiaBottomBar" ),
@@ -189,24 +217,6 @@ fun MifosApp(appState: MifosAppState) {
189
217
}
190
218
}
191
219
192
- @Composable
193
- fun ShowHomeMenuOptions (showHomeMenuOption : Boolean , onDismiss : () -> Unit ) {
194
- val context = LocalContext .current
195
- DropdownMenu (
196
- expanded = showHomeMenuOption,
197
- onDismissRequest = { onDismiss() }
198
- ) {
199
- DropdownMenuItem (
200
- text = { Text (stringResource(id = R .string.faq)) },
201
- onClick = { context.startActivity(Intent (context, FAQActivity ::class .java)) }
202
- )
203
- DropdownMenuItem (
204
- text = { Text (stringResource(id = R .string.settings)) },
205
- onClick = { context.startActivity(Intent (context, SettingsActivity ::class .java)) }
206
- )
207
- }
208
- }
209
-
210
220
@Composable
211
221
private fun MifosNavRail (
212
222
destinations : List <TopLevelDestination >,
0 commit comments