优化 ImageViewerActivity 代码及渐出动画 https://git.shanqu.cc/halo/android/assistant-android/-/issues/52
This commit is contained in:
@ -2,6 +2,7 @@ package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
@ -18,8 +19,11 @@ import java.util.List;
|
||||
**/
|
||||
public class ConcernContentUtils {
|
||||
|
||||
private static final ArrayList<SimpleDraweeView> imageViewList = new ArrayList<>();
|
||||
|
||||
public static void addContentPic(Context context, LinearLayout linearLayout, List<String> list,
|
||||
String entrance, int width) {
|
||||
imageViewList.clear();
|
||||
int count = list.size();
|
||||
int index = 0;
|
||||
for (int i = 0, size = (int) Math.ceil(list.size() / 3.0f); i < size; i++) {
|
||||
@ -30,14 +34,18 @@ public class ConcernContentUtils {
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
ll.addView(getImageView(context, list, entrance, index, width, 0));
|
||||
SimpleDraweeView draweeView = getImageView(context, list, entrance, index, width, 0);
|
||||
imageViewList.add(draweeView);
|
||||
ll.addView(draweeView);
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
count -= 3;
|
||||
break;
|
||||
case 1:
|
||||
linearLayout.addView(getImageView(context, list, entrance, index, width, 1));
|
||||
SimpleDraweeView draweeView = getImageView(context, list, entrance, index, width, 1);
|
||||
imageViewList.add(draweeView);
|
||||
linearLayout.addView(draweeView);
|
||||
count -= 1;
|
||||
index += 1;
|
||||
break;
|
||||
@ -45,7 +53,9 @@ public class ConcernContentUtils {
|
||||
ll = new LinearLayout(context);
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
ll.addView(getImageView(context, list, entrance, index, width, 2));
|
||||
SimpleDraweeView imageView = getImageView(context, list, entrance, index, width, 2);
|
||||
imageViewList.add(imageView);
|
||||
ll.addView(imageView);
|
||||
index += 1;
|
||||
}
|
||||
linearLayout.addView(ll);
|
||||
@ -93,7 +103,7 @@ public class ConcernContentUtils {
|
||||
break;
|
||||
}
|
||||
imageView.setOnClickListener(v -> {
|
||||
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position, entrance);
|
||||
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position, imageViewList, entrance);
|
||||
context.startActivity(checkIntent);
|
||||
});
|
||||
return imageView;
|
||||
|
||||
Reference in New Issue
Block a user