1
0
mirror of https://github.com/fumiama/android-base16384.git synced 2026-06-06 10:40:30 +08:00
This commit is contained in:
fumiama
2020-12-17 14:00:15 +08:00
parent ec2774bbb2
commit e2a4dfbf58
9 changed files with 81 additions and 78 deletions

View File

@@ -1,9 +1,8 @@
plugins { apply plugin: 'com.android.application'
id 'com.android.application' apply plugin: 'kotlin-android'
id 'kotlin-android' apply plugin: 'kotlin-android-extensions'
id 'kotlin-android-extensions' apply plugin: 'kotlin-kapt'
id 'AndResGuard' //apply plugin: 'AndResGuard'
}
android { android {
compileSdkVersion 30 compileSdkVersion 30
@@ -13,8 +12,8 @@ android {
applicationId "top.fumiama.base16384" applicationId "top.fumiama.base16384"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 30 targetSdkVersion 30
versionCode 1 versionCode 5
versionName "1.0" versionName '1.1.2.1'
resConfigs "zh", "en" resConfigs "zh", "en"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -26,25 +25,16 @@ android {
multiDexEnabled = false multiDexEnabled = false
} }
signingConfigs { /*signingConfigs {
release { release {
storeFile file('../../../OneDrive/swc/developer/android_key/open_key') storeFile file('../../../OneDrive/swc/developer/android_key/open_key')
storePassword 'fumiama' storePassword 'fumiama'
keyAlias 'default' keyAlias 'cert'
keyPassword 'fumiama' keyPassword 'fumiama'
v1SigningEnabled true v1SigningEnabled true
v2SigningEnabled true v2SigningEnabled true
} }
} }*/
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
externalNativeBuild { externalNativeBuild {
cmake { cmake {
path "src/main/cpp/CMakeLists.txt" path "src/main/cpp/CMakeLists.txt"
@@ -59,6 +49,14 @@ android {
jvmTarget = '1.8' jvmTarget = '1.8'
} }
ndkVersion '22.0.7026061' ndkVersion '22.0.7026061'
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//signingConfig signingConfigs.release
}
}
} }
dependencies { dependencies {
@@ -71,51 +69,3 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
} }
andResGuard {
// mappingFile = file("./resource_mapping.txt")
mappingFile = null
use7zip = true
useSign = true
// 打开这个开关会keep住所有资源的原始路径只混淆资源的名字
keepRoot = false
// 设置这个值会把arsc name列混淆成相同的名字减少string常量池的大小
fixedResName = "arg"
// 打开这个开关会合并所有哈希值相同的资源,但请不要过度依赖这个功能去除去冗余资源
mergeDuplicatedRes = true
whiteList = [
// for your icon
"R.drawable.icon",
// for fabric
"R.string.com.crashlytics.*",
// for google-services
"R.string.google_app_id",
"R.string.gcm_defaultSenderId",
"R.string.default_web_client_id",
"R.string.ga_trackingId",
"R.string.firebase_database_url",
"R.string.google_api_key",
"R.string.google_crash_reporting_api_key"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
]
sevenzip {
artifact = 'com.tencent.mm:SevenZip:1.2.20'
//path = "/usr/local/bin/7za"
}
/**
* 可选: 如果不设置则会默认覆盖assemble输出的apk
**/
// finalApkBackupPath = "${project.rootDir}/final.apk"
/**
* 可选: 指定v1签名时生成jar文件的摘要算法
* 默认值为“SHA-1”
**/
// digestalg = "SHA-256"
}

BIN
app/release/app-release.aab Normal file

Binary file not shown.

BIN
app/release/app-release.apk Normal file

Binary file not shown.

View File

@@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "top.fumiama.base16384",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 5,
"versionName": "1.1.2.1",
"outputFile": "app-release.apk"
}
]
}

View File

