diff --git a/build.gradle b/build.gradle index 1c6ca03f6..48090e838 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,7 @@ ext { compileSdkVersion = 34 buildToolsVersion = '30.0.3' kotlinVersion = "1.9.10" // 1.9.10 + compose_version = '1.5.4' // App dependencies supportLibraryVersion = '28.0.0' diff --git a/core/src/androidTest/java/org/mifos/mobilewallet/core/ExampleInstrumentedTest.java b/core/src/androidTest/java/org/mifos/mobilewallet/core/ExampleInstrumentedTest.java index 62a26442b..78d818d2b 100644 --- a/core/src/androidTest/java/org/mifos/mobilewallet/core/ExampleInstrumentedTest.java +++ b/core/src/androidTest/java/org/mifos/mobilewallet/core/ExampleInstrumentedTest.java @@ -3,8 +3,9 @@ import static org.junit.Assert.assertEquals; import android.content.Context; + +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner; import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; @@ -14,12 +15,12 @@ * * @see Testing documentation */ -@RunWith(AndroidJUnit4.class) +@RunWith(AndroidJUnit4ClassRunner.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); + Context appContext = InstrumentationRegistry.getInstrumentation().getContext(); assertEquals("org.mifos.mobilewallet.core.test", appContext.getPackageName()); } diff --git a/mifospay/build.gradle b/mifospay/build.gradle index ee614325c..6cc406c1c 100644 --- a/mifospay/build.gradle +++ b/mifospay/build.gradle @@ -45,11 +45,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - + implementation project(':core') implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { - exclude group: 'com.android.support', module: 'support-annotations' - }) implementation 'androidx.appcompat:appcompat:1.6.1' implementation "androidx.core:core-ktx:1.12.0" @@ -60,11 +57,19 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.3.2' api 'com.google.android.material:material:1.0.0' // update require alot of UI changes + // Compose + implementation "androidx.compose.ui:ui:$compose_version" + implementation "androidx.compose.material:material:$compose_version" + implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" + + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion" kapt "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion" // Splash API - implementation 'androidx.core:core-splashscreen:1.0.1' + implementation("androidx.core:core-splashscreen:1.0.1") implementation "com.google.dagger:dagger:$rootProject.daggerVersion" kapt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" @@ -97,9 +102,12 @@ dependencies { implementation 'com.alimuzaffar.lib:pinentryedittext:1.3.1' implementation 'de.hdodenhof:circleimageview:3.1.0' implementation 'com.github.yalantis:ucrop:2.2.2' - testImplementation "junit:junit:$rootProject.junitVersion" - implementation project(':core') + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + testImplementation "junit:junit:$rootProject.junitVersion" } kapt { diff --git a/mifospay/src/androidTest/java/org/mifos/mobilewallet/mifospay/ExampleInstrumentedTest.java b/mifospay/src/androidTest/java/org/mifos/mobilewallet/mifospay/ExampleInstrumentedTest.java index e8375d4d1..2df2b252f 100644 --- a/mifospay/src/androidTest/java/org/mifos/mobilewallet/mifospay/ExampleInstrumentedTest.java +++ b/mifospay/src/androidTest/java/org/mifos/mobilewallet/mifospay/ExampleInstrumentedTest.java @@ -19,7 +19,7 @@ public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); + Context appContext = InstrumentationRegistry.getInstrumentation().getContext(); assertEquals("org.mifos.mobilewallet.mifospay", appContext.getPackageName()); } diff --git a/mifospay/src/main/AndroidManifest.xml b/mifospay/src/main/AndroidManifest.xml index 76ceb7bae..d385a0171 100644 --- a/mifospay/src/main/AndroidManifest.xml +++ b/mifospay/src/main/AndroidManifest.xml @@ -24,7 +24,7 @@ diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.java b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.java deleted file mode 100644 index 39dfd7bb2..000000000 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.mifos.mobilewallet.mifospay; - -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.os.Handler; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -import org.mifos.mobilewallet.mifospay.auth.ui.LoginActivity; - -public class SplashScreenActivity extends AppCompatActivity { - - private final int splashScreenDuration = 2000; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - new Handler().postDelayed(new Runnable() { - public void run() { - startActivity(new Intent(SplashScreenActivity.this, LoginActivity.class)); - finish(); - } - }, splashScreenDuration); - } -} diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.kt new file mode 100644 index 000000000..fcf1e3aab --- /dev/null +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/SplashScreenActivity.kt @@ -0,0 +1,31 @@ +package org.mifos.mobilewallet.mifospay + +import android.annotation.SuppressLint +import android.content.Intent +import android.content.pm.ActivityInfo +import android.os.Build +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen +import androidx.lifecycle.lifecycleScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import org.mifos.mobilewallet.mifospay.auth.ui.LoginActivity + +@SuppressLint("CustomSplashScreen") +class SplashScreenActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){ + val splashScreen = installSplashScreen() + splashScreen.setKeepOnScreenCondition { true } + } + super.onCreate(savedInstanceState) + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + lifecycleScope.launch { + delay(2000) + startActivity(Intent(this@SplashScreenActivity, LoginActivity::class.java)) + finish() + } + } +} diff --git a/mifospay/src/main/res/drawable/bg_splash.xml b/mifospay/src/main/res/drawable/bg_splash.xml new file mode 100644 index 000000000..dfa25dc8a --- /dev/null +++ b/mifospay/src/main/res/drawable/bg_splash.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/bg_splash_12.xml b/mifospay/src/main/res/drawable/bg_splash_12.xml new file mode 100644 index 000000000..56bb0f3fa --- /dev/null +++ b/mifospay/src/main/res/drawable/bg_splash_12.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/splash_icon.png b/mifospay/src/main/res/drawable/splash_icon.png new file mode 100644 index 000000000..b4e20ea37 Binary files /dev/null and b/mifospay/src/main/res/drawable/splash_icon.png differ diff --git a/mifospay/src/main/res/values-v31/themes.xml b/mifospay/src/main/res/values-v31/themes.xml new file mode 100644 index 000000000..7274a7160 --- /dev/null +++ b/mifospay/src/main/res/values-v31/themes.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/mifospay/src/main/res/values/splash.xml b/mifospay/src/main/res/values/splash.xml index d6f71d144..05cdaefc6 100644 --- a/mifospay/src/main/res/values/splash.xml +++ b/mifospay/src/main/res/values/splash.xml @@ -1,8 +1,8 @@ - - \ No newline at end of file + diff --git a/mifospay/src/main/res/values/styles.xml b/mifospay/src/main/res/values/themes.xml similarity index 94% rename from mifospay/src/main/res/values/styles.xml rename to mifospay/src/main/res/values/themes.xml index 59fe6866f..518a3be57 100644 --- a/mifospay/src/main/res/values/styles.xml +++ b/mifospay/src/main/res/values/themes.xml @@ -6,6 +6,10 @@ @color/colorAccent + +