Skip to content

Commit

Permalink
feat: complete maps rules UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-TSNG committed Jun 7, 2021
1 parent 9932c7f commit 1191140
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 43 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.tsng.hidemyapplist"
minSdkVersion 24
targetSdkVersion 30
versionCode 44
versionName "1.7.-0.8 Prebuild"
versionCode 45
versionName "1.7 Beta"
buildConfigField "int", "SERVICE_VERSION", "43"
buildConfigField "int", "MIN_RIRU_VERSION", "15"
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/tsng/hidemyapplist/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
try {
val client = OkHttpClient()
val responseData = client.newCall(Request.Builder()
.url("https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@master/updates/latest_version.json")
.url("https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@updates/updates/latest_version.json")
.build()).execute().body?.string()
if (responseData != null) {
val json = JSONObject(responseData)
var data = json["Stable"] as JSONObject
var updateLogURL = "https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@master/updates/stable-"
var updateLogURL = "https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@updates/updates/stable-"
if (getSharedPreferences("Settings", MODE_PRIVATE).getBoolean("ReceiveBetaUpdate", false))
if (json["Beta"] != false) {
data = json["Beta"] as JSONObject
updateLogURL = "https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@master/updates/beta-"
updateLogURL = "https://cdn.jsdelivr.net/gh/Dr-TSNG/Hide-My-Applist@updates/updates/beta-"
}
updateLogURL += if (Locale.getDefault().language.contains("zh")) "zh" else "en"
updateLogURL += ".html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import androidx.preference.CheckBoxPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.iterator
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.tsng.hidemyapplist.R
import kotlinx.android.synthetic.main.appselect.*
import kotlinx.android.synthetic.main.toolbar.*
Expand Down Expand Up @@ -59,6 +62,39 @@ class TemplateSettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.O
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
preferenceManager.sharedPreferencesName = "tpl_" + arguments?.getString("template")
setPreferencesFromResource(R.xml.template_preferences, rootKey)
preferenceScreen.findPreference<Preference>("MapsRules")?.setOnPreferenceClickListener {
val rules = preferenceManager.sharedPreferences.getStringSet("MapsRules", setOf()).toMutableList()
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, rules)
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.template_add_maps_rules)
.setView(View.inflate(requireContext(), R.layout.alert_customize_maps_rules, null).apply {
findViewById<ListView>(R.id.template_lv_maps_rules).apply {
this.adapter = adapter
setOnItemLongClickListener { _, _, position, _ ->
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.template_delete_maps_rule)
.setMessage(rules[position])
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { _, _ ->
activity?.runOnUiThread { adapter.remove(rules[position]) }
preferenceManager.sharedPreferences.edit().putStringSet("MapsRules", rules.toSet()).apply()
}.show()
true
}
}
findViewById<Button>(R.id.template_btn_add_new_maps_rule).setOnClickListener {
val editText = findViewById<EditText>(R.id.template_et_new_maps_rule)
val newRule = editText.text.toString()
editText.text.clear()
if (newRule.isEmpty() || rules.contains(newRule)) return@setOnClickListener
adapter.add(newRule)
preferenceManager.sharedPreferences.edit().putStringSet("MapsRules", rules.toSet()).apply()
}
})
.setPositiveButton(android.R.string.ok, null)
.show()
true
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_detection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:id="@+id/detection_btn_AddPackage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/detection_add_new_package" />
android:text="@string/add" />
</LinearLayout>

<com.google.android.material.card.MaterialCardView style="@style/ListCard">
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/res/layout/alert_customize_maps_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
style="@style/Default"
android:layout_marginHorizontal="18dp"
android:layout_marginVertical="10dp"
android:orientation="horizontal">

<EditText
android:id="@+id/template_et_new_maps_rule"
style="@style/Default"
android:layout_weight="1"
android:gravity="center"
android:hint="@string/template_add_new_maps_rule_hint"
android:maxLines="1"
android:textSize="20sp" />

<Button
android:id="@+id/template_btn_add_new_maps_rule"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/add" />
</LinearLayout>

<ListView
android:id="@+id/template_lv_maps_rules"
style="@style/Default" />
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="yes">是</string>
<string name="no">否</string>
<string name="error">错误</string>
<string name="add">添加</string>

<string name="new_update">新版本可用:</string>
<string name="update_logs">更新日志</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-zh-rCN/strings_detection.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="detection_hint_input_name">输入要检测的包名</string>
<string name="detection_add_new_package">添加</string>
<string name="detection_hint_how_to_use_title">确保开始检测前做完以下工作</string>
<string name="detection_hint_how_to_use_message"><![CDATA[1. 建立好一个模板<br/>2. 在<b>选择生效应用</b>中给<font color="red"><b>模块自己</b></font>应用模板<br/>3. 设置里开启<b> Hook 模块自身</b>并<font color="red"><b>强制停止</b></font>再重新打开一次模块 APP<br/>4. 不要在检测测试中加入com.tsng.hidemyapplist,自己检测自己无论如何都能检测到]]></string>

