kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Some SonarLint refactors
rodzic
61c1da144e
commit
c03eac1dc9
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.player.gesture
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
|
@ -130,7 +131,7 @@ abstract class BasePlayerGestureListener(
|
|||
}
|
||||
|
||||
private var doubleTapDelay = DOUBLE_TAP_DELAY
|
||||
private val doubleTapHandler: Handler = Handler()
|
||||
private val doubleTapHandler: Handler = Handler(Looper.getMainLooper())
|
||||
private val doubleTapRunnable = Runnable {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "doubleTapRunnable called")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.schabi.newpipe.player.gesture
|
||||
|
||||
interface DoubleTapListener {
|
||||
fun onDoubleTapStarted(portion: DisplayPortion) {}
|
||||
fun onDoubleTapProgressDown(portion: DisplayPortion) {}
|
||||
fun onDoubleTapFinished() {}
|
||||
fun onDoubleTapStarted(portion: DisplayPortion)
|
||||
fun onDoubleTapProgressDown(portion: DisplayPortion)
|
||||
fun onDoubleTapFinished()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.schabi.newpipe.player.ui;
|
||||
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static org.schabi.newpipe.MainActivity.DEBUG;
|
||||
import static org.schabi.newpipe.QueueItemMenuUtil.openPopupMenu;
|
||||
import static org.schabi.newpipe.ktx.ViewUtils.animate;
|
||||
|
@ -21,6 +22,7 @@ import android.database.ContentObserver;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
|
@ -156,7 +158,7 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
|||
.ifPresent(fragmentManager ->
|
||||
PlaylistDialog.showForPlayQueue(player, fragmentManager)));
|
||||
|
||||
settingsContentObserver = new ContentObserver(new Handler()) {
|
||||
settingsContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(final boolean selfChange) {
|
||||
setupScreenRotationButton();
|
||||
|
@ -237,8 +239,7 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
|||
private void initVideoPlayer() {
|
||||
// restore last resize mode
|
||||
setResizeMode(PlayerHelper.retrieveResizeModeFromPrefs(player));
|
||||
binding.getRoot().setLayoutParams(new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
|
||||
binding.getRoot().setLayoutParams(new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -253,8 +254,7 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
|||
binding.getRoot().findViewById(R.id.metadataView).setVisibility(View.VISIBLE);
|
||||
binding.moreOptionsButton.setVisibility(View.VISIBLE);
|
||||
binding.topControls.setOrientation(LinearLayout.VERTICAL);
|
||||
binding.primaryControls.getLayoutParams().width
|
||||
= LinearLayout.LayoutParams.MATCH_PARENT;
|
||||
binding.primaryControls.getLayoutParams().width = MATCH_PARENT;
|
||||
binding.secondaryControls.setVisibility(View.INVISIBLE);
|
||||
binding.moreOptionsButton.setImageDrawable(AppCompatResources.getDrawable(context,
|
||||
R.drawable.ic_expand_more));
|
||||
|
@ -459,7 +459,6 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
|||
* </li>
|
||||
* <li>
|
||||
* Otherwise, the max thumbnail height is the screen height.
|
||||
* TODO investigate why this is done on popup player, too
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
|
|
|
@ -287,8 +287,7 @@ public final class PopupPlayerUi extends VideoPlayerUi {
|
|||
}
|
||||
|
||||
final float minimumWidth = context.getResources().getDimension(R.dimen.popup_minimum_width);
|
||||
final int actualWidth = (int) (width > screenWidth ? screenWidth
|
||||
: (width < minimumWidth ? minimumWidth : width));
|
||||
final int actualWidth = Math.min((int) Math.max(width, minimumWidth), screenWidth);
|
||||
final int actualHeight = (int) getMinimumVideoHeight(width);
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "updatePopupSize() updated values:"
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.graphics.PorterDuffColorFilter;
|
|||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.Gravity;
|
||||
|
@ -103,7 +104,7 @@ public abstract class VideoPlayerUi extends PlayerUi
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
protected PlayerBinding binding;
|
||||
private final Handler controlsVisibilityHandler = new Handler();
|
||||
private final Handler controlsVisibilityHandler = new Handler(Looper.getMainLooper());
|
||||
@Nullable private SurfaceHolderCallback surfaceHolderCallback;
|
||||
boolean surfaceIsSetup = false;
|
||||
@Nullable private Bitmap thumbnail = null;
|
||||
|
|
Ładowanie…
Reference in New Issue