本文整理汇总了Java中com.archos.filecorelibrary.Utils.isLocal方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.isLocal方法的具体用法?Java Utils.isLocal怎么用?Java Utils.isLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.archos.filecorelibrary.Utils
的用法示例。
在下文中一共展示了Utils.isLocal方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onContextItemSelected
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
if(item.getItemId() == R.string.copy_on_device_multi){
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
Tvshow tvshow = (Tvshow) mBrowserAdapter.getItem(info.position);
ArrayList<Uri> list = new ArrayList<>();
Cursor cursor2 = getEpisodeForShowCursor(tvshow.getTvshowId());
if(cursor2!=null) {
if (cursor2.getCount() > 0) {
cursor2.moveToFirst();
int uriCol = cursor2.getColumnIndex(VideoStore.MediaColumns.DATA);
do {
Uri uri = Uri.parse(cursor2.getString(uriCol));
if (!Utils.isLocal(uri))
list.add(uri);
} while (cursor2.moveToNext());
startDownloadingVideo(list);
}
}
cursor2.close();
return true;
}
else return super.onContextItemSelected(item);
}
示例2: requestIndexing
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
/**
* set hidden false when reindex is true
* */
public static void requestIndexing(Uri uri, Context context, boolean reIndex) {
if (uri == null || context == null) {
Log.w(TAG, "requestIndexing: file or context null");
return;
}
//first check if video is hidden
if(reIndex) {
Uri tmp = uri;
if ("file".equals(tmp.getScheme())) {
tmp = Uri.parse(uri.toString().substring("file://".length()));
}
String whereR = VideoStore.MediaColumns.DATA + " = ?";
final ContentValues cvR = new ContentValues(1);
String col = VideoStore.Video.VideoColumns.ARCHOS_HIDDEN_BY_USER;
cvR.put(col, 0);
context.getContentResolver().update(VideoStore.Video.Media.EXTERNAL_CONTENT_URI, cvR, whereR, new String[]{tmp.toString()});
}
String action;
if ((!Utils.isLocal(uri)||UriUtils.isContentUri(uri))&& UriUtils.isIndexable(uri)) {
action = ArchosMediaIntent.ACTION_VIDEO_SCANNER_SCAN_FILE;
}
else {
action = Intent.ACTION_MEDIA_SCANNER_SCAN_FILE;
if(uri.getScheme()==null)
uri = Uri.parse("file://"+uri.toString());
}
Intent scanIntent = new Intent(action);
scanIntent.setData(uri);
if(!UriUtils.isContentUri(uri)) // doesn't work with content
context.sendBroadcast(scanIntent);
else
NetworkScannerServiceVideo.startIfHandles(context, scanIntent);
}
示例3: onReceive
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
NetworkState networkState = NetworkState.instance(context);
networkState.updateFrom(context);
if (mCurrentVideo!=null&&(!networkState.isConnected()||!networkState.hasLocalConnection()&&!Utils.isSlowRemote(mCurrentVideo.getFileUri()))&&!Utils.isLocal(mCurrentVideo.getFileUri())&&isAdded()&&!isDetached()) {
getActivity().finish();
}
}
示例4: setSource
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
public void setSource(Uri source){
if(source.equals(mSelectedUri)){
((CardView)mRootView).setCardBackgroundColor(mBackgroundColor);
}
else ((CardView)mRootView).setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.transparent_grey));
if(Utils.isLocal(source)){
mSourceTextView.setText("Local");
}
else {
mSourceTextView.setText(source.getScheme());
}
}
示例5: setSource
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
public void setSource(Uri source){
if(source.equals(mSelectedUri)){
mRootView.setBackgroundColor(mBackgroundColor);
}
else mRootView.setBackground(ContextCompat.getDrawable(mContext, R.color.lb_basic_card_info_bg_color));
if(Utils.isLocal(source)){
mSourceTextView.setText("Local");
}
else {
mSourceTextView.setText(source.getScheme());
}
}
示例6: isImplementedByFileCore
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
/**
* returns if it has been implemented by filecore
* @param uri
* @return
*/
public static boolean isImplementedByFileCore(Uri uri){
return Utils.isLocal(uri)||uri.getScheme().equals("smb")||
uri.getScheme().equals("upnp")||
uri.getScheme().equals("ftps")||
uri.getScheme().equals("ftp")||
uri.getScheme().equals("sftp")||
uri.getScheme().equals("content");
}
示例7: doInBackground
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
if (DBG) Log.d(TAG, "position: "+mVideoInfo.resume+" - id: "+mVideoInfo.id);
if (mVideoInfo.id != -1) {
int playerParams = VideoStore.paramsFromTracks(mVideoInfo.audioTrack, mVideoInfo.subtitleTrack);
final String where = VideoStore.Video.VideoColumns._ID + " = " + mVideoInfo.id;
ContentResolver resolver = mContext.getContentResolver();
ContentValues values = new ContentValues(8);
values.put(VideoStore.Video.VideoColumns.ARCHOS_BOOKMARK, mVideoInfo.bookmark);
values.put(VideoStore.Video.VideoColumns.BOOKMARK, mVideoInfo.resume);
values.put(VideoStore.Video.VideoColumns.DURATION, mVideoInfo.duration);
values.put(VideoStore.Video.VideoColumns.ARCHOS_PLAYER_PARAMS, playerParams);
values.put(VideoStore.Video.VideoColumns.ARCHOS_PLAYER_SUBTITLE_DELAY, mVideoInfo.subtitleDelay);
values.put(VideoStore.Video.VideoColumns.ARCHOS_PLAYER_SUBTITLE_RATIO, mVideoInfo.subtitleRatio);
values.put(VideoStore.Video.VideoColumns.ARCHOS_LAST_TIME_PLAYED, mVideoInfo.lastTimePlayed);
values.put(VideoStore.Video.VideoColumns.ARCHOS_TRAKT_RESUME, mVideoInfo.traktResume);
resolver.update(VideoStore.Video.Media.EXTERNAL_CONTENT_URI,
values, where, null);
}
XmlDb xmlDb = null;
if (DBG) Log.d(TAG, "mExportDb: "+mExportDb+" - isLocal: "+Utils.isLocal(mVideoInfo.uri)+" isSlowRemote "+Utils.isSlowRemote(mVideoInfo.uri));
if (mExportDb &&
!Utils.isLocal(mVideoInfo.uri)&&
mVideoInfo.duration>0
&&UriUtils.isCompatibleWithRemoteDB(mVideoInfo.uri)) { //save on network
if (xmlDb == null)
xmlDb = XmlDb.getInstance();
xmlDb.writeXmlRemote(mVideoInfo);
}
return null;
}
示例8: onVideoDbInfo
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
private void onVideoDbInfo(VideoDbInfo videoInfo, boolean isRemote) {
if (videoInfo == null) {
videoInfo = new VideoDbInfo(mUri);
}
if (isRemote) {
mRemoteVideoInfo = videoInfo;
}
else {
mLocalVideoInfo = videoInfo;
//unregister listener not to be called again
if(mCursorLoader!=null){
mCursorLoader.unregisterListener(this);
mCursorLoader = null;
}
}
if (mWaitRemote && (mRemoteVideoInfo == null || mLocalVideoInfo == null)&&
!Utils.isLocal(videoInfo.uri)
&&UriUtils.isCompatibleWithRemoteDB(videoInfo.uri)) { //if we haven't remote info yet (we can check this only when we have remote uri
//if we haven't launched remote xml parsing
if(!mHasRetrieveRemote){
mHasRetrieveRemote = true;
XmlDb xmlDb = XmlDb.getInstance();
mRemoteXmlObserver = new XmlObserver(videoInfo.uri);
xmlDb.addParseListener(mRemoteXmlObserver);
xmlDb.parseXmlLocation(videoInfo.uri);
}
return;
}
mUri = mLocalVideoInfo.uri;
mVideoId = mLocalVideoInfo.id;
if (mRemoteVideoInfo != null)
mRemoteVideoInfo.id = mVideoId;
if (mAutoScrape && !mLocalVideoInfo.isScraped&& UriUtils.isIndexable(mUri))
requestScraping();
if (mListener != null)
mListener.onVideoDb(mLocalVideoInfo, mRemoteVideoInfo);
}
示例9: isBlacklisted
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
public boolean isBlacklisted(Uri file) {
if (file == null) return true;
for (String blacklisted : BLACKLISTED_CAMERA) {
if (Utils.isLocal(file) && file.getPath().startsWith(blacklisted)) return true;
}
for (String extPath: ExtStorageManager.getExtStorageManager().getExtSdcards()) {
for (String blacklistedDir : BLACKLISTED_CAM_DIRS) {
if (Utils.isLocal(file) && file.getPath().startsWith(extPath+blacklistedDir)) return true;
}
}
return isFilenameBlacklisted(file.getLastPathSegment());
}
示例10: compare
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
@Override
public int compare(Video video1, Video video2) {
int pos1=0;
int pos2=0;
boolean found1 = false;
boolean found2 = false;
for(Video oldVideoInList : mOldVideoList){
if(oldVideoInList.getUri().equals(video1.getUri())){
found1 = true;
if(found2)
break;
}
if(oldVideoInList.getUri().equals(video2.getUri())){
found2 = true;
if(found1)
break;
}
if(!found1)
pos1++;
if(!found2)
pos2++;
}
if(found1&&found2){
if(pos1<pos2)
return -1;
if(pos1>pos2)
return 1;
}
if(video1.is3D()&&!video2.is3D())
return -1;
if(!video1.is3D()&&video2.is3D())
return 1 ;
if(video1.getNormalizedDefinition()!=video2.getNormalizedDefinition()){ // return better resolution
if(video1.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_4K)
return -1;
if(video2.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_4K)
return 1;
if(video1.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_1080P)
return -1;
if(video2.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_1080P)
return 1;
if(video1.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_720P)
return -1;
if(video2.getNormalizedDefinition() == VideoStore.Video.VideoColumns.ARCHOS_DEFINITION_720P)
return 1;
}
if(Utils.isLocal(video1.getFileUri()))
return -1;
if (Utils.isLocal(video2.getFileUri()))
return 1;
if(!Utils.isSlowRemote(video1.getFileUri()))
return -1;
if(!Utils.isSlowRemote(video2.getFileUri()))
return 1;
return -1;
}
示例11: preloadTorrent
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
private void preloadTorrent(){
if(!Utils.isLocal(Uri.parse(mTorrentURL))&& UriUtils.isImplementedByFileCore(Uri.parse(mTorrentURL))){
//first we download the torrent file
Uri mTorrentUri = Uri.parse(mTorrentURL);
ArrayList<Uri> source = new ArrayList<Uri>();
source.add(mTorrentUri);
File targetFile = TorrentPathDialogPreference.getDefaultDirectory(PreferenceManager.getDefaultSharedPreferences(this));
Uri target = Uri.parse("file://" + targetFile.getAbsolutePath());
//mtorrenttolaunch shouldn't have "file://"
mTorrentToLaunch = Uri.withAppendedPath( Uri.parse(targetFile.getAbsolutePath()), mTorrentUri.getLastPathSegment());
CopyCutEngine engine = new CopyCutEngine(getBaseContext());
engine.setListener(new OperationEngineListener() {
@Override
public void onStart() {
}
@Override
public void onProgress(int currentFile, long currentFileProgress,int currentRootFile, long currentRootFileProgress, long totalProgress, double currentSpeed) {
}
@Override
public void onSuccess(Uri file) {
}
@Override
public void onFilesListUpdate(List<MetaFile2> copyingMetaFiles,List<MetaFile2> rootFiles) {
}
@Override
public void onEnd() {
mTorrentURL = mTorrentToLaunch.toString();
loadTorrent();
}
@Override
public void onFatalError(Exception e) {
showErrorDialog(getString(R.string.error_loading_torrent));
mProgress.dismiss();
}
@Override
public void onCanceled() {
mProgress.dismiss();
}
});
engine.copyUri(source, target, true);
mProgress.show();
}
else {
loadTorrent();
}
}
示例12: bindVideo
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
private void bindVideo(VideoViewHolder vh, Video video) {
final ImageCardView card = vh.getImageCardView();
// setup the trakt flag BEFORE the poster because it is handled in a strange way in the ImageCardViewTarget
vh.mImageCardViewTarget.setWatchedFlag(video.isWatched());
Uri posterUri = video.getPosterUri();
boolean isLarge= false;
if (video instanceof Episode) {
// Special TvShow episode binding
Episode episode = (Episode)video;
Resources r = card.getResources();
String episodeName = episode.getName();
if (episodeName==null) episodeName="";
switch (mEpisodeDisplayMode) {
case FOR_GENERAL_LIST:
card.setTitleText(episode.getShowName());
card.setContentText(r.getString(R.string.leanback_episode_details_for_general_list, episode.getSeasonNumber(), episode.getEpisodeNumber(), episodeName));
break;
case FOR_SEASON_LIST:
if(episode.getPictureUri()!=null) {
posterUri = episode.getPictureUri();
isLarge = true;
}
card.setTitleText(r.getString(R.string.leanback_episode_name_for_season_list, episode.getEpisodeNumber(), episodeName));
card.setContentText("");
break;
}
}
else {
if (video instanceof Movie) {
// Special Movie binding
card.setTitleText(video.getName());
card.setContentText("");
} else {
// Non indexed case
card.setTitleText(video.getFilenameNonCryptic());
card.setContentText("");
}
}
if (posterUri!=null) {
vh.updateCardView(posterUri, video.getId(),isLarge);
}
//don't try to load thumb when not indexed or not local && create remote thumb is set to false
else if (video.isIndexed()&& (Utils.isLocal(video.getFileUri())||PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(VideoProvider.PREFERENCE_CREATE_REMOTE_THUMBS, false))) {
// get/build Thumbnail
vh.updateCardView(ThumbnailRequestHandler.buildUri(video.getId()),-1, false);
}
else {
vh.updateCardView(mErrorDrawable);
}
int resumeMs = video.getResumeMs();
if (resumeMs == 0 || resumeMs == PlayerActivity.LAST_POSITION_UNKNOWN) {
vh.setResumeInPercent(0, isLarge);
} else if (resumeMs == PlayerActivity.LAST_POSITION_END) {
vh.setResumeInPercent(100f, isLarge);
} else {
vh.setResumeInPercent(100*resumeMs/(float)video.getDurationMs(), isLarge);
}
vh.setOccurencies(video.getOccurencies());
}
示例13: smoothUpdateVideo
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
/**
* display current video and returns whether we should or shouldn't rebuild full rows
* @param currentVideo
* @param oldVideoObject
* @return
*/
private boolean smoothUpdateVideo(Video currentVideo, Video oldVideoObject) {
Log.d(TAG, "smoothUpdateVideo");
boolean smoothUpdate = false;
// Check if we really need to update the fragment
boolean needToUpdateDetailsOverview;
if (mDetailsOverviewRow==null && mDetailRowBuilderTask==null) { // if no row yet and no async task building it yet
needToUpdateDetailsOverview = true; // first time
} else {
needToUpdateDetailsOverview = foundDifferencesRequiringDetailsUpdate(oldVideoObject, currentVideo); // update
}
// Update if needed
if (needToUpdateDetailsOverview) {
requestIndexAndScrap();
// First check if we can do a smooth/smart update (when unscrapping and/or unindexing)
// smooth update when unscrapping
if (oldVideoObject!=null && oldVideoObject.hasScraperData() && !currentVideo.hasScraperData()) {
// remove scraper related rows
if(mAdapter.indexOf(mFileListRow)>=0) {
mAdapter.remove(mFileListRow);
INDEX_SUBTITLES--;
INDEX_FILEDETAILS--;
}
mAdapter.remove(mPlotAndGenresRow);
mAdapter.remove(mCastRow);
mAdapter.remove(mTrailersRow);
mAdapter.remove(mPostersRow);
mAdapter.remove(mBackdropsRow);
// update details presenter and actions
mDescriptionPresenter.update(currentVideo);
if(mDetailsOverviewRow.getActionsAdapter()==null)
mDetailsOverviewRow.setActionsAdapter(new VideoActionAdapter(getActivity(), currentVideo, mLaunchedFromPlayer, mShouldDisplayRemoveFromList, mNextEpisode));
else ((VideoActionAdapter)mDetailsOverviewRow.getActionsAdapter()).update(currentVideo, mLaunchedFromPlayer, mShouldDisplayRemoveFromList, mNextEpisode);
// update poster
mDetailsOverviewRow.setImageDrawable(getResources().getDrawable(R.drawable.filetype_new_video));
mDetailsOverviewRow.setImageScaleUpAllowed(false);
smoothUpdate = true;
}
// smooth update when unindexing
if (oldVideoObject!=null && oldVideoObject.isIndexed() && !currentVideo.isIndexed()) {
// update details presenter and actions
mDescriptionPresenter.update(currentVideo);
if(mDetailsOverviewRow.getActionsAdapter()==null)
mDetailsOverviewRow.setActionsAdapter(new VideoActionAdapter(getActivity(), currentVideo, mLaunchedFromPlayer, mShouldDisplayRemoveFromList, mNextEpisode));
else ((VideoActionAdapter)mDetailsOverviewRow.getActionsAdapter()).update(currentVideo, mLaunchedFromPlayer, mShouldDisplayRemoveFromList, mNextEpisode);
// update poster
mDetailsOverviewRow.setImageDrawable(getResources().getDrawable(R.drawable.filetype_new_video));
mDetailsOverviewRow.setImageScaleUpAllowed(false);
smoothUpdate = true;
}
}else {
smoothUpdate = true;
}
if(mShouldUpdateRemoteResume) {
//before that, we couldn't be sure to have the right file uri. Now that we are, try to get remote resume
currentVideo.setRemoteResumeMs(-1);//reset remote resume
if (!mLaunchedFromPlayer && !Utils.isLocal(currentVideo.getFileUri()) && UriUtils.isCompatibleWithRemoteDB(currentVideo.getFileUri())) {
Log.d(TAG, "addParseListener");
XmlDb.getInstance().addParseListener(mRemoteDbObserver);
XmlDb.getInstance().parseXmlLocation(currentVideo.getFileUri());
}
mShouldUpdateRemoteResume = false;
}else if(oldVideoObject!=null)
currentVideo.setRemoteResumeMs(oldVideoObject.getRemoteResumeMs());
mHasRetrievedDetails = true;
return smoothUpdate;
}
示例14: waitForThumbnailReady
import com.archos.filecorelibrary.Utils; //导入方法依赖的package包/类
/**
* This method blocks until thumbnail is ready.
*
* @param thumbUri
* @return
*/
private boolean waitForThumbnailReady(Uri origUri) {
Log.d(TAG,"waitForThumbnailReady");
String origId = origUri.getLastPathSegment();
String[] whereArgs = new String[] { origId };
Cursor c = query(origUri, new String[] { BaseColumns._ID, MediaColumns.DATA,
VideoColumns.MINI_THUMB_MAGIC, VideoColumns.ARCHOS_THUMB_TRY}, LIGHT_INDEX_STORAGE_QUERY, whereArgs , null);
if(DBG) Log.d(TAG_DOCTOR_WHO, "is cursor null ? "+String.valueOf(c==null));
if (c == null) return false;
boolean result = false;
if (c.moveToFirst()) {
long id = c.getLong(0);
String path = c.getString(1);
if(DBG) Log.d(TAG_DOCTOR_WHO, "trying to create thumb for "+path);
long magic = c.getLong(2);
int nbTry = c.getInt(3);
if (magic == 0 && nbTry >= THUMB_TRY_MAX|| !Utils.isLocal(Uri.parse(path))&&!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(PREFERENCE_CREATE_REMOTE_THUMBS, false)) {
// thumbnail creation failed more than one time: abort.
if(DBG) Log.d(TAG_DOCTOR_WHO, "thumbnail creation failed more than "+THUMB_TRY_MAX+" times: abort. ");
c.close();
return false;
}
MediaThumbRequest req = requestMediaThumbnail(path, origUri,
MediaThumbRequest.PRIORITY_HIGH, magic);
if(DBG) Log.d(TAG_DOCTOR_WHO, "is MediaThumbRequest null ? "+String.valueOf(req==null));
if (req == null) {
return false;
}
synchronized (req) {
try {
while (req.mState == MediaThumbRequest.State.WAIT) {
req.wait();
}
} catch (InterruptedException e) {
Log.w(TAG, e);
}
if (req.mState == MediaThumbRequest.State.DONE) {
result = true;
if (magic == 0) {
/*
* previous magic = 0, thumbnail was never created,
* retrieve the new magic after requestMediaThumbnail
* call to check if thumbnail is valid after that call.
*/
c.close();
c = query(origUri, new String[] { VideoColumns.MINI_THUMB_MAGIC,
VideoColumns.ARCHOS_THUMB_TRY}, null, null, null);
if (c == null) return result;
if (c.moveToFirst()) {
magic = c.getLong(0);
nbTry = c.getInt(1) + 1;
if(DBG) Log.d(TAG_DOCTOR_WHO, " MediaThumbRequest set try to "+String.valueOf(nbTry));
if (magic == 0) {
ContentValues values = new ContentValues();
values.put(VideoColumns.ARCHOS_THUMB_TRY, nbTry);
update(origUri, values, null, null);
}
}
}
}
}
}
c.close();
return result;
}