If you think the Android project Locast-Core-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package edu.mit.mobile.android.locast.data;
//fromwww.java2s.comimport org.json.JSONException;
import org.json.JSONObject;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import edu.mit.mobile.android.content.column.DBColumn;
import edu.mit.mobile.android.content.column.IntegerColumn;
import edu.mit.mobile.android.content.column.TextColumn;
import edu.mit.mobile.android.locast.net.NetworkProtocolException;
publicabstractclass VideoContent extends CastMedia {
@DBColumn(type = IntegerColumn.class)
publicfinalstatic String COL_DURATION = "duration";
@DBColumn(type = TextColumn.class)
publicfinalstatic String COL_SCREENSHOT = "screenshot";
@DBColumn(type = TextColumn.class)
publicfinalstatic String COL_ANIMATED_PREVIEW = "preview";
@DBColumn(type = TextColumn.class)
publicfinalstatic String COL_WEB_STREAM = "web_stream";
public VideoContent(Cursor c) {
super(c);
}
@Override
public SyncMap getSyncMap() {
return SYNC_MAP;
}
publicstaticfinal ItemSyncMap SYNC_MAP = new ItemSyncMap();
publicstaticclass VideoResourcesSync extends ResourcesSync {
publicstaticfinal String KEY_WEB_STREAM = "web_stream";
publicstaticfinal String KEY_SCREENSHOT = "screenshot";
publicstaticfinal String KEY_ANIMATED_PREVIEW = "preview";
@Override
protectedvoid fromResourcesJSON(Context context, Uri localItem, ContentValues cv,
JSONObject resources) throws NetworkProtocolException, JSONException {
// this adds in the primary resource
// intentionally not calling super here, so the primary resource can be made optional.
// This is until the API can be revised to make linkedmedia behave like the other types.
// super.fromResourcesJSON(context, localItem, cv, resources);
addToContentValues(cv, "primary", resources, CastMedia.COL_MEDIA_URL,
CastMedia.COL_MIME_TYPE, false);
addToContentValues(cv, KEY_WEB_STREAM, resources, COL_WEB_STREAM, null, false);
addToContentValues(cv, KEY_SCREENSHOT, resources, COL_SCREENSHOT, null, false);
addToContentValues(cv, KEY_ANIMATED_PREVIEW, resources, COL_ANIMATED_PREVIEW, null,
false);
}
}
publicstaticclass ItemSyncMap extends CastMedia.ItemSyncMap {
/**
*
*/privatestaticfinallong serialVersionUID = -5953501614068337339L;
protectedstaticfinal String RESOURCES_KEY = "_resources";
public ResourcesSync getResourcesSync() {
returnnew VideoResourcesSync();
}
public ItemSyncMap() {
super();
put(RESOURCES_KEY, getResourcesSync());
put(COL_DURATION, new SyncFieldMap("duration", SyncFieldMap.DURATION,
SyncFieldMap.SYNC_FROM | SyncFieldMap.FLAG_OPTIONAL));
// this is used for linkedmedia resources.
put(COL_MEDIA_URL, new SyncFieldMap("url", SyncFieldMap.STRING, SyncFieldMap.SYNC_FROM
| SyncFieldMap.FLAG_OPTIONAL));
}
}
}