-
Notifications
You must be signed in to change notification settings - Fork 620
Refactor - GroupList screen to compose UI #2079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
20db21d
refactor/GroupList screen to compose UI
niyajali 6a812b7
fix/GroupList screen to compose UI
niyajali 1a22656
- Created new Testing Module
niyajali ef2e897
Merge branch 'master' into fix_#2074
niyajali 56050d1
Merge branch 'refs/heads/master' into fix_#2074
niyajali 9afdece
Feat - Resolved conflicts & Applied Convention Plugins
niyajali e5d4b4b
Merge branch 'master' into fix_#2074
niyajali 2205efb
- Added Preview Composable
niyajali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
14 changes: 14 additions & 0 deletions
14
core/common/src/main/java/com/mifos/core/common/network/MifosDispatchers.kt
This file contains hidden or 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,14 @@ | ||
|
||
package com.mifos.core.common.network | ||
|
||
import javax.inject.Qualifier | ||
import kotlin.annotation.AnnotationRetention.RUNTIME | ||
|
||
@Qualifier | ||
@Retention(RUNTIME) | ||
annotation class Dispatcher(val mifosDispatcher: MifosDispatchers) | ||
|
||
enum class MifosDispatchers { | ||
Default, | ||
IO, | ||
} |
28 changes: 28 additions & 0 deletions
28
core/common/src/main/java/com/mifos/core/common/network/di/CoroutineScopesModule.kt
This file contains hidden or 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,28 @@ | ||
package com.mifos.core.common.network.di | ||
|
||
import com.mifos.core.common.network.Dispatcher | ||
import com.mifos.core.common.network.MifosDispatchers.Default | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.SupervisorJob | ||
import javax.inject.Qualifier | ||
import javax.inject.Singleton | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
@Qualifier | ||
annotation class ApplicationScope | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal object CoroutineScopesModule { | ||
@Provides | ||
@Singleton | ||
@ApplicationScope | ||
fun providesCoroutineScope( | ||
@Dispatcher(Default) dispatcher: CoroutineDispatcher, | ||
): CoroutineScope = CoroutineScope(SupervisorJob() + dispatcher) | ||
} |
23 changes: 23 additions & 0 deletions
23
core/common/src/main/java/com/mifos/core/common/network/di/DispatchersModule.kt
This file contains hidden or 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,23 @@ | ||
package com.mifos.core.common.network.di | ||
|
||
import com.mifos.core.common.network.Dispatcher | ||
import com.mifos.core.common.network.MifosDispatchers.Default | ||
import com.mifos.core.common.network.MifosDispatchers.IO | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.Dispatchers | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object DispatchersModule { | ||
@Provides | ||
@Dispatcher(IO) | ||
fun providesIODispatcher(): CoroutineDispatcher = Dispatchers.IO | ||
|
||
@Provides | ||
@Dispatcher(Default) | ||
fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
/build |
This file contains hidden or 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,64 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
} | ||
|
||
android { | ||
namespace = "com.mifos.core.ui" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
|
||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.8" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(project(":core:designsystem")) | ||
implementation(project(":core:common")) | ||
|
||
|
||
implementation("androidx.core:core-ktx:1.12.0") | ||
implementation("androidx.appcompat:appcompat:1.6.1") | ||
implementation("com.google.android.material:material:1.11.0") | ||
testImplementation("junit:junit:4.13.2") | ||
androidTestImplementation("androidx.test.ext:junit:1.1.5") | ||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") | ||
|
||
implementation("androidx.compose.compiler:compiler:1.5.10") | ||
implementation("androidx.compose.ui:ui-tooling-preview:1.6.3") | ||
implementation("androidx.activity:activity-compose:1.8.2") | ||
debugImplementation("androidx.compose.ui:ui-tooling:1.6.3") | ||
implementation("androidx.compose.material3:material3:1.2.1") | ||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0") | ||
implementation("androidx.compose.material:material-icons-extended:1.6.3") | ||
} |
Empty file.
This file contains hidden or 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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
core/ui/src/androidTest/java/com/mifos/core/ui/ExampleInstrumentedTest.kt
This file contains hidden or 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,24 @@ | ||
package com.mifos.core.ui | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.mifos.core.ui.test", appContext.packageName) | ||
} | ||
} |
This file contains hidden or 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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
62 changes: 62 additions & 0 deletions
62
core/ui/src/main/java/com/mifos/core/ui/components/MifosEmptyUi.kt
This file contains hidden or 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,62 @@ | ||
package com.mifos.core.ui.components | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Info | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.mifos.core.designsystem.theme.DarkGray | ||
|
||
@Composable | ||
fun MifosEmptyUi( | ||
niyajali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
modifier: Modifier = Modifier, | ||
text: String, | ||
icon: ImageVector = Icons.Default.Info, | ||
) { | ||
Box( | ||
modifier = modifier | ||
.fillMaxSize(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(18.dp) | ||
.align(Alignment.Center), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(20.dp, Alignment.CenterVertically) | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = text + icon.name, | ||
tint = Color.Gray, | ||
modifier = Modifier.size(70.dp) | ||
) | ||
|
||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.bodyMedium.copy( | ||
fontSize = 14.sp, | ||
fontWeight = FontWeight.Normal, | ||
fontStyle = FontStyle.Normal, | ||
color = DarkGray | ||
) | ||
) | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
core/ui/src/main/java/com/mifos/core/ui/components/MifosFAB.kt
This file contains hidden or 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,34 @@ | ||
package com.mifos.core.ui.components | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.material3.FloatingActionButton | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import com.mifos.core.designsystem.theme.BlueSecondary | ||
|
||
@Composable | ||
fun MifosFAB( | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector, | ||
onClick: () -> Unit, | ||
containerColor: Color = BlueSecondary, | ||
) { | ||
Box( | ||
modifier = modifier, | ||
contentAlignment = Alignment.BottomEnd | ||
) { | ||
FloatingActionButton( | ||
onClick = onClick, | ||
containerColor = containerColor | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = "MifosFab" | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.