Skip to content

Commit dff1d37

Browse files
committed
ver 1.0
0 parents  commit dff1d37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1500
-0
lines changed

app/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
signingConfigs {
5+
release {
6+
signingConfigs {
7+
release {
8+
storeFile file(RELEASE_STORE_FILE)
9+
storePassword RELEASE_STORE_PASSWORD
10+
keyAlias RELEASE_KEY_ALIAS
11+
keyPassword RELEASE_KEY_PASSWORD
12+
}
13+
}
14+
}
15+
}
16+
compileSdkVersion 21
17+
buildToolsVersion "21.1.2"
18+
defaultConfig {
19+
applicationId "com.ghostflying.nfmxposed"
20+
minSdkVersion 21
21+
targetSdkVersion 21
22+
versionCode 1
23+
versionName "1.0"
24+
}
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29+
signingConfig signingConfigs.release
30+
}
31+
}
32+
}
33+
34+
dependencies {
35+
provided fileTree(include: ['*.jar'], dir: 'libs')
36+
compile 'com.jakewharton:butterknife:6.1.0'
37+
compile 'com.android.support:recyclerview-v7:21.0.+'
38+
compile 'com.android.support:support-v13:21.0.0+'
39+
}

app/libs/XposedBridgeApi.jar

135 KB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /home/ghostflying/android-sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.ghostflying.nfmxposed" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<meta-data
11+
android:name="xposedmodule"
12+
android:value="true" />
13+
<meta-data
14+
android:name="xposedminversion"
15+
android:value="61" />
16+
<meta-data
17+
android:name="xposeddescription"
18+
android:value="Manage priority and visibility of all notifications" />
19+
20+
<activity
21+
android:name=".ui.MainActivity"
22+
android:label="@string/app_name" >
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
</activity>
29+
<activity
30+
android:name=".ui.HelpActivity"
31+
android:label="@string/title_activity_help"
32+
android:parentActivityName=".ui.MainActivity" >
33+
<meta-data
34+
android:name="android.support.PARENT_ACTIVITY"
35+
android:value="com.ghostflying.nfmxposed.ui.MainActivity" />
36+
</activity>
37+
</application>
38+
39+
</manifest>

