Java Code Examples for android.os.Bundle.putCharSequenceArray()

The following are Jave code examples for showing how to use putCharSequenceArray() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: boohee_v5.6   File: RemoteInputCompatJellybean.java   View Source Code Vote up 5 votes
static Bundle toBundle(RemoteInput remoteInput) {
    Bundle data = new Bundle();
    data.putString(KEY_RESULT_KEY, remoteInput.getResultKey());
    data.putCharSequence(KEY_LABEL, remoteInput.getLabel());
    data.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices());
    data.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput());
    data.putBundle(KEY_EXTRAS, remoteInput.getExtras());
    return data;
}
 
Example 2
Project: GitHub   File: Injector.java   View Source Code Vote up 4 votes
public void putCharSequenceArray(Bundle state, String key, CharSequence[] x) {
    state.putCharSequenceArray(key + baseKey, x);
}
 
Example 3
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 4 votes
public void putCharSequenceArray(Bundle state, String key, CharSequence[] x) {
    state.putCharSequenceArray(key + mBaseKey, x);
}
 
Example 4
Project: react-native-alert   File: DialogModule.java   View Source Code Vote up 4 votes
@ReactMethod
public void showAlert(
    ReadableMap options,
    Callback errorCallback,
    Callback actionCallback) {
    System.out.println("Pilipa Alert Module showAlert");

  FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
  if (fragmentManagerHelper == null) {
    errorCallback.invoke("Tried to show an alert while not attached to an Activity");
    return;
  }

  final Bundle args = new Bundle();
  if (options.hasKey(KEY_TITLE)) {
    args.putString(AlertFragment.ARG_TITLE, options.getString(KEY_TITLE));
  }
  if (options.hasKey(KEY_MESSAGE)) {
    args.putString(AlertFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE));
  }
  if (options.hasKey(KEY_BUTTON_POSITIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEGATIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEUTRAL)) {
    args.putString(AlertFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL));
  }
  if (options.hasKey(KEY_ITEMS)) {
    ReadableArray items = options.getArray(KEY_ITEMS);
    CharSequence[] itemsArray = new CharSequence[items.size()];
    for (int i = 0; i < items.size(); i ++) {
      itemsArray[i] = items.getString(i);
    }
    args.putCharSequenceArray(AlertFragment.ARG_ITEMS, itemsArray);
  }
  if (options.hasKey(KEY_CANCELABLE)) {
    args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE));
  }

  fragmentManagerHelper.showNewAlert(mIsInForeground, args, actionCallback);
}
 
Example 5
Project: prada   File: UploadAgent.java   View Source Code Vote up 4 votes
protected Bundle GenerateUploadBundle(String folderName, HashMap<String, Long> files, String serviceClassName){
    Bundle data = new Bundle();
    data.putString(UPLOAD_FOLDER, folderName);
    if (files != null) {
        UploadLogDBHelper dbHelper = new UploadLogDBHelper(getApplicationContext());
         Iterator<String> fileIT = files.keySet().iterator();
         int uploadNum = files.size();
         CharSequence[] fileNameArr = new CharSequence[uploadNum];
         boolean[] uploadTypeArr = new boolean[uploadNum];
         boolean[] isResendArr = new boolean[uploadNum];
         long[] sizeArr = new long[uploadNum];
         String fileName = "";
         long fileSize = 0L;
         int idx = 0;
         //boolean isForceUpload = false;
         FileInfo fileInfo = null;
         while(fileIT.hasNext()) {
             fileName = fileIT.next();
             fileSize = files.get(fileName);
             fileNameArr[idx] = fileName;
             sizeArr[idx] = fileSize;
             try{
                synchronized(mDBLock) {
                   fileInfo = dbHelper.getFileInfo(fileName);
                }
               Log.i(TAG, "GenerateUploadBundle: getFileInfo(" + fileName + ")= isForceUpload: " + fileInfo.isForceUpload + " isResend: " + fileInfo.isResend);
             } catch(Exception ex) {
                 Log.i(TAG, "GenerateUploadBundle: Exception Happen when isForceUploadFile(" + fileName + ") Msg: " + ex.toString());
                 fileInfo = new FileInfo();
             }
             uploadTypeArr[idx] = fileInfo.isForceUpload;
             isResendArr[idx] = fileInfo.isResend;
             idx ++;
         }
        if(dbHelper != null){
           dbHelper.close();
        }
        data.putCharSequenceArray(UPLOAD_FILE_NAMES, fileNameArr);
        data.putLongArray(UPLOAD_SIZES, sizeArr);
        data.putString(UPLOAD_AGENT_PACKAGE, this.getApplicationContext().getPackageName());
        data.putString(UPLOAD_AGENT, serviceClassName);
        data.putBooleanArray(UPLOAD_IS_FORCE_UPLOAD_TYPE, uploadTypeArr);
        data.putBooleanArray(UPLOAD_IS_RESEND_TYPE, isResendArr);
    }

    return data;
}
 
