Mini player slide to botom fix, buttons size fix
This commit is contained in:
parent
d8f7db4715
commit
08412d6108
|
@ -2245,15 +2245,17 @@ public class VideoDetailFragment
|
||||||
private void setOverlayLook(final AppBarLayout appBar,
|
private void setOverlayLook(final AppBarLayout appBar,
|
||||||
final AppBarLayout.Behavior behavior,
|
final AppBarLayout.Behavior behavior,
|
||||||
final float slideOffset) {
|
final float slideOffset) {
|
||||||
if (behavior != null) {
|
// SlideOffset < 0 when mini player is about to close via swipe.
|
||||||
|
// Stop animation in this case
|
||||||
|
if (behavior == null || slideOffset < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
overlay.setAlpha(Math.min(MAX_OVERLAY_ALPHA, 1 - slideOffset));
|
overlay.setAlpha(Math.min(MAX_OVERLAY_ALPHA, 1 - slideOffset));
|
||||||
|
|
||||||
// These numbers are not special. They just do a cool transition
|
// These numbers are not special. They just do a cool transition
|
||||||
behavior.setTopAndBottomOffset(
|
behavior.setTopAndBottomOffset(
|
||||||
(int) (-thumbnailImageView.getHeight() * 2 * (1 - slideOffset) / 3));
|
(int) (-thumbnailImageView.getHeight() * 2 * (1 - slideOffset) / 3));
|
||||||
appBar.requestLayout();
|
appBar.requestLayout();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setOverlayElementsClickable(final boolean enable) {
|
private void setOverlayElementsClickable(final boolean enable) {
|
||||||
overlayThumbnailImageView.setClickable(enable);
|
overlayThumbnailImageView.setClickable(enable);
|
||||||
|
|
|
@ -106,7 +106,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static android.content.Context.WINDOW_SERVICE;
|
import static android.content.Context.WINDOW_SERVICE;
|
||||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||||
import static org.schabi.newpipe.player.BackgroundPlayer.ACTION_CLOSE;
|
import static org.schabi.newpipe.player.MainPlayer.ACTION_CLOSE;
|
||||||
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_FORWARD;
|
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_FORWARD;
|
||||||
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_REWIND;
|
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_REWIND;
|
||||||
import static org.schabi.newpipe.player.MainPlayer.ACTION_OPEN_CONTROLS;
|
import static org.schabi.newpipe.player.MainPlayer.ACTION_OPEN_CONTROLS;
|
||||||
|
@ -376,12 +376,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
moreOptionsButton.setImageDrawable(service.getResources().getDrawable(
|
moreOptionsButton.setImageDrawable(service.getResources().getDrawable(
|
||||||
R.drawable.ic_expand_more_white_24dp));
|
R.drawable.ic_expand_more_white_24dp));
|
||||||
shareButton.setVisibility(View.VISIBLE);
|
shareButton.setVisibility(View.VISIBLE);
|
||||||
final boolean supportedByKore = playQueue != null
|
showHideKodiButton();
|
||||||
&& playQueue.getItem() != null
|
|
||||||
&& KoreUtil.isServiceSupportedByKore(playQueue.getItem().getServiceId());
|
|
||||||
final boolean kodiEnabled = defaultPreferences.getBoolean(
|
|
||||||
service.getString(R.string.show_play_with_kodi_key), false);
|
|
||||||
playWithKodi.setVisibility(kodiEnabled && supportedByKore ? View.VISIBLE : View.GONE);
|
|
||||||
openInBrowser.setVisibility(View.VISIBLE);
|
openInBrowser.setVisibility(View.VISIBLE);
|
||||||
muteButton.setVisibility(View.VISIBLE);
|
muteButton.setVisibility(View.VISIBLE);
|
||||||
playerCloseButton.setVisibility(isFullscreen ? View.GONE : View.VISIBLE);
|
playerCloseButton.setVisibility(isFullscreen ? View.GONE : View.VISIBLE);
|
||||||
|
@ -418,11 +413,8 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
getPlaybackSpeedTextView().setPadding(
|
getPlaybackSpeedTextView().setPadding(
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
getQualityTextView().setPadding(
|
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
|
||||||
getCaptionTextView().setPadding(
|
getCaptionTextView().setPadding(
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
getQualityTextView().setMinimumWidth(0);
|
|
||||||
getPlaybackSpeedTextView().setMinimumWidth(0);
|
getPlaybackSpeedTextView().setMinimumWidth(0);
|
||||||
} else if (videoPlayerSelected()) {
|
} else if (videoPlayerSelected()) {
|
||||||
final int buttonsMinWidth = service.getResources()
|
final int buttonsMinWidth = service.getResources()
|
||||||
|
@ -440,7 +432,6 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
getPlaybackSpeedTextView().setPadding(
|
getPlaybackSpeedTextView().setPadding(
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
getQualityTextView().setMinimumWidth(buttonsMinWidth);
|
|
||||||
getPlaybackSpeedTextView().setMinimumWidth(buttonsMinWidth);
|
getPlaybackSpeedTextView().setMinimumWidth(buttonsMinWidth);
|
||||||
getCaptionTextView().setPadding(
|
getCaptionTextView().setPadding(
|
||||||
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
buttonsPadding, buttonsPadding, buttonsPadding, buttonsPadding);
|
||||||
|
@ -615,12 +606,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
protected void onMetadataChanged(@NonNull final MediaSourceTag tag) {
|
protected void onMetadataChanged(@NonNull final MediaSourceTag tag) {
|
||||||
super.onMetadataChanged(tag);
|
super.onMetadataChanged(tag);
|
||||||
|
|
||||||
// show kodi button if it supports the current service and it is enabled in settings
|
showHideKodiButton();
|
||||||
final boolean showKodiButton =
|
|
||||||
KoreUtil.isServiceSupportedByKore(tag.getMetadata().getServiceId())
|
|
||||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
|
||||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
|
||||||
playWithKodi.setVisibility(showKodiButton ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
titleTextView.setText(tag.getMetadata().getName());
|
titleTextView.setText(tag.getMetadata().getName());
|
||||||
channelTextView.setText(tag.getMetadata().getUploaderName());
|
channelTextView.setText(tag.getMetadata().getUploaderName());
|
||||||
|
@ -920,6 +906,18 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
getCurrentMetadata().getMetadata().getOriginalUrl());
|
getCurrentMetadata().getMetadata().getOriginalUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showHideKodiButton() {
|
||||||
|
final boolean kodiEnabled = defaultPreferences.getBoolean(
|
||||||
|
service.getString(R.string.show_play_with_kodi_key), false);
|
||||||
|
// show kodi button if it supports the current service and it is enabled in settings
|
||||||
|
final boolean showKodiButton = playQueue != null && playQueue.getItem() != null
|
||||||
|
&& KoreUtil.isServiceSupportedByKore(playQueue.getItem().getServiceId())
|
||||||
|
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||||
|
playWithKodi.setVisibility(videoPlayerSelected() && kodiEnabled && showKodiButton
|
||||||
|
? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private static void showInstallKoreDialog(final Context context) {
|
private static void showInstallKoreDialog(final Context context) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setMessage(R.string.kore_not_found)
|
builder.setMessage(R.string.kore_not_found)
|
||||||
|
|
|
@ -218,10 +218,10 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/qualityTextView"
|
android:id="@+id/qualityTextView"
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
android:layout_width="50dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:paddingTop="@dimen/player_main_buttons_padding"
|
android:minWidth="0dp"
|
||||||
android:paddingBottom="@dimen/player_main_buttons_padding"
|
android:padding="@dimen/player_main_buttons_padding"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="720p"
|
android:text="720p"
|
||||||
|
|
|
@ -223,6 +223,7 @@
|
||||||
android:id="@+id/qualityTextView"
|
android:id="@+id/qualityTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
|
android:minWidth="0dp"
|
||||||
android:padding="@dimen/player_main_buttons_padding"
|
android:padding="@dimen/player_main_buttons_padding"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
|
Loading…
Reference in New Issue