From a1571f61f5a63f174a4aec7d93b25e0f0842fa7d Mon Sep 17 00:00:00 2001 From: 8192Bit <2861035582@qq.com> Date: Fri, 9 Aug 2024 13:54:58 +0800 Subject: [PATCH] completely changed the package name --- app/build.gradle | 2 +- app/src/main/cpp/midi-interface.cpp | 8 ++++---- .../com/x8192bit/diyeditmobile/AboutActivity.java | 2 +- .../x8192bit/diyeditmobile/FileSelectActivity.java | 2 +- .../com/x8192bit/diyeditmobile/MainActivity.java | 13 ++++++++++--- .../x8192bit/diyeditmobile/SaveEditActivity.java | 2 +- .../x8192bit/diyeditmobile/SettingsActivity.java | 7 +++---- .../diyeditmobile/fragments/BGViewFragment.java | 4 ++-- .../diyeditmobile/fragments/FileSelectFragment.java | 2 +- .../diyeditmobile/fragments/MIDIFragment.java | 2 +- .../diyeditmobile/fragments/MetadataFragment.java | 2 +- .../diyeditmobile/fragments/SaveEditFragment.java | 8 ++++---- .../diyeditmobile/fragments/UnlockFragment.java | 2 +- .../x8192bit/diyeditmobile/utils/GraphicsUtils.java | 2 +- .../com/x8192bit/diyeditmobile/utils/SPUtils.java | 5 +++++ 15 files changed, 37 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2a0c952..d2c9e09 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,7 +49,7 @@ android { viewBinding true buildConfig true } - namespace 'x8192Bit.DIYEdit_Mobile' + namespace 'x8192bit.diyeditmobile' lint { abortOnError false } diff --git a/app/src/main/cpp/midi-interface.cpp b/app/src/main/cpp/midi-interface.cpp index 968ef9c..c44b5f3 100644 --- a/app/src/main/cpp/midi-interface.cpp +++ b/app/src/main/cpp/midi-interface.cpp @@ -8,10 +8,10 @@ extern "C" { -JNIEXPORT void JNICALL -Java_com_x8192Bit_DIYEdit_1Mobile_fragments_PlayThread_PlayMIDIFile(JNIEnv *env, jobject, - jstring MIDIFilePath, - jstring SoundFontFilePath) { +JNIEXPORT jstring JNICALL +Java_com_x8192bit_diyeditmobile_fragments_PlayThread_PlayMIDIFile(JNIEnv *env, jobject, + jstring MIDIFilePath, + jstring SoundFontFilePath) { fluid_settings_t *settings; fluid_synth_t *synth; fluid_player_t *player; diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/AboutActivity.java b/app/src/main/java/com/x8192bit/diyeditmobile/AboutActivity.java index dfe43fa..648ef1d 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/AboutActivity.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/AboutActivity.java @@ -7,7 +7,7 @@ import androidx.appcompat.app.ActionBar; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class AboutActivity extends BaseActivity { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/FileSelectActivity.java b/app/src/main/java/com/x8192bit/diyeditmobile/FileSelectActivity.java index ef48372..9254781 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/FileSelectActivity.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/FileSelectActivity.java @@ -34,7 +34,7 @@ import java.util.Map; import java.util.Objects; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class FileSelectActivity extends BaseActivity { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/MainActivity.java b/app/src/main/java/com/x8192bit/diyeditmobile/MainActivity.java index 8d3278f..3a3c503 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/MainActivity.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/MainActivity.java @@ -24,8 +24,8 @@ import com.x8192bit.diyeditmobile.utils.FileUtils; import com.x8192bit.diyeditmobile.utils.SPUtils; -import x8192Bit.DIYEdit_Mobile.BuildConfig; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.BuildConfig; +import x8192bit.diyeditmobile.R; public class MainActivity extends BaseActivity { @@ -213,7 +213,14 @@ public void exit(View view) { private void openFile(String realPath) { Intent intent = new Intent(this, SaveEditActivity.class); intent.putExtra(REAL_PATH, realPath); - startActivity(intent); + try { + startActivity(intent); + } catch (Exception e) { + new AlertDialog.Builder(getApplicationContext()) + .setTitle(e.getClass().getName()) + .setMessage(e.getMessage()) + .show(); + } } } \ No newline at end of file diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/SaveEditActivity.java b/app/src/main/java/com/x8192bit/diyeditmobile/SaveEditActivity.java index 6bae86a..e38bf0e 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/SaveEditActivity.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/SaveEditActivity.java @@ -42,7 +42,7 @@ import java.util.ArrayList; import java.util.Objects; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class SaveEditActivity extends BaseActivity { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/SettingsActivity.java b/app/src/main/java/com/x8192bit/diyeditmobile/SettingsActivity.java index 33dc304..aa31d2c 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/SettingsActivity.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/SettingsActivity.java @@ -1,7 +1,6 @@ package com.x8192bit.diyeditmobile; import android.content.Intent; -import android.content.SharedPreferences; import android.os.Bundle; import android.view.MenuItem; import android.widget.Toast; @@ -12,6 +11,7 @@ import com.x8192bit.diyeditmobile.utils.CharUtils; import com.x8192bit.diyeditmobile.utils.LocaleUtils; +import com.x8192bit.diyeditmobile.utils.SPUtils; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -19,7 +19,7 @@ import java.util.List; import java.util.Map; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class SettingsActivity extends BaseActivity { @@ -99,8 +99,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public boolean onPreferenceClick(Preference preference) { String key = preference.getKey(); if (key.equals("cleanAllHistory")) { - SharedPreferences sp = this.requireContext().getSharedPreferences("com.x8192Bit.DIYEdit_Mobile_preferences", MODE_PRIVATE); - sp.edit().putString("history", null).apply(); + SPUtils.cleanHistory(getContext()); Toast.makeText(requireContext(), R.string.cleanedKey, Toast.LENGTH_SHORT).show(); } if (key.equals("openAboutDialog")) { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/BGViewFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/BGViewFragment.java index 7e66a81..3afc88f 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/BGViewFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/BGViewFragment.java @@ -39,11 +39,11 @@ import java.util.Locale; import java.util.Objects; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class BGViewFragment extends Fragment { - public static final String IS_SAVE_EDIT = "com.x8192Bit.DIYEdit_Mobile.IS_SAVE_EDIT"; + public static final String IS_SAVE_EDIT = "com.x8192bit.diyeditmobile.IS_SAVE_EDIT"; private static final String ARG_NAME = "name"; private static final String ARG_IS_GAME = "is_game"; SwitchMaterial bp = null; diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/FileSelectFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/FileSelectFragment.java index c666ad1..d95e2f2 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/FileSelectFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/FileSelectFragment.java @@ -36,7 +36,7 @@ import java.util.Map; import java.util.Objects; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; /** * A simple {@link Fragment} subclass. diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MIDIFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MIDIFragment.java index ed5cf0d..913083f 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MIDIFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MIDIFragment.java @@ -27,7 +27,7 @@ import java.io.IOException; import java.io.InputStream; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class MIDIFragment extends Fragment { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MetadataFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MetadataFragment.java index fd38b46..659026d 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MetadataFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/MetadataFragment.java @@ -34,7 +34,7 @@ import java.util.Locale; import java.util.Objects; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class MetadataFragment extends Fragment { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/SaveEditFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/SaveEditFragment.java index 14275da..1b24543 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/SaveEditFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/SaveEditFragment.java @@ -44,13 +44,13 @@ import java.util.ArrayList; import java.util.Locale; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class SaveEditFragment extends Fragment { - public static final String IS_IMPORT_MIO = "com.x8192Bit.DIYEdit_Mobile.IS_IMPORT_MIO"; - public static final String IS_SAVE_EDIT = "com.x8192Bit.DIYEdit_Mobile.IS_SAVE_EDIT"; - public static final String SAVE_EDIT_COUNT = "com.x8192Bit.DIYEdit_Mobile.SAVE_EDIT_COUNT"; + public static final String IS_IMPORT_MIO = "com.x8192bit.diyeditmobile.IS_IMPORT_MIO"; + public static final String IS_SAVE_EDIT = "com.x8192bit.diyeditmobile.IS_SAVE_EDIT"; + public static final String SAVE_EDIT_COUNT = "com.x8192bit.diyeditmobile.SAVE_EDIT_COUNT"; private static final String ARG_NAME = "name"; private static final String ARG_MIO_TYPE = "mio_type"; private String name; diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/UnlockFragment.java b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/UnlockFragment.java index 1481a03..fcf2098 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/fragments/UnlockFragment.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/fragments/UnlockFragment.java @@ -13,7 +13,7 @@ import com.xperia64.diyedit.FileByteOperations; import com.xperia64.diyedit.saveutils.SaveHandler; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; /** * A simple {@link Fragment} subclass. diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/utils/GraphicsUtils.java b/app/src/main/java/com/x8192bit/diyeditmobile/utils/GraphicsUtils.java index 731c319..bd0b297 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/utils/GraphicsUtils.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/utils/GraphicsUtils.java @@ -11,7 +11,7 @@ import java.io.InputStream; -import x8192Bit.DIYEdit_Mobile.R; +import x8192bit.diyeditmobile.R; public class GraphicsUtils { diff --git a/app/src/main/java/com/x8192bit/diyeditmobile/utils/SPUtils.java b/app/src/main/java/com/x8192bit/diyeditmobile/utils/SPUtils.java index ab740e6..677e6b8 100644 --- a/app/src/main/java/com/x8192bit/diyeditmobile/utils/SPUtils.java +++ b/app/src/main/java/com/x8192bit/diyeditmobile/utils/SPUtils.java @@ -124,4 +124,9 @@ public static void appendHistory(Context context, String realPath) throws Number throw e; } } + + public static void cleanHistory(Context context) { + SharedPreferences sp = context.getSharedPreferences(sharedPreferencesName, MODE_PRIVATE); + sp.edit().putString("history", null).apply(); + } }