Java Code Examples for android.os.Bundle#putIntegerArrayList()

The following examples show how to use android.os.Bundle#putIntegerArrayList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReadingActivity.java    From IslamicLibraryAndroid with GNU General Public License v3.0 6 votes vote down vote up
private void startLocalSearch(String SearchQuery) {
    Bundle bundle = new Bundle();
    bundle.putBoolean(ARG_IS_GLOBAL_SEARCH, false);
    ArrayList<Integer> bookIds = new ArrayList<>();
    bookIds.add(bookId);
    bundle.putIntegerArrayList(SearchResultFragment.ARG_SEARCHABLE_BOOKS, bookIds);
    bundle.putString(SearchManager.QUERY, SearchQuery);
    Fragment searchResultFragment = SearchResultFragment.newInstance(bundle);
    getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.search_result_fragment_containerr, searchResultFragment, SEARCH_FRAGMENT_TAG)
            .hide(searchResultFragment)
            .addToBackStack(ADD_SEARCH_FRAGMENT_BACK_STACK_ENTRY)
            .commit()
    ;

    getSupportFragmentManager()
            .beginTransaction()
            .show(searchResultFragment)
            .addToBackStack(SHOW_SEARCH_FRAGMENT_BACKSTACK_ENTRY)
            .commit();

}
 
Example 2
Source File: SelectDeviceDialog.java    From EFRConnect-android with Apache License 2.0 6 votes vote down vote up
public static SelectDeviceDialog newDialog(int titleInfo, int descriptionInfo, List<Pair<Integer, Integer>> profilesInfo, BlueToothService.GattConnectType connectType) {
    SelectDeviceDialog dialog = new SelectDeviceDialog();

    Bundle args = new Bundle();
    args.putInt(TITLE_INFO, titleInfo);
    args.putInt(DESC_INFO, descriptionInfo);

    ArrayList<Integer> profilesInfoList = new ArrayList<>();
    if (profilesInfo != null) {
        for (Pair<Integer, Integer> profileInfo : profilesInfo) {
            profilesInfoList.add(profileInfo.first);
            profilesInfoList.add(profileInfo.second);
        }
    }
    args.putIntegerArrayList(PROFILES_INFO, profilesInfoList);
    if (connectType != null) {
        args.putInt(CONN_TYPE_INFO, connectType.ordinal());
    }

    dialog.setArguments(args);
    return dialog;
}
 
Example 3
Source File: SelectDeviceDialog.java    From EFRConnect-android with Apache License 2.0 6 votes vote down vote up
public static SelectDeviceDialog newDialog(int titleInfo, int descriptionInfo, List<Pair<Integer, Integer>> profilesInfo, BlueToothService.GattConnectType connectType) {
    SelectDeviceDialog dialog = new SelectDeviceDialog();

    Bundle args = new Bundle();
    args.putInt(TITLE_INFO, titleInfo);
    args.putInt(DESC_INFO, descriptionInfo);

    ArrayList<Integer> profilesInfoList = new ArrayList<>();
    if (profilesInfo != null) {
        for (Pair<Integer, Integer> profileInfo : profilesInfo) {
            profilesInfoList.add(profileInfo.first);
            profilesInfoList.add(profileInfo.second);
        }
    }
    args.putIntegerArrayList(PROFILES_INFO, profilesInfoList);
    if (connectType != null) {
        args.putInt(CONN_TYPE_INFO, connectType.ordinal());
    }

    dialog.setArguments(args);
    return dialog;
}
 
Example 4
Source File: SelectableAdapter.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
/**
 * Saves the state of the current selection on the items.
 *
 * @param outState Current state
 * @since 1.0.0
 */
public void onSaveInstanceState(Bundle outState) {
    outState.putIntegerArrayList(TAG, new ArrayList<>(mSelectedPositions));
    if (getSelectedItemCount() > 0) {
        log.d("Saving selection %s", mSelectedPositions);
    }
}
 
