Removed PhotoViewer

This commit is contained in:
M66B 2020-05-23 18:40:41 +02:00
parent 09e55fdf1c
commit 29da42bb9f
4 changed files with 9 additions and 52 deletions

View File

@ -14,7 +14,6 @@ FairEmail uses:
* [ShortcutBadger](https://github.com/leolin310148/ShortcutBadger). Copyright 2014 Leo Lin. [Apache license 2.0](https://github.com/leolin310148/ShortcutBadger/blob/master/LICENSE).
* [Bugsnag exception reporter for Android](https://github.com/bugsnag/bugsnag-android). Copyright (c) 2012 Bugsnag. [MIT License](https://github.com/bugsnag/bugsnag-android/blob/master/LICENSE.txt).
* [biweekly](https://github.com/mangstadt/biweekly). Copyright (c) 2013-2018, Michael Angstadt. [BSD 2-Clause](https://github.com/mangstadt/biweekly/blob/master/LICENSE).
* [PhotoView](https://github.com/chrisbanes/PhotoView). Copyright 2018 Chris Banes. [Apache License 2.0](https://github.com/chrisbanes/PhotoView/blob/master/LICENSE).
* [ReLinker](https://github.com/KeepSafe/ReLinker). Copyright 2015 - 2016 KeepSafe Software, Inc. [Apache License 2.0](https://github.com/KeepSafe/ReLinker/blob/master/LICENSE).
* [Markwon](https://github.com/noties/Markwon). Copyright 2019 Dimitry Ivanov. [Apache License 2.0](https://github.com/noties/Markwon/blob/master/LICENSE).
* [Color Picker](https://github.com/QuadFlask/colorpicker). Copyright 2014-2017 QuadFlask. [Apache License 2.0](https://github.com/QuadFlask/colorpicker#user-content-license).

View File

@ -386,9 +386,6 @@ dependencies {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
}
// https://github.com/chrisbanes/PhotoView
implementation "com.github.chrisbanes:PhotoView:$photoview_version"
// https://github.com/KeepSafe/ReLinker
// https://mvnrepository.com/artifact/com.getkeepsafe.relinker/relinker?repo=jcenter
implementation "com.getkeepsafe.relinker:relinker:$relinker_version"

View File

@ -14,7 +14,6 @@ FairEmail uses:
* [ShortcutBadger](https://github.com/leolin310148/ShortcutBadger). Copyright 2014 Leo Lin. [Apache license 2.0](https://github.com/leolin310148/ShortcutBadger/blob/master/LICENSE).
* [Bugsnag exception reporter for Android](https://github.com/bugsnag/bugsnag-android). Copyright (c) 2012 Bugsnag. [MIT License](https://github.com/bugsnag/bugsnag-android/blob/master/LICENSE.txt).
* [biweekly](https://github.com/mangstadt/biweekly). Copyright (c) 2013-2018, Michael Angstadt. [BSD 2-Clause](https://github.com/mangstadt/biweekly/blob/master/LICENSE).
* [PhotoView](https://github.com/chrisbanes/PhotoView). Copyright 2018 Chris Banes. [Apache License 2.0](https://github.com/chrisbanes/PhotoView/blob/master/LICENSE).
* [ReLinker](https://github.com/KeepSafe/ReLinker). Copyright 2015 - 2016 KeepSafe Software, Inc. [Apache License 2.0](https://github.com/KeepSafe/ReLinker/blob/master/LICENSE).
* [Markwon](https://github.com/noties/Markwon). Copyright 2019 Dimitry Ivanov. [Apache License 2.0](https://github.com/noties/Markwon/blob/master/LICENSE).
* [Color Picker](https://github.com/QuadFlask/colorpicker). Copyright 2014-2017 QuadFlask. [Apache License 2.0](https://github.com/QuadFlask/colorpicker#user-content-license).

View File

@ -138,7 +138,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.github.chrisbanes.photoview.PhotoView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
@ -3794,7 +3793,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ImageSpan[] image = buffer.getSpans(off, off, ImageSpan.class);
if (image.length > 0) {
String source = image[0].getSource();
if (source != null) {
if (!TextUtils.isEmpty(source)) {
onOpenImage(message.id, source);
return true;
}
@ -3866,7 +3865,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
args.putString("source", source);
args.putInt("zoom", zoom);
if ("cid".equals(scheme)) {
if ("cid".equals(scheme))
new SimpleTask<EntityAttachment>() {
@Override
protected EntityAttachment onExecute(Context context, Bundle args) {
@ -3889,9 +3888,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
}
}.execute(context, owner, args, "view:cid");
} else if ("http".equals(scheme) || "https".equals(scheme))
else if ("http".equals(scheme) || "https".equals(scheme))
Helper.view(context, uri, false);
else if ("data".equals(scheme)) {
else if ("data".equals(scheme))
new SimpleTask<File>() {
@Override
protected File onExecute(Context context, Bundle args) throws IOException {
@ -3920,11 +3921,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
}
}.execute(context, owner, args, "view:cid");
} else {
FragmentDialogImage fragment = new FragmentDialogImage();
fragment.setArguments(args);
fragment.show(parentFragment.getParentFragmentManager(), "view:image");
}
else
ToastEx.makeText(context, context.getString(R.string.title_no_viewer, source), Toast.LENGTH_LONG).show();
}
private void onMenuUnseen(final TupleMessageEx message) {
@ -5725,43 +5724,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}
public static class FragmentDialogImage extends FragmentDialogBase {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final PhotoView pv = new PhotoView(getContext());
new SimpleTask<Drawable>() {
@Override
protected Drawable onExecute(Context context, Bundle args) throws Throwable {
long id = args.getLong("id");
String source = args.getString("source");
int zoom = args.getInt("zoom");
return ImageHelper.decodeImage(context, id, source, true, zoom, null);
}
@Override
protected void onExecuted(Bundle args, Drawable drawable) {
pv.setImageDrawable(drawable);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (drawable instanceof AnimatedImageDrawable)
((AnimatedImageDrawable) drawable).start();
}
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(this, getArguments(), "view:image");
final Dialog dialog = new Dialog(getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(pv);
return dialog;
}
}
public static class FragmentDialogJunk extends FragmentDialogBase {
@NonNull
@Override