Example usage for android.os Parcelable getClass

List of usage examples for android.os Parcelable getClass

Introduction

In this page you can find the example usage for android.os Parcelable getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:ar.rulosoft.custompref.SeekBarCustomPreference.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (!state.getClass().equals(SavedState.class)) {
        // Didn't save state for us in onSaveInstanceState
        super.onRestoreInstanceState(state);
        return;/*from   w ww.  jav  a 2s.  c  o  m*/
    }

    // Restore the instance state
    SavedState myState = (SavedState) state;
    super.onRestoreInstanceState(myState.getSuperState());
    mPreferredMax = myState.max;
    mPreferredMin = myState.min;
    setProgress(myState.progress, true);
}

From source file:com.orpheusdroid.screenrecorder.folderpicker.FolderChooser.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state == null || !state.getClass().equals(SavedStateHandler.class)) {
        super.onRestoreInstanceState(state);
        return;// w  w w.  j  av  a  2 s  .c o m
    }

    SavedStateHandler myState = (SavedStateHandler) state;
    super.onRestoreInstanceState(myState.getSuperState());

    setCurrentDir(currentDir.getPath());
    if (myState.dialogState != null) {
        // recreate dialog
        newDirDialog(myState.dialogState);
    }
}

From source file:net.xpece.android.support.preference.SeekBarPreference.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (!state.getClass().equals(SavedState.class)) {
        // Didn't save state for us in onSaveInstanceState
        super.onRestoreInstanceState(state);
        return;/*from w  w w. jav a 2s .  c o  m*/
    }

    // Restore the instance state
    SavedState myState = (SavedState) state;
    super.onRestoreInstanceState(myState.getSuperState());
    mMax = myState.max;
    mMin = myState.min;
    setValueInternal(myState.seekBarValue, true);
}

From source file:com.ahao.preferencelibrary.preference.DialogPreference.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state == null || !state.getClass().equals(SavedState.class)) {
        // Didn't save state for us in onSaveInstanceState
        super.onRestoreInstanceState(state);
        return;/*  www  .  j a v  a 2  s . c om*/
    }

    SavedState myState = (SavedState) state;
    super.onRestoreInstanceState(myState.getSuperState());
    if (myState.isDialogShowing) {
        showDialog(myState.dialogBundle);
    }
}

From source file:com.repkap11.repcast.activities.RepcastActivity.java

@Override
protected void doShowContent(Parcelable data) {
    int pageIndex = -1;
    if (data instanceof JsonDirectory.JsonFileDir) {
        Log.e(TAG, "Showing File data of:" + ((JsonDirectory.JsonFileDir) data).name);
        pageIndex = RepcastPageAdapter.FILE_INDEX;
    }/*  w ww  . j a v a  2 s.  c o  m*/
    if (data instanceof JsonTorrent.JsonTorrentResult) {
        pageIndex = RepcastPageAdapter.TORRENT_INDEX;
    }
    if (pageIndex == -1) {
        Log.e(TAG, "Unexpected data type. Class:" + data.getClass() + " String:" + data);
    }
    mPagerAdapter.updatePageAtIndex(pageIndex, data);
    addFragmentToABackStack(data);
    setTitleBasedOnFragment();
}

From source file:com.acious.android.paginationseekbar.PaginationSeekBar.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state == null || !state.getClass().equals(CustomState.class)) {
        super.onRestoreInstanceState(state);
        return;//w  ww . j a  v  a  2 s .co  m
    }

    CustomState customState = (CustomState) state;
    setMin(customState.min);
    setMax(customState.max);
    setProgress(customState.progress, false);
    super.onRestoreInstanceState(customState.getSuperState());
}

From source file:net.qiujuer.genius.ui.widget.GeniusAbsSeekBar.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state == null || !state.getClass().equals(CustomState.class)) {
        super.onRestoreInstanceState(state);
        return;/*from ww w  .  j  a  va  2  s .c  o m*/
    }

    CustomState customState = (CustomState) state;
    setMin(customState.min);
    setMax(customState.max);
    setProgress(customState.progress);
    super.onRestoreInstanceState(customState.getSuperState());
}

From source file:com.phonegap.plugins.pdf417.Pdf417Scanner.java

/**
 * Called when the scanner intent completes.
 * //from ww  w.jav  a  2  s. c o  m
 * @param requestCode
 *            The request code originally supplied to
 *            startActivityForResult(), allowing you to identify who this
 *            result came from.
 * @param resultCode
 *            The integer result code returned by the child activity through
 *            its setResult().
 * @param intent
 *            An Intent, which can return result data to the caller (various
 *            data can be attached to Intent "extras").
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == REQUEST_CODE) {

        if (resultCode == Pdf417ScanActivity.RESULT_OK) {

            // First, obtain scan results array. If scan was successful, array will contain at least one element.
            // Multiple element may be in array if multiple scan results from single image were allowed in settings.

            Parcelable[] resultArray = data
                    .getParcelableArrayExtra(Pdf417ScanActivity.EXTRAS_RECOGNITION_RESULT_LIST);

            // Each recognition result corresponds to active recognizer. As stated earlier, there are 4 types of
            // recognizers available (PDF417, Bardecoder, ZXing and USDL), so there are 4 types of results
            // available.

            JSONArray resultsList = new JSONArray();

            for (Parcelable p : resultArray) {
                try {
                    if (p instanceof Pdf417ScanResult) { // check if scan result is result of Pdf417 recognizer
                        resultsList.put(parsePdf417((Pdf417ScanResult) p));

                    } else if (p instanceof BarDecoderScanResult) { // check if scan result is result of BarDecoder recognizer                       
                        resultsList.put(parseBarDecoder((BarDecoderScanResult) p));

                    } else if (p instanceof ZXingScanResult) { // check if scan result is result of ZXing recognizer
                        resultsList.put(parseZxing((ZXingScanResult) p));

                    } else if (p instanceof USDLScanResult) { // check if scan result is result of US Driver's Licence recognizer
                        resultsList.put(parseUSDL((USDLScanResult) p));
                    }
                } catch (Exception e) {
                    Log.e(LOG_TAG, "Error parsing " + p.getClass().getName());
                }
            }

            try {
                JSONObject root = new JSONObject();
                root.put(RESULT_LIST, resultsList);
                root.put(CANCELLED, false);
                this.callbackContext.success(root);
            } catch (JSONException e) {
                Log.e(LOG_TAG, "This should never happen");
            }

        } else if (resultCode == Pdf417ScanActivity.RESULT_CANCELED) {
            JSONObject obj = new JSONObject();
            try {
                obj.put(CANCELLED, true);

            } catch (JSONException e) {
                Log.e(LOG_TAG, "This should never happen");
            }
            this.callbackContext.success(obj);

        } else {
            this.callbackContext.error("Unexpected error");
        }
    }
}

From source file:android.car.ui.provider.CarDrawerLayout.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    SavedState ss = null;//  ww w.  jav  a  2  s  .  co m
    if (state.getClass().getClassLoader() != getClass().getClassLoader()) {
        // Class loader mismatch, recreate from parcel.
        Parcel stateParcel = Parcel.obtain();
        state.writeToParcel(stateParcel, 0);
        ss = SavedState.CREATOR.createFromParcel(stateParcel);
    } else {
        ss = (SavedState) state;
    }
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.openDrawerGravity != Gravity.NO_GRAVITY) {
        openDrawer();
    }

    setDrawerLockMode(ss.lockModeLeft, Gravity.LEFT);
    setDrawerLockMode(ss.lockModeRight, Gravity.RIGHT);
}