当前位置: 首页>>代码示例>>Java>>正文


Java NotificationCompat.BigTextStyle方法代码示例

本文整理汇总了Java中android.support.v4.app.NotificationCompat.BigTextStyle方法的典型用法代码示例。如果您正苦于以下问题:Java NotificationCompat.BigTextStyle方法的具体用法?Java NotificationCompat.BigTextStyle怎么用?Java NotificationCompat.BigTextStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.NotificationCompat的用法示例。


在下文中一共展示了NotificationCompat.BigTextStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBigTextStyleNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
protected NotificationCompat.Builder createBigTextStyleNotification(Account account, NotificationHolder holder,
        int notificationId) {
    String accountName = controller.getAccountName(account);
    NotificationContent content = holder.content;
    String groupKey = NotificationGroupKeys.getGroupKey(account);

    NotificationCompat.Builder builder = createAndInitializeNotificationBuilder(account)
            .setTicker(content.summary)
            .setGroup(groupKey)
            .setContentTitle(content.sender)
            .setContentText(content.subject)
            .setSubText(accountName);

    NotificationCompat.BigTextStyle style = createBigTextStyle(builder);
    style.bigText(content.preview);

    builder.setStyle(style);

    PendingIntent contentIntent = actionCreator.createViewMessagePendingIntent(
            content.messageReference, notificationId);
    builder.setContentIntent(contentIntent);

    return builder;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:25,代码来源:BaseNotifications.java

示例2: showDisabledNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void showDisabledNotification() {
    Intent main = new Intent(this, ActivityMain.class);
    PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_error_white_24dp)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(getString(R.string.msg_revoked))
            .setContentIntent(pi)
            .setColor(tv.data)
            .setOngoing(false)
            .setAutoCancel(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.setCategory(Notification.CATEGORY_STATUS)
                .setVisibility(Notification.VISIBILITY_SECRET);
    }

    NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
    notification.bigText(getString(R.string.msg_revoked));

    NotificationManagerCompat.from(this).notify(NOTIFY_DISABLED, notification.build());
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:26,代码来源:ServiceSinkhole.java

示例3: showAutoStartNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void showAutoStartNotification() {
    Intent main = new Intent(this, ActivityMain.class);
    main.putExtra(ActivityMain.EXTRA_APPROVE, true);
    PendingIntent pi = PendingIntent.getActivity(this, NOTIFY_AUTOSTART, main, PendingIntent.FLAG_UPDATE_CURRENT);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_error_white_24dp)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(getString(R.string.msg_autostart))
            .setContentIntent(pi)
            .setColor(tv.data)
            .setOngoing(false)
            .setAutoCancel(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.setCategory(Notification.CATEGORY_STATUS)
                .setVisibility(Notification.VISIBILITY_SECRET);
    }

    NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
    notification.bigText(getString(R.string.msg_autostart));

    NotificationManagerCompat.from(this).notify(NOTIFY_AUTOSTART, notification.build());
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:27,代码来源:ServiceSinkhole.java

示例4: showErrorNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void showErrorNotification(String message) {
    Intent main = new Intent(this, ActivityMain.class);
    PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_error_white_24dp)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(getString(R.string.msg_error, message))
            .setContentIntent(pi)
            .setColor(tv.data)
            .setOngoing(false)
            .setAutoCancel(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.setCategory(Notification.CATEGORY_STATUS)
                .setVisibility(Notification.VISIBILITY_SECRET);
    }

    NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
    notification.bigText(getString(R.string.msg_error, message));
    notification.setSummaryText(message);

    NotificationManagerCompat.from(this).notify(NOTIFY_ERROR, notification.build());
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:27,代码来源:ServiceSinkhole.java

示例5: showUpdateNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void showUpdateNotification(String name, String url) {
    Intent download = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    PendingIntent pi = PendingIntent.getActivity(this, 0, download, PendingIntent.FLAG_UPDATE_CURRENT);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_security_white_24dp)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(getString(R.string.msg_update))
            .setContentIntent(pi)
            .setColor(tv.data)
            .setOngoing(false)
            .setAutoCancel(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.setCategory(Notification.CATEGORY_STATUS)
                .setVisibility(Notification.VISIBILITY_SECRET);
    }

    NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
    notification.bigText(getString(R.string.msg_update));
    notification.setSummaryText(name);

    NotificationManagerCompat.from(this).notify(NOTIFY_UPDATE, notification.build());
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:27,代码来源:ServiceSinkhole.java

示例6: setNotificationText

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void setNotificationText(NotificationCompat.Builder builder)
{
    final Resources res = getResources();
    
    final long now = SystemClock.elapsedRealtime();
    final long lastTestDelta = loopModeResults.getLastTestTime() == 0 ? 0 : now - loopModeResults.getLastTestTime();
    
    final String elapsedTimeString = LoopModeTriggerItem.formatSeconds(Math.round(lastTestDelta / 1000), 1);
    
    final CharSequence textTemplate = res.getText(R.string.loop_notification_text_without_stop);
    final CharSequence text = MessageFormat.format(textTemplate.toString(), 
    		loopModeResults.getNumberOfTests(), elapsedTimeString, Math.round(loopModeResults.getLastDistance()));
    builder.setContentText(text);
    
    if (bigTextStyle == null)
    {
        bigTextStyle = (new NotificationCompat.BigTextStyle());
        builder.setStyle(bigTextStyle);
    }
    
    bigTextStyle.bigText(text);
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:23,代码来源:RMBTLoopService.java

示例7: makeBigTextStyle

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
public static NotificationCompat.BigTextStyle makeBigTextStyle(CharSequence title,
                                                               CharSequence text) {
    NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle()
            .setBigContentTitle(title);
    bigTextStyle.bigText(text);
    return bigTextStyle;
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:8,代码来源:NotificationUtils.java

示例8: sendNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void sendNotification(String messageTitle, String messageBody) {
    Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
            PendingIntent.FLAG_ONE_SHOT);

    if (messageTitle == null) messageTitle = "";
    if (messageBody == null) messageBody = "";

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setLights(Color.WHITE, 1000, 1000)
            .setContentTitle(messageTitle.isEmpty() ? getString(R.string.app_name) : messageTitle)
            .setContentText(messageBody)
            .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
            .setSmallIcon(R.drawable.ic_fcm_notification)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        notificationBuilder.setPriority(Notification.PRIORITY_DEFAULT);

        NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
        bigTextStyle.setBigContentTitle(messageTitle.isEmpty() ? getString(R.string.app_name) : messageTitle);
        bigTextStyle.bigText(messageBody);

        notificationBuilder.setStyle(bigTextStyle);
    }

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    Notification notificationToShow = notificationBuilder.build();
    notificationToShow.defaults |= Notification.DEFAULT_VIBRATE;

    notificationManager.notify(notificationCount++, notificationToShow);
}
 
开发者ID:Nulltilus,项目名称:Appmatic-Android,代码行数:39,代码来源:AppmaticMessagingService.java

示例9: alert

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void alert(Crate crate, Crate oldCrate, AlertType type) {
    String title = type.getName(crate);
    String description = type.getDescription(crate, oldCrate);

    NotificationCompat.BigTextStyle notiStyle = new
            NotificationCompat.BigTextStyle();
    notiStyle.bigText(description);

    Notification notification = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle(title)
            .setContentText(description).setVibrate(new long[] { 1000, 1000, 1000})
            .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
            .setAutoCancel(true)
            .setStyle(notiStyle)
            .build();

    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(maxNotificationId, notification);
    if (maxNotificationId + 1 == Integer.MAX_VALUE) {
        maxNotificationId = 0;
    }
    maxNotificationId++;
}
 
开发者ID:TheUberCatman,项目名称:crates-io-android,代码行数:26,代码来源:CrateNotifier.java

示例10: setTitleAndText

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void setTitleAndText(String title, String body, boolean isPost) {
    builder.setContentTitle(title);
    builder.setContentText(body);
    builder.setTicker(body);

    if (isPost) {
        builder.setSmallIcon(R.drawable.ic_post);
        NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(builder);
        bigTextStyle.setBigContentTitle(title);
        bigTextStyle.setSummaryText(body);
        builder.setStyle(bigTextStyle);
    } else {
        builder.setSmallIcon(R.drawable.ic_comment);
    }
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:16,代码来源:CustomNotification.java

示例11: build

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
@Override
public void build() {
    super.build();
    NotificationCompat.BigTextStyle textStyle = new NotificationCompat.BigTextStyle();
    textStyle.setBigContentTitle(contentTitle).bigText(contentText).setSummaryText(summaryText);
    cBuilder.setStyle(textStyle);
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:8,代码来源:BigTextBuilder.java

示例12: buildNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
/**
 * Builds a {@link NotificationCompat.Builder} with some predefined properties
 *
 * @param title                notification title
 * @param text                 notification body, can be null
 * @param hasUndefinedProgress declare if the notification have to contain an undefined progressbar
 * @return a {@link NotificationCompat.Builder} with the properties passed as parameter.
 */
private NotificationCompat.Builder buildNotification(String title, String text, Boolean hasUndefinedProgress) {
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
    mBuilder.setContentTitle(title);
    NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
    if (text != null) {
        style.bigText(text);
    }
    mBuilder.setStyle(style);
    mBuilder.setSmallIcon(R.drawable.ic_reply_white_24dp);
    if (hasUndefinedProgress) {
        mBuilder.setProgress(0, 0, true);
    }
    return mBuilder;
}
 
开发者ID:gsora,项目名称:TootApp,代码行数:23,代码来源:PostStatus.java

示例13: createInstalledSummaryNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private Notification createInstalledSummaryNotification(ArrayList<AppUpdateStatusManager.AppUpdateStatus> installed) {
    String title = context.getResources().getQuantityString(R.plurals.notification_summary_installed,
            installed.size(), installed.size());
    StringBuilder text = new StringBuilder();

    NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
    bigTextStyle.setBigContentTitle(title);

    for (int i = 0; i < MAX_INSTALLED_TO_SHOW && i < installed.size(); i++) {
        AppUpdateStatusManager.AppUpdateStatus entry = installed.get(i);
        App app = entry.app;
        if (text.length() > 0) {
            text.append(", ");
        }
        text.append(app.name);
    }
    bigTextStyle.bigText(text);
    if (installed.size() > MAX_INSTALLED_TO_SHOW) {
        int diff = installed.size() - MAX_INSTALLED_TO_SHOW;
        bigTextStyle.setSummaryText(context.getResources().getQuantityString(R.plurals.notification_summary_more,
                diff, diff));
    }

    // Intent to open main app list
    Intent intentObject = new Intent(context, MainActivity.class);
    PendingIntent piAction = PendingIntent.getActivity(context, 0, intentObject, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder =
            new NotificationCompat.Builder(context)
                    .setAutoCancel(!useStackedNotifications())
                    .setSmallIcon(R.drawable.ic_notification)
                    .setColor(ContextCompat.getColor(context, R.color.fdroid_blue))
                    .setContentTitle(title)
                    .setContentText(text)
                    .setContentIntent(piAction)
                    .setLocalOnly(true)
                    .setVisibility(NotificationCompat.VISIBILITY_SECRET);
    if (useStackedNotifications()) {
        builder.setGroup(GROUP_INSTALLED)
                .setGroupSummary(true);
    }
    Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_ALL_INSTALLED_CLEARED);
    intentDeleted.setClass(context, NotificationBroadcastReceiver.class);
    PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setDeleteIntent(piDeleted);
    return builder.build();
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:48,代码来源:NotificationHelper.java

示例14: BigText

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
public BigText() {
    style = new NotificationCompat.BigTextStyle();
}
 
开发者ID:boybeak,项目名称:NotificationStyles,代码行数:4,代码来源:BigText.java

示例15: notify

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void notify(ContentValues cv, PendingIntent pi, Uri sound, boolean isHeadUp) {
    String body = FeedContract.removeHtml(cv.getAsString(FeedContract.Feeds.COLUMN_Body));
    String title= FeedContract.removeHtml(cv.getAsString(FeedContract.Feeds.COLUMN_Title));
    String link = cv.getAsString(FeedContract.Feeds.COLUMN_Link);
    Bitmap largeIcon = FeedContract.getImage(cv.getAsByteArray(FeedContract.Feeds.COLUMN_Image));

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(_ctx);

    NotificationCompat.BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText(body);

    if (largeIcon == null)
        largeIcon = BitmapFactory.decodeResource(_ctx.getResources(), R.mipmap.ic_launcher);

    mBuilder.setContentTitle(title)
            .setContentText(body)
            .setTicker(body)
            .setContentIntent(pi)
            .setStyle(bigStyle)
            .setSmallIcon(R.drawable.logo_sw)
            .setLargeIcon(largeIcon);

    if (! isHeadUp) {
        Intent linkIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
        PendingIntent linkpi = PendingIntent.getActivity(
                AnotherRSS.getContextOfApplication(), 0, linkIntent, 0
        );
        mBuilder.addAction(
                android.R.drawable.ic_menu_view,
                AnotherRSS.getContextOfApplication().getString(R.string.open),
                linkpi
        );
    } else {
        mBuilder.setPriority(Notification.PRIORITY_HIGH);
    }

    if (sound != null) {
        mBuilder.setSound(sound);
    } else {
        if (_pref.getString("notify_sound", AnotherRSS.Config.DEFAULT_notifySound).equals("1")) {
            // default Handy sound
            sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            mBuilder.setSound(sound);
        }
        // no sound
    }

    switch (_notifyType) {
        case 1:
            mBuilder.setLights(_notifyColor, 1000, 0);
            break;
        case 2:
            mBuilder.setLights(_notifyColor, 4000, 1000);
            break;
        case 3:
            mBuilder.setLights(_notifyColor, 500, 200);
            break;
        default:
    }

    Notification noti = mBuilder.build();
    noti.flags |= Notification.FLAG_AUTO_CANCEL;
    NotificationManager mNotifyMgr =
            (NotificationManager) _ctx.getSystemService(Context.NOTIFICATION_SERVICE);
    mNotifyMgr.notify(cv.getAsInteger(FeedContract.Feeds._ID), noti);
}
 
开发者ID:no-go,项目名称:AnotherRSS,代码行数:67,代码来源:Refresher.java


注:本文中的android.support.v4.app.NotificationCompat.BigTextStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。