Skip to content

Commit

Permalink
Tesst
Browse files Browse the repository at this point in the history
  • Loading branch information
trongtrong committed Feb 27, 2023
1 parent 5cc791c commit f93ca72
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

}
3 changes: 3 additions & 0 deletions app/src/main/java/com/example/testjitpack/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);



}
}
2 changes: 1 addition & 1 deletion testmodule/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions testmodule/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TestJitpack">
<activity
android:name=".TestActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
Expand Down
34 changes: 34 additions & 0 deletions testmodule/src/main/java/com/example/testmodule/Lib.java
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}



}
Expand Down
29 changes: 29 additions & 0 deletions testmodule/src/main/java/com/example/testmodule/TestActivity.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
9 changes: 9 additions & 0 deletions testmodule/src/main/res/layout/activity_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TestActivity">

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit f93ca72

Please sign in to comment.