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

The following are Jave code examples for showing how to use getIntArray() 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: NeoTerm   File: TabSwitcherModel.java   View Source Code Vote up 6 votes
@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);
    }
}
 
Example 2
Project: MyNotes   File: ColorPickerDialog.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments() != null) {
        mTitleResId = getArguments().getInt(KEY_TITLE_ID);
        mColumns = getArguments().getInt(KEY_COLUMNS);
        mSize = getArguments().getInt(KEY_SIZE);
    }

    if (savedInstanceState != null) {
        mColors = savedInstanceState.getIntArray(KEY_COLORS);
        mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR);
        mColorContentDescriptions = savedInstanceState.getStringArray(
                KEY_COLOR_CONTENT_DESCRIPTIONS);
    }
}
 
Example 3
Project: boohee_v5.6   File: PLA_AbsListView.java   View Source Code Vote up 6 votes
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        this.mDataChanged = true;
        this.mSyncHeight = (long) bundle.getInt("height");
        long firstId = bundle.getLong("firstId");
        if (firstId >= 0) {
            this.mNeedSync = true;
            SavedState ss = new SavedState();
            ss.firstId = firstId;
            ss.height = (int) this.mSyncHeight;
            ss.position = bundle.getInt(FriendShipActivity.FRIENDSHIP_POSITION);
            ss.viewTop = bundle.getInt("viewTop");
            ss.childCount = bundle.getInt("childCount");
            ss.viewTops = bundle.getIntArray("viewTops");
            this.mPendingSync = ss;
            this.mSyncRowId = ss.firstId;
            this.mSyncPosition = ss.position;
            this.mSpecificTop = ss.viewTop;
            this.mSpecificTops = ss.viewTops;
        }
        state = bundle.getParcelable("instanceState");
    }
    super.onRestoreInstanceState(state);
    requestLayout();
}
 
Example 4
Project: boohee_v5.6   File: ChartletFragment.java   View Source Code Vote up 5 votes
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        this.CHARTLET_RES_IDS = savedInstanceState.getIntArray(KEY_DRAWABLE_IDS);
        this.mThumbailIds = savedInstanceState.getIntArray(KEY_THUMBNAIL_DRAWABLE_IDS);
        this.CHARTLET_TEXTS = savedInstanceState.getStringArray(KEY_STRINGS);
        this.mUri = Uri.parse(savedInstanceState.getString(KEY_URI_STR));
    }
}
 
Example 5
Project: boohee_v5.6   File: ChartletFragment.java   View Source Code Vote up 5 votes
public void onAttach(Activity activity) {
    super.onAttach(activity);
    Bundle args = getArguments();
    if (args != null) {
        this.CHARTLET_RES_IDS = args.getIntArray(KEY_DRAWABLE_IDS);
        this.mThumbailIds = args.getIntArray(KEY_THUMBNAIL_DRAWABLE_IDS);
        this.CHARTLET_TEXTS = args.getStringArray(KEY_STRINGS);
        this.mUri = Uri.parse(args.getString(KEY_URI_STR));
    }
}
 
Example 6
Project: GravityBox   File: AutoBrightnessDialogPreference.java   View Source Code Vote up 5 votes
@Override
public void onReceiveResult(int resultCode, Bundle resultData) {
    if (resultCode == ModDisplay.RESULT_AUTOBRIGHTNESS_CONFIG) {
        mLuxArray = resultData.getIntArray("config_autoBrightnessLevels");
        mBrightnessArray = resultData.getIntArray("config_autoBrightnessLcdBacklightValues");
        saveConfig();
        setData();
    }
}
 
Example 7
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 8
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 9
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 10
Project: boohee_v5.6   File: FragmentActivity.java   View Source Code Vote up 5 votes
protected void onCreate(@Nullable Bundle savedInstanceState) {
    List list = null;
    this.mFragments.attachHost(null);
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        this.mFragments.restoreLoaderNonConfig(nc.loaders);
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        FragmentController fragmentController = this.mFragments;
        if (nc != null) {
            list = nc.fragments;
        }
        fragmentController.restoreAllState(p, list);
        if (savedInstanceState.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
            this.mNextCandidateRequestIndex = savedInstanceState.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
            int[] requestCodes = savedInstanceState.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
            String[] fragmentWhos = savedInstanceState.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
            if (requestCodes == null || fragmentWhos == null || requestCodes.length != fragmentWhos.length) {
                Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
            } else {
                this.mPendingFragmentActivityResults = new SparseArrayCompat(requestCodes.length);
                for (int i = 0; i < requestCodes.length; i++) {
                    this.mPendingFragmentActivityResults.put(requestCodes[i], fragmentWhos[i]);
                }
            }
        }
    }
    if (this.mPendingFragmentActivityResults == null) {
        this.mPendingFragmentActivityResults = new SparseArrayCompat();
        this.mNextCandidateRequestIndex = 0;
    }
    this.mFragments.dispatchCreate();
}
 
Example 11
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 12
Project: chromium-for-android-56-debug-video   File: IntentUtils.java   View Source Code Vote up 5 votes
/**
 * Just like {@link Bundle#getIntArray(String)} but doesn't throw exceptions.
 */
