|
|
@@ -1,8 +1,13 @@
|
|
|
package com.sheep.gamegroup.model.entity;
|
|
|
|
|
|
+import android.net.Uri;
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
|
+import com.kfzs.duanduan.utils.NumberFormatUtils;
|
|
|
+
|
|
|
import java.io.Serializable;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Created by realicing on 2018/11/27.
|
|
|
@@ -230,6 +235,42 @@ public class DiscoveryVideo implements Serializable {
|
|
|
return obj instanceof DiscoveryVideo && ((DiscoveryVideo) obj).getId() == id;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ private int width;
|
|
|
+ private int height;
|
|
|
+ private int orientation;
|
|
|
+
|
|
|
+ private void initVideoInfo(){
|
|
|
+ if(width == 0 || height == 0 || orientation == 0 && cover != null){
|
|
|
+ Uri uri = Uri.parse(cover);
|
|
|
+ width = (int) NumberFormatUtils.parseFloat(uri.getQueryParameter("w"));
|
|
|
+ height = (int) NumberFormatUtils.parseFloat(uri.getQueryParameter("h"));
|
|
|
+ Pattern p = Pattern.compile("/rotate/(.*?)\\&");
|
|
|
+ Matcher m = p.matcher(cover);
|
|
|
+ if(m.find()) {
|
|
|
+ String result = m.group(1);
|
|
|
+ orientation = (int) NumberFormatUtils.parseFloat(result);
|
|
|
+// String result = m.group(0);
|
|
|
+// orientation = (int) NumberFormatUtils.parseFloat(result.substring("/rotate/".length(), result.length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public int getWidth() {
|
|
|
+ initVideoInfo();
|
|
|
+ return width;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getHeight() {
|
|
|
+ initVideoInfo();
|
|
|
+ return height;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getOrientation() {
|
|
|
+ initVideoInfo();
|
|
|
+ return orientation;
|
|
|
+ }
|
|
|
+
|
|
|
//非通过状态
|
|
|
public boolean isInAudit() {
|
|
|
return status != 1;
|