コード例 #1
0
 public static SearchResultsFragment newInstance(final Place place) {
   SearchResultsFragment fragment = new SearchResultsFragment();
   Bundle args = new Bundle();
   args.putCharSequence(NAME_KEY, place.getName());
   args.putCharSequence(ADDRESS_KEY, place.getAddress());
   args.putCharSequence(PHONE_NUMBER_KEY, place.getPhoneNumber());
   args.putFloat(RATING_KEY, place.getRating());
   args.putParcelable(WEBSITE_KEY, place.getWebsiteUri());
   fragment.setArguments(args);
   return fragment;
 }
コード例 #2
0
 public static DialogFragment newInstance(
     CharSequence charsequence,
     CharSequence charsequence1,
     CharSequence charsequence2,
     Intent intent) {
   Bundle bundle = new Bundle();
   bundle.putCharSequence("title", charsequence);
   bundle.putCharSequence("message", charsequence1);
   bundle.putCharSequence("positive", charsequence2);
   bundle.putParcelable("intent", intent);
   ConfirmIntentDialog confirmintentdialog = new ConfirmIntentDialog();
   confirmintentdialog.setArguments(bundle);
   return confirmintentdialog;
 }
  @Override
  protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(
        SCORE_TEAM_1,
        ((TextView) ((TextSwitcher) findViewById(R.id.trucoAnnotator_scoreTeam1)).getCurrentView())
            .getText());
    outState.putCharSequence(
        SCORE_TEAM_2,
        ((TextView) ((TextSwitcher) findViewById(R.id.trucoAnnotator_scoreTeam2)).getCurrentView())
            .getText());

    outState.putBoolean(TEAM_1_STATUS, findViewById(R.id.trucoAnnotator_scoreTeam1).isEnabled());
    outState.putBoolean(TEAM_2_STATUS, findViewById(R.id.trucoAnnotator_scoreTeam2).isEnabled());
  }
コード例 #4
0
 /** Create a new instance of MyFragment that will be initialized with the given arguments. */
 static MyFragment newInstance(CharSequence label) {
   MyFragment f = new MyFragment();
   Bundle b = new Bundle();
   b.putCharSequence("label", label);
   f.setArguments(b);
   return f;
 }
コード例 #5
0
ファイル: QuizActivity.java プロジェクト: guzike/Lifehack
  /**
   * This method gets bundle from the previous activity, saves information entered in this
   * QuizActivity and changes to the next activity
   *
   * @param view the button clicked by the user
   */
  public void sbContToSum(View view) {

    boolean check_ans1 = mCheckBox1.isChecked();
    boolean check_ans2 = mCheckBox2.isChecked();
    boolean check_ans3 = mCheckBox3.isChecked();

    boolean radio_ans1 = mRadioButton1.isChecked();
    boolean radio_ans2 = mRadioButton2.isChecked();

    String ansText = mTextField.getText().toString();

    Intent toSum = new Intent(this, SummaryActivity.class);
    Bundle extras = getIntent().getExtras();

    extras.putBoolean(EXTRA_ANS_CHECK1, check_ans1);
    extras.putBoolean(EXTRA_ANS_CHECK2, check_ans2);
    extras.putBoolean(EXTRA_ANS_CHECK3, check_ans3);

    extras.putBoolean(EXTRA_ANS_RADIO1, radio_ans1);
    extras.putBoolean(EXTRA_ANS_RADIO2, radio_ans2);

    extras.putCharSequence(EXTRA_ANS_TEXT, ansText);

    toSum.putExtras(extras);
    startActivity(toSum);
  }
コード例 #6
0
  /**
   * Display the info of this photo.
   *
   * @param activity the triggering activity
   * @param eyePhoto the photo for which the image should be displayed.
   */
  public static void displayImageInfo(
      @NonNull final Activity activity, @NonNull final EyePhoto eyePhoto) {
    StringBuilder message = new StringBuilder();
    message.append(
        formatImageInfoLine(activity, R.string.imageinfo_line_filename, eyePhoto.getFilename()));
    message.append(
        formatImageInfoLine(activity, R.string.imageinfo_line_filedate, eyePhoto.getDateString()));

    try {
      JpegMetadata metadata = JpegSynchronizationUtil.getJpegMetadata(eyePhoto.getAbsolutePath());

      if (metadata.getPerson() != null && metadata.getPerson().length() > 0) {
        message.append(
            formatImageInfoLine(activity, R.string.imageinfo_line_name, metadata.getPerson()));
      }
      if (metadata.getComment() != null && metadata.getComment().length() > 0) {
        message.append(
            formatImageInfoLine(activity, R.string.imageinfo_line_comment, metadata.getComment()));
      }
    } catch (Exception e) {
      // cannot append metadata.
    }

    Bundle bundle = new Bundle();
    bundle.putCharSequence(PARAM_MESSAGE, Html.fromHtml(message.toString()));
    bundle.putString(PARAM_TITLE, activity.getString(R.string.title_dialog_image_info));
    bundle.putInt(PARAM_ICON, R.drawable.ic_title_info);
    DialogFragment fragment = new DisplayMessageDialogFragment();
    fragment.setArguments(bundle);
    fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
  }