public static int[] safeGetIntArray(Bundle bundle, String name) {
    try {
        return bundle.getIntArray(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getIntArray failed on bundle " + bundle);
        return null;
    }
}
 
Example 13
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 14
Project: chromium-for-android-56-debug-video   File: ConfirmImportantSitesDialogFragment.java   View Source Code Vote up 5 votes
@Override
public void setArguments(Bundle args) {
    super.setArguments(args);
    mImportantDomains = args.getStringArray(IMPORTANT_DOMAINS_TAG);
    mFaviconURLs = args.getStringArray(FAVICON_URLS_TAG);
    int[] importantDomainReasons = args.getIntArray(IMPORTANT_DOMAIN_REASONS_TAG);
    for (int i = 0; i < mImportantDomains.length; ++i) {
        mImportantDomainsReasons.put(mImportantDomains[i], importantDomainReasons[i]);
        mCheckedState.put(mImportantDomains[i], true);
    }
}
 
Example 15
Project: FragmentRigger   File: SharedTargetFragment.java   View Source Code Vote up 5 votes
@Override
protected void init(Bundle savedInstanceState) {
  imageView = (ImageView) findViewById(R.id.fst_iv);
  Bundle args = savedInstanceState == null ? getArguments() : savedInstanceState;
  mType = args.getInt(BUNDLE_KEY);
  int iconId = 0;
  switch (mType) {
    case TYPE_HAMMER:
      iconId = R.drawable.hammer_h;
      break;
    case TYPE_HOURGLASS:
      iconId = R.drawable.hourglass_h;
      break;
    case TYPE_CLOUD:
      iconId = R.drawable.cloud_h;
      break;
    case TYPE_SEND:
      iconId = R.drawable.send_h;
      break;
  }
  //start transaction anim.
  preLocation = args.getIntArray(BUNDLE_KEY + 1);
  preSize = args.getIntArray(BUNDLE_KEY + 2);
  mStartValues = new Bundle();
  mStartValues.putInt(PROPNAME_WIDTH, preSize[0]);
  mStartValues.putInt(PROPNAME_HEIGHT, preSize[1]);
  mStartValues.putInt(PROPNAME_SCREENLOCATION_LEFT, preLocation[0]);
  mStartValues.putInt(PROPNAME_SCREENLOCATION_TOP, preLocation[1]);

  Picasso.with(mContext).load(iconId).into(imageView, new Callback() {
    @Override
    public void onSuccess() {
      onUiReady();
    }

    @Override
    public void onError() {
    }
  });
}
 
Example 16
Project: GitHub   File: Injector.java   View Source Code Vote up 4 votes
public int[] getIntArray(Bundle state, String key) {
    return state.getIntArray(key + baseKey);
}
 
Example 17
Project: GitHub   File: StaggeredGridLayoutHelper.java   View Source Code Vote up 4 votes
@Override
public void onRestoreInstanceState(Bundle bundle) {
    super.onRestoreInstanceState(bundle);
    mLazySpanLookup.mData = bundle.getIntArray(LOOKUP_BUNDLE_KEY);
}
 
Example 18
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 4 votes
public int[] getIntArray(Bundle state, String key) {
    return state.getIntArray(key + mBaseKey);
}
 
Example 19
Project: buildAPKsSamples   File: GameView.java   View Source Code Vote up 4 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {

    if (!(state instanceof Bundle)) {
        // Not supposed to happen.
        super.onRestoreInstanceState(state);
        return;
    }

    Bundle b = (Bundle) state;
    Parcelable superState = b.getParcelable("gv_super_state");

    setEnabled(b.getBoolean("gv_en", true));

    int[] data = b.getIntArray("gv_data");
    if (data != null && data.length == mData.length) {
        for (int i = 0; i < data.length; i++) {
            mData[i] = State.fromInt(data[i]);
        }
    }

    mSelectedCell = b.getInt("gv_sel_cell", -1);
    mSelectedValue = State.fromInt(b.getInt("gv_sel_val", State.EMPTY.getValue()));
    mCurrentPlayer = State.fromInt(b.getInt("gv_curr_play", State.EMPTY.getValue()));
    mWinner = State.fromInt(b.getInt("gv_winner", State.EMPTY.getValue()));

    mWinCol = b.getInt("gv_win_col", -1);
    mWinRow = b.getInt("gv_win_row", -1);
    mWinDiag = b.getInt("gv_win_diag", -1);

    mBlinkDisplayOff = b.getBoolean("gv_blink_off", false);
    Rect r = b.getParcelable("gv_blink_rect");
    if (r != null) {
        mBlinkRect.set(r);
    }

    // let the blink handler decide if it should blink or not
    mHandler.sendEmptyMessage(MSG_BLINK);

    super.onRestoreInstanceState(superState);
}
 
Example 20
Project: vlayout   File: StaggeredGridLayoutHelper.java   View Source Code Vote up 4 votes
@Override
public void onRestoreInstanceState(Bundle bundle) {
    super.onRestoreInstanceState(bundle);
    mLazySpanLookup.mData = bundle.getIntArray(LOOKUP_BUNDLE_KEY);
}