List of usage examples for android.content ContentResolver SCHEME_CONTENT
String SCHEME_CONTENT
To view the source code for android.content ContentResolver SCHEME_CONTENT.
Click Source Link
From source file:com.commonsware.android.documents.consumer.DurablizerService.java
private DocumentFile buildDocFileForUri(Uri document) { DocumentFile docFile;// w ww . j av a 2s . c o m if (document.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { docFile = DocumentFile.fromSingleUri(this, document); } else { docFile = DocumentFile.fromFile(new File(document.getPath())); } return (docFile); }
From source file:com.example.yf.ijkplayerdemo.activities.VideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); mSettings = new Settings(this); // handle arguments mVideoPath = getIntent().getStringExtra("videoPath"); Intent intent = getIntent();/* w w w . ja v a 2 s. c o m*/ String intentAction = intent.getAction(); if (!TextUtils.isEmpty(intentAction)) { if (intentAction.equals(Intent.ACTION_VIEW)) { mVideoPath = intent.getDataString(); } else if (intentAction.equals(Intent.ACTION_SEND)) { mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish(); return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } } } if (!TextUtils.isEmpty(mVideoPath)) { new RecentMediaStorage(this).saveUrlAsync(mVideoPath); } // init UI Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); mMediaController = new AndroidMediaController(this, false); mMediaController.setSupportActionBar(actionBar); mToastTextView = (TextView) findViewById(R.id.toast_text_view); mHudView = (TableLayout) findViewById(R.id.hud_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mRightDrawer = (ViewGroup) findViewById(R.id.right_drawer); mDrawerLayout.setScrimColor(Color.TRANSPARENT); // init player IjkMediaPlayer.loadLibrariesOnce(null); IjkMediaPlayer.native_profileBegin("libijkplayer.so"); mVideoView = (IjkVideoView) findViewById(R.id.video_view); mVideoView.setMediaController(mMediaController); mVideoView.setHudView(mHudView); // prefer mVideoPath if (mVideoPath != null) mVideoView.setVideoPath(mVideoPath); else if (mVideoUri != null) mVideoView.setVideoURI(mVideoUri); else { Log.e(TAG, "Null Data Source\n"); finish(); return; } mVideoView.start(); }
From source file:com.hema.playViewUtil.ui.OnlineVideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ???// w w w . ja v a2 s. c om requestWindowFeature(Window.FEATURE_NO_TITLE); // ???? getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_player); mSettings = new Settings(this); // handle arguments mVideoPath = getIntent().getStringExtra("videoPath"); Intent intent = getIntent(); String intentAction = intent.getAction(); if (!TextUtils.isEmpty(intentAction)) { if (intentAction.equals(Intent.ACTION_VIEW)) { mVideoPath = intent.getDataString(); } else if (intentAction.equals(Intent.ACTION_SEND)) { mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish(); return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } } } if (!TextUtils.isEmpty(mVideoPath)) { new RecentMediaStorage(this).saveUrlAsync(mVideoPath); } // init UI // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // setSupportActionBar(toolbar); // ActionBar actionBar = getSupportActionBar(); mMediaController = new AndroidMediaController(this, false); // mMediaController.setSupportActionBar(actionBar); mToastTextView = (TextView) findViewById(R.id.toast_text_view); mHudView = (TableLayout) findViewById(R.id.hud_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mRightDrawer = (ViewGroup) findViewById(R.id.right_drawer); loading_icon = (ProgressBar) findViewById(R.id.loading_icon); mDrawerLayout.setScrimColor(Color.TRANSPARENT); // init player IjkMediaPlayer.loadLibrariesOnce(null); IjkMediaPlayer.native_profileBegin("libijkplayer.so"); mVideoView = (IjkVideoView) findViewById(R.id.video_view); mVideoView.setMediaController(mMediaController); // mVideoView.setHudView(mHudView); setListener(); // prefer mVideoPath if (mVideoPath != null) mVideoView.setVideoPath(mVideoPath); else if (mVideoUri != null) mVideoView.setVideoURI(mVideoUri); else { Log.e(TAG, "Null Data Source\n"); finish(); return; } mVideoView.start(); }
From source file:com.ctg.ctvideo.activities.VideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); mSettings = new Settings(this); // handle arguments mVideoPath = getIntent().getStringExtra("videoUrl"); Intent intent = getIntent();/* ww w . j a v a2s . c o m*/ String intentAction = intent.getAction(); if (!TextUtils.isEmpty(intentAction)) { if (intentAction.equals(Intent.ACTION_VIEW)) { mVideoPath = intent.getDataString(); } else if (intentAction.equals(Intent.ACTION_SEND)) { mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish(); return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } } } if (!TextUtils.isEmpty(mVideoPath)) { new RecentMediaStorage(this).saveUrlAsync(mVideoPath); } // init UI Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); mMediaController = new AndroidMediaController(this, false); mMediaController.setSupportActionBar(actionBar); mToastTextView = (TextView) findViewById(R.id.toast_text_view); mHudView = (TableLayout) findViewById(R.id.hud_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mRightDrawer = (ViewGroup) findViewById(R.id.right_drawer); mDrawerLayout.setScrimColor(Color.TRANSPARENT); // init player IjkMediaPlayer.loadLibrariesOnce(null); IjkMediaPlayer.native_profileBegin("libijkplayer.so"); mVideoView = (IjkVideoView) findViewById(R.id.video_view); mVideoView.setMediaController(mMediaController); mVideoView.setHudView(mHudView); // mVideoAd = (FrameLayout) findViewById(R.id.video_ad); mVideoView.setVideoAd(mVideoAd); mVideoView.addVideoAdTask(0, "http://www.pp3.cn/uploads/allimg/111110/15563RI9-7.jpg"); mVideoView.addVideoAdTask(10000, intent.getStringExtra("videoImg")); mVideoView.addVideoAdTask(20000, "http://photo.enterdesk.com/2011-2-16/enterdesk.com-1AA0C93EFFA51E6D7EFE1AE7B671951F.jpg"); mVideoView.addVideoAdTask(15000, "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png"); // prefer mVideoPath if (mVideoPath != null) mVideoView.setVideoPath(mVideoPath); else if (mVideoUri != null) mVideoView.setVideoURI(mVideoUri); else { Log.e(TAG, "Null Data Source\n"); finish(); return; } mVideoView.start(); }
From source file:com.commonsware.android.tte.DocumentStorageService.java
private void save(Uri document, String text, boolean isClosing) { boolean isContent = ContentResolver.SCHEME_CONTENT.equals(document.getScheme()); try {//www .j a v a2 s .c om OutputStream os = getContentResolver().openOutputStream(document, "w"); OutputStreamWriter osw = new OutputStreamWriter(os); try { osw.write(text); osw.flush(); if (isClosing && isContent) { int perms = Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION; getContentResolver().releasePersistableUriPermission(document, perms); } EventBus.getDefault().post(new DocumentSavedEvent(document)); } finally { osw.close(); } } catch (Exception e) { Log.e(getClass().getSimpleName(), "Exception saving " + document.toString(), e); EventBus.getDefault().post(new DocumentSaveErrorEvent(document, e)); } }
From source file:cn.figo.mydemo.ui.activity.VideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); mSettings = new Settings(this); // handle arguments mVideoPath = getIntent().getStringExtra("videoPath"); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish();//from w w w .j a va 2s.c o m return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } Intent intent = getIntent(); String intentAction = intent.getAction(); if (!TextUtils.isEmpty(intentAction)) { if (intentAction.equals(Intent.ACTION_VIEW)) { mVideoPath = intent.getDataString(); } else if (intentAction.equals(Intent.ACTION_SEND)) { mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish(); return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } } } if (!TextUtils.isEmpty(mVideoPath)) { new RecentMediaStorage(this).saveUrlAsync(mVideoPath); } // init UI Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); mMediaController = new AndroidMediaController(this, false); mMediaController.setSupportActionBar(actionBar); mToastTextView = (TextView) findViewById(R.id.toast_text_view); mHudView = (TableLayout) findViewById(R.id.hud_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mRightDrawer = (ViewGroup) findViewById(R.id.right_drawer); mDrawerLayout.setScrimColor(Color.TRANSPARENT); new RecentMediaStorage(this).saveUrlAsync(mVideoPath); // init player IjkMediaPlayer.loadLibrariesOnce(null); IjkMediaPlayer.native_profileBegin("libijkplayer.so"); mVideoView = (IjkVideoView) findViewById(R.id.video_view); mVideoView.setMediaController(mMediaController); mVideoView.setHudView(mHudView); mVideoView.toggleAspectRatio(); if (mVideoPath != null) mVideoView.setVideoPath(mVideoPath); else if (mVideoUri != null) mVideoView.setVideoURI(mVideoUri); else { Log.e(TAG, "Null Data Source\n"); finish(); return; } initDanmaku(); }
From source file:com.commonsware.android.tte.MainActivity.java
private void openEditor(Uri document) { if (ContentResolver.SCHEME_CONTENT.equals(document.getScheme()) || canWriteFiles()) { int position = adapter.getPositionForDocument(document); if (position == -1) { adapter.addDocument(document); pager.setCurrentItem(adapter.getCount() - 1); if (!editHistory.addOpenEditor(document)) { Toast.makeText(this, R.string.msg_save_history, Toast.LENGTH_LONG).show(); }// www.j a va 2 s .c o m } else { pager.setCurrentItem(position); } } else if (ContentResolver.SCHEME_FILE.equals(document.getScheme())) { pendingFiles.add(document); ActivityCompat.requestPermissions(this, PERMS_FILE, REQUEST_PERMS_FILE); } }
From source file:com.android.cts.intent.sender.ContentTest.java
private Uri getBasicContentProviderUri(String path) { // The uris created here are not associated with any data. But this does not prevent us from // granting these uris to other apps, or these apps from trying to access these uris. return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT) .authority("com.android.cts.intent.sender.provider").path(path).build(); }
From source file:cm.aptoide.com.actionbarsherlock.widget.SuggestionsAdapter.java
public Cursor getSuggestions(String query, int limit) { Uri.Builder uriBuilder = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel() .fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel() // append standard suggestion query path uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY); // inject query, either as selection args or inline uriBuilder.appendPath(query);// w w w . j a v a 2 s. c o m if (limit > 0) { uriBuilder.appendQueryParameter(SearchManager.SUGGEST_PARAMETER_LIMIT, String.valueOf(limit)); } Uri uri = uriBuilder.build(); // finally, make the query return mContext.getContentResolver().query(uri, null, null, null, null); }
From source file:com.actionbarsherlock.widget.SuggestionsAdapter.java
public Cursor getSuggestions(String query, int limit) { if (mSearchable == null) { return null; }/*from w w w. j a va 2s . co m*/ String authority = mSearchable.getSuggestAuthority(); if (authority == null) { return null; } Uri.Builder uriBuilder = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(authority) .query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel() .fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel() // if content path provided, insert it now final String contentPath = mSearchable.getSuggestPath(); if (contentPath != null) { uriBuilder.appendEncodedPath(contentPath); } // append standard suggestion query path uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY); // get the query selection, may be null String selection = mSearchable.getSuggestSelection(); // inject query, either as selection args or inline String[] selArgs = null; if (selection != null) { // use selection if provided selArgs = new String[] { query }; } else { // no selection, use REST pattern uriBuilder.appendPath(query); } if (limit > 0) { uriBuilder.appendQueryParameter("limit", String.valueOf(limit)); } Uri uri = uriBuilder.build(); // finally, make the query return mContext.getContentResolver().query(uri, null, selection, selArgs, null); }