forked from openMF/android-client
-
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.
refactor:refactor checker inbox screen to compose with multi module
- Loading branch information
1 parent
bf1bf8c
commit fa7a22a
Showing
7 changed files
with
117 additions
and
56 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosScaffold.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,82 @@ | ||
@file:OptIn(ExperimentalMaterial3Api::class) | ||
|
||
package com.mifos.core.designsystem.component | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.sp | ||
import com.mifos.core.designsystem.R | ||
import com.mifos.core.designsystem.theme.Black | ||
import com.mifos.core.designsystem.theme.White | ||
|
||
@Composable | ||
fun MifosScaffold( | ||
icon: ImageVector?, | ||
title : String?, | ||
onBackPressed: () -> Unit, | ||
actions: @Composable () -> Unit, | ||
snackbarHostState: SnackbarHostState?, | ||
bottomBar: @Composable () -> Unit, | ||
content: @Composable (PaddingValues) -> Unit | ||
) { | ||
|
||
Scaffold( | ||
topBar = { | ||
TopAppBar( | ||
colors = TopAppBarDefaults.mediumTopAppBarColors(containerColor = White), | ||
navigationIcon = { | ||
if (icon != null) { | ||
IconButton( | ||
onClick = { onBackPressed() }, | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = null, | ||
tint = Black, | ||
) | ||
} | ||
} | ||
}, | ||
title = { | ||
title?.let { | ||
Text( | ||
text = it, | ||
style = TextStyle( | ||
fontSize = 24.sp, | ||
fontWeight = FontWeight.Medium, | ||
fontStyle = FontStyle.Normal, | ||
fontFamily = FontFamily(Font(R.font.outfit_medium)) | ||
), | ||
color = Black, | ||
textAlign = TextAlign.Start | ||
) | ||
} | ||
}, | ||
actions = { actions() } | ||
) | ||
}, | ||
snackbarHost = { snackbarHostState?.let { SnackbarHost(it) } }, | ||
containerColor = White, | ||
bottomBar = bottomBar | ||
) { padding -> | ||
content(padding) | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
11 changes: 4 additions & 7 deletions
11
...sparklead/feature/checker_inbox_task/checker_inbox_and_task/di/CheckerInboxTasksModule.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 |
---|---|---|
@@ -1,19 +1,16 @@ | ||
package com.sparklead.feature.checker_inbox_task.checker_inbox_and_task.di | ||
|
||
import com.mifos.core.network.datamanager.DataManagerCheckerInbox | ||
import com.sparklead.feature.checker_inbox_task.checker_inbox_and_task.data.CheckerInboxTasksRepositoryImp | ||
import com.sparklead.feature.checker_inbox_task.checker_inbox_and_task.domain.repository.CheckerInboxTasksRepository | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
class CheckerInboxTasksModule { | ||
|
||
@Provides | ||
fun providesCheckerInboxTasksRepository(dataManagerCheckerInbox: DataManagerCheckerInbox): CheckerInboxTasksRepository = | ||
CheckerInboxTasksRepositoryImp(dataManagerCheckerInbox) | ||
abstract class CheckerInboxTasksModule { | ||
|
||
@Binds | ||
abstract fun bindCheckerInboxTasksRepository(impl: CheckerInboxTasksRepositoryImp): CheckerInboxTasksRepository | ||
} |
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