本文整理汇总了Java中org.videolan.vlc.VLCApplication类的典型用法代码示例。如果您正苦于以下问题:Java VLCApplication类的具体用法?Java VLCApplication怎么用?Java VLCApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VLCApplication类属于org.videolan.vlc包,在下文中一共展示了VLCApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCustomDirectory
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
public static void addCustomDirectory(String path) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
ArrayList<String> dirs = new ArrayList<String>(
Arrays.asList(CustomDirectories.getCustomDirectories()));
dirs.add(path);
StringBuilder builder = new StringBuilder();
builder.append(dirs.remove(0));
for(String s : dirs) {
builder.append(":");
builder.append(s);
}
SharedPreferences.Editor editor = preferences.edit();
editor.putString("custom_paths", builder.toString());
Util.commitPreferences(editor);
}
示例2: removeCustomDirectory
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
public static void removeCustomDirectory(String path) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
if(!preferences.getString("custom_paths", "").contains(path))
return;
ArrayList<String> dirs = new ArrayList<String>(
Arrays.asList(preferences.getString("custom_paths", "").split(
":")));
dirs.remove(path);
String custom_path;
if(dirs.size() > 0) {
StringBuilder builder = new StringBuilder();
builder.append(dirs.remove(0));
for(String s : dirs) {
builder.append(":");
builder.append(s);
}
custom_path = builder.toString();
} else { // don't do unneeded extra work
custom_path = "";
}
SharedPreferences.Editor editor = preferences.edit();
editor.putString("custom_paths", custom_path);
Util.commitPreferences(editor);
}
示例3: onCreateOptionsMenu
import org.videolan.vlc.VLCApplication; //导入依赖的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);
}
示例4: onCreateView
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View v = inflater.inflate(getLayoutId(), container, false);
mRecyclerView = (ContextMenuRecyclerView) v.findViewById(R.id.network_list);
mEmptyView = (TextView) v.findViewById(android.R.id.empty);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.addItemDecoration(new DividerItemDecoration(VLCApplication.getAppContext(), DividerItemDecoration.VERTICAL_LIST));
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(mScrollListener);
registerForContextMenu(mRecyclerView);
mSwipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeLayout);
mSwipeRefreshLayout.setColorSchemeResources(R.color.orange700);
mSwipeRefreshLayout.setOnRefreshListener(this);
return v;
}
示例5: getDescription
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
private String getDescription(int folderCount, int mediaFileCount) {
String holderText = "";
if (folderCount > 0) {
holderText += VLCApplication.getAppResources().getQuantityString(
R.plurals.subfolders_quantity, folderCount, folderCount
);
if (mediaFileCount > 0)
holderText += ", ";
}
if (mediaFileCount > 0)
holderText += VLCApplication.getAppResources().getQuantityString(
R.plurals.mediafiles_quantity, mediaFileCount,
mediaFileCount);
else if (folderCount == 0 && mediaFileCount == 0)
holderText = getString(R.string.directory_empty);
return holderText;
}
示例6: run
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
@Override
public void run() {
if(!vibrated) {
((android.os.Vibrator) VLCApplication.getAppContext().getSystemService(Context.VIBRATOR_SERVICE))
.vibrate(80);
vibrated = true;
}
if(forward) {
if(length <= 0 || possibleSeek < length)
possibleSeek += 4000;
} else {
if(possibleSeek > 4000)
possibleSeek -= 4000;
else if(possibleSeek <= 4000)
possibleSeek = 0;
}
mTime.setText(Strings.millisToString(mShowRemainingTime ? possibleSeek-length : possibleSeek));
mTimeline.setProgress(possibleSeek);
mProgressBar.setProgress(possibleSeek);
h.postDelayed(seekRunnable, 50);
}
示例7: deleteMedia
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
public void deleteMedia(int position){
final MediaWrapper media = mVideoAdapter.getItem(position);
final String path = media.getUri().getPath();
new Thread(new Runnable() {
public void run() {
Util.recursiveDelete(VLCApplication.getAppContext(), new File(path));
}
}).start();
mMediaLibrary.getMediaItems().remove(media);
mVideoAdapter.remove(media);
if (mService != null) {
final List<String> list = mService.getMediaLocations();
if (list != null && list.contains(media.getLocation())) {
mService.removeLocation(media.getLocation());
}
}
}
示例8: onReceive
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if (action.equalsIgnoreCase(Intent.ACTION_BATTERY_CHANGED)) {
if (mBattery == null)
return;
int batteryLevel = intent.getIntExtra("level", 0);
if (batteryLevel >= 50)
mBattery.setTextColor(Color.GREEN);
else if (batteryLevel >= 30)
mBattery.setTextColor(Color.YELLOW);
else
mBattery.setTextColor(Color.RED);
mBattery.setText(String.format("%d%%", batteryLevel));
}
else if (action.equalsIgnoreCase(VLCApplication.SLEEP_INTENT)) {
exitOK();
}
}
示例9: onReceive
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (mMediaLibrary.isWorking())
return;
String action = intent.getAction();
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
final NetworkInfo networkInfo = ((ConnectivityManager) VLCApplication.getAppContext().getSystemService(
Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
if (networkInfo == null || networkInfo.getState() == NetworkInfo.State.CONNECTED) {
if (networkInfo == null){
if (connected)
connected = false;
else
return; //block consecutive calls when disconnected
} else
connected = true;
updateList();
}
} else if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_MOUNTED)) {
mStorageHandlerHandler.sendEmptyMessage(ACTION_MEDIA_MOUNTED);
} else if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_UNMOUNTED)) {
mStorageHandlerHandler.sendEmptyMessageDelayed(ACTION_MEDIA_UNMOUNTED, 100); //Delay to cancel it in case of MOUNT
}
}
示例10: getView
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
@Override
public View getView(int position, View v, ViewGroup parent) {
SidebarEntry sidebarEntry = entries.get(position);
/* If view not created */
if(v == null) {
v = mInflater.inflate(R.layout.sidebar_item, parent, false);
}
TextView textView = (TextView)v;
textView.setText(sidebarEntry.name);
Drawable img = VLCApplication.getAppResources().getDrawable(
Util.getResourceFromAttribute(mContext, sidebarEntry.attributeID));
if (img != null) {
int dp_32 = Util.convertDpToPx(32);
img.setBounds(0, 0, dp_32, dp_32);
textView.setCompoundDrawables(img, null, null, null);
}
// Set in selected the current item.
if (TextUtils.equals(mCurrentFragmentId,sidebarEntry.id)) {
textView.setTypeface(null, Typeface.BOLD);
} else {
textView.setTypeface(null, Typeface.NORMAL);
}
return v;
}
示例11: readAsset
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
public static String readAsset(String assetName, String defaultS) {
InputStream is = null;
BufferedReader r = null;
try {
is = VLCApplication.getAppResources().getAssets().open(assetName);
r = new BufferedReader(new InputStreamReader(is, "UTF8"));
StringBuilder sb = new StringBuilder();
String line = r.readLine();
if(line != null) {
sb.append(line);
line = r.readLine();
while(line != null) {
sb.append('\n');
sb.append(line);
line = r.readLine();
}
}
return sb.toString();
} catch (IOException e) {
return defaultS;
} finally {
close(is);
close(r);
}
}
示例12: removeDir
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
private void removeDir(final String path) {
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
//if media dir list was empty, we add all others
if (mMediaDirsLocation.isEmpty()) {
Storage storage;
String pathString;
for (Object item : mMediaList) {
storage = (Storage) item;
if (!TextUtils.equals(path, storage.getUri().getPath())) {
pathString = storage.getUri().getPath();
mDbManager.addDir(pathString);
}
}
} else {
mDbManager.removeDir(path);
}
updateMediaDirs();
if (isRoot && mMediaDirsLocation.isEmpty() && getItemCount() > 1)
refreshFragment();
}
});
}
示例13: addDir
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
private void addDir(final String path) {
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
mDbManager.addDir(path);
//No need to check for parents for now
// String parentPath = Strings.getParent(path);
// while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
// mDbManager.removeDir(parentPath);
// parentPath = Strings.getParent(parentPath);
// }
//Remove subfolders, it would be redundant
for (String customDirPath : mMediaDirsLocation) {
if (customDirPath.startsWith(path+"/"))
mDbManager.removeDir(customDirPath);
}
updateMediaDirs();
}
});
}
示例14: savePlaylist
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
private void savePlaylist() {
VLCApplication.runBackground(new Runnable() {
public void run() {
final MediaDatabase db = MediaDatabase.getInstance();
final String name = mEditText.getText().toString().trim();
if (db.playlistExists(name))
db.playlistDelete(name);
db.playlistAdd(name);
MediaWrapper mw;
for (int i = 0 ; i< mTracks.size() ; ++i){
mw = mTracks.get(i);
db.playlistInsertItem(name, i, mw.getLocation());
}
}
});
dismiss();
}
示例15: handleMessage
import org.videolan.vlc.VLCApplication; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
final AudioAlbumsSongsFragment fragment = getOwner();
switch (msg.what){
case DELETE_MEDIA:
AudioBrowserListAdapter.ListItem listItem = fragment.mSongsAdapter.getItem(msg.arg1);
MediaWrapper media = listItem.mMediaList.get(0);
final String path = media.getUri().getPath();
fragment.mMediaLibrary.getMediaItems().remove(media);
fragment.mSongsAdapter.removeMedia(media);
fragment.mAlbumsAdapter.removeMedia(media);
if (fragment.mService != null)
fragment.mService.removeLocation(media.getLocation());
fragment.mMediaLibrary.getMediaItems().remove(media);
VLCApplication.runBackground(new Runnable() {
public void run() {
Util.recursiveDelete(VLCApplication.getAppContext(), new File(path));
}
});
break;
}
}