Import infpnt files to android version
This commit is contained in:
parent
cde106eba7
commit
0da317e87c
17 changed files with 135 additions and 9 deletions
|
|
@ -82,7 +82,7 @@
|
|||
<meta-data android:name="SDL_ENV.SDL_ANDROID_TRAP_BACK_BUTTON" android:value="0"/>
|
||||
-->
|
||||
<service
|
||||
android:name="InfiniPaintNetworkService"
|
||||
android:name=".InfiniPaintNetworkService"
|
||||
android:foregroundServiceType="specialUse"
|
||||
android:exported="false">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
|
|
@ -103,11 +103,12 @@
|
|||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleTop"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="layoutDirection|locale|grammaticalGender|fontScale|fontWeightAdjustment|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:exported="true"
|
||||
>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ import static androidx.core.content.FileProvider.getUriForFile;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -202,4 +204,35 @@ public class InfiniPaint extends SDLActivity {
|
|||
Intent shareIntent = Intent.createChooser(sendIntent, null);
|
||||
getContext().startActivity(shareIntent);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/25005243
|
||||
static public String getFileNameFromUriString(String strUri) {
|
||||
if(strUri == null)
|
||||
return null;
|
||||
Uri uri = Uri.parse(strUri);
|
||||
if(uri == null)
|
||||
return null;
|
||||
String result = null;
|
||||
if (uri.getScheme() != null && uri.getScheme().equals("content")) {
|
||||
Cursor cursor = getContext().getContentResolver().query(uri, null, null, null, null);
|
||||
try {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
result = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME));
|
||||
}
|
||||
} finally {
|
||||
if(cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
result = uri.getPath();
|
||||
if(result == null)
|
||||
return null;
|
||||
int cut = result.lastIndexOf('/');
|
||||
if (cut != -1) {
|
||||
result = result.substring(cut + 1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue