@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View result=inflater.inflate(R.layout.editor, container, false); editor=(EditText)result.findViewById(R.id.editor); editor.setHint(getTitle()); editor.setText(getArguments().getCharSequence(KEY_TEXT)); return(result); }
when(bundle.getCharSequence(anyString())).thenAnswer(get); when(bundle.getCharSequence(anyString(), any(CharSequence.class))).thenAnswer(getOrDefault);
@Override public void onViewBound(@NonNull View view) { super.onViewBound(view); tvTitle.setText(getArgs().getCharSequence(KEY_TITLE)); tvDescription.setText(getArgs().getCharSequence(KEY_DESCRIPTION)); tvDescription.setMovementMethod(LinkMovementMethod.getInstance()); }
@Override public void onReceive(Context ctxt, Intent i) { Bundle input=RemoteInput.getResultsFromIntent(i); if (input!=null) { CharSequence speech=input.getCharSequence(EXTRA_SPEECH); if (speech!=null) { Log.d(getClass().getSimpleName(), speech.toString()); } else { Log.e(getClass().getSimpleName(), "No voice response speech"); } } else { Log.e(getClass().getSimpleName(), "No voice response Bundle"); } } }
private TextView mTextView; private static final String KEY_TEXT_VALUE = "textValue"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTextView = (TextView) findViewById(R.id.main); if (savedInstanceState != null) { CharSequence savedText = savedInstanceState.getCharSequence(KEY_TEXT_VALUE); mTextView.setText(savedText); } } @Override protected void onSaveInstanceState (Bundle outState) { super.onSaveInstanceState(outState); outState.putCharSequence(KEY_TEXT_VALUE, mTextView.getText()); }
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { if (savedInstanceState == null) { initAdapter(null); } else { initAdapter(savedInstanceState.getStringArrayList(STATE_MODEL)); initialQuery=savedInstanceState.getCharSequence(STATE_QUERY); } }
@Override public void onReceive(Context ctxt, Intent i) { Bundle input=RemoteInput.getResultsFromIntent(i); if (input!=null) { CharSequence speech=input.getCharSequence(EXTRA_INPUT); if (speech!=null) { Log.d(getClass().getSimpleName(), speech.toString()); } else { Log.e(getClass().getSimpleName(), "No voice response speech"); } } else { Log.e(getClass().getSimpleName(), "No voice response Bundle"); } NotificationCompat.Builder builder= buildNotificationBase(ctxt); NotificationManagerCompat .from(ctxt) .notify(RemoteInputReceiver.NOTIFY_ID, builder.build()); } }
public CharSequence getContentText() { return RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.N ? realNotification.extras.getCharSequence(Notification.EXTRA_TEXT) : findText(applyContentView(), "text"); }
public CharSequence getContentInfo() { if (getApiLevel() >= N) { return realNotification.extras.getCharSequence(Notification.EXTRA_INFO_TEXT); } else { return findText(applyContentView(), "info"); } }
public CharSequence getBigContentTitle() { if (getApiLevel() >= N) { return realNotification.extras.getCharSequence(Notification.EXTRA_TITLE_BIG); } else { return findText(applyBigContentView(), "title"); } }
@Override public void onReceive(Context ctxt, Intent i) { Bundle input=RemoteInput.getResultsFromIntent(i); if (input!=null) { CharSequence text=input.getCharSequence(EXTRA_INPUT); if (text!=null) { MESSAGES.push(new Message(text)); } else { Log.e(getClass().getSimpleName(), "No voice response speech"); } } else { Log.e(getClass().getSimpleName(), "No voice response Bundle"); } NotificationManagerCompat .from(ctxt) .notify(RemoteInputReceiver.NOTIFY_ID, buildNotification(ctxt).build()); }
public CharSequence getBigText() { if (getApiLevel() >= N) { return realNotification.extras.getCharSequence(Notification.EXTRA_BIG_TEXT); } else { return findText(applyBigContentView(), "big_text"); } }
public CharSequence getContentTitle() { return RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.N ? realNotification.extras.getCharSequence(Notification.EXTRA_TITLE) : findText(applyContentView(), "title"); }
public CharSequence getBigContentText() { if (getApiLevel() >= N) { return realNotification.extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT); } else { return findText(applyBigContentView(), "text"); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTextView = findViewById(R.id.textView); if (null != savedInstanceState) { mRetainedFragment = (RetainedFragment) getFragmentManager() .findFragmentByTag(RetainedFragment.TAG); mTextView.setText(savedInstanceState.getCharSequence(MTEXTVIEW_TEXT_KEY)); } else { mRetainedFragment = new RetainedFragment(); getFragmentManager().beginTransaction() .add(mRetainedFragment, RetainedFragment.TAG) .commit(); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTextView = findViewById(R.id.textView); if (null != savedInstanceState) { mRetainedFragment = (RetainedFragment) getFragmentManager() .findFragmentByTag(RetainedFragment.TAG); mTextView.setText(savedInstanceState.getCharSequence(MTEXTVIEW_TEXT_KEY)); } else { mRetainedFragment = new RetainedFragment(); getFragmentManager().beginTransaction() .add(mRetainedFragment, RetainedFragment.TAG) .commit(); } }
vstup.setText(savedState.getCharSequence(App.VSTUP));
final CharSequence comment = remoteInput.getCharSequence(NotificationInteraction.KEY_COMMENT); if (comment != null && !"".equals(comment.toString())) { final CrashReportPersister persister = new CrashReportPersister();
@Test @Config(minSdk = JELLY_BEAN_MR2) public void testGetApplicationRestrictions() { String packageName = context.getPackageName(); assertThat(userManager.getApplicationRestrictions(packageName).size()).isEqualTo(0); Bundle restrictions = new Bundle(); restrictions.putCharSequence("test_key", "test_value"); shadowOf(userManager).setApplicationRestrictions(packageName, restrictions); assertThat( userManager .getApplicationRestrictions(packageName) .getCharSequence("test_key") .toString()) .isEqualTo("test_value"); }
@Test public void getApplicationRestrictions() { assertThat(restrictionsManager.getApplicationRestrictions()).isNull(); Bundle bundle = new Bundle(); bundle.putCharSequence("test_key", "test_value"); shadowOf(restrictionsManager).setApplicationRestrictions(bundle); assertThat(restrictionsManager.getApplicationRestrictions().getCharSequence("test_key")).isEqualTo("test_value"); }