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.
design: design login screen in compose
- Loading branch information
1 parent
cd7c435
commit 9cc644d
Showing
17 changed files
with
441 additions
and
5 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
...esignsystem/src/main/java/com/mifos/core/designsystem/component/MifosAndroidClientIcon.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,23 @@ | ||
package com.mifos.core.designsystem.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun MifosAndroidClientIcon(id: Int) { | ||
|
||
Image( | ||
painter = painterResource(id = id), | ||
contentDescription = null, | ||
modifier = Modifier | ||
.size(200.dp,100.dp) | ||
) | ||
} |
82 changes: 82 additions & 0 deletions
82
core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEditTextField.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 @@ | ||
package com.mifos.core.designsystem.component | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.OutlinedTextField | ||
import androidx.compose.material3.OutlinedTextFieldDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.platform.LocalDensity | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.input.ImeAction | ||
import androidx.compose.ui.text.input.TextFieldValue | ||
import androidx.compose.ui.text.input.VisualTransformation | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.mifos.core.designsystem.theme.BluePrimary | ||
import com.mifos.core.designsystem.theme.BluePrimaryDark | ||
import com.mifos.core.designsystem.theme.DarkGrey | ||
import com.mifos.core.designsystem.theme.White | ||
|
||
@Composable | ||
fun MifosOutlinedTextField( | ||
value: TextFieldValue, | ||
onValueChange: (TextFieldValue) -> Unit, | ||
maxLines: Int = 1, | ||
singleLine: Boolean = true, | ||
icon: ImageVector? = null, | ||
label: Int, | ||
visualTransformation: VisualTransformation = VisualTransformation.None, | ||
trailingIcon: @Composable (() -> Unit)? = null, | ||
error: Boolean = false, | ||
supportingText: String? | ||
) { | ||
|
||
OutlinedTextField( | ||
value = value, | ||
onValueChange = onValueChange, | ||
label = { Text(stringResource(id = label)) }, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(start = 16.dp, end = 16.dp), | ||
leadingIcon = if (icon != null) { | ||
{ | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = null, | ||
tint = if (isSystemInDarkTheme()) White else DarkGrey | ||
) | ||
} | ||
} else null, | ||
trailingIcon = trailingIcon, | ||
maxLines = maxLines, | ||
singleLine = singleLine, | ||
colors = OutlinedTextFieldDefaults.colors( | ||
focusedBorderColor = if (isSystemInDarkTheme()) BluePrimaryDark else BluePrimary, | ||
), | ||
textStyle = LocalDensity.current.run { | ||
TextStyle(fontSize = 18.sp) | ||
}, | ||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), | ||
visualTransformation = visualTransformation, | ||
isError = error, | ||
supportingText = { | ||
if (error) { | ||
if (supportingText != null) { | ||
Text( | ||
modifier = Modifier.fillMaxWidth(), | ||
text = supportingText, | ||
color = MaterialTheme.colorScheme.error | ||
) | ||
} | ||
} | ||
} | ||
) | ||
} |
9 changes: 9 additions & 0 deletions
9
core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Color.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,9 @@ | ||
package com.mifos.core.designsystem.theme | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
val White = Color(0xFFFFFFFF) | ||
val Black = Color(0xFF000000) | ||
val DarkGrey = Color(0xFF696969) | ||
val BluePrimary = Color(0xFF2D5BA8) | ||
val BluePrimaryDark = Color(0xFF9BB1E3) |
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 @@ | ||
/build |
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,73 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("kotlin-kapt") | ||
id("com.google.dagger.hilt.android") | ||
} | ||
|
||
android { | ||
namespace = "com.mifos.feature.auth" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
|
||
compileSdkPreview = "UpsideDownCake" | ||
|
||
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(":mifosng-android")) | ||
implementation(project(":core:designsystem")) | ||
|
||
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") | ||
|
||
// Hilt dependency | ||
implementation("com.google.dagger:hilt-android:2.50") | ||
kapt("com.google.dagger:hilt-android-compiler:2.50") | ||
|
||
// Jetpack Compose | ||
implementation("androidx.compose.material:material:1.6.0") | ||
implementation("androidx.compose.compiler:compiler:1.5.8") | ||
implementation("androidx.compose.ui:ui-tooling-preview:1.6.1") | ||
implementation("androidx.activity:activity-compose:1.8.2") | ||
debugImplementation("androidx.compose.ui:ui-tooling:1.6.1") | ||
implementation("androidx.compose.material3:material3:1.1.2") | ||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0") | ||
implementation("androidx.compose.material:material-icons-extended:1.6.1") | ||
} |
Empty file.
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,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
feature/auth/src/androidTest/java/com/mifos/feature/auth/ExampleInstrumentedTest.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,24 @@ | ||
package com.mifos.feature.auth | ||
|
||
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.feature.auth.test", appContext.packageName) | ||
} | ||
} |
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
Oops, something went wrong.