-
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.
- Loading branch information
trongtrong
committed
Feb 27, 2023
1 parent
5cc791c
commit f93ca72
Showing
8 changed files
with
85 additions
and
10 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
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
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,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(); | ||
} |
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
29 changes: 29 additions & 0 deletions
29
testmodule/src/main/java/com/example/testmodule/TestActivity.java
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,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; | ||
} | ||
} | ||
} |
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 @@ | ||
<?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> |