當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。