Search in sources :

Example 1 with AppCompatImageButton

use of androidx.appcompat.widget.AppCompatImageButton in project android by nextcloud.

the class PreviewMediaFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    Log_OC.v(TAG, "onStart");
    OCFile file = getFile();
    if (file != null) {
        // bind to any existing player
        mediaPlayerServiceConnection.bind();
        if (exoPlayer == null) {
            exoPlayer = new ExoPlayer.Builder(requireContext()).build();
        }
        binding.exoplayerView.setPlayer(exoPlayer);
        LinearLayout linearLayout = binding.exoplayerView.findViewById(R.id.exo_center_controls);
        if (linearLayout.getChildCount() == 5) {
            AppCompatImageButton fullScreenButton = new AppCompatImageButton(requireContext());
            fullScreenButton.setImageResource(R.drawable.exo_styled_controls_fullscreen_exit);
            fullScreenButton.setLayoutParams(new LinearLayout.LayoutParams(143, 143));
            fullScreenButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
            fullScreenButton.setBackgroundColor(Color.TRANSPARENT);
            fullScreenButton.setOnClickListener(l -> {
                startFullScreenVideo();
            });
            linearLayout.addView(fullScreenButton);
            linearLayout.invalidate();
        }
        if (MimeTypeUtil.isAudio(file)) {
            binding.mediaController.setMediaPlayer(mediaPlayerServiceConnection);
            binding.mediaController.setVisibility(View.VISIBLE);
            mediaPlayerServiceConnection.start(user, file, autoplay, savedPlaybackPosition);
            binding.emptyView.emptyListView.setVisibility(View.GONE);
            binding.progress.setVisibility(View.GONE);
        } else if (MimeTypeUtil.isVideo(file)) {
            if (mediaPlayerServiceConnection.isConnected()) {
                // always stop player
                stopAudio();
            }
            playVideo();
        }
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) AppCompatImageButton(androidx.appcompat.widget.AppCompatImageButton) LinearLayout(android.widget.LinearLayout)

Example 2 with AppCompatImageButton

use of androidx.appcompat.widget.AppCompatImageButton in project MTweaks-KernelAdiutorMOD by morogoku.

the class FrequencyButtonView method onCreateView.

@Override
public void onCreateView(View view) {
    AppCompatImageButton refresh = view.findViewById(R.id.frequency_refresh);
    AppCompatImageButton reset = view.findViewById(R.id.frequency_reset);
    AppCompatImageButton restore = view.findViewById(R.id.frequency_restore);
    refresh.setOnClickListener(v -> {
        rotate(v, false);
        if (mRefreshListener != null) {
            mRefreshListener.onClick(v);
        }
    });
    reset.setOnClickListener(v -> {
        rotate(v, true);
        if (mResetListener != null) {
            mResetListener.onClick(v);
        }
    });
    restore.setOnClickListener(v -> {
        rotate(v, true);
        if (mRestoreListener != null) {
            mRestoreListener.onClick(v);
        }
    });
    setFullSpan(true);
    super.onCreateView(view);
}
Also used : AppCompatImageButton(androidx.appcompat.widget.AppCompatImageButton)

Aggregations

AppCompatImageButton (androidx.appcompat.widget.AppCompatImageButton)2 LinearLayout (android.widget.LinearLayout)1 OCFile (com.owncloud.android.datamodel.OCFile)1