Example usage for android.os Bundle getIntArray

List of usage examples for android.os Bundle getIntArray

Introduction

In this page you can find the example usage for android.os Bundle getIntArray.

Prototype

@Nullable
public int[] getIntArray(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.nachiket.titan.LibraryPagerAdapter.java

@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    Bundle in = (Bundle) state;
    mPendingAlbumLimiter = (Limiter) in.getSerializable("limiter_albums");
    mPendingSongLimiter = (Limiter) in.getSerializable("limiter_songs");
    mPendingFileLimiter = (Limiter) in.getSerializable("limiter_files");
    mSavedPositions = in.getIntArray("pos");
}

From source file:org.dkf.jmule.activities.MainActivity.java

private void restoreFragmentsStack(Bundle savedInstanceState) {
    try {/*from ww w  .  j a  va  2s. c o  m*/
        int[] stack = savedInstanceState.getIntArray(FRAGMENTS_STACK_KEY);
        for (int id : stack) {
            fragmentsStack.push(id);
        }
    } catch (Exception ignored) {
    }
}

From source file:com.silentcircle.contacts.list.ScContactEntryListAdapter.java

/**
 * Updates the indexer, which is used to produce section headers.
 *///from   w w w. j a  v  a  2s .  c  o  m
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void updateIndexer(Cursor cursor) {
    if (cursor == null) {
        setIndexer(null);
        return;
    }
    Bundle bundle = cursor.getExtras();

    if (bundle == Bundle.EMPTY && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) // try the dirty trick
        bundle = mContext.getContentResolver().call(ScContactsContract.AUTHORITY_URI, "INDEX", null, null);

    if (bundle != null
            && bundle.containsKey(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES)) {
        String sections[] = bundle
                .getStringArray(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES);
        int counts[] = bundle.getIntArray(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS);
        setIndexer(new ContactsSectionIndexer(sections, counts));
    } else {
        setIndexer(null);
    }
}

From source file:com.ez.gallery.ucrop.UCropActivity.java

/**
 * This method extracts {@link com.ez.gallery.ucrop.UCrop.Options #optionsBundle} from incoming intent
 * and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
 *///  w w  w.  ja v  a 2  s .  c o m
@SuppressWarnings("deprecation")
private void processOptions(@NonNull Intent intent) {
    Bundle optionsBundle = intent.getBundleExtra(UCrop.EXTRA_OPTIONS);
    if (optionsBundle != null) {
        // Bitmap compression options
        String compressionFormatName = optionsBundle.getString(UCrop.Options.EXTRA_COMPRESSION_FORMAT_NAME);
        Bitmap.CompressFormat compressFormat = null;
        if (!TextUtils.isEmpty(compressionFormatName)) {
            compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName);
        }
        mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat;

        mCompressQuality = optionsBundle.getInt(UCrop.Options.EXTRA_COMPRESSION_QUALITY,
                UCropActivity.DEFAULT_COMPRESS_QUALITY);

        // Gestures options
        int[] allowedGestures = optionsBundle.getIntArray(UCrop.Options.EXTRA_ALLOWED_GESTURES);
        if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
            mAllowedGestures = allowedGestures;
        }

        // Crop image view options
        mGestureCropImageView.setMaxBitmapSize(optionsBundle.getInt(UCrop.Options.EXTRA_MAX_BITMAP_SIZE,
                CropImageView.DEFAULT_MAX_BITMAP_SIZE));
        mGestureCropImageView.setMaxScaleMultiplier(optionsBundle.getFloat(
                UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER));
        mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(
                optionsBundle.getInt(UCrop.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION,
                        CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION));

        // Overlay view options
        mOverlayView.setDimmedColor(optionsBundle.getInt(UCrop.Options.EXTRA_DIMMED_LAYER_COLOR,
                getResources().getColor(R.color.ucrop_color_default_dimmed)));
        mOverlayView.setOvalDimmedLayer(optionsBundle.getBoolean(UCrop.Options.EXTRA_OVAL_DIMMED_LAYER,
                OverlayView.DEFAULT_OVAL_DIMMED_LAYER));

        mOverlayView.setShowCropFrame(optionsBundle.getBoolean(UCrop.Options.EXTRA_SHOW_CROP_FRAME,
                OverlayView.DEFAULT_SHOW_CROP_FRAME));
        mOverlayView.setCropFrameColor(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_FRAME_COLOR,
                getResources().getColor(R.color.ucrop_color_default_crop_frame)));
        mOverlayView.setCropFrameStrokeWidth(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_FRAME_STROKE_WIDTH,
                getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width)));

        mOverlayView.setShowCropGrid(optionsBundle.getBoolean(UCrop.Options.EXTRA_SHOW_CROP_GRID,
                OverlayView.DEFAULT_SHOW_CROP_GRID));
        mOverlayView.setCropGridRowCount(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_GRID_ROW_COUNT,
                OverlayView.DEFAULT_CROP_GRID_ROW_COUNT));
        mOverlayView.setCropGridColumnCount(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_GRID_COLUMN_COUNT,
                OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT));
        mOverlayView.setCropGridColor(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_GRID_COLOR,
                getResources().getColor(R.color.ucrop_color_default_crop_grid)));
        mOverlayView.setCropGridStrokeWidth(optionsBundle.getInt(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH,
                getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width)));
    }
}

