[leanback] add video size for live

pull/183/head
FongMi 2 years ago
parent 9abd9882c3
commit b5fc004ad0
  1. 10
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 43
      app/src/leanback/res/layout/view_widget_live.xml

@ -433,6 +433,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private void showControl(View view) {
mBinding.control.getRoot().setVisibility(View.VISIBLE);
mBinding.widget.top.setVisibility(View.VISIBLE);
view.requestFocus();
setR2Callback();
hideInfo();
@ -440,6 +441,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private void hideControl() {
mBinding.control.getRoot().setVisibility(View.GONE);
mBinding.widget.top.setVisibility(View.GONE);
App.removeCallbacks(mR1);
}
@ -449,13 +451,13 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void showInfo() {
mBinding.widget.info.setVisibility(View.VISIBLE);
mBinding.widget.bottom.setVisibility(View.VISIBLE);
setR1Callback();
setInfo();
}
private void hideInfo() {
mBinding.widget.info.setVisibility(View.GONE);
mBinding.widget.bottom.setVisibility(View.GONE);
App.removeCallbacks(mR3);
}
@ -572,6 +574,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
mViewModel.getEpg(mChannel);
mChannel.loadLogo(mBinding.widget.logo);
mBinding.widget.name.setText(mChannel.getName());
mBinding.widget.title.setText(mChannel.getName());
mBinding.widget.line.setText(mChannel.getLineText());
mBinding.widget.number.setText(mChannel.getNumber());
mBinding.control.line.setText(mChannel.getLineText());
@ -666,6 +669,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
mPlayers.reset();
setSpeedVisible();
setTrackVisible(true);
mBinding.widget.size.setText(mPlayers.getSizeText());
break;
case Player.STATE_ENDED:
nextChannel();
@ -923,7 +927,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
public void onBackPressed() {
if (isVisible(mBinding.control.getRoot())) {
hideControl();
} else if (isVisible(mBinding.widget.info)) {
} else if (isVisible(mBinding.widget.bottom)) {
hideInfo();
} else if (isVisible(mBinding.recycler)) {
hideUI();

@ -4,6 +4,47 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:letterSpacing="0.02"
android:shadowColor="@color/grey_900"
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="1"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="20sp"
tools:text="CCTV-1" />
<TextView
android:id="@+id/size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignStart="@+id/title"
android:layout_marginBottom="16dp"
android:shadowColor="@color/grey_900"
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920 x 1080" />
</RelativeLayout>
<LinearLayout
android:id="@+id/progress"
android:layout_width="wrap_content"
@ -127,7 +168,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/info"
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_gravity="bottom"

Loading…
Cancel
Save