Merge pull request #7963 from Stypox/android-tv-player
Improve player UI and navigability for Android TV
This commit is contained in:
commit
00e4631b3b
|
@ -73,7 +73,6 @@ import android.provider.Settings;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -89,7 +88,6 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.PopupMenu;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
@ -99,7 +97,9 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
import androidx.appcompat.widget.AppCompatImageButton;
|
import androidx.appcompat.widget.AppCompatImageButton;
|
||||||
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.GestureDetectorCompat;
|
import androidx.core.view.GestureDetectorCompat;
|
||||||
|
@ -3249,6 +3249,9 @@ public final class Player implements
|
||||||
binding.itemsListPanel.setTranslationY(
|
binding.itemsListPanel.setTranslationY(
|
||||||
-binding.itemsListPanel.getHeight() * 5);
|
-binding.itemsListPanel.getHeight() * 5);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// clear focus, otherwise a white rectangle remains on top of the player
|
||||||
|
binding.itemsListClose.clearFocus();
|
||||||
binding.playPauseButton.requestFocus();
|
binding.playPauseButton.requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3855,8 +3858,9 @@ public final class Player implements
|
||||||
case KeyEvent.KEYCODE_DPAD_DOWN:
|
case KeyEvent.KEYCODE_DPAD_DOWN:
|
||||||
case KeyEvent.KEYCODE_DPAD_RIGHT:
|
case KeyEvent.KEYCODE_DPAD_RIGHT:
|
||||||
case KeyEvent.KEYCODE_DPAD_CENTER:
|
case KeyEvent.KEYCODE_DPAD_CENTER:
|
||||||
if (binding.getRoot().hasFocus() && !binding.playbackControlRoot.hasFocus()) {
|
if ((binding.getRoot().hasFocus() && !binding.playbackControlRoot.hasFocus())
|
||||||
// do not interfere with focus in playlist etc.
|
|| isQueueVisible) {
|
||||||
|
// do not interfere with focus in playlist and play queue etc.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3864,15 +3868,13 @@ public final class Player implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isControlsVisible()) {
|
if (isControlsVisible()) {
|
||||||
if (!isQueueVisible) {
|
hideControls(DEFAULT_CONTROLS_DURATION, DPAD_CONTROLS_HIDE_TIME);
|
||||||
binding.playPauseButton.requestFocus();
|
} else {
|
||||||
}
|
binding.playPauseButton.requestFocus();
|
||||||
showControlsThenHide();
|
showControlsThenHide();
|
||||||
showSystemUIPartially();
|
showSystemUIPartially();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
hideControls(DEFAULT_CONTROLS_DURATION, DPAD_CONTROLS_HIDE_TIME);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,9 +545,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/itemsListControl"
|
android:id="@+id/itemsListControl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp">
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/itemsListHeaderTitle"
|
android:id="@+id/itemsListHeaderTitle"
|
||||||
|
|
|
@ -66,10 +66,7 @@
|
||||||
<item name="tint">?attr/actionColor</item>
|
<item name="tint">?attr/actionColor</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DarkPopupMenu" parent="Widget.AppCompat.PopupMenu">
|
<style name="DarkPopupMenu" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
<item name="android:itemBackground">#2E2E2E</item>
|
|
||||||
<item name="android:textColor">@color/white</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||||
<item name="popupTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item>
|
<item name="popupTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item>
|
||||||
|
|
Loading…
Reference in New Issue