コード例 #7
0
ファイル: IRB.java プロジェクト: tamairama/ruboto-irb
 /**
  * *******************************************************************************************
  *
  * <p>Saving and recalling state
  */
 @Override
 public void onSaveInstanceState(Bundle savedInstanceState) {
   super.onSaveInstanceState(savedInstanceState);
   savedInstanceState.putCharSequence("irbOutput", irbOutput.getText());
   irbInput.onSaveInstanceState(savedInstanceState);
   savedInstanceState.putInt("tab", tabs.getCurrentTab());
 }
コード例 #8
0
 /**
  * Create a new {@link ConfirmDialogFragment}.
  *
  * @param message
  * @return new {@link ConfirmDialogFragment} object.
  */
 public static ConfirmDialogFragment newInstance(CharSequence message) {
   final ConfirmDialogFragment f = new ConfirmDialogFragment();
   final Bundle args = new Bundle();
   args.putCharSequence(MESSAGE_KEY, message);
   f.setArguments(args);
   return f;
 }
コード例 #9
0
 /**
  * Add extended data to the extra.
  *
  * @param name The name of the extra data, with package prefix.
  * @param value The CharSequence data value.
  * @return Returns the same extra object, for chaining multiple calls into a single statement.
  * @see #putExtras
  * @see #removeExtra
  * @see #getCharSequenceExtra(String)
  */
 public Request putExtra(String name, CharSequence value) {
   if (mExtras == null) {
     mExtras = new Bundle();
   }
   mExtras.putCharSequence(name, value);
   return this;
 }
コード例 #10
0
 public static ProgressDialogFragment newInstance(
     CharSequence title,
     CharSequence message,
     boolean spinner,
     String progressNumberFormat,
     NumberFormat progressPercentFormat) {
   ProgressDialogFragment result = new ProgressDialogFragment();
   Bundle args = new Bundle();
   args.putCharSequence("title", title);
   args.putCharSequence("message", message);
   args.putBoolean("spinner", spinner);
   args.putString("number-format", progressNumberFormat);
   args.putSerializable("percent-format", progressPercentFormat);
   result.setArguments(args);
   return result;
 }
コード例 #11
0
  @Override
  public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "Entrada: " + intent.getAction());

    if (SMS_RECEIVED.equalsIgnoreCase(intent.getAction())) {

      Log.i(TAG, "ACCION: " + intent.getAction());
      Bundle bundle = intent.getExtras();

      if (bundle != null) {
        Object[] pdus = (Object[]) bundle.get("pdus");
        final SmsMessage[] messages = new SmsMessage[pdus.length];
        for (int i = 0; i < pdus.length; i++) {
          messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
        }
        if (messages.length > -1) {
          Log.i(TAG, "Recibido: " + messages[0].getMessageBody());
        }

        Intent intentParameters = new Intent(context, ServiceExecutor.class);
        Bundle bundleData = new Bundle();
        bundle.putCharSequence("Command", "command");
        bundle.putInt("Integer", 25);
        intentParameters.putExtras(bundle);
        context.startService(intentParameters);
      }
    }
  }
コード例 #12
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // Save the selected primary item and the title
    outState.putInt(ARGS_SELECTED_POSITION, mCurrentSelectedPosition);
    outState.putCharSequence(ARGS_TITLE, mTitle);
  }
コード例 #13
0
 /**
  * Set text to render
  *
  * @param raw
  * @param repo
  */
 public void setText(final String raw, final Repo repo) {
   Bundle args = new Bundle();
   args.putCharSequence(ARG_TEXT, raw);
   if (repo instanceof Serializable) args.putParcelable(ARG_REPO, repo);
   getLoaderManager().restartLoader(0, args, this);
   Keyboard.hideSoftInput(bodyText);
   showLoading(true);
 }
