本文整理汇总了Java中android.os.Bundle.getCharSequence方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getCharSequence方法的具体用法?Java Bundle.getCharSequence怎么用?Java Bundle.getCharSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.getCharSequence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
ApplicationLoader.postInitApplication();
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput == null) {
return;
}
CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
if (text == null || text.length() == 0) {
return;
}
long dialog_id = intent.getLongExtra("dialog_id", 0);
int max_id = intent.getIntExtra("max_id", 0);
if (dialog_id == 0 || max_id == 0) {
return;
}
SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, null, null, null);
MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false);
}
示例2: onStartCommand
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent != null ? intent.getAction() : null;
if (ACTION_ADD_MESSAGE.equals(action)) {
int accountId = intent.getExtras().getInt(Extra.ACCOUNT_ID);
int peerId = intent.getExtras().getInt(Extra.PEER_ID);
Bundle msg = RemoteInput.getResultsFromIntent(intent);
if (msg != null) {
CharSequence body = msg.getCharSequence(Extra.BODY);
addMessage(accountId, peerId, body);
}
} else {
send();
}
return START_NOT_STICKY;
}
示例3: handleStatusBarNotification
import android.os.Bundle; //导入方法依赖的package包/类
private void handleStatusBarNotification(@NonNull StatusBarNotification statusBarNotification, @NonNull String intentAction) {
String packageName = statusBarNotification.getPackageName();
String tickerText = "";
if (statusBarNotification.getNotification().tickerText != null) {
tickerText = statusBarNotification.getNotification().tickerText.toString();
}
Bundle extras = statusBarNotification.getNotification().extras;
String title = extras.getString("android.title");
String text = "";
CharSequence textCharSequence = extras.getCharSequence("android.text");
if (textCharSequence != null) {
text = textCharSequence.toString();
} else {
Logger.getInstance().Warning(TAG, "textCharSequence is null!");
}
Bitmap bitmap = statusBarNotification.getNotification().largeIcon;
Notification.Action[] notificationActions = statusBarNotification.getNotification().actions;
Intent messageReceiveIntent = new Intent(intentAction);
messageReceiveIntent.putExtra(EXTRA_KEY_PACKAGE_NAME, packageName);
messageReceiveIntent.putExtra(EXTRA_KEY_TICKER_TEXT, tickerText);
messageReceiveIntent.putExtra(EXTRA_KEY_TITLE, title);
messageReceiveIntent.putExtra(EXTRA_KEY_TEXT, text);
messageReceiveIntent.putExtra(EXTRA_KEY_NOTIFICATION_ACTIONS, notificationActions);
if (bitmap != null) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
messageReceiveIntent.putExtra(EXTRA_KEY_ICON, byteArray);
}
LocalBroadcastManager.getInstance(_context).sendBroadcast(messageReceiveIntent);
}
示例4: restoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public final void restoreInstanceState(@Nullable final Bundle savedInstanceState) {
if (savedInstanceState != null) {
firstVisibleTabIndex = savedInstanceState.getInt(FIRST_VISIBLE_TAB_INDEX_EXTRA, -1);
firstVisibleTabPosition =
savedInstanceState.getFloat(FIRST_VISIBLE_TAB_POSITION_EXTRA, -1);
logLevel = (LogLevel) savedInstanceState.getSerializable(LOG_LEVEL_EXTRA);
tabs = savedInstanceState.getParcelableArrayList(TABS_EXTRA);
switcherShown = savedInstanceState.getBoolean(SWITCHER_SHOWN_EXTRA);
selectedTab = savedInstanceState.getParcelable(SELECTED_TAB_EXTRA);
padding = savedInstanceState.getIntArray(PADDING_EXTRA);
tabIconId = savedInstanceState.getInt(TAB_ICON_ID_EXTRA);
tabIconBitmap = savedInstanceState.getParcelable(TAB_ICON_BITMAP_EXTRA);
tabBackgroundColor = savedInstanceState.getParcelable(TAB_BACKGROUND_COLOR_EXTRA);
tabTitleTextColor = savedInstanceState.getParcelable(TAB_TITLE_TEXT_COLOR_EXTRA);
tabCloseButtonIconId = savedInstanceState.getInt(TAB_CLOSE_BUTTON_ICON_ID_EXTRA);
tabCloseButtonIconBitmap =
savedInstanceState.getParcelable(TAB_CLOSE_BUTTON_ICON_BITMAP_EXTRA);
showToolbars = savedInstanceState.getBoolean(SHOW_TOOLBARS_EXTRA);
toolbarTitle = savedInstanceState.getCharSequence(TOOLBAR_TITLE_EXTRA);
childRecyclerAdapter.restoreInstanceState(savedInstanceState);
}
}
示例5: getMessageText
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Get the message text from the intent.
* Note that you should call {@code RemoteInput#getResultsFromIntent(intent)} to process
* the RemoteInput.
*/
private CharSequence getMessageText(Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
return remoteInput.getCharSequence(MessagingService.EXTRA_VOICE_REPLY);
}
return null;
}
示例6: handleReply
import android.os.Bundle; //导入方法依赖的package包/类
private void handleReply(final Context context, Bundle remoteInput, Chat chat) {
CharSequence reply = null;
if (remoteInput != null) {
reply = remoteInput.getCharSequence(NOTIFICATION_INPUT_KEY);
}
FFMIntentService.startReply(context, reply, chat);
}
示例7: getMessageText
import android.os.Bundle; //导入方法依赖的package包/类
private CharSequence getMessageText(Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
return remoteInput.getCharSequence(VOICE_REPLY_KEY);
}
return null;
}
示例8: WearableExtender
import android.os.Bundle; //导入方法依赖的package包/类
public WearableExtender(Action action) {
Bundle wearableBundle = action.getExtras().getBundle(EXTRA_WEARABLE_EXTENSIONS);
if (wearableBundle != null) {
this.mFlags = wearableBundle.getInt(KEY_FLAGS, 1);
this.mInProgressLabel = wearableBundle.getCharSequence(KEY_IN_PROGRESS_LABEL);
this.mConfirmLabel = wearableBundle.getCharSequence(KEY_CONFIRM_LABEL);
this.mCancelLabel = wearableBundle.getCharSequence(KEY_CANCEL_LABEL);
}
}
示例9: getMessage
import android.os.Bundle; //导入方法依赖的package包/类
private CharSequence getMessage(Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
return remoteInput.getCharSequence(EXTRA_REPLY);
}
return null;
}
示例10: getNotificationReply
import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
private static String getNotificationReply(Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
// RemoteInput was added in KITKAT_WATCH.
Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
if (remoteInputResults != null) {
CharSequence reply =
remoteInputResults.getCharSequence(NotificationConstants.KEY_TEXT_REPLY);
if (reply != null) {
return reply.toString();
}
}
}
return null;
}
示例11: getMessageText
import android.os.Bundle; //导入方法依赖的package包/类
private CharSequence getMessageText(Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
return remoteInput.getCharSequence(MessagingService.EXTRA_VOICE_REPLY);
}
return null;
}
示例12: restoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public final void restoreInstanceState(@Nullable final Bundle savedInstanceState) {
if (savedInstanceState != null) {
referenceTabIndex = savedInstanceState.getInt(REFERENCE_TAB_INDEX_EXTRA, -1);
referenceTabPosition = savedInstanceState.getFloat(REFERENCE_TAB_POSITION_EXTRA, -1);
logLevel = (LogLevel) savedInstanceState.getSerializable(LOG_LEVEL_EXTRA);
tabs = savedInstanceState.getParcelableArrayList(TABS_EXTRA);
switcherShown = savedInstanceState.getBoolean(SWITCHER_SHOWN_EXTRA);
int selectedTabIndex = savedInstanceState.getInt(SELECTED_TAB_INDEX_EXTRA);
selectedTab = selectedTabIndex != -1 ? tabs.get(selectedTabIndex) : null;
padding = savedInstanceState.getIntArray(PADDING_EXTRA);
applyPaddingToTabs = savedInstanceState.getBoolean(APPLY_PADDING_TO_TABS_EXTRA);
tabIconId = savedInstanceState.getInt(TAB_ICON_ID_EXTRA);
tabIconBitmap = savedInstanceState.getParcelable(TAB_ICON_BITMAP_EXTRA);
tabBackgroundColor = savedInstanceState.getParcelable(TAB_BACKGROUND_COLOR_EXTRA);
tabContentBackgroundColor =
savedInstanceState.getInt(TAB_CONTENT_BACKGROUND_COLOR_EXTRA);
tabTitleTextColor = savedInstanceState.getParcelable(TAB_TITLE_TEXT_COLOR_EXTRA);
tabCloseButtonIconId = savedInstanceState.getInt(TAB_CLOSE_BUTTON_ICON_ID_EXTRA);
tabCloseButtonIconBitmap =
savedInstanceState.getParcelable(TAB_CLOSE_BUTTON_ICON_BITMAP_EXTRA);
tabProgressBarColor = savedInstanceState.getInt(TAB_PROGRESS_BAR_COLOR_EXTRA, -1);
showToolbars = savedInstanceState.getBoolean(SHOW_TOOLBARS_EXTRA);
toolbarTitle = savedInstanceState.getCharSequence(TOOLBAR_TITLE_EXTRA);
getContentRecyclerAdapter().restoreInstanceState(savedInstanceState);
}
}
示例13: getCharSequence
import android.os.Bundle; //导入方法依赖的package包/类
public CharSequence getCharSequence(Bundle state, String key) {
return state.getCharSequence(key + baseKey);
}
示例14: restoreFromCompatExtras
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void restoreFromCompatExtras(Bundle extras) {
super.restoreFromCompatExtras(extras);
mSummaryText = extras.getCharSequence(NotificationCompat.EXTRA_SUMMARY_TEXT);
}
示例15: containsKey
import android.os.Bundle; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions") //Android Studio does not correlate between containsKey() and get() and thus throws warnings
@TargetApi(value = Build.VERSION_CODES.JELLY_BEAN)
public boolean tryParseNatively(Notification notification)
{
Bundle extras = NotificationCompat.getExtras(notification);
if (extras == null)
return false;
if (parseMessageStyleNotification(notification, extras))
return true;
if (extras.containsKey(Notification.EXTRA_TEXT_LINES) && extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES).length > 0)
{
if (parseInboxNotification(extras))
return true;
}
if (!extras.containsKey(Notification.EXTRA_TEXT) && !extras.containsKey(Notification.EXTRA_TEXT_LINES) && !extras.containsKey(Notification.EXTRA_BIG_TEXT))
{
return false;
}
if (extras.containsKey(Notification.EXTRA_TITLE_BIG))
{
CharSequence bigTitle = extras.getCharSequence(NotificationCompat.EXTRA_TITLE_BIG);
if (bigTitle != null && (bigTitle.length() < 40 || !extras.containsKey(Notification.EXTRA_TITLE)))
title = bigTitle.toString();
else
title = formatCharSequence(extras.getCharSequence(NotificationCompat.EXTRA_TITLE));
}
else if (extras.containsKey(NotificationCompat.EXTRA_TITLE))
title = formatCharSequence(extras.getCharSequence(NotificationCompat.EXTRA_TITLE));
if (extras.containsKey(Notification.EXTRA_TEXT_LINES))
{
for (CharSequence line : extras.getCharSequenceArray(NotificationCompat.EXTRA_TEXT_LINES))
{
text += formatCharSequence(line) + "\n\n";
}
text = text.trim();
}
else if (extras.containsKey(Notification.EXTRA_BIG_TEXT))
{
text = formatCharSequence(extras.getCharSequence(NotificationCompat.EXTRA_BIG_TEXT));
}
else
{
text = formatCharSequence(extras.getCharSequence(NotificationCompat.EXTRA_TEXT));
}
if (extras.containsKey(Notification.EXTRA_SUB_TEXT))
{
text = text.trim();
text= text + "\n\n" + formatCharSequence(extras.getCharSequence(NotificationCompat.EXTRA_SUB_TEXT));
}
return true;
}