Expand Down
8 changes: 6 additions & 2 deletions app/src/main/res/values-zh-rCN/strings_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<string name="template_new">新建模板</string>
<string name="template_name_invalid">模板名称不合法或已存在</string>
<string name="template_delete_confirm">删除模板?</string>

<string name="template_enable_all_hooks">启用所有隐藏方式</string>
<string name="template_apply_hooks">选择隐藏方式</string>
<string name="template_add_custom_maps_rules">添加自定义 maps 拦截规则</string>
<string name="template_add_custom_maps_rules_summary">默认匹配黑名单包名(白名单模式无自动规则)</string>
<string name="template_add_maps_rules">添加自定义 maps 拦截规则</string>
<string name="template_add_maps_rules_summary">默认匹配黑名单包名(白名单模式无自动规则)</string>
<string name="template_add_new_maps_rule_hint">填入要过滤的条目</string>
<string name="template_delete_maps_rule">删除规则?</string>

<string name="template_hide_apps">隐藏应用</string>
<string name="template_whitelist">使用白名单</string>
<string name="template_whitelist_summary">这会使目标应用只能获取到选定的应用信息</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="yes">是</string>
<string name="no">否</string>
<string name="error">錯誤</string>
<string name="add">新增</string>

<string name="new_update">可用新版本: </string>
<string name="update_logs">更新日誌</string>
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values-zh-rTW/strings_detection.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="detection_hint_input_name">輸入需檢測的包名</string>
<string name="detection_add_new_package">新增</string>
<string name="detection_hint_how_to_use_title">開始測試前請確定完成以下步驟</string>
<string name="detection_hint_how_to_use_message"><![CDATA[1. 請先設定模板<br/>2. 把模板套用到「<font color="red"><b>隱藏應用程式列表</b></font>」<br/>3. 在設定中開啟 「<b>Hook 模組本體</b>」選項,並且「<font color="red"><b>強制停止並重新啟動</b></font>」隱藏應用程式列表<br/>4. 請不要將 「com.tsng.hidemyapplist」 加入需檢測包名列表內,因為它總是能檢測到自身本體]]></string>

<string name="detection_start">開始測試</string>
<string name="detection_color_means">[N]:未找到目標 [F]:找到目標 [D]:拒絕訪問</string>
<string name="detection_executing_detections">檢測中</string>
<string name="detection_finished">檢測結束</string>
<string name="detection_using_method">檢測中...</string>
<string name="detection_using_method">檢測中</string>
<string name="detection_delete_confirm">刪除包名?</string>
</resources>
8 changes: 6 additions & 2 deletions app/src/main/res/values-zh-rTW/strings_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<string name="template_new">建立模板</string>
<string name="template_name_invalid">模板名稱不合法或已存在</string>
<string name="template_delete_confirm">刪除模板?</string>

<string name="template_enable_all_hooks">啟用所有隱藏方式</string>
<string name="template_apply_hooks">選擇隱藏方式</string>
<string name="template_add_custom_maps_rules">新增自定 maps 攔截規則</string>
<string name="template_add_custom_maps_rules_summary">預設檢測黑名單包名(白名單模式沒有自動規則)</string>
<string name="template_add_maps_rules">新增自定 maps 攔截規則</string>
<string name="template_add_maps_rules_summary">預設檢測黑名單包名(白名單模式沒有自動規則)</string>
<string name="template_add_new_maps_rule_hint">填入要過濾的條目</string>
<string name="template_delete_maps_rule">刪除規則?</string>

<string name="template_hide_apps">隱藏應用程式</string>
<string name="template_whitelist">使用白名單</string>
<string name="template_whitelist_summary">這會使目標應用程式只能獲取到選定的應用程式資訊</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="error">Error</string>
<string name="add">Add</string>

