Search in sources :

Example 1 with RendererItem

use of org.videolan.libvlc.RendererItem in project vlc-android by GeoffreyMetais.

the class VideoPlayerActivity method initOverlay.

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void initOverlay() {
    final ViewStubCompat vsc = findViewById(R.id.player_hud_stub);
    if (vsc != null) {
        mSeekButtons = mSettings.getBoolean("enable_seek_buttons", false);
        vsc.inflate();
        mHudBinding = DataBindingUtil.bind(findViewById(R.id.progress_overlay));
        mHudBinding.setPlayer(this);
        updateTimeValues();
        mHudBinding.setProgress(mProgress);
        mHudBinding.setLength(mMediaLength);
        final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mHudBinding.progressOverlay.getLayoutParams();
        if (AndroidDevices.isPhone || !AndroidDevices.hasNavBar)
            layoutParams.width = LayoutParams.MATCH_PARENT;
        else
            layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
        mHudBinding.progressOverlay.setLayoutParams(layoutParams);
        mOverlayBackground = findViewById(R.id.player_overlay_background);
        mNavMenu = findViewById(R.id.player_overlay_navmenu);
        if (!AndroidDevices.isChromeBook && AndroidUtil.isJellyBeanMR1OrLater) {
            mRendererBtn = findViewById(R.id.video_renderer);
            RendererDelegate.INSTANCE.getSelectedRenderer().observe(this, new Observer<RendererItem>() {

                @Override
                public void onChanged(@android.support.annotation.Nullable RendererItem rendererItem) {
                    if (mRendererBtn != null)
                        mRendererBtn.setImageResource(rendererItem == null ? R.drawable.ic_renderer_circle : R.drawable.ic_renderer_on_circle);
                }
            });
            RendererDelegate.INSTANCE.getRenderers().observe(this, new Observer<List<RendererItem>>() {

                @Override
                public void onChanged(@Nullable List<RendererItem> rendererItems) {
                    UiTools.setViewVisibility(mRendererBtn, Util.isListEmpty(rendererItems) ? View.GONE : View.VISIBLE);
                }
            });
        }
        if (mSeekButtons)
            initSeekButton();
        resetHudLayout();
        updateOverlayPausePlay();
        updateSeekable(mService.isSeekable());
        updatePausable(mService.isPausable());
        updateNavStatus();
        setListeners(true);
        initPlaylistUi();
        if (!mDisplayManager.isPrimary()) {
            mHudBinding.lockOverlayButton.setVisibility(View.GONE);
            mHudBinding.playerOverlaySize.setVisibility(View.GONE);
        }
    }
}
Also used : ViewStubCompat(android.support.v7.widget.ViewStubCompat) LayoutParams(android.view.ViewGroup.LayoutParams) RelativeLayout(android.widget.RelativeLayout) ArrayList(java.util.ArrayList) List(java.util.List) RendererItem(org.videolan.libvlc.RendererItem) TargetApi(android.annotation.TargetApi)

Example 2 with RendererItem

use of org.videolan.libvlc.RendererItem in project vlc-android by videolan.

the class ContentActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch(item.getItemId()) {
        case R.id.ml_menu_equalizer:
            new EqualizerFragment().show(getSupportFragmentManager(), "equalizer");
            return true;
        case R.id.ml_menu_search:
            startActivity(new Intent(Intent.ACTION_SEARCH, null, this, SearchActivity.class));
            return true;
        case R.id.ml_menu_renderers:
            if (mService != null && !mService.hasRenderer() && RendererDelegate.INSTANCE.getRenderers().size() == 1) {
                final RendererItem renderer = RendererDelegate.INSTANCE.getRenderers().get(0);
                RendererDelegate.INSTANCE.selectRenderer(renderer);
                mService.setRenderer(renderer);
                final View v = findViewById(R.id.audio_player_container);
                if (v != null)
                    UiTools.snacker(v, getString(R.string.casting_connected_renderer, renderer.displayName));
            } else if (getSupportFragmentManager().findFragmentByTag("renderers") == null)
                new RenderersDialog().show(getSupportFragmentManager(), "renderers");
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : RenderersDialog(org.videolan.vlc.gui.dialogs.RenderersDialog) Intent(android.content.Intent) RendererItem(org.videolan.libvlc.RendererItem) SearchView(android.support.v7.widget.SearchView) View(android.view.View) EqualizerFragment(org.videolan.vlc.gui.audio.EqualizerFragment)

Example 3 with RendererItem

use of org.videolan.libvlc.RendererItem in project vlc-android by GeoffreyMetais.

the class ContentActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch(item.getItemId()) {
        case R.id.ml_menu_equalizer:
            new EqualizerFragment().show(getSupportFragmentManager(), "equalizer");
            return true;
        case R.id.ml_menu_search:
            startActivity(new Intent(Intent.ACTION_SEARCH, null, this, SearchActivity.class));
            return true;
        case R.id.ml_menu_renderers:
            if (!RendererDelegate.INSTANCE.hasRenderer() && RendererDelegate.INSTANCE.getRenderers().getValue().size() == 1) {
                final RendererItem renderer = RendererDelegate.INSTANCE.getRenderers().getValue().get(0);
                RendererDelegate.INSTANCE.selectRenderer(renderer);
                final View v = findViewById(R.id.audio_player_container);
                if (v != null)
                    UiTools.snacker(v, getString(R.string.casting_connected_renderer, renderer.displayName));
            } else if (getSupportFragmentManager().findFragmentByTag("renderers") == null)
                new RenderersDialog().show(getSupportFragmentManager(), "renderers");
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : RenderersDialog(org.videolan.vlc.gui.dialogs.RenderersDialog) Intent(android.content.Intent) RendererItem(org.videolan.libvlc.RendererItem) SearchView(android.support.v7.widget.SearchView) View(android.view.View) EqualizerFragment(org.videolan.vlc.gui.audio.EqualizerFragment)

Aggregations

RendererItem (org.videolan.libvlc.RendererItem)3 Intent (android.content.Intent)2 SearchView (android.support.v7.widget.SearchView)2 View (android.view.View)2 EqualizerFragment (org.videolan.vlc.gui.audio.EqualizerFragment)2 RenderersDialog (org.videolan.vlc.gui.dialogs.RenderersDialog)2 TargetApi (android.annotation.TargetApi)1 ViewStubCompat (android.support.v7.widget.ViewStubCompat)1 LayoutParams (android.view.ViewGroup.LayoutParams)1 RelativeLayout (android.widget.RelativeLayout)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1