From source file:com.alibaba.android.layoutmanager.layoutmanager.StaggeredGridLayoutHelper.java

@Override
public void onRestoreInstanceState(Bundle bundle) {
    super.onRestoreInstanceState(bundle);
    mLazySpanLookup.mData = bundle.getIntArray(LOOKUP_BUNDLE_KEY);
}

From source file:com.hippo.ehviewer.ui.scene.FavoritesScene.java

private void onRestore(Bundle savedInstanceState) {
    mUrlBuilder = savedInstanceState.getParcelable(KEY_URL_BUILDER);
    if (mUrlBuilder == null) {
        mUrlBuilder = new FavListUrlBuilder();
    }/*from www.  j a  v a2  s  .  c om*/
    mSearchMode = savedInstanceState.getBoolean(KEY_SEARCH_MODE);
    mHasFirstRefresh = savedInstanceState.getBoolean(KEY_HAS_FIRST_REFRESH);
    mFavCountArray = savedInstanceState.getIntArray(KEY_FAV_COUNT_ARRAY);
}

From source file:com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.contactlist_fragment, container, false);
    ButterKnife.bind(this, view);

    setHasOptionsMenu(true);//from www .  ja v  a2  s.com

    ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();

    ActionBar actionBar = contactsPreferenceActivity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.actionbar_contacts_restore);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    contactsPreferenceActivity.setDrawerIndicatorEnabled(false);

    recyclerView = (RecyclerView) view.findViewById(R.id.contactlist_recyclerview);

    if (savedInstanceState == null) {
        contactListAdapter = new ContactListAdapter(getContext(), vCards);
    } else {
        Set<Integer> checkedItems = new HashSet<>();
        int[] itemsArray = savedInstanceState.getIntArray(CHECKED_ITEMS_ARRAY_KEY);
        for (int i = 0; i < itemsArray.length; i++) {
            checkedItems.add(itemsArray[i]);
        }
        if (checkedItems.size() > 0) {
            onMessageEvent(new VCardToggleEvent(true));
        }
        contactListAdapter = new ContactListAdapter(getContext(), vCards, checkedItems);
    }
    recyclerView.setAdapter(contactListAdapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

    ocFile = getArguments().getParcelable(FILE_NAME);
    setFile(ocFile);
    account = getArguments().getParcelable(ACCOUNT);

    if (!ocFile.isDown()) {
        Intent i = new Intent(getContext(), FileDownloader.class);
        i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
        i.putExtra(FileDownloader.EXTRA_FILE, ocFile);
        getContext().startService(i);

        // Listen for download messages
        IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage());
        downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
        DownloadFinishReceiver mDownloadFinishReceiver = new DownloadFinishReceiver();
        getContext().registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
    } else {
        loadContactsTask.execute();
    }

    restoreContacts.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (checkAndAskForContactsWritePermission()) {
                getAccountForImport();
            }
        }
    });

    restoreContacts.setTextColor(ThemeUtils.primaryAccentColor());

    return view;
}