@@ -2,6 +2,10 @@ package top.fumiama.base16384
import android.Manifest import android.Manifest
import android.app.Activity import android.app.Activity
import android.app.AlertDialog
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.net.Uri import android.net.Uri
@@ -11,6 +15,7 @@ import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.google.android.material.textfield.TextInputEditText
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import java.io.File import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
@@ -19,6 +24,7 @@ class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
val cm = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
sv.viewTreeObserver.addOnGlobalLayoutListener { sv.viewTreeObserver.addOnGlobalLayoutListener {
val h = sv.getChildAt(0).height val h = sv.getChildAt(0).height
tti.visibility = if(h > resources.displayMetrics.heightPixels) View.GONE else View.VISIBLE tti.visibility = if(h > resources.displayMetrics.heightPixels) View.GONE else View.VISIBLE
@@ -32,6 +38,7 @@ class MainActivity : Activity() {
inputFile.writeText(it.toString(), Charsets.UTF_16BE) inputFile.writeText(it.toString(), Charsets.UTF_16BE)
encode(inputFile.absolutePath, outputFile.absolutePath) encode(inputFile.absolutePath, outputFile.absolutePath)
tde.setText(outputFile.readText(Charsets.UTF_16BE)) tde.setText(outputFile.readText(Charsets.UTF_16BE))
copyText(tde, cm)
} }
} }
} }
@@ -43,9 +50,14 @@ class MainActivity : Activity() {
inputFile.writeText(it.toString(), Charsets.UTF_16BE) inputFile.writeText(it.toString(), Charsets.UTF_16BE)
decode(inputFile.absolutePath, outputFile.absolutePath) decode(inputFile.absolutePath, outputFile.absolutePath)
ten.setText(outputFile.readText(Charsets.UTF_16BE)) ten.setText(outputFile.readText(Charsets.UTF_16BE))
copyText(ten, cm)
} }
} }
} }
tti.setOnLongClickListener {
AlertDialog.Builder(this).setTitle(R.string.info).setMessage(R.string.info_content).setIcon(R.mipmap.ic_launcher).show()
true
}
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@@ -86,16 +98,19 @@ class MainActivity : Activity() {
val inputFile = generateCacheFile("input") val inputFile = generateCacheFile("input")
val outputFile = generateCacheFile("output") val outputFile = generateCacheFile("output")
saveFile(inputFile, uri) saveFile(inputFile, uri)
val br = inputFile.bufferedReader(Charsets.US_ASCII) val bbf = ByteArray(2)
val head1 = br.read() val br = inputFile.inputStream()
val head2 = br.read() br.read(bbf)
val re = if(head1 == 0xFE && head2 == 0xFF) decode(inputFile.absolutePath, outputFile.absolutePath) br.close()
val isDecode = bbf[0] == (-2).toByte() && bbf[1] == (-1).toByte()
val re = if(isDecode) decode(inputFile.absolutePath, outputFile.absolutePath)
else encode(inputFile.absolutePath, outputFile.absolutePath) else encode(inputFile.absolutePath, outputFile.absolutePath)
Toast.makeText( Toast.makeText(
this, this,
if(re == 0) { if(re == 0) {
createFile(getString(R.string.output)) createFile(getString(R.string.output))
R.string.succeed if(isDecode) R.string.decode_succeed else R.string.encode_succeed
} else R.string.failed, } else R.string.failed,
Toast.LENGTH_SHORT Toast.LENGTH_SHORT
).show() ).show()
@@ -169,6 +184,14 @@ class MainActivity : Activity() {
private fun generateCacheFile(name: String) = File(cacheDir, name) private fun generateCacheFile(name: String) = File(cacheDir, name)
private fun copyText(t: TextInputEditText, cm: ClipboardManager){
if(t.text?.isNotEmpty() == true) {
//t.selectAll()
ClipData.newPlainText(getString(R.string.app_name), t.text)?.let { cm.setPrimaryClip(it) }
Toast.makeText(this, R.string.copied, Toast.LENGTH_SHORT).show()
}
}
/** /**
* A native method that is implemented by the 'native-lib' native library, * A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application. * which is packaged with this application.

View File

@@ -11,4 +11,9 @@
<string name="succeed">成功</string> <string name="succeed">成功</string>
<string name="failed">失败</string> <string name="failed">失败</string>
<string name="output">输出</string> <string name="output">输出</string>
<string name="decode_succeed">解码成功</string>
<string name="encode_succeed">编码成功</string>
<string name="info">关于</string>
<string name="info_content">作者:源文雨。感谢咲桜动漫社成员的支持。</string>
<string name="copied">已复制</string>
</resources> </resources>

View File

@@ -4,10 +4,15 @@
<string name="decode">decode</string> <string name="decode">decode</string>
<string name="text_original">Original Text</string> <string name="text_original">Original Text</string>
<string name="text_encoded">Encoded Text</string> <string name="text_encoded">Encoded Text</string>
<string name="permissionDenied">permission denied</string> <string name="permissionDenied">Permission Denied</string>
<string name="share">Save Produced File</string> <string name="share">Save Produced File</string>
<string name="read_file_err">Read File Error!</string> <string name="read_file_err">Read File Error!</string>
<string name="succeed">succeed</string> <string name="succeed">Succeed</string>
<string name="failed">failed</string> <string name="failed">Failed</string>
<string name="output">output</string> <string name="output">output</string>
<string name="decode_succeed">Decode Succeed</string>
<string name="encode_succeed">Encode Succeed</string>
<string name="info">Info</string>
<string name="info_content">Author: Fumiama, with precious supports of the members in Sakura Anime Club.</string>
<string name="copied">Copied Text</string>
</resources> </resources>

View File

@@ -4,11 +4,13 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:4.1.1" classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.20' //classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.20'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # 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 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects