1
0
mirror of https://github.com/fumiama/android-base16384.git synced 2026-06-05 18:20:32 +08:00
This commit is contained in:
fumiama
2020-12-19 17:10:11 +08:00
parent 2cb9d5e079
commit fdde76f242
9 changed files with 38 additions and 5 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# Base16384 for Android
> 本项目的核心基于[Base16384](https://github.com/fumiama/base16384),这是使用`JNI`适配的安卓版本,支持深色模式主题,使用`Material Design`
# 功能
- 进行文本的编码/译码
- 从系统文件管理器选择任意二进制文件进行编码/译码
# 用途
- 文本加密通信
- 汉字文本压缩
- 二进制文件的文本化传输

View File

@@ -12,8 +12,8 @@ android {
applicationId "top.fumiama.base16384"
minSdkVersion 23
targetSdkVersion 30
versionCode 7
versionName '1.3'
versionCode 8
versionName '1.3.1'
resConfigs "zh", "en"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Binary file not shown.

Binary file not shown.

View File

@@ -10,8 +10,8 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 7,
"versionName": "1.3",
"versionCode": 8,
"versionName": "1.3.1",
"outputFile": "app-release.apk"
}
]

View File

@@ -26,13 +26,29 @@ import java.io.FileInputStream
import java.nio.charset.Charset
class MainActivity : Activity() {
var forceDecode = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val cm = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val pCharsets = PropertiesTools(File(filesDir, "charsets.prop"))
sv.viewTreeObserver.addOnGlobalLayoutListener { setTitleVisibility() }
fab.setOnClickListener { pickFile() }
fab.setOnLongClickListener {
AlertDialog.Builder(this)
.setTitle(R.string.alert)
.setMessage(R.string.force_decode)
.setIcon(R.mipmap.ic_launcher)
.setPositiveButton(android.R.string.ok){ _, _ ->
forceDecode = true
pickFile()
}
.setNegativeButton(android.R.string.cancel){ _, _ ->}
.show()
false
}
ben.setOnClickListener { clickButton(true, cm, pCharsets) }
bde.setOnClickListener { clickButton(false, cm, pCharsets) }
ben.setOnLongClickListener {
@@ -67,7 +83,8 @@ class MainActivity : Activity() {
val br = inputFile.inputStream()
br.read(bbf)
br.close()
val isDecode = bbf[0] == (-2).toByte() && bbf[1] == (-1).toByte()
val isDecode = (bbf[0] == (-2).toByte() && bbf[1] == (-1).toByte()) || forceDecode
if (forceDecode) forceDecode = false
val re = if(isDecode) decode(inputFile.absolutePath, outputFile.absolutePath)
else encode(inputFile.absolutePath, outputFile.absolutePath)

View File

@@ -17,4 +17,6 @@
<string name="info_content">作者:源文雨。感谢咲桜动漫社成员的支持。</string>
<string name="copied">已复制</string>
<string name="select_charset">选择字符集</string>
<string name="alert">提示</string>
<string name="force_decode">执行强制解码?</string>
</resources>

View File

@@ -16,4 +16,6 @@
<string name="info_content">Author: Fumiama, with precious supports from the members in Sakura Anime Club.</string>
<string name="copied">Copied Text</string>
<string name="select_charset">Select Charset</string>
<string name="alert">Alert</string>
<string name="force_decode">Force Decode?</string>
</resources>