From source file:fm.feed.android.testapp.fragment.TestFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_test, container, false);

    mBtnTune = (Button) rootView.findViewById(R.id.tune);
    mBtnPlay = (ImageButton) rootView.findViewById(R.id.play);
    mBtnPause = (ImageButton) rootView.findViewById(R.id.pause);
    mBtnSkip = (ImageButton) rootView.findViewById(R.id.skip);
    mBtnLike = (Button) rootView.findViewById(R.id.like);
    mBtnUnlike = (Button) rootView.findViewById(R.id.unlike);
    mBtnDislike = (Button) rootView.findViewById(R.id.dislike);
    mBtnHistory = (Button) rootView.findViewById(R.id.history);

    mTxtTitle = (TextView) rootView.findViewById(R.id.title);
    mTxtArtist = (TextView) rootView.findViewById(R.id.artist);
    mTxtAlbum = (TextView) rootView.findViewById(R.id.album);

    mProgressBar = (ProgressBar) rootView.findViewById(R.id.progress);
    mTxtCurrentProgress = (TextView) rootView.findViewById(R.id.current_progress);
    mTxtDuration = (TextView) rootView.findViewById(R.id.duration);

    mStationsView = (ListView) rootView.findViewById(R.id.stations);
    mPlacementsView = (ListView) rootView.findViewById(R.id.placements);

    if (savedInstanceState != null) {
        mPlacements = savedInstanceState.getIntArray(PLACEMENTS);
    }//w w  w  .j  a  v  a 2s .  co m

    mBtnToggleWifi = (Button) rootView.findViewById(R.id.wifi);

    return rootView;
}

From source file:eu.thecoder4.gpl.pleftdroid.EventDetailActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK && data != null) {
        Bundle extras = data.getExtras();
        int SC;// w  ww. j  a v  a2s  . c o m

        switch (requestCode) {
        case ACT_COMMENT:
            String comment = extras.getString(AR_COMMENT);
            int datepos = extras.getInt(AR_DTID);
            getAvailForPerson(curpid, adates.get(datepos).getId());
            updateAvailCommentForPerson(curpid, adates.get(datepos).getId(), comment);
            voteadateadapter.notifyDataSetChanged();
            break;
        case ACT_ADDINVITEE:
            String participant = extras.getString(AR_EMAIL);
            SC = PleftBroker.inviteAnotherParticipant(aid, participant, apserver, auser, avcode);
            if (SC >= HttpStatus.SC_BAD_REQUEST) { //400
                Toast.makeText(this, R.string.toast_problemrequest, Toast.LENGTH_LONG).show();
            } else {
                startActivity(getIntent());
                finish();
            }
            break;
        case ACT_NEWDATE:
            int[] thedate = extras.getIntArray(AR_DATE);
            int[] thetime = extras.getIntArray(AR_TIME);
            PDate td = new PDate(thedate, thetime);
            String newdate = td.getPleftDate();
            //TODO Check if this date and time is the same of one of the current dates!!!
            SC = PleftBroker.proposeNewDate(aid, newdate, apserver, auser, avcode);
            if (SC >= HttpStatus.SC_BAD_REQUEST) { //400
                Toast.makeText(this, R.string.toast_problemrequest, Toast.LENGTH_LONG).show();
            } else {
                startActivity(getIntent());
                finish();
            }
            break;
        }
    }
}