diff --git a/app/src/main/java/ch/dissem/apps/abit/notification/ErrorNotification.java b/app/src/main/java/ch/dissem/apps/abit/notification/ErrorNotification.java new file mode 100644 index 0000000..d14aa78 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/notification/ErrorNotification.java @@ -0,0 +1,41 @@ +package ch.dissem.apps.abit.notification; + +import android.content.Context; +import android.support.v7.app.NotificationCompat; + +import ch.dissem.apps.abit.R; + +/** + * Created by chrigu on 29.10.15. + */ +public class ErrorNotification extends AbstractNotification { + public static final int ERROR_NOTIFICATION_ID = 4; + + private NotificationCompat.Builder builder; + + public ErrorNotification(Context ctx) { + super(ctx); + builder = new NotificationCompat.Builder(ctx); + builder.setContentTitle(ctx.getString(R.string.app_name)) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); + } + + public ErrorNotification setWarning(int resId, Object... args) { + builder.setSmallIcon(R.drawable.ic_notification_warning) + .setContentText(ctx.getString(resId, args)); + notification = builder.build(); + return this; + } + + public ErrorNotification setError(int resId, Object... args) { + builder.setSmallIcon(R.drawable.ic_notification_error) + .setContentText(ctx.getString(resId, args)); + notification = builder.build(); + return this; + } + + @Override + protected int getNotificationId() { + return ERROR_NOTIFICATION_ID; + } +} diff --git a/app/src/main/res/drawable/ic_notification_error.xml b/app/src/main/res/drawable/ic_notification_error.xml new file mode 100644 index 0000000..bc132bb --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_error.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_notification_proof_of_work.xml b/app/src/main/res/drawable/ic_notification_proof_of_work.xml new file mode 100644 index 0000000..c64f014 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_proof_of_work.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_notification_warning.xml b/app/src/main/res/drawable/ic_notification_warning.xml new file mode 100644 index 0000000..0510991 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_warning.xml @@ -0,0 +1,9 @@ + + +