app/src/main/assets/xposed_init

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.ghostflying.nfmxposed.XposedMain
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.ghostflying.nfmxposed;
2+
3+
import android.app.Notification;
4+
5+
import com.ghostflying.nfmxposed.util.PreferencesUtil;
6+
7+
import de.robv.android.xposed.IXposedHookLoadPackage;
8+
import de.robv.android.xposed.XC_MethodHook;
9+
import de.robv.android.xposed.XSharedPreferences;
10+
import de.robv.android.xposed.XposedBridge;
11+
import de.robv.android.xposed.callbacks.XC_LoadPackage;
12+
13+
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
14+
/**
15+
* Created by ghostflying on 2/16/15.
16+
*/
17+
public class XposedMain implements IXposedHookLoadPackage{
18+
@Override
19+
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
20+
XSharedPreferences pre = new XSharedPreferences(BuildConfig.APPLICATION_ID, PreferencesUtil.PREFERENCES_NAME);
21+
22+
String priorityPreName = loadPackageParam.packageName + PreferencesUtil.PRIORITY_PREFERENCES_POSTFIX;
23+
String visibilityPreName = loadPackageParam.packageName + PreferencesUtil.VISIBILITY_PREFERENCES_POSTFIX;
24+
25+
if (pre.contains(priorityPreName) || pre.contains(visibilityPreName)){
26+
final int setPriority = pre.getInt(priorityPreName, Notification.PRIORITY_DEFAULT);
27+
final int setVisibility = pre.getInt(visibilityPreName, Notification.VISIBILITY_PRIVATE);
28+
try{
29+
findAndHookMethod("android.app.NotificationManager", loadPackageParam.classLoader, "notify", String.class, int.class, Notification.class , new XC_MethodHook() {
30+
@Override
31+
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
32+
super.beforeHookedMethod(param);
33+
((Notification)param.args[2]).priority = setPriority;
34+
((Notification)param.args[2]).visibility = setVisibility;
35+
}
36+
});
37+
}
38+
catch (Throwable t){
39+
XposedBridge.log(t);
40+
}
41+
}
42+
}
43+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package com.ghostflying.nfmxposed.adapter;
2+
3+
import android.support.v7.widget.RecyclerView;
4+
import android.view.LayoutInflater;
5+
import android.view.View;
6+
import android.view.ViewGroup;
7+
import android.widget.ImageView;
8+
import android.widget.TextView;
9+
10+
import com.ghostflying.nfmxposed.R;
11+
import com.ghostflying.nfmxposed.model.AppInfo;
12+
13+
import java.util.ArrayList;
14+
import java.util.List;
15+
16+
import butterknife.ButterKnife;
17+
import butterknife.InjectView;
18+
19+
/**
20+
* Created by ghostflying on 2/19/15.
21+
*/
22+
public abstract class BaseAppListAdapter extends RecyclerView.Adapter<BaseAppListAdapter.ViewHolder> {
23+
private List<AppInfo> mDataSet;
24+
private View.OnClickListener mItemClickListener;
25+
26+
protected int mModifiedTextColor;
27+
protected int mUnmodifiedTextColor;
28+
29+
public BaseAppListAdapter(View.OnClickListener itemClickListener, int modifiedTextColor, int unmodifiedTextColor){
30+
mDataSet = new ArrayList<>();
31+
mItemClickListener = itemClickListener;
32+
mModifiedTextColor = modifiedTextColor;
33+
mUnmodifiedTextColor = unmodifiedTextColor;
34+
}
35+
36+
public void addData(List<AppInfo> appInfos){
37+
mDataSet.addAll(appInfos);
38+
}
39+
40+
public AppInfo getDataItem(int position){
41+
return mDataSet.get(position);
42+
}
43+
44+
@Override
45+
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
46+
View v = LayoutInflater.from(parent.getContext())
47+
.inflate(R.layout.app_item, parent, false);
48+
v.setOnClickListener(mItemClickListener);
49+
return new ViewHolder(v);
50+
}
51+
52+
@Override
53+
public void onBindViewHolder(ViewHolder holder, int position) {
54+
holder.mIcon.setImageDrawable(mDataSet.get(position).getIcon());
55+
holder.mAppName.setText(mDataSet.get(position).getAppName());
56+
setStatusText(mDataSet.get(position), holder.mStatus);
57+
}
58+
59+
protected abstract void setStatusText(AppInfo info, TextView status);
60+
61+
@Override
62+
public int getItemCount() {
63+
return mDataSet.size();
64+
}
65+
66+
public class ViewHolder extends RecyclerView.ViewHolder{
67+
@InjectView(R.id.app_icon)
68+
ImageView mIcon;
69+
@InjectView(R.id.app_name)
70+
TextView mAppName;
71+
@InjectView(R.id.app_status)
72+
TextView mStatus;
73+
74+
public ViewHolder(View itemView) {
75+
super(itemView);
76+
ButterKnife.inject(this, itemView);
77+
}
78+
}
79+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.ghostflying.nfmxposed.adapter;
2+
3+
import android.app.Notification;
4+
import android.view.View;
5+
import android.widget.TextView;
6+
7+
import com.ghostflying.nfmxposed.R;
8+
import com.ghostflying.nfmxposed.model.AppInfo;
9+
10+
/**
11+
* Created by ghostflying on 2/20/15.
12+
*/
13+
public class PriorityAdapter extends BaseAppListAdapter {
14+
15+
public PriorityAdapter(View.OnClickListener itemClickListener, int modifiedTextColor, int unmodifiedTextColor){
16+
super(itemClickListener, modifiedTextColor, unmodifiedTextColor);
17+
}
18+
19+
@Override
20+
protected void setStatusText(AppInfo info, TextView status) {
21+
switch (info.getPriority()){
22+
case Notification.PRIORITY_DEFAULT:
23+
status.setText(R.string.status_priority_default);
24+
status.setTextColor(mModifiedTextColor);
25+
break;
26+
case Notification.PRIORITY_HIGH:
27+
status.setText(R.string.status_priority_high);
28+
status.setTextColor(mModifiedTextColor);
29+
break;
30+
case Notification.PRIORITY_LOW:
31+
status.setText(R.string.status_priority_low);
32+
status.setTextColor(mModifiedTextColor);
33+
break;
34+
case Notification.PRIORITY_MAX:
35+
status.setText(R.string.status_priority_max);
36+
status.setTextColor(mModifiedTextColor);
37+
break;
38+
case Notification.PRIORITY_MIN:
39+
status.setText(R.string.status_priority_min);
40+
status.setTextColor(mModifiedTextColor);
41+
break;
42+
default:
43+
status.setText(R.string.status_not_modified);
44+
status.setTextColor(mUnmodifiedTextColor);
45+
}
46+
}
47+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.ghostflying.nfmxposed.adapter;
2+
3+
import android.app.Notification;
4+
import android.view.View;
5+
import android.widget.TextView;
6+
7+
import com.ghostflying.nfmxposed.R;
8+
import com.ghostflying.nfmxposed.model.AppInfo;
9+
10+
/**
11+
* Created by ghostflying on 2/20/15.
12+
*/
13+
public class VisibilityAdapter extends BaseAppListAdapter {
14+
15+
public VisibilityAdapter(View.OnClickListener itemOnClickListener, int modifiedTextColor, int unmodifiedTextColor){
16+
super(itemOnClickListener, modifiedTextColor, unmodifiedTextColor);
17+
}
18+
19+
@Override
20+
protected void setStatusText(AppInfo info, TextView status) {
21+
switch (info.getVisibility()){
22+
case Notification.VISIBILITY_PRIVATE:
23+
status.setText(R.string.status_visibility_private);
24+
status.setTextColor(mModifiedTextColor);
25+
break;
26+
case Notification.VISIBILITY_PUBLIC:
27+
status.setText(R.string.status_visibility_public);
28+
status.setTextColor(mModifiedTextColor);
29+
break;
30+
case Notification.VISIBILITY_SECRET:
31+
status.setText(R.string.status_visibility_secret);
32+
status.setTextColor(mModifiedTextColor);
33+
break;
34+
default:
35+
status.setText(R.string.status_not_modified);
36+
status.setTextColor(mUnmodifiedTextColor);
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)