<string name="new_update">New update:</string>
<string name="update_logs">New features</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings_detection.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="detection_hint_input_name">Input package name</string>
<string name="detection_add_new_package">Add</string>
<string name="detection_hint_how_to_use_title">Make sure the following work is done before testing</string>
<string name="detection_hint_how_to_use_message"><![CDATA[1. Set up a template<br/>2. Apply the template to <font color="red"><b>the module app itself</b></font><br/>3. Switch on <b>\"Hook Self\"</b> option in settings and <font color="red"><b>force stop & restart</b></font> the app again<br/>4. Do not add \"com.tsng.hidemyapplist\" to the detection list, for an app can always detect itself]]></string>

Expand Down
8 changes: 6 additions & 2 deletions app/src/main/res/values/strings_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<string name="template_new">New Template</string>
<string name="template_name_invalid">Template name is invalid or already exists.</string>
<string name="template_delete_confirm">Delete template?</string>

<string name="template_enable_all_hooks">Enable all hide methods</string>
<string name="template_apply_hooks">Select hide methods</string>
<string name="template_add_custom_maps_rules">Add custom maps interception rules</string>
<string name="template_add_custom_maps_rules_summary">Default match blacklist package name (whitelist mode has no automatic rules)</string>
<string name="template_add_maps_rules">Add custom maps interception rules</string>
<string name="template_add_maps_rules_summary">Default match blacklist package name (whitelist mode has no automatic rules)</string>
<string name="template_add_new_maps_rule_hint">Fill in an item to be filtered</string>
<string name="template_delete_maps_rule">Delete the rule?</string>

<string name="template_hide_apps">Hide apps</string>
<string name="template_whitelist">WhiteList</string>
<string name="template_whitelist_summary">This will allow target apps to find app selected only</string>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/xml/template_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
android:key="ApplyHooks"
android:title="@string/template_apply_hooks" />
<Preference
android:key="CustomMapsRules"
android:summary="@string/template_add_custom_maps_rules_summary"
android:title="@string/template_add_custom_maps_rules" />
android:key="MapsRules"
android:summary="@string/template_add_maps_rules_summary"
android:title="@string/template_add_maps_rules" />
</PreferenceCategory>

<PreferenceCategory android:title="@string/template_hide_apps">
Expand Down
15 changes: 4 additions & 11 deletions updates/beta-en.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<b><font color="red">Attention: You should and <u>ONLY</u> should check System Framework in Xposed activation scope</font></b><br/>
<b>Don't be mean for a few seconds. Read the about page, which will save you a lot of time asking everywhere how to use this module</b><br/>
<b>XP V1.6.4.1 Beta + Riru V0.3.4.1</b><br/>
<p><font color="red">There are big changes to the riru extension. Please perform the settings manually before updating - stop system services - clean up environment at the same time</font></p>
<p>Fix crashes on permission controller and some games</p>
<p>Fix a memory leak problem</p>
<p>Fix some bootloop problems (For those whose devices crash with stable native version, the riru extension may not cause crash anymore)</p>
<b>V1.6.2.1 Beta</b><br/>
<p>Using a magic, file detection interceptions now can take efforts in real-time without restart target app</p>
<b>V1.6.2 Beta</b><br/>
<p>Move all native functions to Riru - Hide My Applist, only retaining system service in Xposed module</p>
<p>For should you install riru extension, please refer to the about page</p>
<p>Add token verification to prevent malicious calls to the system interface</p>
<b>XP V1.7 Beta + Riru V0.4.1.1</b><br/>
<p>Performance optimization</p>
<p>Add maps interception</p>
<p><font color="red">DO NOT only update app without updating riru extension, or 100% bootloop</font></p>
16 changes: 4 additions & 12 deletions updates/beta-zh.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<b><font color="red">注意:Xposed作用域应该且<u>只应该</u>勾选系统框架</font></b><br/>
<b>不要吝啬几秒钟去看看关于页面,这会节省很多到处去问怎么使用本模块的时间</b><br/>
<b>XP V1.6.4.1 Beta + Riru V0.3.4.1</b><br/>
<p><font color="red">Riru插件有较大改动,更新前请手动执行一遍设置-停止系统服务-同时清理环境</font></p>
<p>修复崩坏3、明日方舟、MIUI权限控制器、闪退问题</p>
<p>修复一个内存泄露问题</p>
<p>Riru插件加入签名认证,<font color="red">某个傻逼MT小子别想二改还用上高级功能了。</font>app签名认证也在路上,我看你还怎么改</p>
<p>修复部分手机卡开机问题(理论上曾经稳定版native版无法使用的bug已经修复了,现在可以使用riru插件)</p>
<b>V1.6.2.1 Beta</b><br/>
<p>使用了一个魔法,文件拦截也能实时生效,无需强制停止目标APP了</p>
<b>V1.6.2 Beta</b><br/>
<p>迁移所有native功能至 Riru - Hide My Applist,XP部分只保留System service</p>
<p>关于是否有必要安装riru插件,请参阅关于页面</p>
<p>加入token验证,防止恶意调用系统接口</p>
<b>XP V1.7 Beta + Riru V0.4.1.1</b><br/>
<p>性能优化</p>
<p>加入 maps 拦截功能</p>
<p><font color="red">切忌只更新 app 不更新 riru 插件,否则 100% 卡开机</font></p>
6 changes: 5 additions & 1 deletion updates/latest_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"VersionName": "V1.6.6",
"DownloadURL": "https://github.com/Dr-TSNG/Hide-My-Applist/releases/tag/V1.6.6"
},
"Beta": false
"Beta": {
"VersionCode": 45,
"VersionName": "V1.7 Beta",
"DownloadURL": "https://github.com/Dr-TSNG/Hide-My-Applist/releases/tag/V1.7"
}
}

0 comments on commit 1191140

Please sign in to comment.