Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix color of subtitles #124

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import androidx.leanback.widget.Row;
import androidx.leanback.widget.RowPresenter;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
Expand Down Expand Up @@ -1863,7 +1866,6 @@ public void run() {
mSubtitleText.setText("");
}
});

}

public void showSubLoadingMsg(final boolean show) {
Expand All @@ -1882,7 +1884,6 @@ public void run() {
}

public void updateSubtitles(long positionMs) {

if (lastReportedPosMs > 0){
if (Math.abs(lastReportedPosMs - positionMs) < 500) {
return;
Expand All @@ -1906,7 +1907,6 @@ public void updateSubtitles(long positionMs) {
}

private void setTimedText(final SubtitleTrackEvent textObj) {

mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Expand All @@ -1922,7 +1922,9 @@ public void run() {
return;
}

mSubtitleText.setText(Html.fromHtml(text));
SpannableString span = new SpannableString(Html.fromHtml(text));
span.setSpan(new ForegroundColorSpan(Color.WHITE), 0, span.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
mSubtitleText.setText(span);
mSubtitleText.setVisibility(View.VISIBLE);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import org.jellyfin.apiclient.model.dto.BaseItemDto;
import org.jellyfin.apiclient.model.mediainfo.SubtitleTrackInfo;

/**
* Created by Eric on 4/28/2015.
*/
public interface IPlaybackOverlayFragment {
void setCurrentTime(long time);
void setSecondaryTime(long time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,19 @@ public class VideoManager implements IVLCVout.OnNewVideoLayoutListener {

public VideoManager(PlaybackOverlayActivity activity, View view) {
mActivity = activity;
mSurfaceView = (SurfaceView) view.findViewById(R.id.player_surface);
mSurfaceView = view.findViewById(R.id.player_surface);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(mSurfaceCallback);
mSurfaceFrame = (FrameLayout) view.findViewById(R.id.player_surface_frame);
mSubtitlesSurface = (SurfaceView) view.findViewById(R.id.subtitles_surface);
mSurfaceFrame = view.findViewById(R.id.player_surface_frame);
mSubtitlesSurface = view.findViewById(R.id.subtitles_surface);
if (DeviceUtils.is50()) {
mSubtitlesSurface.setZOrderMediaOverlay(true);
mSubtitlesSurface.getHolder().setFormat(PixelFormat.TRANSLUCENT);
hasSubtitlesSurface = true;
} else {
mSubtitlesSurface.setVisibility(View.GONE);
}
mVideoView = (EMVideoView) view.findViewById(R.id.videoView);

mVideoView = view.findViewById(R.id.videoView);
}

public void init(int buffer, boolean isInterlaced) {
Expand Down