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