From 62cb5618881a3b8890fdb1c3ba25e5b7d7843cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Thu, 29 Aug 2019 18:10:39 +0530 Subject: [PATCH] Implement sharing of logs using Hastebin --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 1 + .../java/emu/lightswitch/LogActivity.java | 52 +++++++++++++++++-- .../java/emu/lightswitch/MainActivity.java | 6 +-- app/src/main/res/drawable/ic_share.xml | 5 ++ app/src/main/res/menu/toolbar_log.xml | 5 ++ app/src/main/res/values/strings.xml | 2 + 7 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/drawable/ic_share.xml diff --git a/app/build.gradle b/app/build.gradle index 71800eaef..80d4e68fe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion "29.0.0" defaultConfig { applicationId "lightswitch.emu" - minSdkVersion 21 + minSdkVersion 24 targetSdkVersion 29 versionCode 1 versionName "1.0" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 284ef0fb4..89284e49d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ + parent, View view, int position, long id) { if (adapter.getItemViewType(position) == ContentType.Item) { - String path = ((GameItem) parent.getItemAtPosition(position)).getPath(); - notifyUser(getString(R.string.launching) + " " + path); - loadFile(path, getApplicationInfo().dataDir + "/shared_prefs/" + getApplicationInfo().packageName + "_preferences.xml", getApplicationInfo().dataDir + "/log.bin"); + GameItem item = ((GameItem) parent.getItemAtPosition(position)); + notifyUser(getString(R.string.launching) + " " + item.getTitle()); + loadFile(item.getPath(), getApplicationInfo().dataDir + "/shared_prefs/" + getApplicationInfo().packageName + "_preferences.xml", getApplicationInfo().dataDir + "/lightswitch.log"); } } }); diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml new file mode 100644 index 000000000..978c77d37 --- /dev/null +++ b/app/src/main/res/drawable/ic_share.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/menu/toolbar_log.xml b/app/src/main/res/menu/toolbar_log.xml index 399f2edc7..f91a90c57 100644 --- a/app/src/main/res/menu/toolbar_log.xml +++ b/app/src/main/res/menu/toolbar_log.xml @@ -7,6 +7,11 @@ android:title="@string/search" app:showAsAction="ifRoom|withText" app:actionViewClass="androidx.appcompat.widget.SearchView"/> + Language Clear + Share The log file was not found An I/O error has occurred + An error has occurred while sharing The logs have been cleared