Store screenshot generator as UI test

This commit is contained in:
Grishka
2022-04-13 04:39:14 +03:00
parent 0f61cb12d4
commit 3d7f2c154a
7 changed files with 289 additions and 5 deletions

View File

@@ -172,11 +172,13 @@ public class UiUtils{
}
public static String getFileName(Uri uri){
try(Cursor cursor=MastodonApp.context.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)){
cursor.moveToFirst();
String name=cursor.getString(0);
if(name!=null)
return name;
if(uri.getScheme().equals("content")){
try(Cursor cursor=MastodonApp.context.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)){
cursor.moveToFirst();
String name=cursor.getString(0);
if(name!=null)
return name;
}
}
return uri.getLastPathSegment();
}