Skip to content

Commit cdaf128

Browse files
committed
优化标题滚动
1 parent 67c49e5 commit cdaf128

5 files changed

Lines changed: 7 additions & 46 deletions

File tree

dkplayer-java/src/main/java/com/dueeeke/videoplayer/player/PlayerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* 此接口使用方法:
77
* 1.继承{@link AbstractPlayer}扩展自己的播放器。
8-
* 2.继承此接口并实现${@link #createPlayer(Context)},返回步骤1中的播放器。
8+
* 2.继承此接口并实现{@link #createPlayer(Context)},返回步骤1中的播放器。
99
* 可参照{@link AndroidMediaPlayer}和{@link AndroidMediaPlayerFactory}的实现。
1010
*/
1111
public abstract class PlayerFactory<P extends AbstractPlayer> {

dkplayer-ui/src/main/java/com/dueeeke/videocontroller/MarqueeTextView.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

dkplayer-ui/src/main/java/com/dueeeke/videocontroller/component/CompleteView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,12 @@ public void onPlayerStateChanged(int playerState) {
103103
if (activity != null && mControlWrapper.hasCutout()) {
104104
int orientation = activity.getRequestedOrientation();
105105
int cutoutHeight = mControlWrapper.getCutoutHeight();
106+
LayoutParams sflp = (LayoutParams) mStopFullscreen.getLayoutParams();
106107
if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
107-
LayoutParams sflp = (LayoutParams) mStopFullscreen.getLayoutParams();
108108
sflp.setMargins(0, 0, 0, 0);
109109
} else if (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
110-
LayoutParams sflp = (LayoutParams) mStopFullscreen.getLayoutParams();
111110
sflp.setMargins(cutoutHeight, 0, 0, 0);
112111
} else if (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
113-
LayoutParams sflp = (LayoutParams) mStopFullscreen.getLayoutParams();
114112
sflp.setMargins(0, 0, 0, 0);
115113
}
116114
}

dkplayer-ui/src/main/java/com/dueeeke/videocontroller/component/TitleView.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import androidx.annotation.NonNull;
2020
import androidx.annotation.Nullable;
2121

22-
import com.dueeeke.videocontroller.MarqueeTextView;
2322
import com.dueeeke.videocontroller.R;
2423
import com.dueeeke.videoplayer.controller.IControlComponent;
2524
import com.dueeeke.videoplayer.controller.ControlWrapper;
@@ -34,7 +33,7 @@ public class TitleView extends FrameLayout implements IControlComponent {
3433
private ControlWrapper mControlWrapper;
3534

3635
private LinearLayout mTitleContainer;
37-
private MarqueeTextView mTitle;
36+
private TextView mTitle;
3837
private TextView mSysTime;//系统当前时间
3938

4039
private BatteryReceiver mBatteryReceiver;
@@ -120,8 +119,8 @@ public void onVisibilityChanged(boolean isVisible, Animation anim) {
120119
}
121120
} else {
122121
if (getVisibility() == VISIBLE) {
122+
setVisibility(GONE);
123123
if (anim != null) {
124-
setVisibility(GONE);
125124
startAnimation(anim);
126125
}
127126
}
@@ -149,10 +148,10 @@ public void onPlayerStateChanged(int playerState) {
149148
setVisibility(VISIBLE);
150149
mSysTime.setText(PlayerUtils.getCurrentSystemTime());
151150
}
152-
mTitle.setNeedFocus(true);
151+
mTitle.setSelected(true);
153152
} else {
154153
setVisibility(GONE);
155-
mTitle.setNeedFocus(false);
154+
mTitle.setSelected(false);
156155
}
157156

158157
Activity activity = PlayerUtils.scanForActivity(getContext());

dkplayer-ui/src/main/res/layout/dkplayer_layout_title_view.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
android:padding="@dimen/dkplayer_controller_icon_padding"
2222
android:src="@drawable/dkplayer_ic_action_arrow_back" />
2323

24-
<com.dueeeke.videocontroller.MarqueeTextView
24+
<TextView
2525
android:id="@+id/title"
2626
android:layout_width="0dp"
2727
android:layout_height="wrap_content"
2828
android:layout_weight="1"
2929
android:ellipsize="marquee"
30-
android:focusable="true"
31-
android:focusableInTouchMode="true"
3230
android:marqueeRepeatLimit="marquee_forever"
3331
android:paddingLeft="6dp"
3432
android:paddingRight="6dp"

0 commit comments

Comments
 (0)