Changed library used to display fullscreen images.

parent d0bbe213
...@@ -37,7 +37,7 @@ dependencies { ...@@ -37,7 +37,7 @@ dependencies {
compile 'com.github.bumptech.glide:glide:4.2.0' compile 'com.github.bumptech.glide:glide:4.2.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
compile 'com.github.chrisbanes:PhotoView:2.1.3' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.7.2'
compile 'com.google.android.exoplayer:exoplayer:r2.5.4' compile 'com.google.android.exoplayer:exoplayer:r2.5.4'
} }
...@@ -20,14 +20,12 @@ import android.view.View; ...@@ -20,14 +20,12 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.davemorrissey.labs.subscaleview.ImageSource;
import com.github.chrisbanes.photoview.PhotoView; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
public class ImageActivity extends AppCompatActivity { public class ImageActivity extends AppCompatActivity {
ArrayList<String> list_of_images = new ArrayList<>(); ArrayList<String> list_of_images = new ArrayList<>();
...@@ -189,10 +187,13 @@ public class ImageActivity extends AppCompatActivity { ...@@ -189,10 +187,13 @@ public class ImageActivity extends AppCompatActivity {
// Inflate layout // Inflate layout
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.view_pager_item, container, false); View layout = inflater.inflate(R.layout.view_pager_item, container, false);
// Get view // Get views
PhotoView photoView = layout.findViewById(R.id.inside_imageview); SubsamplingScaleImageView imageView = findViewById(R.id.inside_imageview);
ImageView overlay = layout.findViewById(R.id.outside_imageview); ImageView overlay = layout.findViewById(R.id.outside_imageview);
//Set image
imageView.setImage(ImageSource.uri(Uri.fromFile(image)));
// If it's a video, add overlay // If it's a video, add overlay
if(Utils.isVideo(image.getName())){ if(Utils.isVideo(image.getName())){
overlay.setVisibility(View.VISIBLE); overlay.setVisibility(View.VISIBLE);
...@@ -200,17 +201,17 @@ public class ImageActivity extends AppCompatActivity { ...@@ -200,17 +201,17 @@ public class ImageActivity extends AppCompatActivity {
overlay.setVisibility(View.INVISIBLE); overlay.setVisibility(View.INVISIBLE);
} }
GlideApp //GlideApp
.with(getApplicationContext()) // .with(getApplicationContext())
.load(image) // .load(image)
.transition(withCrossFade()) // .transition(withCrossFade())
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) // .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.into(photoView); // .into(imageView);
container.addView(layout); container.addView(layout);
// Set up the user interaction to manually show or hide the system UI. // Set up the user interaction to manually show or hide the system UI.
photoView.setOnClickListener(new View.OnClickListener() { imageView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
toggle(); toggle();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.github.chrisbanes.photoview.PhotoView <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@+id/inside_imageview" android:id="@+id/inside_imageview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment