|
|
|
|
@ -3,8 +3,6 @@ package com.fongmi.android.tv.bean; |
|
|
|
|
import android.graphics.Color; |
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.utils.ResUtil; |
|
|
|
|
|
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
|
|
|
|
|
public class DanmakuData { |
|
|
|
|
@ -16,17 +14,17 @@ public class DanmakuData { |
|
|
|
|
private long time; |
|
|
|
|
private float size; |
|
|
|
|
|
|
|
|
|
public DanmakuData(Matcher matcher) throws Exception { |
|
|
|
|
this.param(matcher.group(1)); |
|
|
|
|
public DanmakuData(Matcher matcher, float density) throws Exception { |
|
|
|
|
this.param(matcher.group(1), density); |
|
|
|
|
this.text = matcher.group(2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void param(String parm) throws Exception { |
|
|
|
|
private void param(String parm, float density) throws Exception { |
|
|
|
|
String[] params = parm.split(","); |
|
|
|
|
if (params.length < 4) throw new Exception(); |
|
|
|
|
this.type = Integer.parseInt(params[1]); |
|
|
|
|
this.time = (long) (Float.parseFloat(params[0]) * 1000); |
|
|
|
|
this.size = Float.parseFloat(params[2]) * (ResUtil.getDisplayMetrics().density - 0.6f); |
|
|
|
|
this.size = Float.parseFloat(params[2]) * (density - 0.6f); |
|
|
|
|
this.color = (int) (0xFF000000L | Long.parseLong(params[3]) & 0xFFFFFF); |
|
|
|
|
this.shadow = color == Color.BLACK ? Color.WHITE : Color.BLACK; |
|
|
|
|
} |
|
|
|
|
|