Procházet zdrojové kódy

查看视频详情返回后不刷新视频列表

zengjiebin před 7 roky
rodič
revize
8c828e5ebb

+ 9 - 5
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -1758,10 +1758,16 @@ public class ViewUtil {
     public static void setViewWH(View view, int width, float radio) {
         LayoutParamsUtil.resetLayoutParams(view, new Lp().setWidth(width).setHeight((int) (width * radio)));
     }
-    public static void setImageWH(ImageView view, Object url, int width, int radius) {
+    public static void setImageWH(ImageView view, String url, int width, int radius) {
         if(url == null || view == null){
             return;
         }
+        int w = DataUtil.getAsInt(url+"_w", 0);
+        int h = DataUtil.getAsInt(url+"_h", 0);
+        if(w > 0 && h > 0) {
+            float radio = h * 1.0f / w;
+            ViewUtil.setViewWH(view, width, radio);
+        }
         Glide.with(SheepApp.getInstance())
                 .load(url)
                 .listener(new RequestListener<Drawable>() {
@@ -1774,10 +1780,8 @@ public class ViewUtil {
                     public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                         int w = resource.getIntrinsicWidth();
                         int h = resource.getIntrinsicHeight();
-                        if(w > 0 && h > 0) {
-                            float radio = h * 1.0f / w;
-                            ViewUtil.setViewWH(view, width, radio);
-                        }
+                        DataUtil.putAsInt(url+"_w", w);
+                        DataUtil.putAsInt(url+"_h", h);
                         return false;
                     }
                 })

+ 1 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/ActVideoDetail.java

@@ -301,8 +301,7 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
                             }
                             loadVideoData(newVideo);
                         }
-                        //回去视频列表后需要刷新界面
-                        ActionUtil.getInstance().addNextAction(FgtArticleVideo.class.getSimpleName(), IRefresh.class.getSimpleName());
+//                        ActionUtil.getInstance().addNextAction(FgtArticleVideo.class.getSimpleName(), IRefresh.class.getSimpleName());
                         hideProgress();
                         ViewUtil.setVisibility(video_loading, !isPlaying());
                     }