Example 5
Source File: SwitchTimePicker.java    From Android-SwitchDateTimePicker with Apache License 2.0 5 votes vote down vote up
/**
 * Save elements for view
 * @param outState
 */
public void onSaveInstanceState(Bundle outState) {
    if (mTimePicker != null) {
        outState.putInt(KEY_HOUR_OF_DAY, mTimePicker.getHours());
        outState.putInt(KEY_MINUTE, mTimePicker.getMinutes());
        outState.putBoolean(KEY_IS_24_HOUR_VIEW, mIs24HourMode);
        outState.putBoolean(KEY_HIGHLIGHT_SELECTED_AM_PM_VIEW, mHighlightAMPMSelection);
        outState.putInt(KEY_CURRENT_ITEM_SHOWING, mTimePicker.getCurrentItemShowing());
        outState.putBoolean(KEY_IN_KB_MODE, mInKbMode);
        if (mInKbMode) {
            outState.putIntegerArrayList(KEY_TYPED_TIMES, mTypedTimes);
        }
        outState.putBoolean(KEY_VIBRATE, mVibrate);
    }
}
 
Example 6
Source File: PhotoGallery.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = (Bundle) super.onSaveInstanceState();
    if (bundle != null)
        bundle.putIntegerArrayList(BUNDLE_DELETED_IMAGES, new ArrayList<>(getDeletedAttaches()));
    return bundle;
}
 
Example 7
Source File: ChooseLayerDialog.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState)
{
    ArrayList<Integer> ids = new ArrayList<>();
    for (ILayer layer : mLayers) {
        ids.add(layer.getId());
    }
    outState.putIntegerArrayList(KEY_LAYERS_IDS, ids);
    outState.putInt(KEY_CODE, mCode);
    super.onSaveInstanceState(outState);
}
 
Example 8
Source File: FieldSelector.java    From android-places-demos with Apache License 2.0 5 votes vote down vote up
public void onSaveInstanceState(@NonNull Bundle bundle) {
  List<Field> fields = getSelectedFields();

  ArrayList<Integer> serializedFields = new ArrayList<>();
  for (Field field : fields) {
    serializedFields.add(field.ordinal());
  }
  bundle.putIntegerArrayList(SELECTED_PLACE_FIELDS_KEY, serializedFields);
}
 
Example 9
Source File: RingtonePickerDialog.java    From android-ringtone-picker with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create and display the {@link RingtonePickerDialog}.
 *
 * @param fragmentManager    Support {@link FragmentManager}.
 * @param title              Title of the dialog.
 * @param positiveButtonText Title for the positive button.
 * @param negativeButtonText Title for the negative button.
 * @param ringtoneTypes      {@link java.util.List} of the {@link RingtoneTypes} to display.
 * @param currentUri         Current ringtone {@link Uri}.
 * @param listener           {@link RingtonePickerListener} to get notify when new ringtone is
 *                           selected.
 * @param isPlaySample       True if the dialog should play sample ringtone else false.
 */
private static void launchRingtonePicker(@NonNull final FragmentManager fragmentManager,
                                         @Nullable final String title,
                                         @NonNull final String positiveButtonText,
                                         @Nullable final String negativeButtonText,
                                         @NonNull final ArrayList<Integer> ringtoneTypes,
                                         @Nullable final String currentUri,
                                         @NonNull final RingtonePickerListener listener,
                                         final boolean isPlaySample,
                                         final boolean isDisplayDefault,
                                         final boolean isDisplaySilent) {

    // Prepare arguments bundle
    Bundle bundle = new Bundle();
    bundle.putString(ARG_DIALOG_TITLE, title);
    bundle.putString(ARG_DIALOG_POSITIVE, positiveButtonText);
    bundle.putString(ARG_DIALOG_NEGATIVE, negativeButtonText);
    bundle.putIntegerArrayList(ARG_RINGTONE_TYPES, ringtoneTypes);
    bundle.putString(ARG_CURRENT_URI, currentUri);
    bundle.putBoolean(ARG_IS_PLAY, isPlaySample);
    bundle.putBoolean(ARG_IS_DISPLAY_DEFAULT, isDisplayDefault);
    bundle.putBoolean(ARG_IS_DISPLAY_SILENT, isDisplaySilent);
    bundle.putSerializable(ARG_LISTENER, listener);

    RingtonePickerDialog ringtonePickerDialog = new RingtonePickerDialog();
    ringtonePickerDialog.setRetainInstance(true);
    ringtonePickerDialog.setArguments(bundle);
    ringtonePickerDialog.show(fragmentManager, RingtonePickerDialog.class.getSimpleName());
}
 
