diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 74368d2..f24e003 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -11,6 +11,7 @@ diff --git a/mylibrary/.gitignore b/mylibrary/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/mylibrary/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/mylibrary/build.gradle b/mylibrary/build.gradle new file mode 100644 index 0000000..2b7d683 --- /dev/null +++ b/mylibrary/build.gradle @@ -0,0 +1,36 @@ +plugins { + id 'com.android.library' +} + +android { + namespace 'com.ifkaar.commons.mylibrary' + compileSdk 32 + + defaultConfig { + minSdk 21 + targetSdk 32 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.8.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} \ No newline at end of file diff --git a/mylibrary/consumer-rules.pro b/mylibrary/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/mylibrary/proguard-rules.pro b/mylibrary/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/mylibrary/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/mylibrary/src/androidTest/java/com/ifkaar/commons/mylibrary/ExampleInstrumentedTest.java b/mylibrary/src/androidTest/java/com/ifkaar/commons/mylibrary/ExampleInstrumentedTest.java new file mode 100644 index 0000000..e541c1a --- /dev/null +++ b/mylibrary/src/androidTest/java/com/ifkaar/commons/mylibrary/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.ifkaar.commons.mylibrary; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.ifkaar.commons.mylibrary.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/mylibrary/src/main/AndroidManifest.xml b/mylibrary/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/mylibrary/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/mylibrary/src/test/java/com/ifkaar/commons/mylibrary/ExampleUnitTest.java b/mylibrary/src/test/java/com/ifkaar/commons/mylibrary/ExampleUnitTest.java new file mode 100644 index 0000000..e9252dd --- /dev/null +++ b/mylibrary/src/test/java/com/ifkaar/commons/mylibrary/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.ifkaar.commons.mylibrary; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1cf33ee..a263a85 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,3 +15,4 @@ dependencyResolutionManagement { rootProject.name = "AndroidTest" include ':app' include ':string-converter' +include ':mylibrary' diff --git a/string-converter/src/main/java/com/example/commons/string/converter/Validations2.java b/string-converter/src/main/java/com/example/commons/string/converter/Validations2.java index 25e9fc4..7d58a9a 100644 --- a/string-converter/src/main/java/com/example/commons/string/converter/Validations2.java +++ b/string-converter/src/main/java/com/example/commons/string/converter/Validations2.java @@ -7,4 +7,7 @@ public class Validations2 { public static void showToast(Context context, String message) { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } + public static void showToast22(Context context, String message) { + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + } } diff --git a/string-converter/src/main/java/com/example/commons/string/converter/Validations3.java b/string-converter/src/main/java/com/example/commons/string/converter/Validations3.java new file mode 100644 index 0000000..594e58e --- /dev/null +++ b/string-converter/src/main/java/com/example/commons/string/converter/Validations3.java @@ -0,0 +1,10 @@ +package com.example.commons.string.converter; + +import android.content.Context; +import android.widget.Toast; + +public class Validations3 { + public static void showAhsanToast(Context context, String message) { + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + } +}