本文整理汇总了Java中org.videolan.libvlc.util.AndroidUtil类的典型用法代码示例。如果您正苦于以下问题:Java AndroidUtil类的具体用法?Java AndroidUtil怎么用?Java AndroidUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidUtil类属于org.videolan.libvlc.util包,在下文中一共展示了AndroidUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detachViews
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@Override
@MainThread
public void detachViews() {
if (mSurfacesState.get() == SURFACE_STATE_INIT)
return;
mSurfacesState.set(SURFACE_STATE_INIT);
mHandler.removeCallbacksAndMessages(null);
synchronized (mNativeLock) {
mOnNewVideoLayoutListener = null;
mNativeLock.buffersGeometryAbort = true;
mNativeLock.notifyAll();
}
for (int id = 0; id < ID_MAX; ++id) {
final SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
if (surfaceHelper != null)
surfaceHelper.release();
mSurfaceHelpers[id] = null;
}
for (IVLCVout.Callback cb : mIVLCVoutCallbacks)
cb.onSurfacesDestroyed(this);
if (mSurfaceCallback != null)
mSurfaceCallback.onSurfacesDestroyed(this);
if (AndroidUtil.isJellyBeanOrLater)
mSurfaceTextureThread.release();
}
示例2: getPlaylistDbItems
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
public ArrayList<AudioBrowserListAdapter.ListItem> getPlaylistDbItems() {
ArrayList<AudioBrowserListAdapter.ListItem> playlistItems = new ArrayList<AudioBrowserListAdapter.ListItem>();
AudioBrowserListAdapter.ListItem playList;
MediaDatabase db = MediaDatabase.getInstance();
String[] items, playlistNames = db.getPlaylists();
for (String playlistName : playlistNames){
items = db.playlistGetItems(playlistName);
if (items == null)
continue;
playList = new AudioBrowserListAdapter.ListItem(playlistName, null, null, false);
for (String track : items){
playList.mMediaList.add(new MediaWrapper(AndroidUtil.LocationToUri(track)));
}
playlistItems.add(playList);
}
return playlistItems;
}
示例3: deleteFile
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static boolean deleteFile (String path){
boolean deleted = false;
path = Uri.decode(Strings.removeFileProtocole(path));
//Delete from Android Medialib, for consistency with device MTP storing and other apps listing content:// media
if (AndroidUtil.isHoneycombOrLater()){
ContentResolver cr = VLCApplication.getAppContext().getContentResolver();
String[] selectionArgs = { path };
deleted = cr.delete(MediaStore.Files.getContentUri("external"),
MediaStore.Files.FileColumns.DATA + "=?", selectionArgs) > 0;
}
File file = new File(path);
if (file.exists())
deleted |= file.delete();
return deleted;
}
示例4: BitmapCache
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private BitmapCache() {
// Get memory class of this device, exceeding this amount will throw an
// OutOfMemory exception.
final ActivityManager am = ((ActivityManager) VLCApplication.getAppContext().getSystemService(
Context.ACTIVITY_SERVICE));
final int memClass = AndroidUtil.isHoneycombOrLater() ? am.getLargeMemoryClass() : am.getMemoryClass();
// Use 1/5th of the available memory for this memory cache.
final int cacheSize = 1024 * 1024 * memClass / 5;
Log.d(TAG, "LRUCache size sets to " + cacheSize);
mMemCache = new LruCache<String, Bitmap>(cacheSize) {
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight();
}
};
}
示例5: onCreateOptionsMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
/** Create menu from XML
*/
@TargetApi(Build.VERSION_CODES.FROYO)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mMenu = menu;
/* Note: on Android 3.0+ with an action bar this method
* is called while the view is created. This can happen
* any time after onCreate.
*/
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.media_library, menu);
if (AndroidUtil.isFroyoOrLater()) {
SearchManager searchManager =
(SearchManager) VLCApplication.getAppContext().getSystemService(Context.SEARCH_SERVICE);
mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.ml_menu_search));
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
mSearchView.setQueryHint(getString(R.string.search_hint));
SearchSuggestionsAdapter searchSuggestionsAdapter = new SearchSuggestionsAdapter(this, null);
searchSuggestionsAdapter.setFilterQueryProvider(this);
mSearchView.setSuggestionsAdapter(searchSuggestionsAdapter);
} else
menu.findItem(R.id.ml_menu_search).setVisible(false);
return super.onCreateOptionsMenu(menu);
}
示例6: onPopupMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!AndroidUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
setContextMenu(popupMenu.getMenuInflater(), popupMenu.getMenu(), position);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
示例7: onPopupMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!AndroidUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
setContextMenuItems(popupMenu.getMenu(), anchor, position);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
示例8: onPopupMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!AndroidUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
setContextMenuItems(popupMenu.getMenu(), anchor, position);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
示例9: prepareCacheFolder
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@SuppressLint("NewApi")
public static void prepareCacheFolder(Context context) {
try {
if (AndroidUtil.isFroyoOrLater() && AndroidDevices.hasExternalStorage() && context.getExternalCacheDir() != null)
CACHE_DIR = context.getExternalCacheDir().getPath();
else
CACHE_DIR = AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Android/data/" + BuildConfig.APPLICATION_ID + "/cache";
} catch (Exception e) { // catch NPE thrown by getExternalCacheDir()
CACHE_DIR = AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Android/data/" + BuildConfig.APPLICATION_ID + "/cache";
}
ART_DIR = CACHE_DIR + "/art/";
COVER_DIR = CACHE_DIR + "/covers/";
PLAYLIST_DIR = CACHE_DIR + "/playlists/";
for(String path : Arrays.asList(ART_DIR, COVER_DIR)) {
File file = new File(path);
if (!file.exists())
file.mkdirs();
}
}
示例10: onPopupMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!AndroidUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
setContextMenuItems(popupMenu.getMenu(), anchor);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
示例11: onContextPopupMenu
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onContextPopupMenu(View anchor, final int position) {
if (!AndroidUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.video_list, popupMenu.getMenu());
MediaWrapper media = mVideoAdapter.getItem(position);
if (media == null)
return;
setContextMenuItems(popupMenu.getMenu(), media);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
示例12: initBrightnessTouch
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(android.os.Build.VERSION_CODES.FROYO)
private void initBrightnessTouch() {
float brightnesstemp = 0.6f;
// Initialize the layoutParams screen brightness
try {
if (AndroidUtil.isFroyoOrLater() &&
Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
mRestoreAutoBrightness = android.provider.Settings.System.getInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
} else {
brightnesstemp = android.provider.Settings.System.getInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
}
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = brightnesstemp;
getWindow().setAttributes(lp);
mIsFirstBrightnessGesture = false;
}
示例13: setRemoteControlClientPlaybackState
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
/**
* A function to control the Remote Control Client. It is needed for
* compatibility with devices below Ice Cream Sandwich (4.0).
*
* @param state Playback state
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setRemoteControlClientPlaybackState(int state) {
if (!AndroidUtil.isICSOrLater() || mRemoteControlClient == null)
return;
switch (state) {
case MediaPlayer.Event.Playing:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
break;
case MediaPlayer.Event.Paused:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
break;
case MediaPlayer.Event.Stopped:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
break;
}
}
示例14: canUseForInBitmap
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
static boolean canUseForInBitmap(
Bitmap candidate, BitmapFactory.Options targetOptions) {
if (candidate == null)
return false;
if (AndroidUtil.isKitKatOrLater()) {
if (targetOptions.inSampleSize == 0)
return false;
// From Android 4.4 (KitKat) onward we can re-use if the byte size of
// the new bitmap is smaller than the reusable bitmap candidate
// allocation byte count.
int width = targetOptions.outWidth / targetOptions.inSampleSize;
int height = targetOptions.outHeight / targetOptions.inSampleSize;
int byteCount = width * height * getBytesPerPixel(candidate.getConfig());
return byteCount <= candidate.getAllocationByteCount();
}
// On earlier versions, the dimensions must match exactly and the inSampleSize must be 1
return candidate.getWidth() == targetOptions.outWidth
&& candidate.getHeight() == targetOptions.outHeight
&& targetOptions.inSampleSize == 1;
}
示例15: setView
import org.videolan.libvlc.util.AndroidUtil; //导入依赖的package包/类
private void setView(int id, TextureView view) {
if (!AndroidUtil.isICSOrLater)
throw new IllegalArgumentException("TextureView not implemented in this android version");
ensureInitState();
if (view == null)
throw new NullPointerException("view is null");
final SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
if (surfaceHelper != null)
surfaceHelper.release();
mSurfaceHelpers[id] = new SurfaceHelper(id, view);
}