Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
605 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#Android generated | ||
bin | ||
gen | ||
gen* | ||
|
||
#Eclipse | ||
.project | ||
.classpath | ||
.settings | ||
|
||
#IntelliJ IDEA | ||
.idea | ||
*.iml | ||
*.ipr | ||
*.iws | ||
out | ||
|
||
#Maven | ||
target | ||
release.properties | ||
pom.xml.* | ||
|
||
#Ant | ||
build.xml | ||
local.properties | ||
proguard.cfg | ||
|
||
#Gradle | ||
.gradle | ||
build | ||
gradle.properties | ||
gradle/ | ||
gradlew | ||
gradlew.bat | ||
|
||
#OSX | ||
.DS_Store | ||
|
||
#Personal Files | ||
signing. | ||
|
||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "24.0.2" | ||
defaultConfig { | ||
applicationId "cn.gavinliu.notificationbox" | ||
minSdkVersion 19 | ||
targetSdkVersion 24 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:24.2.1' | ||
compile 'com.android.support:design:24.2.1' | ||
testCompile 'junit:junit:4.12' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/Gavin/Develop/android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/cn/gavinliu/notificationbox/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cn.gavinliu.notificationbox; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("cn.gavinliu.notificationbox", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="cn.gavinliu.notificationbox"> | ||
|
||
<application | ||
android:name=".NotificationBoxApp" | ||
android:allowBackup="false" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="false" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".ui.main.MainActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service | ||
android:name=".service.NotificationListenerService" | ||
android:label="@string/service_name" | ||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> | ||
<intent-filter> | ||
<action android:name="android.service.notification.NotificationListenerService"/> | ||
</intent-filter> | ||
</service> | ||
|
||
</application> | ||
|
||
</manifest> |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/cn/gavinliu/notificationbox/NotificationBoxApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package cn.gavinliu.notificationbox; | ||
|
||
import android.app.Application; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class NotificationBoxApp extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/cn/gavinliu/notificationbox/model/AppInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cn.gavinliu.notificationbox.model; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class AppInfo { | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/cn/gavinliu/notificationbox/model/NotificationInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cn.gavinliu.notificationbox.model; | ||
|
||
import android.content.Intent; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class NotificationInfo { | ||
|
||
String packageName; | ||
|
||
String title; | ||
|
||
String text; | ||
|
||
long time; | ||
|
||
Intent mIntent; | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
app/src/main/java/cn/gavinliu/notificationbox/service/NotificationListenerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package cn.gavinliu.notificationbox.service; | ||
|
||
import android.app.Notification; | ||
import android.content.Intent; | ||
import android.os.IBinder; | ||
import android.service.notification.StatusBarNotification; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class NotificationListenerService extends android.service.notification.NotificationListenerService { | ||
|
||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return super.onBind(intent); | ||
} | ||
|
||
@Override | ||
public boolean onUnbind(Intent intent) { | ||
return super.onUnbind(intent); | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
} | ||
|
||
@Override | ||
public int onStartCommand(Intent intent, int flags, int startId) { | ||
return super.onStartCommand(intent, flags, startId); | ||
} | ||
|
||
@Override | ||
public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) { | ||
super.onNotificationPosted(sbn, rankingMap); | ||
} | ||
|
||
@Override | ||
public void onNotificationPosted(StatusBarNotification sbn) { | ||
super.onNotificationPosted(sbn); | ||
|
||
Notification notification = sbn.getNotification(); | ||
|
||
String title = notification.extras.getString(Notification.EXTRA_TITLE); | ||
String text = notification.extras.getString(Notification.EXTRA_TEXT); | ||
} | ||
|
||
@Override | ||
public void onNotificationRemoved(StatusBarNotification sbn) { | ||
super.onNotificationRemoved(sbn); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/cn/gavinliu/notificationbox/ui/BasePresenter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package cn.gavinliu.notificationbox.ui; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public interface BasePresenter { | ||
|
||
void start(); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/cn/gavinliu/notificationbox/ui/BaseView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package cn.gavinliu.notificationbox.ui; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public interface BaseView<T extends BasePresenter> { | ||
|
||
void setPresenter(T presenter); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/cn/gavinliu/notificationbox/ui/detail/DetailActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cn.gavinliu.notificationbox.ui.detail; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class DetailActivity { | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/cn/gavinliu/notificationbox/ui/detail/DetailFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cn.gavinliu.notificationbox.ui.detail; | ||
|
||
/** | ||
* Created by Gavin on 2016/10/11. | ||
*/ | ||
|
||
public class DetailFragment { | ||
} |
52 changes: 52 additions & 0 deletions
52
app/src/main/java/cn/gavinliu/notificationbox/ui/main/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cn.gavinliu.notificationbox.ui.main; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v4.content.res.ResourcesCompat; | ||
import android.support.v4.graphics.drawable.DrawableCompat; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
|
||
import cn.gavinliu.notificationbox.R; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
.setAction("Action", null).show(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.menu_main, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
int id = item.getItemId(); | ||
|
||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
|
||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
Oops, something went wrong.