当前位置: 首页>>代码示例>>Java>>正文


Java MRLPanelFragment类代码示例

本文整理汇总了Java中org.videolan.vlc.gui.network.MRLPanelFragment的典型用法代码示例。如果您正苦于以下问题:Java MRLPanelFragment类的具体用法?Java MRLPanelFragment怎么用?Java MRLPanelFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MRLPanelFragment类属于org.videolan.vlc.gui.network包,在下文中一共展示了MRLPanelFragment类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPrepareOptionsMenu

import org.videolan.vlc.gui.network.MRLPanelFragment; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu (Menu menu) {
    super.onPrepareOptionsMenu(menu);
    if (menu == null)
        return false;
    Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
    MenuItem item;
    // Disable the sort option if we can't use it on the current fragment.
    if (current == null || !(current instanceof ISortable)) {
        item = menu.findItem(R.id.ml_menu_sortby);
        if (item == null)
            return false;
        item.setEnabled(false);
        item.setVisible(false);
    } else {
        ISortable sortable = (ISortable) current;
        item = menu.findItem(R.id.ml_menu_sortby);
        if (item == null)
            return false;
        item.setEnabled(true);
        item.setVisible(true);
        item = menu.findItem(R.id.ml_menu_sortby_name);
        if (sortable.sortDirection(VideoListAdapter.SORT_BY_TITLE) == 1)
            item.setTitle(R.string.sortby_name_desc);
        else
            item.setTitle(R.string.sortby_name);
        item = menu.findItem(R.id.ml_menu_sortby_length);
        if (sortable.sortDirection(VideoListAdapter.SORT_BY_LENGTH) == 1)
            item.setTitle(R.string.sortby_length_desc);
        else
            item.setTitle(R.string.sortby_length);
        item = menu.findItem(R.id.ml_menu_sortby_date);
        if (sortable.sortDirection(VideoListAdapter.SORT_BY_DATE) == 1)
            item.setTitle(R.string.sortby_date_desc);
        else
            item.setTitle(R.string.sortby_date);
    }

    boolean networkSave = current instanceof NetworkBrowserFragment && !((NetworkBrowserFragment)current).isRootDirectory();
    if (networkSave) {
        item = menu.findItem(R.id.ml_menu_save);
        item.setVisible(true);
        String mrl = ((BaseBrowserFragment)current).mMrl;
        item.setIcon(MediaDatabase.getInstance().networkFavExists(Uri.parse(mrl)) ?
                R.drawable.ic_menu_bookmark_w :
                R.drawable.ic_menu_bookmark_outline_w);
    } else
        menu.findItem(R.id.ml_menu_save).setVisible(false);
    if (current instanceof MRLPanelFragment)
        menu.findItem(R.id.ml_menu_clean).setVisible(!((MRLPanelFragment) current).isEmpty());
    boolean showLast = current instanceof AudioBrowserFragment || (current instanceof VideoGridFragment && mSettings.getString(PreferencesActivity.VIDEO_LAST, null) != null);
    menu.findItem(R.id.ml_menu_last_playlist).setVisible(showLast);
    return true;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:55,代码来源:MainActivity.java

示例2: onOptionsItemSelected

import org.videolan.vlc.gui.network.MRLPanelFragment; //导入依赖的package包/类
/**
 * Handle onClick form menu buttons
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // Current fragment loaded
    Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

    // Handle item selection
    switch (item.getItemId()) {
        case R.id.ml_menu_sortby_name:
        case R.id.ml_menu_sortby_length:
        case R.id.ml_menu_sortby_date:
            if (current == null)
                break;
            if (current instanceof ISortable) {
                int sortBy = VideoListAdapter.SORT_BY_TITLE;
                if (item.getItemId() == R.id.ml_menu_sortby_length)
                    sortBy = VideoListAdapter.SORT_BY_LENGTH;
                else if(item.getItemId() == R.id.ml_menu_sortby_date)
                    sortBy = VideoListAdapter.SORT_BY_DATE;
                ((ISortable) current).sortBy(sortBy);
                supportInvalidateOptionsMenu();
            }
            break;
        case R.id.ml_menu_equalizer:
            showSecondaryFragment(SecondaryActivity.EQUALIZER);
            break;
        // Refresh
        case R.id.ml_menu_refresh:
            if (!mMediaLibrary.isWorking()) {
                if(current != null && current instanceof IRefreshable)
                    ((IRefreshable) current).refresh();
                else
                    mMediaLibrary.loadMediaItems(true);
            }
            break;
        // Restore last playlist
        case R.id.ml_menu_last_playlist:
            if (current instanceof AudioBrowserFragment) {
                Intent i = new Intent(PlaybackService.ACTION_REMOTE_LAST_PLAYLIST);
                sendBroadcast(i);
            } else if (current instanceof VideoGridFragment) {
                final Uri uri = Uri.parse(mSettings.getString(PreferencesActivity.VIDEO_LAST, null));
                if (uri != null)
                    VideoPlayerActivity.start(this, uri);
            }
            break;
        case android.R.id.home:
            // Slide down the audio player.
            if (slideDownAudioPlayer())
                break;
            /* Toggle the sidebar */
            if (mDrawerToggle.onOptionsItemSelected(item)) {
                return true;
            }
            break;
        case R.id.ml_menu_clean:
            if (getFragment(mCurrentFragment) instanceof MRLPanelFragment)
                ((MRLPanelFragment)getFragment(mCurrentFragment)).clearHistory();
            break;
        case R.id.ml_menu_save:
            if (current == null)
                break;
            ((NetworkBrowserFragment)current).toggleFavorite();
            item.setIcon(R.drawable.ic_menu_bookmark_w);
            break;
    }
    mDrawerLayout.closeDrawer(mListView);
    return super.onOptionsItemSelected(item);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:73,代码来源:MainActivity.java

示例3: onOptionsItemSelected

import org.videolan.vlc.gui.network.MRLPanelFragment; //导入依赖的package包/类
/**
 * Handle onClick form menu buttons
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // Current fragment loaded
    Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

    // Handle item selection
    switch (item.getItemId()) {
        case R.id.ml_menu_sortby_name:
        case R.id.ml_menu_sortby_length:
        case R.id.ml_menu_sortby_date:
            if (current == null)
                break;
            if (current instanceof ISortable) {
                int sortBy = VideoListAdapter.SORT_BY_TITLE;
                if (item.getItemId() == R.id.ml_menu_sortby_length)
                    sortBy = VideoListAdapter.SORT_BY_LENGTH;
                else if(item.getItemId() == R.id.ml_menu_sortby_date)
                    sortBy = VideoListAdapter.SORT_BY_DATE;
                ((ISortable) current).sortBy(sortBy);
                supportInvalidateOptionsMenu();
            }
            break;
        case R.id.ml_menu_equalizer:
            showSecondaryFragment(SecondaryActivity.EQUALIZER);
            break;
        // Refresh
        case R.id.ml_menu_refresh:
            if (!mMediaLibrary.isWorking()) {
                if(current != null && current instanceof IRefreshable)
                    ((IRefreshable) current).refresh();
                else
                    mMediaLibrary.scanMediaItems(true);
            }
            break;
        // Restore last playlist
        case R.id.ml_menu_last_playlist:
            if (current instanceof AudioBrowserFragment) {
                Intent i = new Intent(PlaybackService.ACTION_REMOTE_LAST_PLAYLIST);
                sendBroadcast(i);
            } else if (current instanceof VideoGridFragment) {
                final Uri uri = Uri.parse(mSettings.getString(PreferencesActivity.VIDEO_LAST, null));
                if (uri != null)
                    VideoPlayerActivity.start(this, uri);
            }
            break;
        case android.R.id.home:
            // Slide down the audio player.
            if (slideDownAudioPlayer())
                break;
            /* Toggle the sidebar */
            if (mDrawerToggle.onOptionsItemSelected(item)) {
                return true;
            }
            break;
        case R.id.ml_menu_clean:
            if (getFragment(mCurrentFragment) instanceof MRLPanelFragment)
                ((MRLPanelFragment)getFragment(mCurrentFragment)).clearHistory();
            break;
        case R.id.ml_menu_save:
            if (current == null)
                break;
            ((NetworkBrowserFragment)current).toggleFavorite();
            item.setIcon(R.drawable.ic_menu_bookmark_w);
            break;
    }
    mDrawerLayout.closeDrawer(mListView);
    return super.onOptionsItemSelected(item);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:73,代码来源:MainActivity.java


注:本文中的org.videolan.vlc.gui.network.MRLPanelFragment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。