diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ba8e973 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/NotificationProviderModule/.gitignore b/NotificationProviderModule/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/NotificationProviderModule/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/NotificationProviderModule/build.gradle b/NotificationProviderModule/build.gradle new file mode 100644 index 0000000..2091961 --- /dev/null +++ b/NotificationProviderModule/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.1" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + +} \ No newline at end of file diff --git a/NotificationProviderModule/consumer-rules.pro b/NotificationProviderModule/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/NotificationProviderModule/proguard-rules.pro b/NotificationProviderModule/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/NotificationProviderModule/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/NotificationProviderModule/src/androidTest/java/com/jstechnologies/notificationprovidermodule/ExampleInstrumentedTest.java b/NotificationProviderModule/src/androidTest/java/com/jstechnologies/notificationprovidermodule/ExampleInstrumentedTest.java new file mode 100644 index 0000000..d71dcb9 --- /dev/null +++ b/NotificationProviderModule/src/androidTest/java/com/jstechnologies/notificationprovidermodule/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.jstechnologies.notificationprovidermodule; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.jstechnologies.notificationprovidermodule.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/NotificationProviderModule/src/main/AndroidManifest.xml b/NotificationProviderModule/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8799579 --- /dev/null +++ b/NotificationProviderModule/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + / + \ No newline at end of file diff --git a/NotificationProviderModule/src/main/ic_launcher-playstore.png b/NotificationProviderModule/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..c0f3398 Binary files /dev/null and b/NotificationProviderModule/src/main/ic_launcher-playstore.png differ diff --git a/NotificationProviderModule/src/main/image-playstore.png b/NotificationProviderModule/src/main/image-playstore.png new file mode 100644 index 0000000..c0f3398 Binary files /dev/null and b/NotificationProviderModule/src/main/image-playstore.png differ diff --git a/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/ExpandedNotificationProvider.java b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/ExpandedNotificationProvider.java new file mode 100644 index 0000000..855bc7d --- /dev/null +++ b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/ExpandedNotificationProvider.java @@ -0,0 +1,157 @@ +package com.jstechnologies.notificationprovidermodule; + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.app.TaskStackBuilder; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; + +import androidx.core.app.NotificationCompat; + +import java.util.ArrayList; +import java.util.List; + +public class ExpandedNotificationProvider { + + public enum ExpandedNotificationType{ + BIG_PICTURE, + BIG_TEXT, + MESSAGE, + INBOX + } + String channelName="Notification_provider"; + String channelID="Notification_provider"; + int notificationIcon=R.drawable.ic_notification; + Context context; + String title,body; + Intent intent; + Bitmap image; + boolean autocancel=false; + int notificationId=101; + List actions=new ArrayList<>(); + ExpandedNotificationType type=ExpandedNotificationType.BIG_TEXT; + String bigText; + Listmessages= new ArrayList<>(); + ListinboxLines= new ArrayList<>(); + Bitmap largeIcon; + String replyname="user"; + + public ExpandedNotificationProvider(Context context, ExpandedNotificationType type) { + this.context = context; + this.type = type; + } + + public ExpandedNotificationProvider setChannelName(String channelName) { + this.channelName = channelName; + return this; + } + + public ExpandedNotificationProvider setImage(Bitmap image) { + this.image = image; + return this; + } + + public ExpandedNotificationProvider setLargeIcon(Bitmap largeIcon) { + this.largeIcon = largeIcon; + return this; + } + + public ExpandedNotificationProvider setChannelID(String channelID) { + this.channelID = channelID; + return this; + } + public ExpandedNotificationProvider addActionButton(NotificationCompat.Action action) { + this.actions.add(action); + return this; + } + + public ExpandedNotificationProvider setBigText(String bigText) { + this.bigText = bigText; + return this; + } + + public void setReplyname(String replyname) { + this.replyname = replyname; + } + + public ExpandedNotificationProvider addMessages(NotificationCompat.MessagingStyle.Message msg) { + this.messages.add(msg); + return this; + } + public ExpandedNotificationProvider addLines(String line) { + this.inboxLines.add(line); + return this; + } + + public ExpandedNotificationProvider setNotificationIcon(int notificationIcon) { + this.notificationIcon = notificationIcon; + return this; + } + + public ExpandedNotificationProvider setTitle(String title) { + this.title = title; + return this; + } + + public ExpandedNotificationProvider setBody(String body) { + this.body = body; + return this; + } + + public ExpandedNotificationProvider setIntent(Intent intent) { + this.intent = intent; + return this; + } + + public ExpandedNotificationProvider setAutocancel(boolean autocancel) { + this.autocancel = autocancel; + return this; + } + public void show() + { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + int importance = NotificationManager.IMPORTANCE_HIGH; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + NotificationChannel mChannel = new NotificationChannel( + channelID, channelName, importance); + notificationManager.createNotificationChannel(mChannel); + } + + NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelID) + .setSmallIcon(notificationIcon) + .setContentTitle(title) + .setContentText(body) + .setLargeIcon(largeIcon); + + switch (type) + { + case BIG_PICTURE: mBuilder.setStyle(new NotificationCompat.BigPictureStyle() + .bigPicture(image) + .bigLargeIcon(null));break; + case BIG_TEXT:mBuilder.setStyle(new NotificationCompat.BigTextStyle() + .bigText(bigText));break; + case INBOX: NotificationCompat.InboxStyle obj=new NotificationCompat.InboxStyle(); + for(String line:inboxLines) + { + obj.addLine(line); + } + mBuilder.setStyle(obj); + break; + case MESSAGE:NotificationCompat.MessagingStyle obj1=new NotificationCompat.MessagingStyle(replyname); + for(NotificationCompat.MessagingStyle.Message line:messages) + { + obj1.addMessage(line); + } + mBuilder.setStyle(obj1); + break; + } + if(actions!=null && actions.size()>0) + for(NotificationCompat.Action action:actions) + mBuilder.addAction(action); + + notificationManager.notify(NotificationIDManager.getnotificationID(), mBuilder.build()); + } +} diff --git a/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationIDManager.java b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationIDManager.java new file mode 100644 index 0000000..311c321 --- /dev/null +++ b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationIDManager.java @@ -0,0 +1,10 @@ +package com.jstechnologies.notificationprovidermodule; + +public class NotificationIDManager { + + static int lastId=100; + public static int getnotificationID() + { + return lastId++; + } +} diff --git a/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationProvider.java b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationProvider.java new file mode 100644 index 0000000..1232221 --- /dev/null +++ b/NotificationProviderModule/src/main/java/com/jstechnologies/notificationprovidermodule/NotificationProvider.java @@ -0,0 +1,101 @@ +package com.jstechnologies.notificationprovidermodule; + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.app.TaskStackBuilder; +import android.content.Context; +import android.content.Intent; + +import androidx.core.app.NotificationCompat; + +import java.util.ArrayList; +import java.util.List; + +public class NotificationProvider { + + String channelName="Notification_provider"; + String channelID="Notification_provider"; + int notificationIcon=R.drawable.ic_notification; + Context context; + String title,body; + Intent intent; + boolean autocancel=false; + Listactions=new ArrayList<>(); + + public NotificationProvider(Context context) { + this.context = context; + + } + + public NotificationProvider setChannelName(String channelName) { + this.channelName = channelName; + return this; + } + + public NotificationProvider setChannelID(String channelID) { + this.channelID = channelID; + return this; + } + + public NotificationProvider setAutocancel(boolean autocancel) { + this.autocancel = autocancel; + return this; + } + public NotificationProvider addActionButton(NotificationCompat.Action action) { + this.actions.add(action); + return this; + } + public NotificationProvider setNotificationIcon(int notificationIcon) { + this.notificationIcon = notificationIcon; + return this; + } + + public NotificationProvider setTitle(String title) { + this.title = title; + return this; + } + + public NotificationProvider setBody(String body) { + this.body = body; + return this; + } + + public NotificationProvider setIntent(Intent intent) { + this.intent = intent; + return this; + } + public void show() + { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + int importance = NotificationManager.IMPORTANCE_HIGH; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + NotificationChannel mChannel = new NotificationChannel( + channelID, channelName, importance); + notificationManager.createNotificationChannel(mChannel); + } + + NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelID) + .setSmallIcon(notificationIcon) + .setContentTitle(title) + .setContentText(body) + .setAutoCancel(autocancel); + if(actions!=null && actions.size()>0) + for(NotificationCompat.Action action:actions) + mBuilder.addAction(action); + if(intent!=null) + { + TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); + stackBuilder.addNextIntent(intent); + PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( + 0, + PendingIntent.FLAG_UPDATE_CURRENT + ); + mBuilder.setContentIntent(resultPendingIntent); + } + + + notificationManager.notify(NotificationIDManager.getnotificationID(), mBuilder.build()); + } +} diff --git a/NotificationProviderModule/src/main/res/drawable/ic_launcher_background.xml b/NotificationProviderModule/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..ca3826a --- /dev/null +++ b/NotificationProviderModule/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NotificationProviderModule/src/main/res/drawable/ic_notification.xml b/NotificationProviderModule/src/main/res/drawable/ic_notification.xml new file mode 100644 index 0000000..21cb88d --- /dev/null +++ b/NotificationProviderModule/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,10 @@ + + + diff --git a/NotificationProviderModule/src/main/res/drawable/image_background.xml b/NotificationProviderModule/src/main/res/drawable/image_background.xml new file mode 100644 index 0000000..ca3826a --- /dev/null +++ b/NotificationProviderModule/src/main/res/drawable/image_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NotificationProviderModule/src/main/res/drawable/user5.jpg b/NotificationProviderModule/src/main/res/drawable/user5.jpg new file mode 100644 index 0000000..963b033 Binary files /dev/null and b/NotificationProviderModule/src/main/res/drawable/user5.jpg differ diff --git a/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..c4a603d --- /dev/null +++ b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..c4a603d --- /dev/null +++ b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image.xml b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image.xml new file mode 100644 index 0000000..e2c1bbb --- /dev/null +++ b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image_round.xml b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image_round.xml new file mode 100644 index 0000000..e2c1bbb --- /dev/null +++ b/NotificationProviderModule/src/main/res/mipmap-anydpi-v26/image_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cdb226b Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..997b1b0 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_round.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..20ee12c Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/image.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/image.png new file mode 100644 index 0000000..cdb226b Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/image.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/image_foreground.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/image_foreground.png new file mode 100644 index 0000000..997b1b0 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/image_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-hdpi/image_round.png b/NotificationProviderModule/src/main/res/mipmap-hdpi/image_round.png new file mode 100644 index 0000000..20ee12c Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-hdpi/image_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..3c790f4 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..9026d66 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_round.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..a1d80f7 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/image.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/image.png new file mode 100644 index 0000000..3c790f4 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/image.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/image_foreground.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/image_foreground.png new file mode 100644 index 0000000..9026d66 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/image_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-mdpi/image_round.png b/NotificationProviderModule/src/main/res/mipmap-mdpi/image_round.png new file mode 100644 index 0000000..a1d80f7 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-mdpi/image_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..ae3d55e Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..8b2a97b Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..930f4ac Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/image.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image.png new file mode 100644 index 0000000..ae3d55e Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_foreground.png new file mode 100644 index 0000000..8b2a97b Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_round.png b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_round.png new file mode 100644 index 0000000..930f4ac Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xhdpi/image_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..ce98b2e Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..11193d6 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..d230bec Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image.png new file mode 100644 index 0000000..ce98b2e Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_foreground.png new file mode 100644 index 0000000..11193d6 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_round.png b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_round.png new file mode 100644 index 0000000..d230bec Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxhdpi/image_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..6cd3c2f Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..206a166 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..446b89f Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image.png new file mode 100644 index 0000000..6cd3c2f Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_foreground.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_foreground.png new file mode 100644 index 0000000..206a166 Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_foreground.png differ diff --git a/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_round.png b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_round.png new file mode 100644 index 0000000..446b89f Binary files /dev/null and b/NotificationProviderModule/src/main/res/mipmap-xxxhdpi/image_round.png differ diff --git a/NotificationProviderModule/src/test/java/com/jstechnologies/notificationprovidermodule/ExampleUnitTest.java b/NotificationProviderModule/src/test/java/com/jstechnologies/notificationprovidermodule/ExampleUnitTest.java new file mode 100644 index 0000000..7661913 --- /dev/null +++ b/NotificationProviderModule/src/test/java/com/jstechnologies/notificationprovidermodule/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.jstechnologies.notificationprovidermodule; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/NotiificationProvider/.gitignore b/app/NotiificationProvider/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/NotiificationProvider/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/NotiificationProvider/build.gradle b/app/NotiificationProvider/build.gradle new file mode 100644 index 0000000..2091961 --- /dev/null +++ b/app/NotiificationProvider/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.1" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + +} \ No newline at end of file diff --git a/app/NotiificationProvider/consumer-rules.pro b/app/NotiificationProvider/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/app/NotiificationProvider/proguard-rules.pro b/app/NotiificationProvider/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/NotiificationProvider/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/NotiificationProvider/src/androidTest/java/com/jstechnologies/notiificationprovider/ExampleInstrumentedTest.java b/app/NotiificationProvider/src/androidTest/java/com/jstechnologies/notiificationprovider/ExampleInstrumentedTest.java new file mode 100644 index 0000000..f3c85e5 --- /dev/null +++ b/app/NotiificationProvider/src/androidTest/java/com/jstechnologies/notiificationprovider/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.jstechnologies.notiificationprovider; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.jstechnologies.notiificationprovider.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/NotiificationProvider/src/main/AndroidManifest.xml b/app/NotiificationProvider/src/main/AndroidManifest.xml new file mode 100644 index 0000000..40a57d4 --- /dev/null +++ b/app/NotiificationProvider/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + / + \ No newline at end of file diff --git a/app/NotiificationProvider/src/test/java/com/jstechnologies/notiificationprovider/ExampleUnitTest.java b/app/NotiificationProvider/src/test/java/com/jstechnologies/notiificationprovider/ExampleUnitTest.java new file mode 100644 index 0000000..90503a5 --- /dev/null +++ b/app/NotiificationProvider/src/test/java/com/jstechnologies/notiificationprovider/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.jstechnologies.notiificationprovider; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..b35d456 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.1" + + defaultConfig { + applicationId "com.jstechnologies.notificationprovider" + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation project(":NotificationProviderModule") + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/jstechnologies/notificationprovider/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/jstechnologies/notificationprovider/ExampleInstrumentedTest.java new file mode 100644 index 0000000..8091fcd --- /dev/null +++ b/app/src/androidTest/java/com/jstechnologies/notificationprovider/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.jstechnologies.notificationprovider; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.jstechnologies.notificationprovider", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..43f043e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/jstechnologies/notificationprovider/MainActivity.java b/app/src/main/java/com/jstechnologies/notificationprovider/MainActivity.java new file mode 100644 index 0000000..e18b4f5 --- /dev/null +++ b/app/src/main/java/com/jstechnologies/notificationprovider/MainActivity.java @@ -0,0 +1,60 @@ +package com.jstechnologies.notificationprovider; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.NotificationCompat; + +import android.app.Notification; +import android.app.PendingIntent; +import android.app.TaskStackBuilder; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.view.View; + +import com.jstechnologies.notificationprovidermodule.ExpandedNotificationProvider; +import com.jstechnologies.notificationprovidermodule.NotificationProvider; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + } + + public void show(View view) { + + Bitmap img=BitmapFactory.decodeResource(getResources(),R.drawable.user5); + TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); + stackBuilder.addNextIntent(getIntent()); + PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( + 0, + PendingIntent.FLAG_UPDATE_CURRENT); + new ExpandedNotificationProvider(this, ExpandedNotificationProvider.ExpandedNotificationType.INBOX). + setTitle("This is a notification"). + setNotificationIcon(R.mipmap.ic_launcher). + setIntent(this.getIntent()). + setAutocancel(false). + addMessages(new NotificationCompat.MessagingStyle.Message("Hello",System.currentTimeMillis(),"Jerin")). + addMessages(new NotificationCompat.MessagingStyle.Message("Hi there",System.currentTimeMillis(),"Sundar")). + addMessages(new NotificationCompat.MessagingStyle.Message("How are you?",System.currentTimeMillis(),"Jerin")). + addMessages(new NotificationCompat.MessagingStyle.Message("I am fine bro. wbu?",System.currentTimeMillis(),"Sundar")). + addMessages(new NotificationCompat.MessagingStyle.Message("U know me.. I am fine too",System.currentTimeMillis(),"Jerin")). + setBigText("Apply NotificationCompat.InboxStyle to a notification if you want to add multiple short summary lines, " + + "such as snippets from incoming emails. This allows you to add multiple pieces of content text that are " + + "each truncated to one line, instead of one continuous line of text provided by NotificationCompat.BigTextStyle."). + addLines("This is a line"). + addLines("This is a line"). + addLines("This is a line"). + addLines("This is a line"). + addLines("This is a line"). + addActionButton(new NotificationCompat.Action(R.drawable.ic_reply,"Reply",resultPendingIntent)). + addActionButton(new NotificationCompat.Action(R.drawable.ic_reply,"Reply",resultPendingIntent)). + addActionButton(new NotificationCompat.Action(R.drawable.ic_reply,"Reply",resultPendingIntent)). + setBody("Test"). + setLargeIcon(img). + setImage(img). + show(); + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_reply.xml b/app/src/main/res/drawable/ic_reply.xml new file mode 100644 index 0000000..f49d97d --- /dev/null +++ b/app/src/main/res/drawable/ic_reply.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..65d5a18 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,17 @@ + + + +