Setting to use internal or external media viewer

This commit is contained in:
Arne 2024-09-23 13:09:39 +02:00
parent 93b096fcd6
commit d060ea6d6a
5 changed files with 18 additions and 2 deletions

View file

@ -8,6 +8,8 @@ import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import androidx.preference.PreferenceManager;
import java.io.File;
import java.util.List;
@ -50,7 +52,7 @@ public class ViewUtil {
return;
}
// use internal viewer for images and videos
if (mime.startsWith("image/")) {
if (mime.startsWith("image/") && PreferenceManager.getDefaultSharedPreferences(context).getBoolean("internal_meda_viewer", context.getResources().getBoolean(R.bool.internal_meda_viewer))) {
final Intent intent = new Intent(context, MediaViewerActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
@ -60,7 +62,7 @@ public class ViewUtil {
} catch (ActivityNotFoundException e) {
Toast.makeText(context, R.string.cant_open_file, Toast.LENGTH_LONG).show();
}
} else if (mime.startsWith("video/")) {
} else if (mime.startsWith("video/") && PreferenceManager.getDefaultSharedPreferences(context).getBoolean("internal_meda_viewer", context.getResources().getBoolean(R.bool.internal_meda_viewer))) {
final Intent intent = new Intent(context, MediaViewerActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

View file

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="?colorControlNormal" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M360,520L760,520L622,340L530,460L468,380L360,520ZM120,840Q87,840 63.5,816.5Q40,793 40,760L40,240L120,240L120,760Q120,760 120,760Q120,760 120,760L800,760L800,840L120,840ZM280,680Q247,680 223.5,656.5Q200,633 200,600L200,160Q200,127 223.5,103.5Q247,80 280,80L480,80L560,160L840,160Q873,160 896.5,183.5Q920,207 920,240L920,600Q920,633 896.5,656.5Q873,680 840,680L280,680ZM280,600L840,600Q840,600 840,600Q840,600 840,600L840,240Q840,240 840,240Q840,240 840,240L527,240L447,160L280,160Q280,160 280,160Q280,160 280,160L280,600Q280,600 280,600Q280,600 280,600ZM280,600Q280,600 280,600Q280,600 280,600L280,160Q280,160 280,160Q280,160 280,160L280,160L280,240L280,240Q280,240 280,240Q280,240 280,240L280,600Q280,600 280,600Q280,600 280,600Z"/>
</vector>

View file

@ -7,4 +7,5 @@
<bool name="show_own_accounts">false</bool>
<bool name="set_text_collapsable">false</bool>
<bool name="show_nav_drawer">false</bool>
<bool name="internal_meda_viewer">true</bool>
</resources>

View file

@ -1125,4 +1125,6 @@
<string name="note_to_self">Note to Self</string>
<string name="show_link_previews">Show link previews</string>
<string name="show_link_previews_summary">Show a link description when sender included it</string>
<string name="internal_meda_viewer_title">Internal media viewer</string>
<string name="internal_meda_viewer_summary">Use internal media viewer to open image or video files inside monocles chat</string>
</resources>

View file

@ -34,6 +34,12 @@
android:summary="Don't use the above size limit on unmetered networks" />
</PreferenceCategory>
<PreferenceCategory android:title="Advanced">
<SwitchPreferenceCompat
android:defaultValue="@bool/internal_meda_viewer"
android:icon="@drawable/outline_perm_media_24"
android:key="internal_meda_viewer"
android:title="@string/internal_meda_viewer_title"
android:summary="@string/internal_meda_viewer_summary" />
<Preference
android:title="Change Stickers Location"
android:key="sticker_directory" />