コード例 #14
0
ファイル: FloatLabelLayout.java プロジェクト: EnriqueRE/wui
 @Override
 protected Parcelable onSaveInstanceState() {
   Bundle bundle = new Bundle();
   bundle.putParcelable(SAVED_SUPER_STATE, super.onSaveInstanceState());
   bundle.putInt(SAVED_LABEL_VISIBILITY, mLabel.getVisibility());
   bundle.putCharSequence(SAVED_HINT, mHint);
   return bundle;
 }
コード例 #15
0
  /**
   * 获取Fragment实例
   *
   * @param title Fragment的菜单项
   * @param list Fragment的菜单列表
   */
  public static ItemFragment newInstance(String title, ArrayList<Merchants> list) {

    Bundle args = new Bundle();
    args.putCharSequence(KEY_TITLE, title);
    args.putParcelableArrayList(KEY_LIST, list);
    ItemFragment fragment = new ItemFragment();
    fragment.setArguments(args);
    return fragment;
  }
コード例 #16
0
  private void loadMarkdown() {
    ViewUtils.setGone(loadingBar, false);
    ViewUtils.setGone(codeView, true);

    String markdown = new String(EncodingUtils.fromBase64(blob.getContent()));
    Bundle args = new Bundle();
    args.putCharSequence(ARG_TEXT, markdown);
    args.putSerializable(ARG_REPO, repo);
    getSupportLoaderManager().restartLoader(0, args, this);
  }
コード例 #17
0
  private void loadMarkdown() {
    ViewUtils.setGone(loadingBar, false);
    ViewUtils.setGone(codeView, true);

    String markdown = new String(Base64.decode(blob.content, Base64.DEFAULT));
    Bundle args = new Bundle();
    args.putCharSequence(ARG_TEXT, markdown);
    args.putParcelable(ARG_REPO, repo);
    getSupportLoaderManager().restartLoader(0, args, this);
  }
コード例 #18
0
 @Override
 public void onLoaded(WeatherForecast result) {
   if (!result.isSuccessed()) {
     Bundle data = new Bundle();
     data.putCharSequence(ErrorActivity.ERROR_DESCRIPTION, getString(R.string.no_cache));
     NavigationService.navigate(ForecastPageActivity.this, ErrorActivity.class);
     finish();
   }
   updateWeatherInfo(result);
 }
コード例 #19
0
 /**
  * Populate an intent object with the results gathered from remote input. This method should only
  * be called by remote input collection services when sending results to a pending intent.
  *
  * @param remoteInputs The remote inputs for which results are being provided
  * @param intent The intent to add remote inputs to. The {@link ClipData} field of the intent will
  *     be modified to contain the results.
  * @param results A bundle holding the remote input results. This bundle should be populated with
  *     keys matching the result keys specified in {@code remoteInputs} with values being the
  *     result per key.
  */
 public static void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, Bundle results) {
   Bundle resultsBundle = new Bundle();
   for (RemoteInput remoteInput : remoteInputs) {
     Object result = results.get(remoteInput.getResultKey());
     if (result instanceof CharSequence) {
       resultsBundle.putCharSequence(remoteInput.getResultKey(), (CharSequence) result);
     }
   }
   Intent clipIntent = new Intent();
   clipIntent.putExtra(EXTRA_RESULTS_DATA, resultsBundle);
   intent.setClipData(ClipData.newIntent(RESULTS_CLIP_LABEL, clipIntent));
 }
 /**
  * Constructs a new instance with the specified parameters. The parameters passed this way survive
  * recreation of the fragment due to orientation changes etc.
  *
  * @param emailAddress the email address to preset (null for none)
  * @param userName the user name to preset (null for none)
  * @param queryOnSuccess a query to run on successful signup (this is used for example if a query
  *     fails due to insufficient credentials and needs to be repeated once logged in) or null
  * @param queryOnSuccessCompletion a completion callback to go hand in hand with {@code
  *     queryOnSuccess} or null
  * @param queryError the error resulting from {@code queryOnSuccess} if it was run before
  * @return the fragment with the given parameters (if any)
  */
 public static SignUpDialogFragment newInstance(
     CharSequence emailAddress,
     CharSequence userName,
     PLYAndroid.Query queryOnSuccess,
     PLYCompletion queryOnSuccessCompletion,
     PLYAndroid.QueryError queryError) {
   SignUpDialogFragment signUpDialogFragment = new SignUpDialogFragment();
   Bundle args = new Bundle();
   if (emailAddress != null) {
     args.putCharSequence(KEY_EMAIL_ADDRESS, emailAddress);
   }
   if (userName != null) {
     args.putCharSequence(KEY_USERNAME, userName);
   }
   if (emailAddress != null || userName != null) {
     signUpDialogFragment.setArguments(args);
   }
   // any query to automatically run on successful login will not survive app restarts
   signUpDialogFragment.queryOnSuccess = queryOnSuccess;
   signUpDialogFragment.queryOnSuccessCompletion = queryOnSuccessCompletion;
   signUpDialogFragment.queryError = queryError;
   return signUpDialogFragment;
 }
