1
0
mirror of https://github.com/fumiama/android-base16384.git synced 2026-06-06 02:30: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 {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'AndResGuard'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
//apply plugin: 'AndResGuard'
android {
compileSdkVersion 30
@@ -13,8 +12,8 @@ android {
applicationId "top.fumiama.base16384"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 5
versionName '1.1.2.1'
resConfigs "zh", "en"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -26,25 +25,16 @@ android {
multiDexEnabled = false
}
signingConfigs {
/*signingConfigs {
release {
storeFile file('../../../OneDrive/swc/developer/android_key/open_key')
storePassword 'fumiama'
keyAlias 'default'
keyAlias 'cert'
keyPassword 'fumiama'
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}*/
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
@@ -59,6 +49,14 @@ android {
jvmTarget = '1.8'
}
ndkVersion '22.0.7026061'
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//signingConfig signingConfigs.release
}
}
}
dependencies {
@@ -71,51 +69,3 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
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.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.pm.PackageManager
import android.net.Uri
@@ -11,6 +15,7 @@ import android.view.View
import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.android.material.textfield.TextInputEditText
import kotlinx.android.synthetic.main.activity_main.*
import java.io.File
import java.io.FileInputStream
@@ -19,6 +24,7 @@ class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val cm = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
sv.viewTreeObserver.addOnGlobalLayoutListener {
val h = sv.getChildAt(0).height
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)
encode(inputFile.absolutePath, outputFile.absolutePath)
tde.setText(outputFile.readText(Charsets.UTF_16BE))
copyText(tde, cm)
}
}
}
@@ -43,9 +50,14 @@ class MainActivity : Activity() {
inputFile.writeText(it.toString(), Charsets.UTF_16BE)
decode(inputFile.absolutePath, outputFile.absolutePath)
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?) {
@@ -86,16 +98,19 @@ class MainActivity : Activity() {
val inputFile = generateCacheFile("input")
val outputFile = generateCacheFile("output")
saveFile(inputFile, uri)
val br = inputFile.bufferedReader(Charsets.US_ASCII)
val head1 = br.read()
val head2 = br.read()
val re = if(head1 == 0xFE && head2 == 0xFF) decode(inputFile.absolutePath, outputFile.absolutePath)
val bbf = ByteArray(2)
val br = inputFile.inputStream()
br.read(bbf)
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)
Toast.makeText(
this,
if(re == 0) {
createFile(getString(R.string.output))
R.string.succeed
if(isDecode) R.string.decode_succeed else R.string.encode_succeed
} else R.string.failed,
Toast.LENGTH_SHORT
).show()
@@ -169,6 +184,14 @@ class MainActivity : Activity() {
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,
* which is packaged with this application.

View File

@@ -11,4 +11,9 @@
<string name="succeed">成功</string>
<string name="failed">失败</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>

View File

@@ -4,10 +4,15 @@
<string name="decode">decode</string>
<string name="text_original">Original 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="read_file_err">Read File Error!</string>
<string name="succeed">succeed</string>
<string name="failed">failed</string>
<string name="succeed">Succeed</string>
<string name="failed">Failed</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>