Example usage for android.os Parcel readInt

List of usage examples for android.os Parcel readInt

Introduction

In this page you can find the example usage for android.os Parcel readInt.

Prototype

public final int readInt() 

Source Link

Document

Read an integer value from the parcel at the current dataPosition().

Usage

From source file:edu.umich.flowfence.common.QMDescriptor.java

public static QMDescriptor readFromParcel(Parcel source) {
    int kind = source.readInt();
    if (kind == KIND_NULL) {
        return null;
    }/*  w  ww  .j a v a 2  s  .  c  om*/

    ComponentName definingClass = new ComponentName(source);
    String methodName = source.readString();
    ArrayList<String> paramTypes = source.createStringArrayList();

    return new QMDescriptor(kind, definingClass, methodName, paramTypes, false);
}

From source file:edu.umich.oasis.common.SodaDescriptor.java

public static SodaDescriptor readFromParcel(Parcel source) {
    int kind = source.readInt();
    if (kind == KIND_NULL) {
        return null;
    }/*  www .j av  a2 s.  c  o  m*/

    ComponentName definingClass = new ComponentName(source);
    String methodName = source.readString();
    ArrayList<String> paramTypes = source.createStringArrayList();

    return new SodaDescriptor(kind, definingClass, methodName, paramTypes, false);
}

From source file:com.clover.sdk.v3.JsonParcelHelper.java

private static Object readValue(Parcel in) {
    int type = in.readInt();

    switch (type) {
    case VAL_NULL:
        return JSONObject.NULL;

    case VAL_STRING:
        return in.readString();

    case VAL_INTEGER:
        return in.readInt();

    case VAL_MAP:
        return ObjectWrapper.CREATOR.createFromParcel(in).unwrap();

    case VAL_LONG:
        return in.readLong();

    case VAL_FLOAT:
        return in.readFloat();

    case VAL_DOUBLE:
        return in.readDouble();

    case VAL_BOOLEAN:
        return in.readInt() != 0;

    case VAL_OBJECTARRAY:
        return ArrayWrapper.CREATOR.createFromParcel(in).unwrap();

    default:/*from   ww w .  j a va 2  s  .c o m*/
        int off = in.dataPosition() - 4;
        throw new IllegalArgumentException(
                "Json: unmarshalling unknown type code " + type + " at offset " + off);
    }
}

From source file:org.solovyev.android.calculator.onscreen.CalculatorOnscreenViewState.java

@Nonnull
private static CalculatorOnscreenViewState fromParcel(@Nonnull Parcel in) {
    final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState();
    result.width = in.readInt();
    result.height = in.readInt();/*  ww w  .  j a  v a2 s .  c  o  m*/
    result.x = in.readInt();
    result.y = in.readInt();
    return result;
}

From source file:Main.java

/**
 * Repairs the broken tag on HTC devices running Android 5.x
 * <p/>/*from  w  ww .  j  ava 2  s . c  o m*/
 * "It seems, the reason of this bug in TechExtras of NfcA is null. However, TechList contains MifareClassic." -bildin
 * For more information please refer to https://github.com/ikarus23/MifareClassicTool/issues/52#issuecomment-103797115
 * <p/>
 * Code source: https://github.com/ikarus23/MifareClassicTool/issues/52#issuecomment-104277445
 *
 * @param oTag The broken tag
 * @return The fixed tag
 */
public static Tag repairTag(Tag oTag) {
    if (oTag == null)
        return null;

    String[] sTechList = oTag.getTechList();

    Parcel oParcel, nParcel;

    oParcel = Parcel.obtain();
    oTag.writeToParcel(oParcel, 0);
    oParcel.setDataPosition(0);

    int len = oParcel.readInt();
    byte[] id = null;
    if (len >= 0) {
        id = new byte[len];
        oParcel.readByteArray(id);
    }
    int[] oTechList = new int[oParcel.readInt()];
    oParcel.readIntArray(oTechList);
    Bundle[] oTechExtras = oParcel.createTypedArray(Bundle.CREATOR);
    int serviceHandle = oParcel.readInt();
    int isMock = oParcel.readInt();
    IBinder tagService;
    if (isMock == 0) {
        tagService = oParcel.readStrongBinder();
    } else {
        tagService = null;
    }
    oParcel.recycle();

    int nfca_idx = -1;
    int mc_idx = -1;

    for (int idx = 0; idx < sTechList.length; idx++) {
        if (sTechList[idx].equals(NfcA.class.getName())) {
            nfca_idx = idx;
        } else if (sTechList[idx].equals(MifareClassic.class.getName())) {
            mc_idx = idx;
        }
    }

    if (nfca_idx >= 0 && mc_idx >= 0 && oTechExtras[mc_idx] == null) {
        oTechExtras[mc_idx] = oTechExtras[nfca_idx];
    } else {
        return oTag;
    }

    nParcel = Parcel.obtain();
    nParcel.writeInt(id.length);
    nParcel.writeByteArray(id);
    nParcel.writeInt(oTechList.length);
    nParcel.writeIntArray(oTechList);
    nParcel.writeTypedArray(oTechExtras, 0);
    nParcel.writeInt(serviceHandle);
    nParcel.writeInt(isMock);
    if (isMock == 0) {
        nParcel.writeStrongBinder(tagService);
    }
    nParcel.setDataPosition(0);

    Tag nTag = Tag.CREATOR.createFromParcel(nParcel);

    nParcel.recycle();

    return nTag;
}

From source file:com.philliphsu.clock2.alarms.Alarm.java

private static Alarm create(Parcel in) {
    Alarm alarm = Alarm.builder().hour(in.readInt()).minutes(in.readInt()).label(in.readString())
            .ringtone(in.readString()).vibrates(in.readInt() != 0).build();
    alarm.setId(in.readLong());/* w  w w. ja  v a2  s . c  o  m*/
    alarm.snoozingUntilMillis = in.readLong();
    alarm.enabled = in.readInt() != 0;
    in.readBooleanArray(alarm.recurringDays);
    alarm.ignoreUpcomingRingTime = in.readInt() != 0;
    return alarm;
}

From source file:edu.umich.flowfence.common.TaintSet.java

public static TaintSet readFromParcel(Parcel source) {
    int numTaints = source.readInt();
    if (numTaints == -1) {
        return null;
    }/*from  w w w.j a va2s  .c  o  m*/
    if (numTaints == 0) {
        return TaintSet.EMPTY;
    }
    Map<ComponentName, Float> taints = new HashMap<>(numTaints);
    while (numTaints-- > 0) {
        ComponentName taintKind = new ComponentName(source);
        float taintAmount = Math.max(source.readFloat(), 0.0f);
        taints.put(taintKind, taintAmount);
    }
    return new TaintSet(taints);
}

From source file:com.jungle.base.utils.MiscUtils.java

public static byte[] readBytesFromParcel(Parcel source) {
    int len = source.readInt();
    if (len > 0) {
        byte[] buff = new byte[len];
        source.readByteArray(buff);//w w  w  .  j  a v  a2 s .co  m
        return buff;
    }

    return null;
}

From source file:com.tigerpenguin.places.model.OpeningHours.java

@SuppressWarnings("unchecked")
public OpeningHours(Parcel in) {
    openNow = (in.readInt() == 1);
    periods = in.readArrayList(Period.class.getClassLoader());
}

From source file:com.dwg.weibo.entity.Visible.java

protected Visible(Parcel in) {
    this.type = in.readInt();
    this.list_id = in.readInt();
}