當前位置: 首頁>>代碼示例>>Java>>正文


Java NotificationCompat.BigPictureStyle方法代碼示例

本文整理匯總了Java中android.support.v7.app.NotificationCompat.BigPictureStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java NotificationCompat.BigPictureStyle方法的具體用法?Java NotificationCompat.BigPictureStyle怎麽用?Java NotificationCompat.BigPictureStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.app.NotificationCompat的用法示例。


在下文中一共展示了NotificationCompat.BigPictureStyle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showBigNotification

import android.support.v7.app.NotificationCompat; //導入方法依賴的package包/類
private void showBigNotification(Bitmap bitmap, NotificationCompat.Builder mBuilder, int icon, String title, String message, String timeStamp, PendingIntent resultPendingIntent, Uri alarmSound) {
    NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
    bigPictureStyle.setBigContentTitle(title);
    bigPictureStyle.setSummaryText(Html.fromHtml(message).toString());
    bigPictureStyle.bigPicture(bitmap);
    Notification notification;
    notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
            .setAutoCancel(true)
            .setContentTitle(title)
            .setContentIntent(resultPendingIntent)
            .setSound(alarmSound)
            .setStyle(bigPictureStyle)
            .setWhen(getTimeMilliSec(timeStamp))
            .setSmallIcon(R.mipmap.ic_launcher)
            .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
            .setContentText(message)
            .build();

    NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(Config.NOTIFICATION_ID_BIG_IMAGE, notification);
}
 
開發者ID:safaricom,項目名稱:LNMOnlineAndroidSample,代碼行數:22,代碼來源:NotificationUtils.java

示例2: build

import android.support.v7.app.NotificationCompat; //導入方法依賴的package包/類
@Override
public void build() {
    super.build();
    NotificationCompat.BigPictureStyle picStyle = new NotificationCompat.BigPictureStyle();
    if(bitmap==null || bitmap.isRecycled()){
        if(bigPic >0){
            final BitmapFactory.Options options = new BitmapFactory.Options();
            options.inScaled = true;
            options.inSampleSize = 2;
            bitmap = BitmapFactory.decodeResource(NotifyUtil.getInstance().getContext().getResources(),
                    bigPic, options);
        }
    }
    picStyle.bigPicture(bitmap);
    //picStyle.bigLargeIcon(bitmap);
    picStyle.setBigContentTitle(contentTitle);
    picStyle.setSummaryText(summaryText);
    cBuilder.setStyle(picStyle);
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:20,代碼來源:BigPicBuilder.java

示例3: notify_bigPic

import android.support.v7.app.NotificationCompat; //導入方法依賴的package包/類
/**
 * 容納大圖片的通知
 *
 * @param pendingIntent
 * @param smallIcon
 * @param ticker
 * @param title
 * @param bigPic
 */
public void notify_bigPic(PendingIntent pendingIntent, int smallIcon, String ticker,
                          String title, String content, int bigPic, boolean sound, boolean vibrate, boolean lights) {

    setCompatBuilder(pendingIntent, smallIcon, ticker, title, null, sound, vibrate, lights);
    NotificationCompat.BigPictureStyle picStyle = new NotificationCompat.BigPictureStyle();
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inScaled = true;
    options.inSampleSize = 2;
    Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(),
            bigPic, options);
    picStyle.bigPicture(bitmap);
    picStyle.bigLargeIcon(bitmap);
    cBuilder.setContentText(content);
    cBuilder.setStyle(picStyle);
    sent();
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:26,代碼來源:NotifyUtil.java

示例4: sendRichTextNotifi

import android.support.v7.app.NotificationCompat; //導入方法依賴的package包/類
/**
 * 發送富文本通知(大圖片/長文字)
 */
private void sendRichTextNotifi() {
    Log.e("發送富文本", "執行了");
    builder = new NotificationCompat.Builder(this);
    NotificationCompat.BigPictureStyle bigPictureStyle =
            new android.support.v4.app.NotificationCompat.BigPictureStyle();
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeResource(getResources(), R.drawable.train_online, options);

    int inSampleSize = (int) (options.outHeight * 1f / dip2px(256));
    Log.e("圖片高度+256dp的值", options.outHeight + "+++++++++" + dip2px(256));
    options.inJustDecodeBounds = false;
    options.inSampleSize = inSampleSize;
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.train_online, options);

    bigPictureStyle.bigLargeIcon(this.bitmap)
            .bigPicture(bitmap)
            .setBigContentTitle("大圖片通知");

    notification = builder.setStyle(bigPictureStyle)
            .setContentTitle("恭喜您中獎了")
            .setContentIntent(pendingIntent)
            .setLargeIcon(this.bitmap)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentText("您有一條消息")
            .setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND)
            .setAutoCancel(true)
            .build();
    manager.notify(2, notification);
}
 
開發者ID:BittleDragon,項目名稱:MyRepository,代碼行數:34,代碼來源:MainActivity.java


注:本文中的android.support.v7.app.NotificationCompat.BigPictureStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。