mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-05 04:19:27 -05:00
app: touch mode improvements
This commit is contained in:
+1
-1
@@ -465,7 +465,7 @@ public class VideoLoaderController extends PlayerEventListenerHelper implements
|
||||
loadNext();
|
||||
break;
|
||||
case PlayerUI.REPEAT_MODE_ONE:
|
||||
getPlayer().setPositionMs(0);
|
||||
getPlayer().setPositionMs(100); // fix frozen image on Android 4?
|
||||
break;
|
||||
case PlayerUI.REPEAT_MODE_CLOSE:
|
||||
// Close player if suggestions not shown
|
||||
|
||||
+1
-17
@@ -171,27 +171,11 @@ public class MotherActivity extends FragmentActivity {
|
||||
getResources().getDisplayMetrics().setTo(getDisplayMetrics());
|
||||
}
|
||||
|
||||
//private DisplayMetrics getDisplayMetrics() {
|
||||
// DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
// getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
//
|
||||
// // To adapt to resolution change (e.g. on AFR) check old width.
|
||||
// if (sCachedDisplayMetrics == null || sCachedDisplayMetrics.widthPixels != displayMetrics.widthPixels) {
|
||||
// float uiScale = MainUIData.instance(this).getUIScale();
|
||||
// float widthRatio = DEFAULT_WIDTH / displayMetrics.widthPixels;
|
||||
// float density = DEFAULT_DENSITY / widthRatio * uiScale;
|
||||
// displayMetrics.density = density;
|
||||
// displayMetrics.scaledDensity = density;
|
||||
// sCachedDisplayMetrics = displayMetrics;
|
||||
// }
|
||||
//
|
||||
// return sCachedDisplayMetrics;
|
||||
//}
|
||||
|
||||
private DisplayMetrics getDisplayMetrics() {
|
||||
// BUG: adapt to resolution change (e.g. on AFR)
|
||||
// Don't disable caching or you will experience weird sizes on cards in video suggestions (e.g. after exit from PIP)!
|
||||
if (sCachedDisplayMetrics == null) {
|
||||
// NOTE: Don't replace with getResources().getDisplayMetrics(). Shows wrong metrics here!
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
float uiScale = MainUIData.instance(this).getUIScale();
|
||||
|
||||
@@ -1631,7 +1631,9 @@
|
||||
</style>
|
||||
<style name="Widget.Leanback.PlaybackControlsButtonStyle">
|
||||
<item name="android:focusable">true</item>
|
||||
<item name="android:focusableInTouchMode">true</item>
|
||||
<!-- MOD: Enable single click touch mode -->
|
||||
<item name="android:focusableInTouchMode">false</item>
|
||||
<!--<item name="android:focusableInTouchMode">true</item>-->
|
||||
</style>
|
||||
<style name="Widget.Leanback.PlaybackControlsTimeStyle">
|
||||
<item name="android:textAlignment">viewStart</item>
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ public class GridFragmentHelper {
|
||||
Resources res = context.getResources();
|
||||
|
||||
DisplayMetrics displayMetrics = res.getDisplayMetrics();
|
||||
int displayWidthPx = displayMetrics.widthPixels;
|
||||
// Take into the account screen orientation (e.g. when running on phone)
|
||||
int displayWidthPx = Math.max(displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
float cardWidthPx = res.getDimensionPixelSize(cardWidthResId) * cardScale;
|
||||
float cardSpacingPx = res.getDimensionPixelSize(R.dimen.grid_item_horizontal_spacing);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!-- MOD: Enable single click touch mode (focusableInTouchMode=false) -->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<androidx.leanback.widget.SpeechOrbView
|
||||
@@ -23,7 +24,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/lb_search_bar_speech_orb_margin_start"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusableInTouchMode="false"
|
||||
>
|
||||
<!-- Should be commented out? Fix voice search activation after fragment restore? -->
|
||||
<requestFocus/>
|
||||
@@ -86,7 +87,7 @@
|
||||
android:layout_marginEnd="@dimen/search_bar_right_items_margin"
|
||||
android:layout_toStartOf="@+id/lb_search_bar_search_orb"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusableInTouchMode="false"
|
||||
app:searchOrbIcon="@drawable/search_bar_settings_orb"
|
||||
app:searchOrbColor="@color/orb_color"
|
||||
app:searchOrbBrightColor="@color/orb_bright_color"
|
||||
@@ -101,7 +102,7 @@
|
||||
android:layout_marginEnd="@dimen/search_bar_right_items_margin"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusableInTouchMode="false"
|
||||
app:searchOrbColor="@color/orb_color"
|
||||
app:searchOrbBrightColor="@color/orb_bright_color"
|
||||
app:searchOrbIconColor="@color/orb_icon_color" />
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- MOD: Enable single click touch mode -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user