Example 10
Source File: RxPresenter.java    From nucleus with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@CallSuper
@Override
protected void onSave(Bundle state) {
    for (int i = requested.size() - 1; i >= 0; i--) {
        int restartableId = requested.get(i);
        Subscription subscription = restartableSubscriptions.get(restartableId);
        if (subscription != null && subscription.isUnsubscribed())
            requested.remove(i);
    }
    state.putIntegerArrayList(REQUESTED_KEY, requested);
}
 
Example 11
Source File: LicenseFragmentBase.java    From Android-License-Fragment with Apache License 2.0 4 votes vote down vote up
protected static LicenseFragmentBase onNewInstance(LicenseFragmentBase fragment, int[] licenseIDs) {
    Bundle bundle = new Bundle();
    bundle.putIntegerArrayList(ARG_LICENSE_IDS, ArrayManager.asIntegerArrayList(licenseIDs));
    fragment.setArguments(bundle);
    return fragment;
}
 
Example 12
Source File: ActivityOptionsCompatICS.java    From ActivityOptionsICS with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 将各种坐标和参数放入bundle中传递
 * 
    * Returns the created options as a Bundle, which can be passed to
    * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
    * Context.startActivity(Intent, Bundle)} and related methods.
    * Note that the returned Bundle is still owned by the ActivityOptions
    * object; you must not modify it, but can supply it to the startActivity
    * methods that take an options Bundle.
    */
public Bundle toBundle() {
	if (mAnimationType == ANIM_DEFAULT) {
           return null;
       }
	Bundle bundle = new Bundle();
       bundle.putInt(KEY_ANIM_TYPE, mAnimationType);
       switch (mAnimationType) {
       
           case ANIM_CUSTOM:
           	bundle.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId);
               bundle.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId);
               break;
               
           case ANIM_SCALE_UP:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
       		
       		bundle.putInt(KEY_ANIM_WIDTH, mWidth);
       		bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
       		bundle.putInt(KEY_ANIM_START_X, mStartX);
       		bundle.putInt(KEY_ANIM_START_Y, mStartY);
               break;
               
           case ANIM_THUMBNAIL_SCALE_UP:
           	bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
           	bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
               bundle.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail);
               bundle.putInt(KEY_ANIM_START_X, mStartX);
               bundle.putInt(KEY_ANIM_START_Y, mStartY);
               bundle.putInt(KEY_ANIM_WIDTH, mWidth);
               bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
               break;
               
           case ANIM_SCENE_TRANSITION:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
       		
       		bundle.putBooleanArray(kEY_IS_IN_THE_SCREEN_ARR, mIsInTheScreenArr);
       		bundle.putIntegerArrayList(kEY_SHARED_ELEMENT_ID_LIST, mSharedElementIds);
       		bundle.putParcelableArrayList(kEY_SHARED_ELEMENT_BOUNDS_LIST, mSharedElementBounds);
               break;
       }

	return bundle;
}
 
Example 13
Source File: MainActivity.java    From UpdatableFragmentStatePagerAdapter with Apache License 2.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putIntegerArrayList("dataset", sDataSet);
}
 
