Example usage for android.os Parcel readStringList

List of usage examples for android.os Parcel readStringList

Introduction

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

Prototype

public final void readStringList(List<String> list) 

Source Link

Document

Read into the given List items String objects that were written with #writeStringList at the current dataPosition().

Usage

From source file:at.bitfire.davdroid.resource.LocalGroup.java

/**
 * Processes all groups with non-null {@link #COLUMN_PENDING_MEMBERS}: the pending memberships
 * are (if possible) applied, keeping cached memberships in sync.
 * @param addressBook    address book to take groups from
 * @throws ContactsStorageException on contact provider errors
 *//* ww  w.  j av a  2s  .  c  o m*/
public static void applyPendingMemberships(LocalAddressBook addressBook) throws ContactsStorageException {
    try {
        @Cleanup
        Cursor cursor = addressBook.provider.query(addressBook.syncAdapterURI(Groups.CONTENT_URI),
                new String[] { Groups._ID, COLUMN_PENDING_MEMBERS }, COLUMN_PENDING_MEMBERS + " IS NOT NULL",
                new String[] {}, null);

        BatchOperation batch = new BatchOperation(addressBook.provider);
        while (cursor != null && cursor.moveToNext()) {
            long id = cursor.getLong(0);
            Constants.log.fine("Assigning members to group " + id);

            // delete all memberships and cached memberships for this group
            batch.enqueue(new BatchOperation.Operation(ContentProviderOperation
                    .newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
                    .withSelection(
                            "(" + GroupMembership.MIMETYPE + "=? AND " + GroupMembership.GROUP_ROW_ID
                                    + "=?) OR (" + CachedGroupMembership.MIMETYPE + "=? AND "
                                    + CachedGroupMembership.GROUP_ID + "=?)",
                            new String[] { GroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id),
                                    CachedGroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id) })
                    .withYieldAllowed(true)));

            // extract list of member UIDs
            List<String> members = new LinkedList<>();
            byte[] raw = cursor.getBlob(1);
            @Cleanup("recycle")
            Parcel parcel = Parcel.obtain();
            parcel.unmarshall(raw, 0, raw.length);
            parcel.setDataPosition(0);
            parcel.readStringList(members);

            // insert memberships
            for (String uid : members) {
                Constants.log.fine("Assigning member: " + uid);
                try {
                    LocalContact member = addressBook.findContactByUID(uid);
                    member.addToGroup(batch, id);
                } catch (FileNotFoundException e) {
                    Constants.log.log(Level.WARNING, "Group member not found: " + uid, e);
                }
            }

            // remove pending memberships
            batch.enqueue(new BatchOperation.Operation(ContentProviderOperation
                    .newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, id)))
                    .withValue(COLUMN_PENDING_MEMBERS, null).withYieldAllowed(true)));

            batch.commit();
        }
    } catch (RemoteException e) {
        throw new ContactsStorageException("Couldn't get pending memberships", e);
    }
}

From source file:com.artemchep.horario.database.models.SubjectGroup.java

public SubjectGroup(Parcel source) {
    key = source.readString();//from w ww  .ja v  a2s.  c  o  m
    name = source.readString();
    users = new ArrayList<>();
    source.readStringList(users);
}

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

public Photo(Parcel in) {
    photoReference = in.readString();//from w  w w  .  j ava  2s . c  o m
    height = in.readInt();
    width = in.readInt();
    htmlAttributions = new ArrayList<String>();
    in.readStringList(htmlAttributions);
}

From source file:com.artemchep.horario.database.models.Note.java

public Note(Parcel source) {
    key = source.readString();//w ww  .  j  av a2 s.  c  o  m
    title = source.readString();
    content = source.readString();
    contentHtml = source.readString();
    priority = source.readString();
    source.readStringList(subjects = new ArrayList<>());
    due = source.readInt();
}

From source file:com.nestapi.lib.API.Structure.java

private Structure(Parcel in) {
    mStructureID = in.readString();// w  ww.  java  2 s.co m
    in.readStringList(mThermostatIDs = new ArrayList<>());
    in.readStringList(mSmokeCOAlarms = new ArrayList<>());
    mName = in.readString();
    mCountryCode = in.readString();
    mPeakPeriodStartTime = in.readString();
    mPeakPeriodEndTime = in.readString();
    mTimeZone = in.readString();
    mAwayState = (AwayState) in.readSerializable();
    mETA = in.readParcelable(ETA.class.getClassLoader());
}

From source file:com.facebook.AccessToken.java

AccessToken(Parcel parcel) {
    this.expires = new Date(parcel.readLong());
    ArrayList<String> permissionsList = new ArrayList<>();
    parcel.readStringList(permissionsList);
    this.permissions = Collections.unmodifiableSet(new HashSet<String>(permissionsList));
    permissionsList.clear();/*w w w.  j  av a2  s  .c o m*/
    parcel.readStringList(permissionsList);
    this.declinedPermissions = Collections.unmodifiableSet(new HashSet<String>(permissionsList));
    this.token = parcel.readString();
    this.source = AccessTokenSource.valueOf(parcel.readString());
    this.lastRefresh = new Date(parcel.readLong());
    this.applicationId = parcel.readString();
    this.userId = parcel.readString();
}

From source file:com.markupartist.sthlmtraveling.provider.planner.JourneyQuery.java

public JourneyQuery(Parcel parcel) {
    origin = parcel.readParcelable(Location.class.getClassLoader());
    destination = parcel.readParcelable(Location.class.getClassLoader());
    via = parcel.readParcelable(Location.class.getClassLoader());
    time = new Time();
    time.parse(parcel.readString());//from   ww w .j  av a  2  s.  co  m
    isTimeDeparture = (parcel.readInt() == 1) ? true : false;
    alternativeStops = (parcel.readInt() == 1) ? true : false;
    transportModes = new ArrayList<String>();
    parcel.readStringList(transportModes);
    ident = parcel.readString();
    seqnr = parcel.readString();
}

From source file:com.bravo.ecm.service.ScannedFile.java

public void readFromParcel(Parcel parcel) {
    pathname = parcel.readString();//from ww w .  j  av  a  2s.  c om
    ean = parcel.readString();
    parcel.readStringList(titles);
    publisher = parcel.readString();

    try {
        long date = parcel.readLong();
        publishedDate = new Date(date);
    } catch (Exception ex) {
        publishedDate = null;
    }

    int size = parcel.readInt();
    for (int i = 0; i < size; i++) {
        String first = parcel.readString();
        String last = parcel.readString();
        addContributor(first, last);
    }

    try {
        parcel.readLong();
        lastAccessedDate = new Date((new File(pathname)).lastModified());
    } catch (Exception ex) {
        lastAccessedDate = null;
    }
    try {
        long date = parcel.readLong();
        createdDate = new Date(date);
    } catch (Exception ex) {
        createdDate = null;
    }
    int idx = pathname.lastIndexOf('.');
    String ext = pathname.substring(idx + 1).toLowerCase();
    if (ext.equals("html")) {
        ext = "htm";
    }
    if (type.equals("zip"))
        type = "fb2";
    type = ext;
    addKeywords(ext);
}

From source file:fr.free.nrw.commons.Media.java

@SuppressWarnings("unchecked")
public Media(Parcel in) {
    localUri = in.readParcelable(Uri.class.getClassLoader());
    thumbUrl = in.readString();//from   w  w w.ja  v  a  2 s  .  c om
    imageUrl = in.readString();
    filename = in.readString();
    description = in.readString();
    dataLength = in.readLong();
    dateCreated = (Date) in.readSerializable();
    dateUploaded = (Date) in.readSerializable();
    creator = in.readString();
    tags = (HashMap<String, Object>) in.readSerializable();
    width = in.readInt();
    height = in.readInt();
    license = in.readString();
    if (categories != null) {
        in.readStringList(categories);
    }
    descriptions = in.readHashMap(ClassLoader.getSystemClassLoader());
}

From source file:io.bunnyblue.noticedog.app.notifications.Notification.java

public Notification(Parcel in) {
    this.expandedInboxText = new ArrayList();
    this.people = new ArrayList();
    this.actions = new ArrayList();
    this.packageName = in.readString();
    this.id = in.readInt();
    this.tag = in.readString();
    this.key = in.readString();
    this.when = in.readLong();
    this.smallIcon = in.readInt();
    this.largeIcon = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.tickerText = in.readString();
    this.contentTitle = in.readString();
    this.contentText = in.readString();
    this.contentInfoText = in.readString();
    this.expandedLargeIconBig = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.expandedContentTitle = in.readString();
    this.expandedContentText = in.readString();
    in.readStringList(this.expandedInboxText);
    in.readList(this.people, Uri.class.getClassLoader());
    this.picture = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.priority = in.readInt();
    this.pendingLaunchIntent = (PendingIntent) in.readParcelable(PendingIntent.class.getClassLoader());
    in.readList(this.actions, Action.class.getClassLoader());
}