diff --git a/app/build.gradle b/app/build.gradle index cf796e6..90163a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,6 +37,6 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'com.github.trongtrong:demo_lib_2:0.0.3' + implementation 'com.github.trongtrong:demo_lib_2:0.0.4' } \ No newline at end of file diff --git a/app/src/main/java/com/example/testjitpack/MainActivity.java b/app/src/main/java/com/example/testjitpack/MainActivity.java index 14d6aed..7f8afe9 100644 --- a/app/src/main/java/com/example/testjitpack/MainActivity.java +++ b/app/src/main/java/com/example/testjitpack/MainActivity.java @@ -10,5 +10,8 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + + } } \ No newline at end of file diff --git a/testmodule/build.gradle b/testmodule/build.gradle index 37c4315..1076979 100644 --- a/testmodule/build.gradle +++ b/testmodule/build.gradle @@ -42,7 +42,7 @@ publishing { release(MavenPublication) { groupId = 'com.github.trongtrong' artifactId = 'demo-simple-android-lib' - version = '0.0.1' + version = '0.0.5' afterEvaluate { from components.release diff --git a/testmodule/src/main/AndroidManifest.xml b/testmodule/src/main/AndroidManifest.xml index d2fe05a..2dd63ea 100644 --- a/testmodule/src/main/AndroidManifest.xml +++ b/testmodule/src/main/AndroidManifest.xml @@ -8,6 +8,13 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.TestJitpack"> + + + diff --git a/testmodule/src/main/java/com/example/testmodule/Lib.java b/testmodule/src/main/java/com/example/testmodule/Lib.java new file mode 100644 index 0000000..5373a83 --- /dev/null +++ b/testmodule/src/main/java/com/example/testmodule/Lib.java @@ -0,0 +1,34 @@ +package com.example.testmodule; + +import android.app.Activity; +import android.content.Intent; + +public class Lib { + private static Lib INSTANCE; + public Activity activity; + public LibListener listener; + + public static Lib getInstance() { + if (INSTANCE == null) { + INSTANCE = new Lib(); + } + return INSTANCE; + } + + + public void init(Activity activity, LibListener listener) { + this.activity = activity; + this.listener = listener; + } + + public void open(Activity activity, LibListener listener) { + Intent intent = new Intent(activity, TestActivity.class); + intent.putExtra("data", "'open test"); + activity.startActivity(intent); + } + +} + +interface LibListener{ + public void onTest(); +} diff --git a/testmodule/src/main/java/com/example/testmodule/MainActivity.java b/testmodule/src/main/java/com/example/testmodule/MainActivity.java index 391dfb0..82095f0 100644 --- a/testmodule/src/main/java/com/example/testmodule/MainActivity.java +++ b/testmodule/src/main/java/com/example/testmodule/MainActivity.java @@ -15,14 +15,7 @@ protected void onCreate(Bundle savedInstanceState) { TextView text1 = (TextView) findViewById(R.id.txt_test); - int a = 10; - int b = 20; - - if (a > b){ - b = 30; - }else { - a = 20; - } + } diff --git a/testmodule/src/main/java/com/example/testmodule/TestActivity.java b/testmodule/src/main/java/com/example/testmodule/TestActivity.java new file mode 100644 index 0000000..964f35f --- /dev/null +++ b/testmodule/src/main/java/com/example/testmodule/TestActivity.java @@ -0,0 +1,29 @@ +package com.example.testmodule; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; + +public class TestActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_test); + + Intent intent = getIntent(); + String test = intent.getStringExtra("'data"); + Log.d("TestActivity", "onCreate: " +test); + + int a = 10; + int b = 20; + + if (a > b){ + b = 30; + }else { + a = 20; + } + } +} \ No newline at end of file diff --git a/testmodule/src/main/res/layout/activity_test.xml b/testmodule/src/main/res/layout/activity_test.xml new file mode 100644 index 0000000..9ea4942 --- /dev/null +++ b/testmodule/src/main/res/layout/activity_test.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file