commit 840ab0e52b09cae64ff35c1b6645d3c41632f621 Author: Administrator <981964879@qq.com> Date: Fri Aug 14 18:13:52 2020 +0800 2020.08.14 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f0c20a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,77 @@ +# Built application files +*.apk +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/caches + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..935c06b --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,37 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.1" + + defaultConfig { + applicationId "com.tt.ttutils" + minSdkVersion 14 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..87955bf --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/tt/MyApplication.kt b/app/src/main/java/com/tt/MyApplication.kt new file mode 100644 index 0000000..9d129d9 --- /dev/null +++ b/app/src/main/java/com/tt/MyApplication.kt @@ -0,0 +1,13 @@ +package com.tt + +import android.app.Application +import com.tt.ttutils.java.ToastUtil + +class MyApplication : Application() { + override fun onCreate() { + super.onCreate() + ToastUtil.init(this) + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/tt/activity/MainActivity.kt b/app/src/main/java/com/tt/activity/MainActivity.kt new file mode 100644 index 0000000..66ac0f8 --- /dev/null +++ b/app/src/main/java/com/tt/activity/MainActivity.kt @@ -0,0 +1,16 @@ +package com.tt.activity + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import com.tt.ttutils.R +import com.tt.ttutils.java.CmdUtil + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + //截图 + CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png"); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tt/ttutils/java/ApkUtils.java b/app/src/main/java/com/tt/ttutils/java/ApkUtils.java new file mode 100644 index 0000000..8a6d9ab --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/ApkUtils.java @@ -0,0 +1,5 @@ +package com.tt.ttutils.java; + +public class ApkUtils { + +} diff --git a/app/src/main/java/com/tt/ttutils/java/BitmapUtils.java b/app/src/main/java/com/tt/ttutils/java/BitmapUtils.java new file mode 100644 index 0000000..49684ae --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/BitmapUtils.java @@ -0,0 +1,4 @@ +package com.tt.ttutils.java; + +public class BitmapUtils { +} diff --git a/app/src/main/java/com/tt/ttutils/java/CmdUtil.java b/app/src/main/java/com/tt/ttutils/java/CmdUtil.java new file mode 100644 index 0000000..b7c8bae --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/CmdUtil.java @@ -0,0 +1,103 @@ +package com.tt.ttutils.java; + +import android.text.TextUtils; +import android.util.Log; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +public class CmdUtil { + private static final String TAG = "CmdUtil"; + + private static final String COMMAND_SH = "sh"; + private static final String COMMAND_EXIT = "exit\n"; + private static final String COMMAND_LINE_END = "\n"; + + + /** + * 运行命令 + * + * @param command 命令 + * @return 结果 + */ + public static Result execute(String command) { + Log.i(TAG, "execute() command = " + command); + Result result = new Result(); + + if (TextUtils.isEmpty(command)) { + Log.w(TAG, "WARNING: command should not be null or empty"); + return result; + } + + Process process = null; + DataOutputStream dos = null; + + try { + process = Runtime.getRuntime().exec(COMMAND_SH); + dos = new DataOutputStream(process.getOutputStream()); + dos.write(command.trim().getBytes()); + dos.writeBytes(COMMAND_LINE_END); + dos.flush(); + dos.writeBytes(COMMAND_EXIT); + dos.flush(); + result.code = process.waitFor(); + result.success = readBuffer(new BufferedReader(new InputStreamReader(process.getInputStream()))); + result.error = readBuffer(new BufferedReader(new InputStreamReader(process.getErrorStream()))); + Log.i(TAG, "result = " + result); + } catch (IOException ioe) { + ioe.printStackTrace(); + Log.e(TAG, ioe.getMessage()); + } catch (InterruptedException ie) { + ie.printStackTrace(); + Log.e(TAG, ie.getMessage()); + } finally { + try { + if (null != dos) { + dos.close(); + } + } catch (IOException ioe) { + ioe.printStackTrace(); + Log.e(TAG, ioe.getMessage()); + } + if (null != process) { + process.destroy(); + } + } + return result; + } + + private static String readBuffer(BufferedReader bufferedReader) throws IOException { + StringBuilder sb = new StringBuilder(); + String s; + while ((s = bufferedReader.readLine()) != null) { + sb.append(s); + } + return sb.toString(); + } + + + /** + * Command执行结果 + */ + public static final class Result { + + public static final int SUCCESS = 0; + public static final int ERROR = -1; + + public int code = ERROR; + String error; + String success; + + @Override + public String toString() { + return "Result{" + + "code=" + code + + ", error='" + error + '\'' + + ", success='" + success + '\'' + + '}'; + } + } +} + diff --git a/app/src/main/java/com/tt/ttutils/java/OtherUtils.java b/app/src/main/java/com/tt/ttutils/java/OtherUtils.java new file mode 100644 index 0000000..421f673 --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/OtherUtils.java @@ -0,0 +1,5 @@ +package com.tt.ttutils.java; + +public class OtherUtils { + +} diff --git a/app/src/main/java/com/tt/ttutils/java/PictrueUtils.java b/app/src/main/java/com/tt/ttutils/java/PictrueUtils.java new file mode 100644 index 0000000..d38ed6b --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/PictrueUtils.java @@ -0,0 +1,17 @@ +package com.tt.ttutils.java; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class PictrueUtils { + /**{@link } + * 静默截图 + *https://blog.csdn.net/mochiwxtianya/article/details/78889773 + *https://www.cnblogs.com/angel88/p/7933437.html + * @params + */ + + //1.系统签名adb命令截图 + + } diff --git a/app/src/main/java/com/tt/ttutils/java/SystemSignUtils.java b/app/src/main/java/com/tt/ttutils/java/SystemSignUtils.java new file mode 100644 index 0000000..879a652 --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/SystemSignUtils.java @@ -0,0 +1,5 @@ +package com.tt.ttutils.java; + +public class SystemSignUtils { + +} diff --git a/app/src/main/java/com/tt/ttutils/java/ToastUtil.java b/app/src/main/java/com/tt/ttutils/java/ToastUtil.java new file mode 100644 index 0000000..77ad1be --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/java/ToastUtil.java @@ -0,0 +1,101 @@ +package com.tt.ttutils.java; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Build; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; +import android.widget.Toast; + +import com.tt.ttutils.BuildConfig; + + +/** + * Created by tongtong on 2017/3/2. + */ + +public class ToastUtil { + private static Handler mainHandler = new Handler(Looper.getMainLooper()); + private static Toast toast; + private static Context mContext; + + @SuppressLint("ShowToast") + public static void init(Context context) { + mContext = context; + toast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT); + debugToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT); + + } + + private static long time1 = 0L; + private static long time2 = 0L; + + public static void show(final String msg) { + mainHandler.post(new Runnable() { + @Override + public void run() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + time2 = System.currentTimeMillis(); + if ((time2 - time1) > 3499) { + showToast(mContext, msg, Toast.LENGTH_LONG); + Log.e("fht", "LENGTH_LONG"); + time1 = time2; + } + } else { + if (toast != null) { + toast.setText(msg); + toast.show(); + } + } + } + }); + + } + + private static Toast mToast = null; + + //android 8.0以后限制 + //https://www.jianshu.com/p/d9813ad03d59 + //https://www.jianshu.com/p/050ce052b873 + public static void showToast(Context context, String text, int duration) { + if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) { + Toast.makeText(context, text, duration).show(); + } else { + if (mToast == null) { + mToast = Toast.makeText(context, text, duration); + } else { + mToast.setText(text); + mToast.setDuration(duration); + } + mToast.show(); + } + } + + // public static void showInCenter(String msg) { +// mainHandler.post(() -> { +// if (toast != null) { +// toast.setGravity(Gravity.CENTER, 0, 0); +// toast.setText(msg); +// toast.show(); +// } +// }); +// } + static Handler debugHandler = new Handler(Looper.getMainLooper()); + static Toast debugToast; + + public static void debugShow(final String msg) { + mainHandler.post(new Runnable() { + @Override + public void run() { + if (BuildConfig.DEBUG) { + if (toast != null) { + toast.setText(msg); + toast.show(); + } + } + } + }); + } + +} diff --git a/app/src/main/java/com/tt/ttutils/kt/ApkUtils.kt b/app/src/main/java/com/tt/ttutils/kt/ApkUtils.kt new file mode 100644 index 0000000..d483941 --- /dev/null +++ b/app/src/main/java/com/tt/ttutils/kt/ApkUtils.kt @@ -0,0 +1,6 @@ +package com.tt.ttutils.kt + +class ApkUtils { + + +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml new file mode 100644 index 0000000..4500292 --- /dev/null +++ b/app/src/main/res/layout-land/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-port/activity_main.xml b/app/src/main/res/layout-port/activity_main.xml new file mode 100644 index 0000000..91cc1cc --- /dev/null +++ b/app/src/main/res/layout-port/activity_main.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..4faecfa --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #6200EE + #3700B3 + #03DAC5 + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..5f56dde --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + TTUtils + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..fac9291 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/zip/MTKLogger.rar b/app/src/zip/MTKLogger.rar new file mode 100644 index 0000000..9b06535 Binary files /dev/null and b/app/src/zip/MTKLogger.rar differ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1241d12 --- /dev/null +++ b/build.gradle @@ -0,0 +1,26 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + ext.kotlin_version = "1.3.72" + repositories { + google() + jcenter() + } + dependencies { + classpath "com.android.tools.build:gradle:4.0.1" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4d15d01 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0f5e416 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Aug 03 12:01:53 CST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..36e1624 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +include ':app' +rootProject.name = "TTUtils" \ No newline at end of file