|
@@ -12,14 +12,18 @@ import android.provider.MediaStore;
|
|
|
import android.support.v4.view.PagerAdapter;
|
|
|
import android.support.v4.view.ViewCompat;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
+import android.support.v7.widget.Toolbar;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
+import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.WindowManager;
|
|
|
import android.widget.AbsoluteLayout;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
@@ -37,6 +41,8 @@ import com.netease.nim.uikit.common.util.file.AttachmentStore;
|
|
|
import com.netease.nim.uikit.common.util.media.BitmapDecoder;
|
|
|
import com.netease.nim.uikit.common.util.media.ImageUtil;
|
|
|
import com.netease.nim.uikit.common.util.storage.StorageUtil;
|
|
|
+import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
|
|
+import com.netease.nim.uikit.session.SessionCustomization;
|
|
|
import com.netease.nimlib.sdk.AbortableFuture;
|
|
|
import com.netease.nimlib.sdk.NIMClient;
|
|
|
import com.netease.nimlib.sdk.Observer;
|
|
@@ -67,6 +73,7 @@ public class WatchPictureActivity extends UI {
|
|
|
|
|
|
private View loadingLayout;
|
|
|
private BaseZoomableImageView image;
|
|
|
+ private ImageView thumbImage;
|
|
|
protected CustomAlertDialog alertDialog;
|
|
|
private ViewPager imageViewPager;
|
|
|
private PagerAdapter adapter;
|
|
@@ -87,7 +94,7 @@ public class WatchPictureActivity extends UI {
|
|
|
@Override
|
|
|
public void onCreate(Bundle savedInstatnceState){
|
|
|
super.onCreate(savedInstatnceState);
|
|
|
- setContentView(R.layout.nim_watch_picture_activity);
|
|
|
+ setContentView(R.layout.watch_picture_activity);
|
|
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
|
|
@@ -112,7 +119,7 @@ public class WatchPictureActivity extends UI {
|
|
|
alertDialog = new CustomAlertDialog(this);
|
|
|
loadingLayout = findViewById(R.id.loading_layout);
|
|
|
|
|
|
- imageViewPager = (ViewPager) findViewById(R.id.view_pager_image);
|
|
|
+ imageViewPager = (ViewPager) findViewById(R.id.view_pager_picture);
|
|
|
|
|
|
textView = (TextView) findViewById(R.id.watch_picture_text);
|
|
|
}
|
|
@@ -132,7 +139,7 @@ public class WatchPictureActivity extends UI {
|
|
|
@Override
|
|
|
public void destroyItem(ViewGroup container, int position, Object object) {
|
|
|
View layout = (View) object;
|
|
|
- BaseZoomableImageView iv = (BaseZoomableImageView) layout.findViewById(R.id.watch_image_view);
|
|
|
+ BaseZoomableImageView iv = (BaseZoomableImageView) layout.findViewById(R.id.watch_picture_view);
|
|
|
iv.clear();
|
|
|
container.removeView(layout);
|
|
|
}
|
|
@@ -145,7 +152,7 @@ public class WatchPictureActivity extends UI {
|
|
|
@Override
|
|
|
public Object instantiateItem(ViewGroup container, int position) {
|
|
|
ViewGroup layout;
|
|
|
- layout = (ViewGroup) LayoutInflater.from(WatchPictureActivity.this).inflate(R.layout.image_layout_multi_touch, null);
|
|
|
+ layout = (ViewGroup) LayoutInflater.from(WatchPictureActivity.this).inflate(R.layout.watch_picture_layout_multi_touch, null);
|
|
|
layout.setBackgroundColor(Color.BLACK);
|
|
|
|
|
|
container.addView(layout);
|
|
@@ -191,7 +198,7 @@ public class WatchPictureActivity extends UI {
|
|
|
private void onViewPagerSelected(int position) {
|
|
|
updateCurrentImageView(position);
|
|
|
onImageViewFound(image);
|
|
|
- requestOriImage(data.getPics().get(position));
|
|
|
+ requestOriImage(data.getThumbs().get(position), data.getPics().get(position));
|
|
|
}
|
|
|
|
|
|
// 初始化每个view的image
|
|
@@ -207,20 +214,25 @@ public class WatchPictureActivity extends UI {
|
|
|
});
|
|
|
return;
|
|
|
};
|
|
|
- image = (BaseZoomableImageView) currentLayout.findViewById(R.id.watch_image_view);
|
|
|
+ image = (BaseZoomableImageView) currentLayout.findViewById(R.id.watch_picture_view);
|
|
|
image.bitmapRecyclable = false;
|
|
|
|
|
|
+ thumbImage = (ImageView) currentLayout.findViewById(R.id.watch_thumb_view);
|
|
|
+
|
|
|
textView.setText(""+(position+1)+"/"+data.size());
|
|
|
}
|
|
|
|
|
|
// 若图片已下载,直接显示图片;若图片未下载,则下载图片
|
|
|
- private void requestOriImage(final String path) {
|
|
|
+ private void requestOriImage(final String thumb, final String path) {
|
|
|
+
|
|
|
+ Glide.with(this.getApplicationContext()).load(thumb).into(thumbImage);
|
|
|
|
|
|
Glide.with(this.getApplicationContext()).load(path).asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).into(new SimpleTarget<Bitmap>() {
|
|
|
|
|
|
@Override
|
|
|
public void onLoadStarted(Drawable placeholder) {
|
|
|
loadingLayout.setVisibility(View.VISIBLE);
|
|
|
+ thumbImage.setVisibility(View.VISIBLE);
|
|
|
Log.d("onLoadStarted", path);
|
|
|
}
|
|
|
|
|
@@ -234,6 +246,7 @@ public class WatchPictureActivity extends UI {
|
|
|
Log.d("onResourceReady", path);
|
|
|
loadingLayout.setVisibility(View.GONE);
|
|
|
image.setImageBitmap(resource);
|
|
|
+ thumbImage.setVisibility(View.GONE);
|
|
|
}
|
|
|
});
|
|
|
}
|