Search in sources :

Example 21 with Notification

use of android.app.Notification in project making-apps-beautiful by ankurkotwal.

the class ArticleListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.refresh) {
        DummyContent.DummyItem dummy = DummyContent.ITEMS.get(0);
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 16;
        Bitmap photo = BitmapFactory.decodeResource(getResources(), dummy.photoResId);
        Notification n = new NotificationCompat.Builder(getActivity()).setContentTitle("Article published").setSmallIcon(R.drawable.stat_icon).setDefaults(Notification.DEFAULT_SOUND).setLargeIcon(photo).setStyle(new NotificationCompat.BigPictureStyle().bigPicture(photo).setSummaryText(dummy.title)).setContentText(dummy.title).setContentIntent(PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).setAutoCancel(true).addAction(R.drawable.ic_share, "Share", PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).build();
        NotificationManager nm = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(1, n);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bitmap(android.graphics.Bitmap) NotificationManager(android.app.NotificationManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BitmapFactory(android.graphics.BitmapFactory) DummyContent(com.example.xyzreader.cp2.dummy.DummyContent) Notification(android.app.Notification)

Example 22 with Notification

use of android.app.Notification in project making-apps-beautiful by ankurkotwal.

the class ArticleListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.refresh) {
        DummyContent.DummyItem dummy = DummyContent.ITEMS.get(0);
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 16;
        Bitmap photo = BitmapFactory.decodeResource(getResources(), dummy.photoResId);
        Notification n = new NotificationCompat.Builder(getActivity()).setContentTitle("Article published").setSmallIcon(R.drawable.stat_icon).setDefaults(Notification.DEFAULT_SOUND).setLargeIcon(photo).setStyle(new NotificationCompat.BigPictureStyle().bigPicture(photo).setSummaryText(dummy.title)).setContentText(dummy.title).setContentIntent(PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).setAutoCancel(true).addAction(R.drawable.ic_share, "Share", PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).build();
        NotificationManager nm = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(1, n);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bitmap(android.graphics.Bitmap) NotificationManager(android.app.NotificationManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BitmapFactory(android.graphics.BitmapFactory) DummyContent(com.example.xyzreader.cp3.dummy.DummyContent) Notification(android.app.Notification)

Example 23 with Notification

use of android.app.Notification in project making-apps-beautiful by ankurkotwal.

the class ArticleListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.refresh) {
        DummyContent.DummyItem dummy = DummyContent.ITEMS.get(0);
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 16;
        Bitmap photo = BitmapFactory.decodeResource(getResources(), dummy.photoResId);
        Notification n = new NotificationCompat.Builder(getActivity()).setContentTitle("Article published").setSmallIcon(R.drawable.stat_icon).setDefaults(Notification.DEFAULT_SOUND).setLargeIcon(photo).setStyle(new NotificationCompat.BigPictureStyle().bigPicture(photo).setSummaryText(dummy.title)).setContentText(dummy.title).setContentIntent(PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).setAutoCancel(true).addAction(R.drawable.ic_share, "Share", PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).build();
        NotificationManager nm = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(1, n);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bitmap(android.graphics.Bitmap) NotificationManager(android.app.NotificationManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BitmapFactory(android.graphics.BitmapFactory) DummyContent(com.example.xyzreader.cp4.dummy.DummyContent) Notification(android.app.Notification)

Example 24 with Notification

use of android.app.Notification in project making-apps-beautiful by ankurkotwal.

the class ArticleListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.refresh) {
        DummyContent.DummyItem dummy = DummyContent.ITEMS.get(0);
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 16;
        Bitmap photo = BitmapFactory.decodeResource(getResources(), dummy.photoResId);
        Notification n = new NotificationCompat.Builder(getActivity()).setContentTitle("Article published").setSmallIcon(R.drawable.stat_icon).setDefaults(Notification.DEFAULT_SOUND).setLargeIcon(photo).setStyle(new NotificationCompat.BigPictureStyle().bigPicture(photo).setSummaryText(dummy.title)).setContentText(dummy.title).setContentIntent(PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).setAutoCancel(true).addAction(R.drawable.ic_share, "Share", PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).build();
        NotificationManager nm = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(1, n);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bitmap(android.graphics.Bitmap) NotificationManager(android.app.NotificationManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BitmapFactory(android.graphics.BitmapFactory) DummyContent(com.example.xyzreader.cp5.dummy.DummyContent) Notification(android.app.Notification)

Example 25 with Notification

use of android.app.Notification in project making-apps-beautiful by ankurkotwal.

the class ArticleListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.refresh) {
        DummyContent.DummyItem dummy = DummyContent.ITEMS.get(0);
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 16;
        Bitmap photo = BitmapFactory.decodeResource(getResources(), dummy.photoResId);
        Notification n = new NotificationCompat.Builder(getActivity()).setContentTitle("Article published").setSmallIcon(R.drawable.stat_icon).setDefaults(Notification.DEFAULT_SOUND).setLargeIcon(photo).setStyle(new NotificationCompat.BigPictureStyle().bigPicture(photo).setSummaryText(dummy.title)).setContentText(dummy.title).setContentIntent(PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).setAutoCancel(true).addAction(R.drawable.ic_share, "Share", PendingIntent.getActivity(getActivity(), 0, new Intent(getActivity(), getActivity().getClass()), PendingIntent.FLAG_UPDATE_CURRENT)).build();
        NotificationManager nm = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(1, n);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bitmap(android.graphics.Bitmap) NotificationManager(android.app.NotificationManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BitmapFactory(android.graphics.BitmapFactory) DummyContent(com.example.xyzreader.cp7.dummy.DummyContent) Notification(android.app.Notification)

Aggregations

Notification (android.app.Notification)568 PendingIntent (android.app.PendingIntent)276 Intent (android.content.Intent)253 NotificationManager (android.app.NotificationManager)128 StatusBarNotification (android.service.notification.StatusBarNotification)96 NotificationCompat (android.support.v4.app.NotificationCompat)64 Resources (android.content.res.Resources)56 Bitmap (android.graphics.Bitmap)48 Test (org.junit.Test)48 Context (android.content.Context)47 ITransientNotification (android.app.ITransientNotification)32 RemoteViews (android.widget.RemoteViews)30 RemoteException (android.os.RemoteException)24 ApplicationInfo (android.content.pm.ApplicationInfo)17 UserHandle (android.os.UserHandle)17 Date (java.util.Date)16 Uri (android.net.Uri)15 Bundle (android.os.Bundle)15 ComponentName (android.content.ComponentName)13 File (java.io.File)13