mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
-Rollbacks the original main player UI to display nav and status bar on click.
-Changed system UI color to translucent on Lollipop and above.
This commit is contained in:
parent
74199c8624
commit
a275d7ff50
@ -30,8 +30,10 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
@ -248,22 +250,6 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
// View
|
// View
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Prior to Kitkat, hiding system ui causes the player view to be overlaid and require two
|
|
||||||
* clicks to get rid of that invisible overlay. By showing the system UI on actions/events,
|
|
||||||
* that overlay is removed and the player view is put to the foreground.
|
|
||||||
*
|
|
||||||
* Post Kitkat, navbar and status bar can be pulled out by swiping the edge of
|
|
||||||
* screen, therefore, we can do nothing or hide the UI on actions/events.
|
|
||||||
* */
|
|
||||||
private void changeSystemUi() {
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
|
||||||
showSystemUi();
|
|
||||||
} else {
|
|
||||||
hideSystemUi();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showSystemUi() {
|
private void showSystemUi() {
|
||||||
if (DEBUG) Log.d(TAG, "showSystemUi() called");
|
if (DEBUG) Log.d(TAG, "showSystemUi() called");
|
||||||
if (playerImpl != null && playerImpl.queueVisible) return;
|
if (playerImpl != null && playerImpl.queueVisible) return;
|
||||||
@ -276,6 +262,14 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
} else {
|
} else {
|
||||||
visibility = View.STATUS_BAR_VISIBLE;
|
visibility = View.STATUS_BAR_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ColorInt final int systenUiColor =
|
||||||
|
ActivityCompat.getColor(getApplicationContext(), R.color.video_overlay_color);
|
||||||
|
getWindow().setStatusBarColor(systenUiColor);
|
||||||
|
getWindow().setNavigationBarColor(systenUiColor);
|
||||||
|
}
|
||||||
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(visibility);
|
getWindow().getDecorView().setSystemUiVisibility(visibility);
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
}
|
}
|
||||||
@ -416,15 +410,6 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
this.itemsListCloseButton = findViewById(R.id.playQueueClose);
|
this.itemsListCloseButton = findViewById(R.id.playQueueClose);
|
||||||
this.itemsList = findViewById(R.id.playQueue);
|
this.itemsList = findViewById(R.id.playQueue);
|
||||||
|
|
||||||
this.windowRootLayout = rootView.findViewById(R.id.playbackWindowRoot);
|
|
||||||
// Prior to Kitkat, there is no way of setting translucent navbar programmatically.
|
|
||||||
// Thus, fit system windows is opted instead.
|
|
||||||
// See https://stackoverflow.com/questions/29069070/completely-transparent-status-bar-and-navigation-bar-on-lollipop
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
windowRootLayout.setFitsSystemWindows(false);
|
|
||||||
windowRootLayout.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
titleTextView.setSelected(true);
|
titleTextView.setSelected(true);
|
||||||
channelTextView.setSelected(true);
|
channelTextView.setSelected(true);
|
||||||
|
|
||||||
@ -732,7 +717,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
animatePlayButtons(true, 200);
|
animatePlayButtons(true, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
changeSystemUi();
|
showSystemUi();
|
||||||
getRootView().setKeepScreenOn(false);
|
getRootView().setKeepScreenOn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,7 +890,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
playerImpl.hideControls(150, 0);
|
playerImpl.hideControls(150, 0);
|
||||||
} else {
|
} else {
|
||||||
playerImpl.showControlsThenHide();
|
playerImpl.showControlsThenHide();
|
||||||
changeSystemUi();
|
showSystemUi();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
<gradient
|
<gradient
|
||||||
android:angle="90"
|
android:angle="90"
|
||||||
android:endColor="#00000000"
|
android:endColor="#00000000"
|
||||||
android:startColor="#8c000000"/>
|
android:startColor="@color/video_overlay_color"/>
|
||||||
</shape>
|
</shape>
|
@ -3,5 +3,5 @@
|
|||||||
<gradient
|
<gradient
|
||||||
android:angle="-90"
|
android:angle="-90"
|
||||||
android:endColor="#00000000"
|
android:endColor="#00000000"
|
||||||
android:startColor="#8c000000"/>
|
android:startColor="@color/video_overlay_color"/>
|
||||||
</shape>
|
</shape>
|
@ -129,7 +129,7 @@
|
|||||||
android:id="@+id/playbackControlRoot"
|
android:id="@+id/playbackControlRoot"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#64000000"
|
android:background="@color/video_overlay_color"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<color name="playlist_stream_count_background_color">#e6000000</color>
|
<color name="playlist_stream_count_background_color">#e6000000</color>
|
||||||
<color name="duration_text_color">#EEFFFFFF</color>
|
<color name="duration_text_color">#EEFFFFFF</color>
|
||||||
<color name="playlist_stream_count_text_color">#ffffff</color>
|
<color name="playlist_stream_count_text_color">#ffffff</color>
|
||||||
<color name="video_overlay_color">#66000000</color>
|
<color name="video_overlay_color">#64000000</color>
|
||||||
|
|
||||||
<color name="background_notification_color">#323232</color>
|
<color name="background_notification_color">#323232</color>
|
||||||
<color name="background_title_color">#ffffff</color>
|
<color name="background_title_color">#ffffff</color>
|
||||||
|
Loading…
Reference in New Issue
Block a user