Example 14
Source File: MainActivity.java    From MultiLevelExpandableIndentableListView with MIT License 4 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putIntegerArrayList(GROUPS_KEY, mAdapter.saveGroups());
    super.onSaveInstanceState(outState);
}
 
Example 15
Source File: XYGraph.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putIntegerArrayList("arrayList", mPercentages);
    return super.onSaveInstanceState();
}
 
Example 16
Source File: XYGraph.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putIntegerArrayList("arrayList", mPercentages);
    return super.onSaveInstanceState();
}
 
Example 17
Source File: ActivityOptionsCompatICS.java    From AndroidStudyDemo with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 将各种坐标和参数放入bundle中传递
 * 
    * Returns the created options as a Bundle, which can be passed to
    * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
    * Context.startActivity(Intent, Bundle)} and related methods.
    * Note that the returned Bundle is still owned by the ActivityOptions
    * object; you must not modify it, but can supply it to the startActivity
    * methods that take an options Bundle.
    */
public Bundle toBundle() {
	if (mAnimationType == ANIM_DEFAULT) {
           return null;
       }
	Bundle bundle = new Bundle();
       bundle.putInt(KEY_ANIM_TYPE, mAnimationType);
       switch (mAnimationType) {
       
           case ANIM_CUSTOM:
           	bundle.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId);
               bundle.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId);
               break;
               
           case ANIM_SCALE_UP:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
       		
       		bundle.putInt(KEY_ANIM_WIDTH, mWidth);
       		bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
       		bundle.putInt(KEY_ANIM_START_X, mStartX);
       		bundle.putInt(KEY_ANIM_START_Y, mStartY);
               break;
               
           case ANIM_THUMBNAIL_SCALE_UP:
           	bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
           	bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
               bundle.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail);
               bundle.putInt(KEY_ANIM_START_X, mStartX);
               bundle.putInt(KEY_ANIM_START_Y, mStartY);
               bundle.putInt(KEY_ANIM_WIDTH, mWidth);
               bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
               break;
               
           case ANIM_SCENE_TRANSITION:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
       		
       		bundle.putBooleanArray(kEY_IS_IN_THE_SCREEN_ARR, mIsInTheScreenArr);
       		bundle.putIntegerArrayList(kEY_SHARED_ELEMENT_ID_LIST, mSharedElementIds);
       		bundle.putParcelableArrayList(kEY_SHARED_ELEMENT_BOUNDS_LIST, mSharedElementBounds);
               break;
       }

	return bundle;
}
 
Example 18
Source File: LicenseFragmentBase.java    From Android-License-Fragment with Apache License 2.0 4 votes vote down vote up
protected static LicenseFragmentBase onNewInstance(LicenseFragmentBase fragment, ArrayList<Integer> licenseIDs) {
    Bundle bundle = new Bundle();
    bundle.putIntegerArrayList(ARG_LICENSE_IDS, licenseIDs);
    fragment.setArguments(bundle);
    return fragment;
}
 
