Hide sticker dir setting on lower android

(cherry picked from commit f9562238fc2905211cbd1384caa37b520c69a2ac)
This commit is contained in:
Stephen Paul Weber 2024-09-03 10:35:34 -05:00 committed by Arne
parent 8add837d92
commit 2f51c8326f

View file

@ -44,12 +44,16 @@ public class AttachmentsSettingsFragment extends XmppPreferenceFragment {
final var p = PreferenceManager.getDefaultSharedPreferences(requireActivity());
final var stickerDir = findPreference("sticker_directory");
stickerDir.setSummary(p.getString("sticker_directory", "Pictures/Stickers"));
stickerDir.setOnPreferenceClickListener((pref) -> {
final var intent = ((StorageManager) requireActivity().getSystemService(Context.STORAGE_SERVICE)).getPrimaryStorageVolume().createOpenDocumentTreeIntent();
startActivityForResult(Intent.createChooser(intent, "Choose sticker location"), 0);
return true;
});
if (Build.VERSION.SDK_INT >= 29) {
stickerDir.setSummary(p.getString("sticker_directory", "Pictures/Stickers"));
stickerDir.setOnPreferenceClickListener((pref) -> {
final var intent = ((StorageManager) requireActivity().getSystemService(Context.STORAGE_SERVICE)).getPrimaryStorageVolume().createOpenDocumentTreeIntent();
startActivityForResult(Intent.createChooser(intent, "Choose sticker location"), 0);
return true;
});
} else {
stickerDir.setVisible(false);
}
final var downloadDefaultStickers = findPreference("download_default_stickers");
downloadDefaultStickers.setOnPreferenceClickListener((pref) -> {