Example 6
Project: MagicBox   File: CharSequenceArrayWriter.java   View Source Code Vote up 4 votes
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
    Field propertyField = field.getField();
    propertyField.setAccessible(true);
    bundle.putCharSequenceArray(field.getBundleKey(), (CharSequence[]) propertyField.get(to));
}
 
Example 7
Project: RNLearn_Project1   File: DialogModule.java   View Source Code Vote up 4 votes
@ReactMethod
public void showAlert(
    ReadableMap options,
    Callback errorCallback,
    Callback actionCallback) {
  FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
  if (fragmentManagerHelper == null) {
    errorCallback.invoke("Tried to show an alert while not attached to an Activity");
    return;
  }

  final Bundle args = new Bundle();
  if (options.hasKey(KEY_TITLE)) {
    args.putString(AlertFragment.ARG_TITLE, options.getString(KEY_TITLE));
  }
  if (options.hasKey(KEY_MESSAGE)) {
    args.putString(AlertFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE));
  }
  if (options.hasKey(KEY_BUTTON_POSITIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEGATIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEUTRAL)) {
    args.putString(AlertFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL));
  }
  if (options.hasKey(KEY_ITEMS)) {
    ReadableArray items = options.getArray(KEY_ITEMS);
    CharSequence[] itemsArray = new CharSequence[items.size()];
    for (int i = 0; i < items.size(); i ++) {
      itemsArray[i] = items.getString(i);
    }
    args.putCharSequenceArray(AlertFragment.ARG_ITEMS, itemsArray);
  }
  if (options.hasKey(KEY_CANCELABLE)) {
    args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE));
  }

  fragmentManagerHelper.showNewAlert(mIsInForeground, args, actionCallback);
}
 
Example 8
Project: RNLearn_Project1   File: DialogModule.java   View Source Code Vote up 4 votes
@ReactMethod
public void showAlert(
    ReadableMap options,
    Callback errorCallback,
    Callback actionCallback) {
  FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
  if (fragmentManagerHelper == null) {
    errorCallback.invoke("Tried to show an alert while not attached to an Activity");
    return;
  }

  final Bundle args = new Bundle();
  if (options.hasKey(KEY_TITLE)) {
    args.putString(AlertFragment.ARG_TITLE, options.getString(KEY_TITLE));
  }
  if (options.hasKey(KEY_MESSAGE)) {
    args.putString(AlertFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE));
  }
  if (options.hasKey(KEY_BUTTON_POSITIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEGATIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEUTRAL)) {
    args.putString(AlertFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL));
  }
  if (options.hasKey(KEY_ITEMS)) {
    ReadableArray items = options.getArray(KEY_ITEMS);
    CharSequence[] itemsArray = new CharSequence[items.size()];
    for (int i = 0; i < items.size(); i ++) {
      itemsArray[i] = items.getString(i);
    }
    args.putCharSequenceArray(AlertFragment.ARG_ITEMS, itemsArray);
  }
  if (options.hasKey(KEY_CANCELABLE)) {
    args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE));
  }

  fragmentManagerHelper.showNewAlert(mIsInForeground, args, actionCallback);
}
 
Example 9
Project: Lyra   File: CharSequenceArrayCoder.java   View Source Code Vote up 2 votes
/**
 * Write a field's value into the saved state {@link Bundle}.
 *
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
 */
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull CharSequence[] fieldValue) {
    state.putCharSequenceArray(key, fieldValue);
}