Commit 003faa1b authored by wanglei's avatar wanglei

移除混淆功能

parent 157d8d2c
This diff is collapsed.
......@@ -24,20 +24,7 @@ class MyApplication : BaseApplication() {
fun initApp() {
if (ConfigHelper.ifAgreePrivacy) {
MobileAds.initialize(this) { initializationStatus ->
val statusMap =
initializationStatus.adapterStatusMap
for (adapterClass in statusMap.keys) {
val status = statusMap[adapterClass]
Log.d(
"MyApp", String.format(
"Adapter name: %s, Description: %s, Latency: %d",
adapterClass, status!!.description, status.latency
)
)
}
}
MobileAds.initialize(this) { initializationStatus -> }
}
initLifeListener()
}
......
package com.base.easyfilemanager.helps
import android.util.Base64
import java.security.SecureRandom
import javax.crypto.Cipher
import javax.crypto.spec.GCMParameterSpec
import javax.crypto.spec.SecretKeySpec
object AESHelper {
private const val aesKey = "bt8n2r8wdqk30wcu"
private val cipher by lazy {
Cipher.getInstance("AES/GCM/NoPadding")
}
fun encrypt(content: String): String {
try {
val iv = ByteArray(12).apply {
SecureRandom().nextBytes(this)
}
val contentBytes = content.toByteArray(Charsets.UTF_8)
val params = GCMParameterSpec(128, iv)
cipher.init(
Cipher.ENCRYPT_MODE,
secretKey, params
)
val encryptData = cipher.doFinal(contentBytes)
assert(encryptData.size == contentBytes.size + 16)
val message = ByteArray(12 + contentBytes.size + 16)
System.arraycopy(iv, 0, message, 0, 12)
System.arraycopy(encryptData, 0, message, 12, encryptData.size)
return String(Base64.encode(message, Base64.NO_WRAP), Charsets.UTF_8)
} catch (_: Exception) {
}
return content
}
@Synchronized
fun decrypt(content: String): String {
try {
val con = content.replace(" ".toRegex(), "+")
val contentByte = Base64.decode(con, Base64.NO_WRAP)
require(contentByte.size >= 12 + 16)
val params = GCMParameterSpec(128, contentByte, 0, 12)
cipher.init(
Cipher.DECRYPT_MODE,
secretKey, params
)
val decryptData = cipher.doFinal(contentByte, 12, contentByte.size - 12)
return String(decryptData, Charsets.UTF_8)
} catch (_: Exception) {
}
return content
}
private val secretKey by lazy {
SecretKeySpec(aesKey.toByteArray(), "AES")
}
}
\ No newline at end of file
package com.base.easyfilemanager.helps
import android.content.Context
import android.util.AttributeSet
import com.base.easyfilemanager.helps.KotlinExt.decode
import com.noober.background.view.BLTextView
class AESTextView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : BLTextView(context, attrs) {
override fun setText(text: CharSequence?, type: BufferType?) {
super.setText(text?.toString()?.run { decode().takeIf { it != this } } ?: text, type)
}
}
\ No newline at end of file
package com.base.easyfilemanager.helps
//noinspection SuspiciousImport
import android.R
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
......@@ -73,7 +72,7 @@ object BarUtils {
private fun applyStatusBarColor(window: Window, color: Int, isDecor: Boolean): View {
val parent =
if (isDecor) window.decorView as ViewGroup else (window.findViewById<View>(R.id.content) as ViewGroup)
if (isDecor) window.decorView as ViewGroup else (window.findViewById<View>(android.R.id.content) as ViewGroup)
var fakeStatusBarView =
parent.findViewWithTag<View>(TAG_STATUS_BAR)
if (fakeStatusBarView != null) {
......@@ -102,6 +101,7 @@ object BarUtils {
// status bar
///////////////////////////////////////////////////////////////////////////
private const val TAG_STATUS_BAR = "TAG_STATUS_BAR"
@SuppressLint("DiscouragedApi", "InternalInsetResource")
fun getStatusBarHeight(): Int {
val resources = Resources.getSystem()
......
......@@ -6,13 +6,6 @@ import com.base.easyfilemanager.utils.SPUtils
object ConfigHelper {
var gid = ""
var isOpenNotification = false
// 域名
const val eventUrl = "http://test"
const val apiUrl = "http://test"
// admob广告id
const val openAdmobId = "/6499/example/app-open"
......
package com.base.easyfilemanager.helps
import android.view.View
import java.text.SimpleDateFormat
import java.util.Locale
object KotlinExt {
private val aesMap = mutableMapOf<Int, String>()
fun Int.string(vararg arg: Any) = try {
(aesMap[this] ?: BaseApplication.context.getString(this).decode()).run {
aesMap[this@string] = this
String.format(this, *arg)
}
} catch (_: Exception) {
""
}
fun String.decode() = AESHelper.decrypt(this)
.replace("\\r", "\r")
.replace("\\n", "\n")
.replace("\\'", "'")
.replace("\\\"", "\"")
.replace("\\?", "?")
.replace("&amp;", "&")
fun Collection<View>.setOnClickListener(listener: (View) -> Unit) {
this.forEach {
it.setOnClickListener(listener)
}
}
fun View.setTrackedOnClickListener(action: (view: View) -> Unit) {
setOnClickListener {
action(this)
var view: View? = this
while (view != null) {
try {
break
} catch (_: Exception) {
view = view.parent as? View
}
}
}
}
fun Number.toFormatSize(count: Int = 1): String {
var suffix = "B"
var fSize = this.toDouble()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment