forked from upstream-mirrors/quik
Merge pull request #306 from gavine99/update-attachment-icon-retrieve-and-manifest
Update attachment icon retrieve and manifest query to enable
This commit is contained in:
@@ -26,4 +26,11 @@
|
||||
android:grantUriPermissions="true">
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="*" android:mimeType="*/*" />
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
||||
@@ -136,21 +136,25 @@ fun Uri.contactToVCard(context: Context): Uri =
|
||||
}
|
||||
|
||||
fun Uri.getDefaultActivityIconForMimeType(context: Context): Drawable? =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.ResolveInfoFlags.of(
|
||||
PackageManager.MATCH_DEFAULT_ONLY.toLong()
|
||||
)
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
} else {
|
||||
context.packageManager
|
||||
.resolveActivity(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.MATCH_DEFAULT_ONLY)
|
||||
?.loadIcon(context.packageManager)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.ResolveInfoFlags.of(
|
||||
PackageManager.MATCH_DEFAULT_ONLY.toLong()
|
||||
)
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
} else {
|
||||
// else, pre-tiramisu versions
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.MATCH_DEFAULT_ONLY
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:background="?attr/bubbleColor">
|
||||
|
||||
<FrameLayout
|
||||
@@ -41,11 +42,11 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fileName"
|
||||
style="@style/TextPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ddffffff"
|
||||
android:background="#a7ffffff"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
@@ -61,6 +62,6 @@
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?attr/bubbleColor"
|
||||
android:src="@drawable/ic_cancel_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fileName"
|
||||
style="@style/TextPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ddffffff"
|
||||
android:background="#a7ffffff"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user