diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 39054f65..ea48ce57 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -14,8 +14,14 @@ - - + + + + + tools:replace="icon, label"> + android:exported="true" + android:label="WhereYouGo"> - - - - - - - - - - - - - - + + + + + - - - + + + - + - - - - + + + + @@ -124,17 +89,29 @@ - - + + - + android:name="menion.android.whereyougo.network.activity.DownloadCartridgeActivity" + android:exported="true"> + + + + + + + + + + + + + + + ((MainActivity)getActivity()).openFilePicker()) .create(); } catch (Exception e) { Logger.e(TAG, "createDialog()", e); diff --git a/src/main/java/menion/android/whereyougo/utils/ContentUtils.java b/src/main/java/menion/android/whereyougo/utils/ContentUtils.java new file mode 100644 index 00000000..32fb59d7 --- /dev/null +++ b/src/main/java/menion/android/whereyougo/utils/ContentUtils.java @@ -0,0 +1,30 @@ +package menion.android.whereyougo.utils; + +import android.content.ContentResolver; +import android.database.Cursor; +import android.net.Uri; +import android.provider.OpenableColumns; + +public abstract class ContentUtils { + public static String getFileName(ContentResolver contentResolver, Uri uri) { + String result = null; + if ("content".equalsIgnoreCase(uri.getScheme())) { + try (Cursor cursor = contentResolver.query(uri, null, null, null, null)) { + if (cursor != null && cursor.moveToFirst()) { + int colIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); + if (colIndex >= 0) { + result = cursor.getString(colIndex); + } + } + } + } + if (result == null) { + result = uri.getPath(); + int cut = result.lastIndexOf('/'); + if (cut != -1) { + result = result.substring(cut + 1); + } + } + return result; + } +} diff --git a/src/main/java/menion/android/whereyougo/utils/NotificationService.java b/src/main/java/menion/android/whereyougo/utils/NotificationService.java index 41994c1d..e1bb4747 100644 --- a/src/main/java/menion/android/whereyougo/utils/NotificationService.java +++ b/src/main/java/menion/android/whereyougo/utils/NotificationService.java @@ -1,5 +1,6 @@ package menion.android.whereyougo.utils; +import menion.android.whereyougo.MainApplication; import menion.android.whereyougo.R; import android.app.Notification; @@ -73,7 +74,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { private void startNotificationService(boolean background) { Logger.v(TAG, "Start notification service."); - Context context = A.getMain().getApplicationContext(); + Context context = MainApplication.getContext(); Intent intent = new Intent(context, menion.android.whereyougo.gui.activity.MainActivity.class); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setAction(Intent.ACTION_MAIN); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a1649212..6c19aaf6 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -33,6 +33,7 @@ Failed Feet Cannot create Root directory, SDCard probably missing.\n\nInsert it into device and run again! + Starting previously imported cartridge Finished Default Select… @@ -46,6 +47,8 @@ Location on Information Input + Select file + Please select a gwc file Invalid cartridge\n\n %s Invalid URL Invalid value @@ -66,7 +69,7 @@ No Location providers available! No satellites No target! - No Wherigo cartridge (*.gwc) is available.\nDownload or copy them into directory \"%1$s\". You can also set a path to custom directory in \"Settings - Main - Wherigo folder\". Make sure you granted the application permission to write to external storage and you have write permission in selected directory. Some newer devices don\'t allow writing to SD card.If you\'re not sure, set \"Wherigo folder\" automatically. + No Wherigo cartridge (*.gwc) is available.\nClick the select file button to import a cartridge.\nYou can also download a cartridge directly by navigating to the download page on the WhereIGo website and choosing to open it in this app. OK Pending Pitch