Example usage for android.os Parcel createStringArrayList

List of usage examples for android.os Parcel createStringArrayList

Introduction

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

Prototype

public final ArrayList<String> createStringArrayList() 

Source Link

Document

Read and return a new ArrayList containing String objects from the parcel that was written with #writeStringList 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;
    }//from  w w w. ja  va2  s . co  m

    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;
    }//from   w  w  w.  j  a  v  a 2 s . c om

    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:org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter.java

public ArrayList<CertifyAction> getSelectedCertifyActions() {
    LongSparseArray<CertifyAction> actions = new LongSparseArray<>();
    for (int i = 0; i < mCheckStates.size(); i++) {
        if (mCheckStates.get(i)) {
            mCursor.moveToPosition(i);/*from  w  w w .java  2 s. co  m*/

            long keyId = mCursor.getLong(0);
            byte[] data = mCursor.getBlob(1);

            Parcel p = Parcel.obtain();
            p.unmarshall(data, 0, data.length);
            p.setDataPosition(0);
            ArrayList<String> uids = p.createStringArrayList();
            p.recycle();

            CertifyAction action = actions.get(keyId);
            if (actions.get(keyId) == null) {
                actions.put(keyId, new CertifyAction(keyId, uids, null));
            } else {
                action.mUserIds.addAll(uids);
            }
        }
    }

    ArrayList<CertifyAction> result = new ArrayList<>(actions.size());
    for (int i = 0; i < actions.size(); i++) {
        result.add(actions.valueAt(i));
    }
    return result;
}

From source file:org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter.java

@Override
public void bindView(View view, Context context, Cursor cursor) {
    TextView vHeaderId = (TextView) view.findViewById(R.id.user_id_header);
    TextView vName = (TextView) view.findViewById(R.id.user_id_item_name);
    TextView vAddresses = (TextView) view.findViewById(R.id.user_id_item_addresses);

    byte[] data = cursor.getBlob(1);
    int isHeader = cursor.getInt(2);
    Parcel p = Parcel.obtain();
    p.unmarshall(data, 0, data.length);/* ww w.jav  a  2  s  . com*/
    p.setDataPosition(0);
    ArrayList<String> uids = p.createStringArrayList();
    p.recycle();

    { // first one
        String userId = uids.get(0);
        OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(userId);
        if (splitUserId.name != null) {
            vName.setText(splitUserId.name);
        } else {
            vName.setText(R.string.user_id_no_name);
        }

        if (isHeader == 1) {
            vHeaderId.setVisibility(View.VISIBLE);
            String message;
            if (splitUserId.name != null) {
                message = mContext.getString(R.string.section_uids_to_certify) + splitUserId.name;
            } else {
                message = mContext.getString(R.string.section_uids_to_certify)
                        + context.getString(R.string.user_id_no_name);
            }
            vHeaderId.setText(message);
        } else {
            vHeaderId.setVisibility(View.GONE);
        }
    }

    StringBuilder lines = new StringBuilder();
    for (String uid : uids) {
        OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(uid);
        if (splitUserId.email == null) {
            continue;
        }
        lines.append(splitUserId.email);
        if (splitUserId.comment != null) {
            lines.append(" (").append(splitUserId.comment).append(")");
        }
        lines.append('\n');
    }

    // If we have any data here, show it
    if (lines.length() > 0) {
        // delete last newline
        lines.setLength(lines.length() - 1);
        vAddresses.setVisibility(View.VISIBLE);
        vAddresses.setText(lines);
    } else {
        vAddresses.setVisibility(View.GONE);
    }

    final CheckBox vCheckBox = (CheckBox) view.findViewById(R.id.user_id_item_check_box);
    final int position = cursor.getPosition();
    vCheckBox.setOnCheckedChangeListener(null);
    vCheckBox.setChecked(mCheckStates.get(position));
    vCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            mCheckStates.set(position, b);
        }
    });
    vCheckBox.setClickable(false);
    vCheckBox.setVisibility(checkboxVisibility ? View.VISIBLE : View.GONE);

    View vUidBody = view.findViewById(R.id.user_id_body);
    vUidBody.setClickable(true);
    vUidBody.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            vCheckBox.toggle();
        }
    });

}

From source file:com.nestlabs.sdk.Structure.java

public Structure(Parcel in) {
    mStructureId = in.readString();//from w ww  . ja  va  2 s.  com
    mThermostats = in.createStringArrayList();
    mSmokeCoAlarms = in.createStringArrayList();
    mCameras = in.createStringArrayList();
    mDevices = new LinkedHashMap<>();
    in.readMap(mDevices, LinkedHashMap.class.getClassLoader());
    mAway = in.readString();
    mName = in.readString();
    mCountryCode = in.readString();
    mPostalCode = in.readString();
    mPeakPeriodStartTime = in.readString();
    mPeakPeriodEndTime = in.readString();
    mTimeZone = in.readString();
    mEta = in.readParcelable(ETA.class.getClassLoader());
    mRhrEnrollment = Utils.readBoolean(in);
    mWheres = new LinkedHashMap<>();
    in.readMap(mWheres, LinkedHashMap.class.getClassLoader());
}

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

protected Status(Parcel in) {
    this.created_at = in.readString();
    this.id = in.readString();
    this.mid = in.readString();
    this.idstr = in.readString();
    this.textLength = in.readInt();
    this.text = in.readString();
    this.isLongText = in.readByte() != 0;
    this.source_type = in.readInt();
    this.source = in.readString();
    this.favorited = in.readByte() != 0;
    this.truncated = in.readByte() != 0;
    this.in_reply_to_status_id = in.readString();
    this.in_reply_to_user_id = in.readString();
    this.in_reply_to_screen_name = in.readString();
    this.thumbnail_pic = in.readString();
    this.bmiddle_pic = in.readString();
    this.original_pic = in.readString();
    this.geo = in.readParcelable(Geo.class.getClassLoader());
    this.user = in.readParcelable(User.class.getClassLoader());
    this.retweeted_status = in.readParcelable(Status.class.getClassLoader());
    this.reposts_count = in.readInt();
    this.comments_count = in.readInt();
    this.attitudes_count = in.readInt();
    this.mlevel = in.readInt();
    this.visible = in.readParcelable(Visible.class.getClassLoader());
    this.source_allowclick = in.readInt();
    this.pic_urls = new ArrayList<PicUrlsBean>();
    in.readList(this.pic_urls, PicUrlsBean.class.getClassLoader());
    this.thumbnail_pic_urls = in.createStringArrayList();
    this.bmiddle_pic_urls = in.createStringArrayList();
    this.origin_pic_urls = in.createStringArrayList();
    this.singleImgSizeType = in.readString();
}