Messaging: Use ActivityResultContracts for media and contacts

Instead of handling showing and picking the media ourselves,
use existing AcitivityResultContracts to pick images, videos
or contacts

Change-Id: I20079ad94882cc6bbfeae8d57ca0e4aa30612c01
This commit is contained in:
Michael W
2024-12-26 15:54:37 +01:00
parent 7f9087a49e
commit e335f6bec8
24 changed files with 148 additions and 1481 deletions
+33 -26
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2024 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,30 +16,36 @@
limitations under the License.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<FrameLayout
android:id="@+id/mediapicker_enabled"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.messaging.ui.mediapicker.GalleryGridView
android:id="@+id/gallery_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
android:columnWidth="@dimen/gallery_image_cell_size"
android:numColumns="auto_fit"
android:verticalSpacing="6dp"
android:horizontalSpacing="6dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:clipToPadding="false"
android:background="@android:color/white" />
<!-- This view will hide all other views if the required permission is not granted -->
<TextView
android:id="@+id/missing_permission_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/enable_permission_procedure"
android:contentDescription="@string/enable_permission_procedure_description"
android:background="@android:color/white"
android:gravity="center"
android:visibility="gone" />
</FrameLayout>
android:layout_height="match_parent" >
<TextView
style="@style/ContactPickerHintText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="16dp"
android:text="@string/mediapicker_galleryChooserDescription"
android:importantForAccessibility="no" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="center"
android:src="@drawable/ic_image_light"
android:scaleX="1.33"
android:scaleY="1.33"
app:tint="@color/primary_color"
android:importantForAccessibility="no"
android:contentDescription="@null" />
</FrameLayout>
</FrameLayout>