Created
March 27, 2020 00:11
-
-
Save jorisbertomeu/84735ed8416559ec3c151c00bce89899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/plugins/com-sarriaroman-photoviewer/src/android/PhotoActivity.java b/plugins/com-sarriaroman-photoviewer/src/android/PhotoActivity.java | |
index 68c1eb6..0c32c9c 100644 | |
--- a/plugins/com-sarriaroman-photoviewer/src/android/PhotoActivity.java | |
+++ b/plugins/com-sarriaroman-photoviewer/src/android/PhotoActivity.java | |
@@ -19,6 +19,7 @@ import android.widget.ProgressBar; | |
import android.widget.TextView; | |
import android.widget.Toast; | |
+import com.squareup.picasso.Callback; | |
import com.squareup.picasso.Picasso; | |
import org.json.JSONArray; | |
@@ -161,22 +162,29 @@ public class PhotoActivity extends Activity { | |
*/ | |
private void loadImage() { | |
if (mImage.startsWith("http") || mImage.startsWith("file")) { | |
- Picasso.with(this) | |
+ Picasso.get() | |
.load(mImage) | |
.fit() | |
.centerInside() | |
- .into(photo, new com.squareup.picasso.Callback() { | |
+ .into(photo, new Callback() { | |
@Override | |
public void onSuccess() { | |
hideLoadingAndUpdate(); | |
} | |
@Override | |
- public void onError() { | |
+ public void onError(Exception e) { | |
Toast.makeText(getActivity(), "Error loading image.", Toast.LENGTH_LONG).show(); | |
finish(); | |
} | |
+ | |
+ /*@Override | |
+ public void onError() { | |
+ Toast.makeText(getActivity(), "Error loading image.", Toast.LENGTH_LONG).show(); | |
+ | |
+ finish(); | |
+ }*/ | |
}); | |
} else if (mImage.startsWith("data:image")) { | |
@@ -189,18 +197,18 @@ public class PhotoActivity extends Activity { | |
protected void onPostExecute(File file) { | |
mTempImage = file; | |
- Picasso.with(PhotoActivity.this) | |
+ Picasso.get() | |
.load(mTempImage) | |
.fit() | |
.centerCrop() | |
- .into(photo, new com.squareup.picasso.Callback() { | |
+ .into(photo, new Callback() { | |
@Override | |
public void onSuccess() { | |
hideLoadingAndUpdate(); | |
} | |
@Override | |
- public void onError() { | |
+ public void onError(Exception e) { | |
Toast.makeText(getActivity(), "Error loading image.", Toast.LENGTH_LONG).show(); | |
finish(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment