Example usage for android.content ContentValues getAsString

List of usage examples for android.content ContentValues getAsString

Introduction

In this page you can find the example usage for android.content ContentValues getAsString.

Prototype

public String getAsString(String key) 

Source Link

Document

Gets a value and converts it to a String.

Usage

From source file:org.anhonesteffort.flock.sync.calendar.EventFactory.java

private static void handleAddPropertiesForEditExceptionToRecurring(String path, ContentValues eventValues,
        VEvent vEvent) throws InvalidComponentException {
    Log.w(TAG, "gonna try and export edit exception from androids recurrence model...");

    Long originalLocalId = eventValues.getAsLong(CalendarContract.Events.ORIGINAL_ID);
    String originalSyncId = eventValues.getAsString(CalendarContract.Events.ORIGINAL_SYNC_ID);
    Long originalInstanceTime = eventValues.getAsLong(CalendarContract.Events.ORIGINAL_INSTANCE_TIME);
    String syncId = eventValues.getAsString(CalendarContract.Events._SYNC_ID);

    if (TextUtils.isEmpty(originalSyncId))
        throw new InvalidComponentException("original sync id required on recurring event edit exceptions",
                false, CalDavConstants.CALDAV_NAMESPACE, path);

    if (originalLocalId == null || originalLocalId < 1 || originalInstanceTime == null)
        throw new InvalidComponentException(
                "original local id and instance time required on recurring event edit exceptions", false,
                CalDavConstants.CALDAV_NAMESPACE, path);

    if (vEvent.getUid() == null)
        vEvent.getProperties().add(new Uid(syncId));
    else if (vEvent.getUid().getValue() == null)
        vEvent.getUid().setValue(syncId);

    vEvent.getProperties().add(new XProperty(PROPERTY_NAME_FLOCK_ORIGINAL_SYNC_ID, originalSyncId));
    vEvent.getProperties().add(// w w  w  . j  av a  2 s .  c o  m
            new XProperty(PROPERTY_NAME_FLOCK_ORIGINAL_INSTANCE_TIME, String.valueOf(originalInstanceTime)));
}

From source file:org.frc836.database.DB.java

protected static Map<String, String> getPostData(ContentValues values) {
    Map<String, String> data = new HashMap<String, String>();
    for (String key : values.keySet()) {
        data.put(key, values.getAsString(key));
    }//from   w ww  .  jav a  2s.  c o  m
    return data;
}

From source file:com.inferiorhumanorgans.WayToGo.Agency.BART.Station.StationTask.java

public void addStation(final ContentValues aStation) {
    Log.d(LOG_NAME, "Trying to initially add station of: (" + aStation.getAsString("tag") + ") " + aStation);
    theStations.put(aStation.getAsString("tag"), new ContentValues(aStation));
}

From source file:org.anhonesteffort.flock.sync.addressbook.ContactFactory.java

protected static void addNote(VCard vCard, ContentValues noteValues) {
    String noteText = noteValues.getAsString(ContactsContract.CommonDataKinds.Note.NOTE);

    if (noteText != null) {
        Note note = new Note(noteText);
        vCard.addNote(note);/*from www  .j av a  2 s.c  o  m*/
    }
}

From source file:at.bitfire.ical4android.AndroidTaskList.java

protected void populate(ContentValues values) {
    syncId = values.getAsString(TaskLists._SYNC_ID);
    name = values.getAsString(TaskLists.LIST_NAME);
    if (values.containsKey(TaskLists.LIST_COLOR))
        color = values.getAsInteger(TaskLists.LIST_COLOR);
    if (values.containsKey(TaskLists.SYNC_ENABLED))
        isSynced = values.getAsInteger(TaskLists.SYNC_ENABLED) != 0;
    if (values.containsKey(TaskLists.VISIBLE))
        isVisible = values.getAsInteger(TaskLists.VISIBLE) != 0;
}

From source file:org.anhonesteffort.flock.sync.addressbook.ContactFactory.java

protected static void addSipAddress(VCard vCard, ContentValues sipAddressValues) {
    String sipAddress = sipAddressValues.getAsString(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS);

    if (sipAddress != null)
        vCard.setExtendedProperty(PROPERTY_SIP, sipAddress);
}

From source file:at.bitfire.ical4android.AndroidCalendar.java

protected void populate(ContentValues info) {
    name = info.getAsString(Calendars.NAME);
    displayName = info.getAsString(Calendars.CALENDAR_DISPLAY_NAME);

    if (info.containsKey(Calendars.CALENDAR_COLOR))
        color = info.getAsInteger(Calendars.CALENDAR_COLOR);

    isSynced = info.getAsInteger(Calendars.SYNC_EVENTS) != 0;
    isVisible = info.getAsInteger(Calendars.VISIBLE) != 0;
}

From source file:org.anhonesteffort.flock.sync.addressbook.ContactFactory.java

protected static void addNickName(VCard vCard, ContentValues nickNameValues) {
    String nickNameText = nickNameValues.getAsString(ContactsContract.CommonDataKinds.Nickname.NAME);

    if (nickNameText != null) {
        Nickname nickname = new Nickname();
        nickname.addValue(nickNameText);

        vCard.addNickname(nickname);/*  ww  w. j  a  v  a2 s.  co  m*/
    }
}

From source file:org.anhonesteffort.flock.sync.addressbook.ContactFactory.java

protected static ComponentETagPair<VCard> getVCard(ContentValues rawContactValues) {
    String uidText = rawContactValues.getAsString(ContactsContract.RawContacts.SOURCE_ID);
    String eTagText = rawContactValues.getAsString(ContactsContract.RawContacts.SYNC1);
    Boolean starred = rawContactValues.getAsBoolean(ContactsContract.RawContacts.STARRED);

    VCard vCard = new VCard();
    vCard.setVersion(VCardVersion.V3_0);

    vCard.setUid(new Uid(uidText));

    if (starred != null)
        vCard.setExtendedProperty(PROPERTY_STARRED, starred ? "1" : "0");

    Optional<String> eTag = Optional.fromNullable(eTagText);

    return new ComponentETagPair<VCard>(vCard, eTag);
}

From source file:org.anhonesteffort.flock.sync.addressbook.ContactFactory.java

protected static void addOrganizer(VCard vCard, ContentValues organizerValues) {
    String companyText = organizerValues.getAsString(ContactsContract.CommonDataKinds.Organization.COMPANY);
    String roleText = organizerValues.getAsString(ContactsContract.CommonDataKinds.Organization.TITLE);

    if (companyText != null) {
        Organization organization = new Organization();
        organization.addValue(companyText);
        vCard.addOrganization(organization);
    }//from ww w. j a v a2 s  . c  o m

    if (roleText != null) {
        Role role = new Role(roleText);
        vCard.addRole(role);
    }
}