improve attachment icon fetch from other apps. make compose box attachment text background a little less tranparent so icon 'pops' a bit more. make same icon text always black so it can be seen properly.

This commit is contained in:
gavine99
2025-02-21 11:47:46 +11:00
parent 4cbf3bdc4d
commit cb6a83eacc
3 changed files with 31 additions and 20 deletions
+7
View File
@@ -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>
@@ -148,9 +148,13 @@ fun Uri.getDefaultActivityIconForMimeType(context: Context): Drawable? =
else null else null
} }
} else { } else {
// else, pre-tiramisu versions
context.packageManager context.packageManager
.resolveActivity( .queryIntentActivities(
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)), Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
PackageManager.MATCH_DEFAULT_ONLY) PackageManager.MATCH_DEFAULT_ONLY
?.loadIcon(context.packageManager) ).let {
if (it.size > 0) it[0].loadIcon(context.packageManager)
else null
}
} }
@@ -41,11 +41,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" />