support live - part 1

pull/123/head
FongMi 4 years ago
parent 5a3f1f1bb4
commit 17391fa4fb
  1. 5
      app/src/leanback/AndroidManifest.xml
  2. 15
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  3. 4
      app/src/leanback/res/drawable/selector_live_channel.xml
  4. 4
      app/src/leanback/res/drawable/selector_live_group.xml
  5. 12
      app/src/leanback/res/drawable/shape_live.xml
  6. 11
      app/src/leanback/res/drawable/shape_live_channel.xml
  7. 7
      app/src/leanback/res/drawable/shape_live_group.xml
  8. 16
      app/src/leanback/res/layout/activity_detail.xml
  9. 55
      app/src/leanback/res/layout/activity_live.xml
  10. 46
      app/src/leanback/res/layout/adapter_live_channel.xml
  11. 32
      app/src/leanback/res/layout/adapter_live_group.xml
  12. 15
      app/src/leanback/res/values/styles.xml

@ -59,6 +59,11 @@
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="sensorLandscape" />
<activity
android:name=".ui.activity.LiveActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="sensorLandscape" />
<activity
android:name=".ui.activity.DetailActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"

@ -0,0 +1,15 @@
package com.fongmi.android.tv.ui.activity;
import androidx.viewbinding.ViewBinding;
import com.fongmi.android.tv.databinding.ActivityLiveBinding;
public class LiveActivity extends BaseActivity {
private ActivityLiveBinding mBinding;
@Override
protected ViewBinding getBinding() {
return mBinding = ActivityLiveBinding.inflate(getLayoutInflater());
}
}

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_live_channel" android:state_selected="true" />
</selector>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_live_group" android:state_selected="true" />
</selector>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="0"
android:centerColor="#99000000"
android:endColor="#0D000000"
android:startColor="#CC000000"
android:type="linear" />
</shape>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#CC2196F3" />
<corners
android:bottomRightRadius="40dp"
android:topRightRadius="40dp" />
</shape>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/green_400" />
</shape>

@ -20,27 +20,19 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/surface"
style="@style/VodPlayerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:animation_enabled="false"
app:auto_show="false"
app:controller_layout_id="@layout/view_controller_bottom"
app:resize_mode="fit"
app:surface_type="surface_view"
app:use_controller="false" />
app:surface_type="surface_view" />
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/texture"
style="@style/VodPlayerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:animation_enabled="false"
app:auto_show="false"
app:controller_layout_id="@layout/view_controller_bottom"
app:resize_mode="fit"
app:surface_type="texture_view"
app:use_controller="false" />
app:surface_type="texture_view" />
<include
android:id="@+id/widget"

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/surface"
style="@style/LivePlayerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:surface_type="surface_view" />
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/texture"
style="@style/LivePlayerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:surface_type="texture_view" />
<LinearLayout
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/shape_live"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible">
<androidx.leanback.widget.VerticalGridView
android:id="@+id/group"
android:layout_width="120dp"
android:layout_height="match_parent"
tools:itemCount="5"
tools:listitem="@layout/adapter_live_group" />
<View
android:layout_width="0.3dp"
android:layout_height="match_parent"
android:background="@color/grey_700" />
<androidx.leanback.widget.VerticalGridView
android:id="@+id/channel"
android:layout_width="280dp"
android:layout_height="match_parent"
tools:itemCount="5"
tools:listitem="@layout/adapter_live_channel" />
</LinearLayout>
</FrameLayout>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_live_channel"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="20dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp">
<TextView
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:letterSpacing="0.05"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="01" />
<ImageView
android:id="@+id/logo"
android:layout_width="48dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:letterSpacing="0.05"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="CNN" />
</LinearLayout>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_live_group"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="20dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp">
<ImageView
android:id="@+id/logo"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:letterSpacing="0.05"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="收藏" />
</LinearLayout>

@ -19,4 +19,19 @@
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
<style name="VodPlayerStyle">
<item name="auto_show">false</item>
<item name="resize_mode">fit</item>
<item name="use_controller">false</item>
<item name="animation_enabled">false</item>
<item name="controller_layout_id">@layout/view_controller_bottom</item>
</style>
<style name="LivePlayerStyle">
<item name="auto_show">false</item>
<item name="resize_mode">fill</item>
<item name="use_artwork">true</item>
<item name="animation_enabled">false</item>
</style>
</resources>

Loading…
Cancel
Save