use of com.zype.android.webapi.model.video.VideoData in project zype-android by zype.
the class VideoHelper method getAllDownloads.
@Nullable
public static List<VideoData> getAllDownloads(ContentResolver contentResolver) {
List<VideoData> downloads = new ArrayList<>();
Cursor cursor = CursorHelper.getAllDownloadsCursor(contentResolver);
VideoData videoData;
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
videoData = VideoHelper.objectFromCursor(cursor);
videoData = VideoHelper.getDownloadedData(cursor, videoData);
downloads.add(videoData);
} while (cursor.moveToNext());
}
cursor.close();
}
return downloads;
}
use of com.zype.android.webapi.model.video.VideoData in project zype-android by zype.
the class VideoHelper method removeFavoritesInLocalVideoDb.
@Nullable
public static void removeFavoritesInLocalVideoDb(ContentResolver contentResolver) {
List<VideoData> favoritesList = new ArrayList<>();
Cursor cursor = CursorHelper.getAllFavoritesVideoCursor(contentResolver);
VideoData videoData;
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
videoData = VideoHelper.objectFromCursor(cursor);
videoData = VideoHelper.getDownloadedData(cursor, videoData);
favoritesList.add(videoData);
} while (cursor.moveToNext());
}
cursor.close();
}
for (int i = 0; i < favoritesList.size(); i++) {
Uri uri = Contract.Video.CONTENT_URI;
ContentValues value = new ContentValues();
value.put(Contract.Video.COLUMN_IS_FAVORITE, 0);
contentResolver.update(uri, value, Contract.Video.COLUMN_ID + " =?", new String[] { favoritesList.get(i).getId() });
}
}
use of com.zype.android.webapi.model.video.VideoData in project zype-android by zype.
the class MyLibraryFragment method handleRetrieveVideo.
@Subscribe
public void handleRetrieveVideo(RetrieveVideoEvent event) {
Logger.d("handleRetrieveVideo(): size=" + event.getEventData().getModelData().getVideoData().size());
Video data = event.getEventData().getModelData();
if (data.getVideoData().size() > 0) {
for (VideoData item : data.getVideoData()) {
if (videoEntitlements.containsKey(item.getId())) {
List<VideoData> videos = new ArrayList<>();
videos.add(item);
DataHelper.insertVideos(getActivity().getContentResolver(), videos);
VideoEntitlementData entitlementData = videoEntitlements.get(item.getId());
if (entitlementData != null) {
VideoHelper.setEntitlement(getActivity().getContentResolver(), item.getId(), true, entitlementData.updatedAt);
}
}
}
}
}
use of com.zype.android.webapi.model.video.VideoData in project zype-android by zype.
the class BaseVideoActivity method onShowAudio.
@Override
public void onShowAudio() {
if (mInterface != null) {
mInterface.stop();
}
VideoData videoData = VideoHelper.getFullData(getContentResolver(), mVideoId);
if (!TextUtils.isEmpty(videoData.getDownloadAudioPath())) {
mType = PlayerFragment.TYPE_AUDIO_LOCAL;
} else if (!TextUtils.isEmpty(videoData.getPlayerAudioUrl())) {
mType = PlayerFragment.TYPE_AUDIO_WEB;
} else {
requestAudioUrl(mVideoId);
}
changeFragment(false);
}
use of com.zype.android.webapi.model.video.VideoData in project zype-android by zype.
the class FavoritesFragment method handleRetrieveVideo.
@Subscribe
public void handleRetrieveVideo(RetrieveVideoEvent event) {
Logger.d("handleRetrieveVideo(): size=" + event.getEventData().getModelData().getVideoData().size());
Video data = event.getEventData().getModelData();
if (data.getVideoData().size() > 0) {
for (VideoData item : data.getVideoData()) {
if (!TextUtils.isEmpty(DataHelper.getFavoriteId(getActivity().getContentResolver(), item.getId()))) {
List<VideoData> videos = new ArrayList<>();
videos.add(item);
DataHelper.insertVideos(getActivity().getContentResolver(), videos);
DataHelper.setFavoriteVideo(getActivity().getContentResolver(), item.getId(), true);
}
}
}
}
Aggregations