[mobile] adjust control

pull/123/head
FongMi 3 years ago
parent 7c7ff23001
commit 8b8f235fa8
  1. 4
      app/src/main/java/com/fongmi/android/tv/api/ApiConfig.java
  2. 14
      app/src/main/res/layout/view_control_seek.xml
  3. 7
      app/src/main/res/values-zh-rCN/strings.xml
  4. 7
      app/src/main/res/values-zh-rTW/strings.xml
  5. 3
      app/src/main/res/values/strings.xml
  6. 35
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  7. 2
      app/src/mobile/res/drawable/ic_full_off.xml
  8. 2
      app/src/mobile/res/drawable/ic_full_on.xml
  9. 15
      app/src/mobile/res/drawable/shape_action.xml
  10. 2
      app/src/mobile/res/layout/adapter_parse.xml
  11. 99
      app/src/mobile/res/layout/view_control_vod.xml
  12. 35
      app/src/mobile/res/layout/view_widget_vod.xml

@ -67,6 +67,10 @@ public class ApiConfig {
return get().getSite("push_agent") != null;
}
public static boolean hasParse() {
return get().getParses().size() > 0;
}
public ApiConfig init() {
this.ads = null;
this.wall = null;

@ -11,24 +11,25 @@
android:id="@+id/position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey_700"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="00:00:00" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@+id/timeBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:focusable="true"
android:focusableInTouchMode="true"
android:nextFocusLeft="@+id/timeBar"
android:nextFocusRight="@+id/timeBar"
android:nextFocusDown="@+id/timeBar"
app:buffered_color="@color/grey_700"
app:played_color="@color/blue_700"
app:buffered_color="@color/blue_200"
app:played_color="@color/blue_500"
app:scrubber_color="@color/blue_500"
app:unplayed_color="@color/grey_500" />
@ -36,8 +37,9 @@
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey_700"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="00:00:00" />
</LinearLayout>

@ -35,15 +35,16 @@
<!-- Play -->
<string name="play">播放</string>
<string name="play_next"></string>
<string name="play_prev"></string>
<string name="play_next">下集</string>
<string name="play_prev">上集</string>
<string name="play_ready">准备播放:<xliff:g name="name">%s</xliff:g></string>
<string name="play_track_text">字幕</string>
<string name="play_track_audio">音轨</string>
<string name="play_track_video">视轨</string>
<string name="play_invert">反转</string>
<string name="play_across">跨类</string>
<string name="play_oped">片头片尾</string>
<string name="play_op">片头</string>
<string name="play_ed">片尾</string>
<string name="play_reverse">倒序</string>
<string name="play_forward"></string>
<string name="play_backward"></string>

@ -35,15 +35,16 @@
<!-- Play -->
<string name="play">播放</string>
<string name="play_next"></string>
<string name="play_prev"></string>
<string name="play_next">下集</string>
<string name="play_prev">上集</string>
<string name="play_ready">準備播放:<xliff:g name="name">%s</xliff:g></string>
<string name="play_track_text">字幕</string>
<string name="play_track_audio">音軌</string>
<string name="play_track_video">視軌</string>
<string name="play_invert">反轉</string>
<string name="play_across">跨類</string>
<string name="play_oped">片頭片尾</string>
<string name="play_op">片頭</string>
<string name="play_ed">片尾</string>
<string name="play_reverse">倒序</string>
<string name="play_forward"></string>
<string name="play_backward"></string>

@ -43,7 +43,8 @@
<string name="play_track_video">Video</string>
<string name="play_invert">Invert</string>
<string name="play_across">Across</string>
<string name="play_oped">OP&amp;ED</string>
<string name="play_op">OP</string>
<string name="play_ed">ED</string>
<string name="play_reverse">Reverse</string>
<string name="play_forward"></string>
<string name="play_backward"></string>

@ -79,7 +79,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private boolean mInitAuto;
private boolean mAutoMode;
private boolean mUseParse;
private boolean mLock;
private boolean mStop;
private boolean mLand;
private int mCurrent;
@ -201,7 +200,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mBinding.control.text.setOnClickListener(this::onTrack);
mBinding.control.audio.setOnClickListener(this::onTrack);
mBinding.control.video.setOnClickListener(this::onTrack);
mBinding.control.lock.setOnClickListener(view -> onLock());
mBinding.control.full.setOnClickListener(view -> onFull());
mBinding.control.next.setOnClickListener(view -> checkNext());
mBinding.control.prev.setOnClickListener(view -> checkPrev());
@ -264,8 +262,8 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mViewModel = new ViewModelProvider(this).get(SiteViewModel.class);
//mViewModel.search.observe(this, result -> setSearch(result.getList()));
mViewModel.player.observe(this, result -> {
setUseParse(result.getPlayUrl().isEmpty() && ApiConfig.get().getFlags().contains(result.getFlag()) || result.getJx() == 1);
mBinding.control.parseLayout.setVisibility(mParseAdapter.getItemCount() > 0 && isUseParse() ? View.VISIBLE : View.GONE);
setUseParse(ApiConfig.hasParse() && ((result.getPlayUrl().isEmpty() && ApiConfig.get().getFlags().contains(result.getFlag())) || result.getJx() == 1));
mBinding.control.parse.setVisibility(isFullscreen() && isUseParse() ? View.VISIBLE : View.GONE);
int timeout = getSite().isChangeable() ? Constant.TIMEOUT_PLAY : -1;
mPlayers.start(result, isUseParse(), timeout);
});
@ -402,13 +400,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
hideControl();
}
private void onLock() {
setR1Callback();
setLock(!isLock());
mBinding.control.lock.setImageResource(isLock() ? R.drawable.ic_lock_on : R.drawable.ic_lock_off);
setRequestedOrientation(isLock() ? (ResUtil.isLand(this) ? ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT) : ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
}
private void onFull() {
setR1Callback();
toggleFullscreen();
@ -509,7 +500,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private boolean onEndingReset() {
mHistory.setEnding(0);
mBinding.control.ending.setText(mPlayers.stringToTime(mHistory.getEnding()));
mBinding.control.ending.setText(R.string.play_ed);
setR1Callback();
return true;
}
@ -525,7 +516,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private boolean onOpeningReset() {
mHistory.setOpening(0);
mBinding.control.opening.setText(mPlayers.stringToTime(mHistory.getOpening()));
mBinding.control.opening.setText(R.string.play_op);
setR1Callback();
return true;
}
@ -589,8 +580,8 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
}
private void showControl() {
mBinding.control.parseLayout.setVisibility(isFullscreen() && isUseParse() ? View.VISIBLE : View.GONE);
mBinding.control.actionLayout.setVisibility(isFullscreen() ? View.VISIBLE : View.GONE);
mBinding.control.parse.setVisibility(isFullscreen() && isUseParse() ? View.VISIBLE : View.GONE);
mBinding.control.action.setVisibility(isFullscreen() ? View.VISIBLE : View.GONE);
mBinding.control.getRoot().setVisibility(View.VISIBLE);
setR1Callback();
}
@ -630,8 +621,8 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mHistory = mHistory == null ? createHistory(item) : mHistory;
onItemClick(mHistory.getFlag());
if (mHistory.isRevSort()) reverseEpisode();
mBinding.control.opening.setText(mPlayers.stringToTime(mHistory.getOpening()));
mBinding.control.ending.setText(mPlayers.stringToTime(mHistory.getEnding()));
mBinding.control.opening.setText(mHistory.getOpening() == 0 ? getString(R.string.play_op) : mPlayers.stringToTime(mHistory.getOpening()));
mBinding.control.ending.setText(mHistory.getEnding() == 0 ? getString(R.string.play_ed) : mPlayers.stringToTime(mHistory.getEnding()));
mBinding.control.speed.setText(mPlayers.setSpeed(mHistory.getSpeed()));
mPlayers.setPlayer(getPlayer());
setScale(getScale());
@ -751,8 +742,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
}
private void onPause(boolean visible) {
mBinding.widget.exoDuration.setText(mPlayers.getDurationTime());
mBinding.widget.exoPosition.setText(mPlayers.getPositionTime(0));
if (visible) showInfo();
else hideInfo();
mPlayers.pause();
@ -803,14 +792,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
this.mUseParse = useParse;
}
public boolean isLock() {
return mLock;
}
public void setLock(boolean lock) {
this.mLock = lock;
}
public boolean isStop() {
return mStop;
}

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@color/grey_700"
android:tint="@color/white"
android:viewportWidth="24"
android:viewportHeight="24">
<path

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@color/grey_700"
android:tint="@color/white"
android:viewportWidth="24"
android:viewportHeight="24">
<path

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_light">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/black_50" />
<corners android:radius="4dp" />
<padding
android:bottom="6dp"
android:left="10dp"
android:right="10dp"
android:top="6dp" />
</shape>
</item>
</ripple>

