Skip to content

Commit aa76c2c

Browse files
chr56NullPointerException
authored andcommitted
[Enhancement][UI] Enhanced Full-functional Image Viewer for Images Attached in Comments (InfinityLoop1308#31)
Replace `PictureDialog` with `ImageViewerActivity`, ~borrowed from my other projects~. Thanks to [com.github.chrisbanes:PhotoView](https://github.com/Baseflow/PhotoView), now this image detail dialog (activity) can: - Full screen - Zoom - Swipe to switch - Download / Copy URI / Open in browser Reviewed-on: https://codeberg.org/NullPointerException/PipePipeClient/pulls/31 Co-authored-by: chr56 <chr0056@gmail.com> Co-committed-by: chr56 <chr0056@gmail.com>
1 parent 6f98759 commit aa76c2c

8 files changed

Lines changed: 416 additions & 224 deletions

File tree

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ dependencies {
287287
// File picker
288288
implementation "com.nononsenseapps:filepicker:4.2.1"
289289

290+
// Image Viewer: PhotoView
291+
implementation "com.github.chrisbanes:PhotoView:2.3.0"
292+
290293
// Crash reporting
291294
implementation "ch.acra:acra-core:5.9.1"
292295

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
</intent-filter>
123123
</activity>
124124

125+
<activity
126+
android:name=".util.ImageViewerActivity"
127+
android:theme="@style/BlackTheme" />
128+
125129
<activity
126130
android:name=".error.ReCaptchaActivity"
127131
android:label="@string/recaptcha" />

app/src/main/java/org/schabi/newpipe/info_list/dialog/PictureDialog.kt

Lines changed: 0 additions & 102 deletions
This file was deleted.

app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsInfoItemHolder.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
import android.widget.ImageView;
77
import android.widget.TextView;
88

9-
import androidx.fragment.app.FragmentActivity;
10-
119
import org.schabi.newpipe.R;
1210
import org.schabi.newpipe.extractor.Image;
1311
import org.schabi.newpipe.extractor.InfoItem;
1412
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
1513
import org.schabi.newpipe.info_list.InfoItemBuilder;
16-
import org.schabi.newpipe.info_list.dialog.PictureDialog;
1714
import org.schabi.newpipe.local.history.HistoryRecordManager;
15+
import org.schabi.newpipe.util.ImageViewerActivity;
1816

1917
import java.util.Collection;
2018

@@ -76,15 +74,7 @@ public void updateFromItem(final InfoItem infoItem,
7674
itemViewImageView.getContext().getString(R.string.button_view_pictures, pictures.size())
7775
);
7876
itemViewImageView.setOnClickListener(v -> {
79-
PictureDialog pictureDialog = PictureDialog.from(pictures);
80-
81-
if (itemBuilder != null && itemBuilder.getContext() instanceof FragmentActivity) {
82-
pictureDialog.show(
83-
((FragmentActivity) itemBuilder.getContext()).getSupportFragmentManager(),
84-
"PICTURE_DIALOG"
85-
);
86-
}
87-
77+
v.getContext().startActivity(ImageViewerActivity.intent(v.getContext(), pictures));
8878
});
8979
} else {
9080
itemViewImageView.setVisibility(View.GONE);

0 commit comments

Comments
 (0)