Skip to content

Commit

Permalink
App Icon and about dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
twilightgod committed Feb 20, 2015
1 parent a39e4a0 commit d908417
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rexpress.xposed.malwarebuster;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
Expand All @@ -13,6 +14,7 @@
import android.os.AsyncTask;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -495,7 +497,7 @@ public boolean onQueryTextChange(String newText) {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.menu_main, menu);
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

Expand All @@ -504,13 +506,54 @@ public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
switch (item.getItemId()) {
case R.id.menu_refresh:
refreshApps();
return true;
case R.id.menu_about:
showAboutDialog();
return true;
default:
return super.onOptionsItemSelected(item);
}
}

private void showAboutDialog() {
View vAbout;
vAbout = getLayoutInflater().inflate(R.layout.about, null);

// Warn if the module is not active
//if (!isModActive())
// vAbout.findViewById(R.id.about_notactive).setVisibility(View.VISIBLE);

// Display the resources translator, or hide it if none
//String translator = getResources().getString(R.string.translator);
//TextView txtTranslation = (TextView) vAbout.findViewById(R.id.about_translation);
// if (translator.isEmpty()) {
// txtTranslation.setVisibility(View.GONE);
//} else {
// txtTranslation.setText(getString(R.string.app_translation, translator));
// txtTranslation.setMovementMethod(LinkMovementMethod.getInstance());
//}

// Clickable links
((TextView) vAbout.findViewById(R.id.about_title)).setMovementMethod(LinkMovementMethod.getInstance());

// Display the correct version
try {
((TextView) vAbout.findViewById(R.id.version)).setText(getString(R.string.app_version,
getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
} catch (PackageManager.NameNotFoundException e) {
}

return super.onOptionsItemSelected(item);
// Prepare and show the dialog
AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
dlgBuilder.setTitle(R.string.app_name);
dlgBuilder.setCancelable(true);
dlgBuilder.setIcon(R.drawable.ic_launcher);
dlgBuilder.setPositiveButton(android.R.string.ok, null);
dlgBuilder.setView(vAbout);
dlgBuilder.show();
}

}
Binary file modified app/src/main/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions app/src/main/res/layout/about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="?android:attr/scrollbarSize"
android:paddingRight="?android:attr/scrollbarSize" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<TextView
android:id="@+id/about_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_about"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/app_description" />

<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/app_version" />



</LinearLayout>

</ScrollView>
3 changes: 1 addition & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
android:fadingEdge="vertical"
android:fastScrollEnabled="true"
android:scrollbars="vertical"
android:textFilterEnabled="true"
android:choiceMode="multipleChoice" />
android:textFilterEnabled="true" />

</RelativeLayout>
16 changes: 11 additions & 5 deletions app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_refresh"
android:showAsAction="withText"
android:title="@string/menu_refresh"/>
<item
android:id="@+id/menu_about"
android:icon="@android:drawable/ic_menu_help"
android:showAsAction="withText"
android:title="@string/menu_about"/>
</menu>
5 changes: 5 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
<string name="app_loading">正在加载程序,请稍候</string>
<string name="app_name">流氓终结者</string>
<string name="app_searchhint">App名称或包名</string>
<string name="app_version">版本: %s</string>
<string name="menu_about">关于</string>
<string name="menu_refresh">刷新</string>
<string name="app_description">Android上有很多流氓App, 比如xx地图, xx输入法, xxx钱包, xx点评, 会注册一堆service和receiver常驻后台, 即使在App的设置里关掉各种推送也没用. 常见的方法是使用绿色守护. 对于高级用户来说使用My Android Tools/3C Tools, 可以更有效地关闭不必要的service和receiver. 可是这些顽固的App会在运行的过程中重新注册这些service/receiver, 而My Android Tools只是静态地禁用, 没有常驻进程, 无法检测是否被重新开启了. 本App的解决方案是使用Xposed Module, 通过Hook setComponentEnabledSetting方法, 改写参数为DISABLED, 让流氓App无法重新注册service/receiver.</string>
<string name="app_about">由twilightgod &amp; CC开发的<a href="http://forum.xda-developers.com/showthread.php?t=1574401"> Xposed </a>模块。\n您可访问<a href="http://forum.xda-developers.com/xposed/modules/mod-malware-buster-progress-t3035804">此帖</a>提问及建议。</string>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<string name="action_settings" translatable="false">Settings</string>
<string name="app_loading">Loading apps, please wait</string>
<string name="app_searchhint">name or package</string>
<string name="app_version">Version: %s</string>
<string name="app_about">An <a href="http://forum.xda-developers.com/showthread.php?t=1574401">Xposed</a> module by twilightgod &amp; CC.\nYou can use <a href="http://forum.xda-developers.com/xposed/modules/mod-malware-buster-progress-t3035804">this thread</a> for questions or suggestions.</string>
<string name="app_description">This is a Xposed module. It helps to prevent malwares to register service/receiver which were disabled in My Android Tools before.</string>
<string name="menu_about">About</string>
<string name="menu_refresh">Refresh</string>

<!-- Main screen -->

Expand Down

0 comments on commit d908417

Please sign in to comment.