|
@@ -1,5 +1,6 @@
|
|
|
package com.eastpolar.hookcli
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.os.Bundle
|
|
|
import androidx.activity.ComponentActivity
|
|
|
import androidx.activity.compose.setContent
|
|
@@ -12,40 +13,50 @@ import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
import com.eastpolar.hookcli.tools.AutoCopySO
|
|
|
import com.eastpolar.hookcli.ui.theme.HookCliTheme
|
|
|
+import java.text.SimpleDateFormat
|
|
|
+import java.util.Date
|
|
|
|
|
|
//注入的应用包名
|
|
|
private val INJECT_PACKAGE_NAME = "com.rbigkic.yyydsj"
|
|
|
|
|
|
class MainActivity : ComponentActivity() {
|
|
|
+ @SuppressLint("SimpleDateFormat")
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
- setContent {
|
|
|
- HookCliTheme {
|
|
|
- // A surface container using the 'background' color from the theme
|
|
|
- Surface(
|
|
|
- modifier = Modifier.fillMaxSize(),
|
|
|
- color = MaterialTheme.colorScheme.background
|
|
|
- ) {
|
|
|
- Greeting("Android")
|
|
|
+ val copySoFileResult = AutoCopySO.instance.copySoFile(this, INJECT_PACKAGE_NAME)
|
|
|
+ if (copySoFileResult.isNotEmpty()) {
|
|
|
+ //通过Composable,设置到TextView上
|
|
|
+ setContent {
|
|
|
+ HookCliTheme {
|
|
|
+ // A surface container using the 'background' color from the theme
|
|
|
+ Surface(
|
|
|
+ modifier = Modifier.fillMaxSize(),
|
|
|
+ color = MaterialTheme.colorScheme.background
|
|
|
+ ) {
|
|
|
+ Greeting(
|
|
|
+ "$copySoFileResult\n包名:$INJECT_PACKAGE_NAME\n" +
|
|
|
+ "${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}"
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- AutoCopySO.instance.copySoFile(this, INJECT_PACKAGE_NAME)
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-@Composable
|
|
|
-fun Greeting(name: String, modifier: Modifier = Modifier) {
|
|
|
- Text(
|
|
|
- text = "Hello $name!",
|
|
|
- modifier = modifier
|
|
|
- )
|
|
|
-}
|
|
|
+ @Composable
|
|
|
+ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
|
|
+ Text(
|
|
|
+ text = "Hello $name!",
|
|
|
+ modifier = modifier
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
-@Preview(showBackground = true)
|
|
|
-@Composable
|
|
|
-fun GreetingPreview() {
|
|
|
- HookCliTheme {
|
|
|
- Greeting("Android")
|
|
|
+ @Preview(showBackground = true)
|
|
|
+ @Composable
|
|
|
+ fun GreetingPreview() {
|
|
|
+ HookCliTheme {
|
|
|
+ Greeting("Android")
|
|
|
+ }
|
|
|
}
|
|
|
}
|