@ -4,7 +4,7 @@
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:gravity="center"
android:textColor="@color/text"
android:textSize="14sp"

@ -4,19 +4,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/shape_controller"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="4dp"
android:paddingEnd="16dp"
android:paddingBottom="4dp">
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingBottom="6dp">
<HorizontalScrollView
android:id="@+id/actionLayout"
android:id="@+id/action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="8dp"
android:layout_marginBottom="6dp"
android:fillViewport="true"
android:scrollbars="none">
@ -26,20 +23,12 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/play"
android:textColor="@color/grey_700"
android:textSize="14sp" />
<TextView
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:text="@string/play_next"
android:textColor="@color/white"
android:textSize="14sp" />
@ -49,7 +38,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:text="@string/play_prev"
android:textColor="@color/white"
android:textSize="14sp" />
@ -59,7 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="刷新" />
@ -69,7 +58,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="EXO" />
@ -79,7 +68,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="硬解" />
@ -89,7 +78,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="1.00" />
@ -99,7 +88,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="預設" />
@ -109,7 +98,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:tag="3"
android:text="@string/play_track_text"
android:textColor="@color/white"
@ -122,7 +111,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:tag="1"
android:text="@string/play_track_audio"
android:textColor="@color/white"
@ -135,7 +124,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:tag="2"
android:text="@string/play_track_video"
android:textColor="@color/white"
@ -143,20 +132,12 @@
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/play_oped"
android:textColor="@color/grey_700"
android:textSize="14sp" />
<TextView
android:id="@+id/opening"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="00:00" />
@ -165,7 +146,7 @@
android:id="@+id/ending"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_text"
android:background="@drawable/shape_action"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="00:00" />
@ -173,33 +154,16 @@
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="@+id/parseLayout"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/parse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/parse"
android:textColor="@color/grey_700"
android:textSize="14sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/parse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="36dp"
tools:listitem="@layout/adapter_parse" />
</LinearLayout>
tools:itemCount="1"
tools:listitem="@layout/adapter_parse"
tools:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
@ -211,23 +175,14 @@
android:id="@+id/seek"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginEnd="6dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/lock"
android:layout_width="28dp"
android:layout_height="28dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="4dp"
android:src="@drawable/ic_lock_off" />
<ImageView
android:id="@+id/full"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="4dp"
android:src="@drawable/ic_full_off" />
</LinearLayout>

@ -66,7 +66,7 @@
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
tools:visibility="gone">
<include layout="@layout/view_progress" />
@ -122,7 +122,7 @@
android:orientation="vertical"
android:padding="16dp"
android:visibility="gone"
tools:visibility="gone">
tools:visibility="visible">
<ImageView
android:id="@+id/action"
@ -131,36 +131,5 @@
android:scaleType="fitCenter"
android:src="@drawable/ic_play" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="00:00:00" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:text="/"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="00:00:00" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
Loading…
Cancel
Save