コード例 #21
0
 /**
  * Display a confirmation message asking for cancel or ok.
  *
  * @param activity the current activity
  * @param listener The listener waiting for the response
  * @param buttonResource the display on the positive button
  * @param messageResource the confirmation message
  * @param args arguments for the confirmation message
  */
 public static void displayConfirmationMessage(
     @NonNull final Activity activity,
     final ConfirmDialogListener listener,
     final int buttonResource,
     final int messageResource,
     final Object... args) {
   String message = String.format(activity.getString(messageResource), args);
   Bundle bundle = new Bundle();
   bundle.putCharSequence(PARAM_MESSAGE, message);
   bundle.putInt(PARAM_BUTTON_RESOURCE, buttonResource);
   bundle.putSerializable(PARAM_LISTENER, listener);
   ConfirmDialogFragment fragment = new ConfirmDialogFragment();
   fragment.setArguments(bundle);
   fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
 }
 private void handleDisplayMagnificationPreferenceScreenClick() {
   Bundle extras = mDisplayMagnificationPreferenceScreen.getExtras();
   extras.putString(EXTRA_TITLE, getString(R.string.accessibility_screen_magnification_title));
   extras.putCharSequence(
       EXTRA_SUMMARY,
       getActivity().getResources().getText(R.string.accessibility_screen_magnification_summary));
   extras.putBoolean(
       EXTRA_CHECKED,
       Settings.Secure.getInt(
               getContentResolver(),
               Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
               0)
           == 1);
   super.onPreferenceTreeClick(
       mDisplayMagnificationPreferenceScreen, mDisplayMagnificationPreferenceScreen);
 }
コード例 #23
0
 /**
  * Display an information message and go back to the current activity.
  *
  * @param activity the current activity
  * @param listener an optional listener waiting for the dialog response. If a listener is given,
  *     then the dialog will not be automatically recreated on orientation change!
  * @param resource the message resource
  * @param args arguments for the error message
  */
 public static void displayInfo(
     @NonNull final Activity activity,
     @Nullable final MessageDialogListener listener,
     final int resource,
     final Object... args) {
   String message = String.format(activity.getString(resource), args);
   Bundle bundle = new Bundle();
   bundle.putCharSequence(PARAM_MESSAGE, message);
   bundle.putString(PARAM_TITLE, activity.getString(R.string.title_dialog_info));
   bundle.putInt(PARAM_ICON, R.drawable.ic_title_info);
   if (listener != null) {
     bundle.putSerializable(PARAM_LISTENER, listener);
   }
   DialogFragment fragment = new DisplayMessageDialogFragment();
   fragment.setArguments(bundle);
   fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
 }
コード例 #24
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   outState.putCharSequence(KEY_TITLE, getTitle());
   outState.putCharSequence(KEY_CONTENT, getContent());
 }
コード例 #25
0
 public void onSaveInstanceState(Bundle outState) {
   outState.putCharSequence("undo_message", mUndoMessage);
   outState.putParcelable("undo_token", mUndoToken);
 }
コード例 #26
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
   outState.putCharSequence(STATE_TITLE, mTitle);
 }
コード例 #27
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putCharSequence("root", parentItem);
 }
コード例 #28
0
ファイル: luy.java プロジェクト: ChiangC/FMTech
 public final void e(Bundle paramBundle) {
   paramBundle.putCharSequence("text_value", this.Z.getText());
 }
コード例 #29
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   // save data so that fragment can restore the previous state
   outState.putCharSequence(OVERVIEW_KEY, mOverview.getText());
   super.onSaveInstanceState(outState);
 }
コード例 #30
0
 public Bundle getCurrentState() {
   Bundle state = new Bundle();
   state.putCharSequence("label_number", label_number.getText());
   return state;
 }