Example 19
Source File: LabelsView.java    From LabelsView with Apache License 2.0 4 votes vote down vote up
@Override
    protected Parcelable onSaveInstanceState() {

        Bundle bundle = new Bundle();
        //保存父类的信息
        bundle.putParcelable(KEY_SUPER_STATE, super.onSaveInstanceState());
        //保存标签文字颜色
        if (mTextColor != null) {
            bundle.putParcelable(KEY_TEXT_COLOR_STATE, mTextColor);
        }
        //保存标签文字大小
        bundle.putFloat(KEY_TEXT_SIZE_STATE, mTextSize);
        //保存标签背景 (由于背景改用Drawable,所以不能自动保存和恢复)
//        bundle.putInt(KEY_BG_RES_ID_STATE, mLabelBgResId);
        //保存标签宽高
        bundle.putInt(KEY_LABEL_WIDTH_STATE, mLabelWidth);
        bundle.putInt(KEY_LABEL_HEIGHT_STATE, mLabelHeight);
        //保存标签方向
        bundle.putInt(KEY_LABEL_GRAVITY_STATE, mLabelGravity);
        //保存标签内边距
        bundle.putIntArray(KEY_PADDING_STATE, new int[]{mTextPaddingLeft, mTextPaddingTop,
                mTextPaddingRight, mTextPaddingBottom});
        //保存标签间隔
        bundle.putInt(KEY_WORD_MARGIN_STATE, mWordMargin);
        //保存行间隔
        bundle.putInt(KEY_LINE_MARGIN_STATE, mLineMargin);
        //保存标签的选择类型
        bundle.putInt(KEY_SELECT_TYPE_STATE, mSelectType.value);
        //保存标签的最大选择数量
        bundle.putInt(KEY_MAX_SELECT_STATE, mMaxSelect);
        //保存标签的最少选择数量
        bundle.putInt(KEY_MIN_SELECT_STATE, mMinSelect);
        //保存标签的最大行数
        bundle.putInt(KEY_MAX_LINES_STATE, mMaxLines);
        //保存是否是指示器模式
        bundle.putBoolean(KEY_INDICATOR_STATE, isIndicator);

        //保存标签列表
//        if (!mLabels.isEmpty()) {
//            bundle.putStringArrayList(KEY_LABELS_STATE, mLabels);
//        }
        //保存已选择的标签列表
        if (!mSelectLabels.isEmpty()) {
            bundle.putIntegerArrayList(KEY_SELECT_LABELS_STATE, mSelectLabels);
        }

        //保存必选项列表
        if (!mCompulsorys.isEmpty()) {
            bundle.putIntegerArrayList(KEY_COMPULSORY_LABELS_STATE, mCompulsorys);
        }

        bundle.putBoolean(KEY_SINGLE_LINE_STATE, isSingleLine);

        return bundle;
    }
 
Example 20
Source File: DataMap.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
public Bundle toBundle() {
    Bundle bundle = new Bundle();
    for (String key : data.keySet()) {
        switch (types.get(key)) {
            case Asset:
                bundle.putParcelable(key, (Asset) data.get(key));
                break;
            case Boolean:
                bundle.putBoolean(key, (Boolean) data.get(key));
                break;
            case Byte:
                bundle.putByte(key, (Byte) data.get(key));
                break;
            case ByteArray:
                bundle.putByteArray(key, (byte[]) data.get(key));
                break;
            case DataMap:
                bundle.putBundle(key, ((DataMap) data.get(key)).toBundle());
                break;
            case DataMapArrayList:
                ArrayList<Bundle> bundles = new ArrayList<Bundle>();
                for (DataMap dataMap : ((ArrayList<DataMap>) data.get(key))) {
                    bundles.add(dataMap.toBundle());
                }
                bundle.putParcelableArrayList(key, bundles);
                break;
            case Double:
                bundle.putDouble(key, (Double) data.get(key));
                break;
            case Float:
                bundle.putFloat(key, (Float) data.get(key));
                break;
            case FloatArray:
                bundle.putFloatArray(key, (float[]) data.get(key));
                break;
            case Integer:
                bundle.putInt(key, (Integer) data.get(key));
                break;
            case IntegerArrayList:
                bundle.putIntegerArrayList(key, (ArrayList<Integer>) data.get(key));
                break;
            case Long:
                bundle.putLong(key, (Long) data.get(key));
                break;
            case LongArray:
                bundle.putLongArray(key, (long[]) data.get(key));
                break;
            case String:
                bundle.putString(key, (String) data.get(key));
                break;
            case StringArray:
                bundle.putStringArray(key, (String[]) data.get(key));
                break;
            case StringArrayList:
                bundle.putStringArrayList(key, (ArrayList<String>) data.get(key));
                break;
        }
    }
    return bundle;
}