diff --git a/NotificationHW/.gitignore b/NotificationHW/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/NotificationHW/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/NotificationHW/.idea/.name b/NotificationHW/.idea/.name new file mode 100644 index 0000000..5d878cc --- /dev/null +++ b/NotificationHW/.idea/.name @@ -0,0 +1 @@ +NotificationHW \ No newline at end of file diff --git a/NotificationHW/.idea/compiler.xml b/NotificationHW/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/NotificationHW/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/copyright/profiles_settings.xml b/NotificationHW/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/NotificationHW/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/NotificationHW/.idea/encodings.xml b/NotificationHW/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/NotificationHW/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/gradle.xml b/NotificationHW/.idea/gradle.xml new file mode 100644 index 0000000..8d2df47 --- /dev/null +++ b/NotificationHW/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/misc.xml b/NotificationHW/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/NotificationHW/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/modules.xml b/NotificationHW/.idea/modules.xml new file mode 100644 index 0000000..fc1a18d --- /dev/null +++ b/NotificationHW/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/runConfigurations.xml b/NotificationHW/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/NotificationHW/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/NotificationHW/.idea/vcs.xml b/NotificationHW/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/NotificationHW/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NotificationHW/app/.gitignore b/NotificationHW/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/NotificationHW/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/NotificationHW/app/build.gradle b/NotificationHW/app/build.gradle new file mode 100644 index 0000000..f691517 --- /dev/null +++ b/NotificationHW/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + applicationId "com.example.wasabi.notificationhw" + minSdkVersion 14 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.1.1' +} diff --git a/NotificationHW/app/proguard-rules.pro b/NotificationHW/app/proguard-rules.pro new file mode 100644 index 0000000..7fe377b --- /dev/null +++ b/NotificationHW/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Wasabi\AppData\Local\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 *; +#} diff --git a/NotificationHW/app/src/androidTest/java/com/example/wasabi/notificationhw/ApplicationTest.java b/NotificationHW/app/src/androidTest/java/com/example/wasabi/notificationhw/ApplicationTest.java new file mode 100644 index 0000000..678aa15 --- /dev/null +++ b/NotificationHW/app/src/androidTest/java/com/example/wasabi/notificationhw/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.wasabi.notificationhw; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/NotificationHW/app/src/main/AndroidManifest.xml b/NotificationHW/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b26ccb9 --- /dev/null +++ b/NotificationHW/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + diff --git a/NotificationHW/app/src/main/ic_pikachu-web.png b/NotificationHW/app/src/main/ic_pikachu-web.png new file mode 100644 index 0000000..8960f7e Binary files /dev/null and b/NotificationHW/app/src/main/ic_pikachu-web.png differ diff --git a/NotificationHW/app/src/main/ic_profile-web.png b/NotificationHW/app/src/main/ic_profile-web.png new file mode 100644 index 0000000..8960f7e Binary files /dev/null and b/NotificationHW/app/src/main/ic_profile-web.png differ diff --git a/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/ClaireActivity.java b/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/ClaireActivity.java new file mode 100644 index 0000000..f625e99 --- /dev/null +++ b/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/ClaireActivity.java @@ -0,0 +1,162 @@ +package com.example.wasabi.notificationhw; + +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Intent; +import android.support.v4.app.NotificationCompat; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.StyleSpan; +import android.view.View; +import android.widget.Button; +import android.widget.RemoteViews; +import android.widget.TextView; + +public class ClaireActivity extends AppCompatActivity { + + public static int INBOX_NOTIFICATION_ID = 100; + public static int BIGTEXT_NOTIFICATION_ID = 200; + public static int ACTION_NOTIFICATION_ID = 300; + public static int BONUS_NOTIFICATION_ID = 400; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_claire); + + Button inboxButton = (Button)findViewById(R.id.inbox_button); + Button bigTextButton = (Button)findViewById(R.id.bigtext_button); + Button actionButton = (Button)findViewById(R.id.action_button); + Button bonusButton = (Button)findViewById(R.id.bonus_button); + Button nextButton = (Button)findViewById(R.id.next_button); + + nextButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(ClaireActivity.this, WillActivity.class)); + } + }); + + inboxButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builder = new NotificationCompat.Builder(ClaireActivity.this); + builder.setStyle(new NotificationCompat.InboxStyle().setBigContentTitle("5 new messages") + .addLine("Cheeta: Bananas on sale") + .addLine("George: Curious about your blog post") + .addLine("Nikko: Need a ride to Evolve?") + .setSummaryText("+2 more")); + builder.setSmallIcon(android.R.drawable.ic_dialog_info); + builder.setContentTitle("5 new messages"); + builder.setContentText("Scroll down to read"); + Intent intent = new Intent(ClaireActivity.this,ClaireActivity.class); + PendingIntent pIntent = PendingIntent.getActivity(ClaireActivity.this, (int)System.currentTimeMillis(), intent, 0); + builder.setContentIntent(pIntent); + builder.setAutoCancel(true); + + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(INBOX_NOTIFICATION_ID,builder.build()); + } + }); + + bigTextButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builder = new NotificationCompat.Builder(ClaireActivity.this); + builder.setStyle(new NotificationCompat.BigTextStyle().setBigContentTitle("94833") + .bigText("Breaking News: Your Seamless order is being prepared. Our crystal ball estimates your delivery time between 1:30 PM and 1:40 PM.")); + builder.setSmallIcon(android.R.drawable.ic_menu_camera); + builder.setContentTitle("94833"); + builder.setContentText("New story is delivered."); + Intent intent = new Intent(ClaireActivity.this,ClaireActivity.class); + PendingIntent pIntent = PendingIntent.getActivity(ClaireActivity.this, (int)System.currentTimeMillis(), intent, 0); + builder.addAction(android.R.drawable.ic_menu_send, "REPLY", pIntent); + builder.setAutoCancel(true); + + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(INBOX_NOTIFICATION_ID,builder.build()); + } + }); + + bigTextButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builder = new NotificationCompat.Builder(ClaireActivity.this); + builder.setStyle(new NotificationCompat.BigTextStyle().setBigContentTitle("94833") + .bigText("Breaking News: Your Seamless order is being prepared. Our crystal ball estimates your delivery time between 1:30 PM and 1:40 PM.")); + builder.setSmallIcon(android.R.drawable.ic_menu_camera); + builder.setContentTitle("94833"); + builder.setContentText("New story is delivered."); + Intent intent = new Intent(ClaireActivity.this,ClaireActivity.class); + PendingIntent pIntent = PendingIntent.getActivity(ClaireActivity.this, (int)System.currentTimeMillis(), intent, 0); + builder.addAction(android.R.drawable.ic_menu_send,"REPLY",pIntent); + builder.setAutoCancel(true); + + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(BIGTEXT_NOTIFICATION_ID,builder.build()); + } + }); + + actionButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builder = new NotificationCompat.Builder(ClaireActivity.this); + + Spannable sb = new SpannableString("Dinner tonight?"); + sb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + + builder.setSmallIcon(android.R.drawable.ic_menu_call); + builder.setContentTitle("Michael"); + builder.setContentText("Message from Michael"); + builder.setStyle(new NotificationCompat.InboxStyle().setBigContentTitle("Michael") + .addLine(sb) + .addLine("Let's grab some dinner. Are your free?") + .setSummaryText("alex.faa.borg@android.com")); + + Intent intent = new Intent(ClaireActivity.this,ClaireActivity.class); + PendingIntent pIntent = PendingIntent.getActivity(ClaireActivity.this, (int)System.currentTimeMillis(), intent, 0); + builder.addAction(android.R.drawable.ic_menu_upload,"ARCHIVE",pIntent); + builder.addAction(android.R.drawable.ic_menu_send,"REPLY",pIntent); + builder.setAutoCancel(true); + + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(ACTION_NOTIFICATION_ID,builder.build()); + } + }); + + bonusButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builder = new NotificationCompat.Builder(ClaireActivity.this); + + Spannable sb = new SpannableString("Dinner tonight?"); + sb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + + RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification); + contentView.setImageViewResource(R.id.album_art, R.drawable.profile); + contentView.setTextViewText(R.id.title_tv, "Midnight City"); + contentView.setTextViewText(R.id.artist_tv, "M83 - Hurry Up, We're Dreaming"); + + + builder.setSmallIcon(android.R.drawable.ic_media_play); + builder.setContentTitle("Midnight City"); + builder.setContentText("M83"); + + builder.addAction(android.R.drawable.ic_media_pause, null, null); + builder.addAction(android.R.drawable.ic_media_play,null,null); + builder.addAction(android.R.drawable.ic_menu_close_clear_cancel,null,null); + builder.setContent(contentView); + + Intent intent = new Intent(ClaireActivity.this,ClaireActivity.class); + PendingIntent pIntent = PendingIntent.getActivity(ClaireActivity.this, (int)System.currentTimeMillis(), intent, 0); + builder.setContentIntent(pIntent); + builder.setAutoCancel(true); + + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(BONUS_NOTIFICATION_ID,builder.build()); + } + }); + } +} diff --git a/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/WillActivity.java b/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/WillActivity.java new file mode 100644 index 0000000..953ef60 --- /dev/null +++ b/NotificationHW/app/src/main/java/com/example/wasabi/notificationhw/WillActivity.java @@ -0,0 +1,102 @@ +package com.example.wasabi.notificationhw; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Intent; +import android.graphics.BitmapFactory; +import android.support.v4.app.NotificationCompat; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class WillActivity extends AppCompatActivity { + + Button mClearButton; + Button mScreenshotButton; + Button mChatButton; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_will); + + //CLEAR NOTIFICATIONS + mClearButton = (Button)findViewById(R.id.buttonClearNotifications); + mClearButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + NotificationCompat.Builder builderClear = new NotificationCompat.Builder(WillActivity.this); + builderClear.setSmallIcon(android.R.drawable.ic_menu_info_details); + builderClear.setContentTitle("Clear Notifications"); + builderClear.setContentText(""); + + Intent intent = new Intent(WillActivity.this, WillActivity.class); + PendingIntent pendingIntent = PendingIntent.getActivity(WillActivity.this, (int)System.currentTimeMillis(),intent,0); + builderClear.setContentIntent(pendingIntent); + + Notification notification = builderClear.build(); + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(1, notification); + + } + }); + + //SCREENSHOT NOTIFICATION + + + mScreenshotButton = (Button)findViewById(R.id.screenshotButton); + mScreenshotButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + NotificationCompat.Builder builderScreenshot = new NotificationCompat.Builder(WillActivity.this); + builderScreenshot.setSmallIcon(android.R.drawable.ic_menu_gallery); + builderScreenshot.setContentTitle("Screenshot captured."); + builderScreenshot.setContentText(""); + + NotificationCompat.BigPictureStyle picHere = new NotificationCompat.BigPictureStyle(); + picHere.bigPicture(BitmapFactory.decodeResource(getResources(), R.drawable.pic)).build(); + builderScreenshot.setStyle(picHere); + + builderScreenshot.addAction(android.R.drawable.ic_menu_share, "Share", null); + builderScreenshot.addAction(android.R.drawable.ic_menu_delete, "Delete", null); + Notification notification2 = builderScreenshot.build(); + NotificationManager notificationManager2 = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + notificationManager2.notify(2,notification2); + + } + }); + + //CHAT NOTIFICATION + + mChatButton = (Button)findViewById(R.id.chatButton); + mChatButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NotificationCompat.Builder builderScreenshot = new NotificationCompat.Builder(WillActivity.this); + + builderScreenshot.setSmallIcon(android.R.drawable.picture_frame); + builderScreenshot.setContentTitle("Greg Miller"); + builderScreenshot.setContentText("Message delivered"); + + NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); + bigTextStyle.setBigContentTitle("Greg Miller"); + bigTextStyle.bigText("Liked: Tim: \"It's cool that the @BatmanvSuperman movie cast the guy from Gigli.\n@GameOverGreggy.\"..Are you srsly making a joke right now, Tim?"); + builderScreenshot.setStyle(bigTextStyle); + + Notification notification = builderScreenshot.build(); + NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify(3,notification); + + } + }); + + + + } + + +} diff --git a/NotificationHW/app/src/main/res/drawable/pic.jpg b/NotificationHW/app/src/main/res/drawable/pic.jpg new file mode 100644 index 0000000..82b84ee Binary files /dev/null and b/NotificationHW/app/src/main/res/drawable/pic.jpg differ diff --git a/NotificationHW/app/src/main/res/drawable/profile.jpg b/NotificationHW/app/src/main/res/drawable/profile.jpg new file mode 100644 index 0000000..acb7d3c Binary files /dev/null and b/NotificationHW/app/src/main/res/drawable/profile.jpg differ diff --git a/NotificationHW/app/src/main/res/layout/activity_claire.xml b/NotificationHW/app/src/main/res/layout/activity_claire.xml new file mode 100644 index 0000000..266633c --- /dev/null +++ b/NotificationHW/app/src/main/res/layout/activity_claire.xml @@ -0,0 +1,50 @@ + + + +