From 2f6f16696d4354ed173b29bac7864949c254f2ad Mon Sep 17 00:00:00 2001 From: Austin Hogan Date: Sun, 15 Sep 2019 14:16:35 -0400 Subject: [PATCH 1/2] Limit Database Overwrite & Optimize Imports Limit Database Overwrite & Optimize Imports --- app/build.gradle | 4 +-- app/src/main/assets/changelog.txt | 5 ++++ .../com/adam/aslfms/ChangeThemeActivity.java | 1 - .../com/adam/aslfms/MusicAppsActivity.java | 1 - .../java/com/adam/aslfms/OptionsActivity.java | 1 - .../com/adam/aslfms/SettingsActivity.java | 3 ++- .../com/adam/aslfms/UserCredActivity.java | 1 - .../adam/aslfms/UserCredsListActivity.java | 1 - .../aslfms/ViewCorrectionRuleEditDialog.java | 2 +- .../aslfms/ViewCorrectionRulesActivity.java | 2 +- .../aslfms/ViewScrobbleCacheActivity.java | 3 --- .../adam/aslfms/ViewScrobbleInfoDialog.java | 2 -- .../com/adam/aslfms/service/Scrobbler.java | 2 +- .../java/com/adam/aslfms/util/MyBase64.java | 2 +- .../adam/aslfms/util/ScrobblesDatabase.java | 26 ++++++++++++------- .../main/res/layout/activity_permissions.xml | 1 - 16 files changed, 30 insertions(+), 27 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f779313f..baac39ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.adam.aslfms" minSdkVersion 14 targetSdkVersion 26 - versionCode = 58 - versionName = "1.6.7" + versionCode = 59 + versionName = "1.6.8" testApplicationId "com.adam.aslfms.test" testInstrumentationRunner "android.test.InstrumentationTestRunner" diff --git a/app/src/main/assets/changelog.txt b/app/src/main/assets/changelog.txt index 91b5e327..c9f11337 100644 --- a/app/src/main/assets/changelog.txt +++ b/app/src/main/assets/changelog.txt @@ -1,6 +1,11 @@ Visit, https://github.com/simple-last-fm-scrobbler/sls For more details. +https://github.com/simple-last-fm-scrobbler/sls/wiki/Privacy-Concerns +For privacy concerns. + +- 1.6.8 (2019-9-15) codename: kingus + * Correction Rules database problem fixed - 1.6.7 (2019-9-15) codename: jingus * Fixed non-foreground service crash Bug diff --git a/app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java b/app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java index 2ea8fa9f..59f4b18b 100644 --- a/app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java +++ b/app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java @@ -25,7 +25,6 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; diff --git a/app/src/main/java/com/adam/aslfms/MusicAppsActivity.java b/app/src/main/java/com/adam/aslfms/MusicAppsActivity.java index fabdd53b..fb1de407 100644 --- a/app/src/main/java/com/adam/aslfms/MusicAppsActivity.java +++ b/app/src/main/java/com/adam/aslfms/MusicAppsActivity.java @@ -30,7 +30,6 @@ import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.support.v4.app.NavUtils; -import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; diff --git a/app/src/main/java/com/adam/aslfms/OptionsActivity.java b/app/src/main/java/com/adam/aslfms/OptionsActivity.java index 7a85059e..7a077a50 100644 --- a/app/src/main/java/com/adam/aslfms/OptionsActivity.java +++ b/app/src/main/java/com/adam/aslfms/OptionsActivity.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.net.sip.SipSession; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; diff --git a/app/src/main/java/com/adam/aslfms/SettingsActivity.java b/app/src/main/java/com/adam/aslfms/SettingsActivity.java index f894804a..2e930c10 100644 --- a/app/src/main/java/com/adam/aslfms/SettingsActivity.java +++ b/app/src/main/java/com/adam/aslfms/SettingsActivity.java @@ -121,7 +121,8 @@ protected void onCreate(Bundle savedInstanceState) { int v = Util.getAppVersionCode(this, getPackageName()); if (settings.getWhatsNewViewedVersion() < v){ settings.setKeyBypassNewPermissions(2); - mDb.rebuildDataBaseOnce(); // keep as not all users have the newest database. + mDb.rebuildScrobblesDatabaseOnce(); // keep as not all users have the newest database. + // TODO: verify only needed databases are destroyed } if (settings.getKeyBypassNewPermissions() == 2){ startActivity(new Intent(this, PermissionsActivity.class)); diff --git a/app/src/main/java/com/adam/aslfms/UserCredActivity.java b/app/src/main/java/com/adam/aslfms/UserCredActivity.java index d96dfc02..2c318004 100644 --- a/app/src/main/java/com/adam/aslfms/UserCredActivity.java +++ b/app/src/main/java/com/adam/aslfms/UserCredActivity.java @@ -36,7 +36,6 @@ import android.util.Log; import android.view.MenuItem; -import com.adam.aslfms.service.ControllerReceiverService; import com.adam.aslfms.service.NetApp; import com.adam.aslfms.service.ScrobblingService; import com.adam.aslfms.util.AppSettings; diff --git a/app/src/main/java/com/adam/aslfms/UserCredsListActivity.java b/app/src/main/java/com/adam/aslfms/UserCredsListActivity.java index 9aee27dc..dd87a44e 100644 --- a/app/src/main/java/com/adam/aslfms/UserCredsListActivity.java +++ b/app/src/main/java/com/adam/aslfms/UserCredsListActivity.java @@ -32,7 +32,6 @@ import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.support.v4.app.NavUtils; -import android.util.Log; import android.view.MenuItem; import com.adam.aslfms.service.NetApp; diff --git a/app/src/main/java/com/adam/aslfms/ViewCorrectionRuleEditDialog.java b/app/src/main/java/com/adam/aslfms/ViewCorrectionRuleEditDialog.java index b136ea89..ab01329c 100644 --- a/app/src/main/java/com/adam/aslfms/ViewCorrectionRuleEditDialog.java +++ b/app/src/main/java/com/adam/aslfms/ViewCorrectionRuleEditDialog.java @@ -29,8 +29,8 @@ import android.view.View; import android.widget.TextView; -import com.adam.aslfms.util.ScrobblesDatabase; import com.adam.aslfms.util.CorrectionRule; +import com.adam.aslfms.util.ScrobblesDatabase; import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; diff --git a/app/src/main/java/com/adam/aslfms/ViewCorrectionRulesActivity.java b/app/src/main/java/com/adam/aslfms/ViewCorrectionRulesActivity.java index e55304cf..c631b624 100644 --- a/app/src/main/java/com/adam/aslfms/ViewCorrectionRulesActivity.java +++ b/app/src/main/java/com/adam/aslfms/ViewCorrectionRulesActivity.java @@ -41,9 +41,9 @@ import android.widget.TextView; import com.adam.aslfms.util.AppSettings; +import com.adam.aslfms.util.CorrectionRule; import com.adam.aslfms.util.MyContextWrapper; import com.adam.aslfms.util.ScrobblesDatabase; -import com.adam.aslfms.util.CorrectionRule; import com.adam.aslfms.util.Util; /** diff --git a/app/src/main/java/com/adam/aslfms/ViewScrobbleCacheActivity.java b/app/src/main/java/com/adam/aslfms/ViewScrobbleCacheActivity.java index 7cd3f5a3..65fbe5f0 100644 --- a/app/src/main/java/com/adam/aslfms/ViewScrobbleCacheActivity.java +++ b/app/src/main/java/com/adam/aslfms/ViewScrobbleCacheActivity.java @@ -24,8 +24,6 @@ import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; @@ -43,7 +41,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.CursorAdapter; import android.widget.ListView; diff --git a/app/src/main/java/com/adam/aslfms/ViewScrobbleInfoDialog.java b/app/src/main/java/com/adam/aslfms/ViewScrobbleInfoDialog.java index 7c16e9ac..9396cdf1 100644 --- a/app/src/main/java/com/adam/aslfms/ViewScrobbleInfoDialog.java +++ b/app/src/main/java/com/adam/aslfms/ViewScrobbleInfoDialog.java @@ -23,8 +23,6 @@ import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.database.Cursor; import android.os.Build; diff --git a/app/src/main/java/com/adam/aslfms/service/Scrobbler.java b/app/src/main/java/com/adam/aslfms/service/Scrobbler.java index c6a007cc..9e94b421 100644 --- a/app/src/main/java/com/adam/aslfms/service/Scrobbler.java +++ b/app/src/main/java/com/adam/aslfms/service/Scrobbler.java @@ -194,9 +194,9 @@ private void notifyAuthStatusUpdate(int st) { } /** - * @return a {@link ScrobbleResult} struct with some info * @throws BadSessionException * @throws TemporaryFailureException + * @throws AuthStatus.BadSessionException */ public void scrobbleCommit(HandshakeResult hInfo, Track[] tracks) throws BadSessionException, TemporaryFailureException, AuthStatus.ClientBannedException, AuthStatus.UnknownResponseException { diff --git a/app/src/main/java/com/adam/aslfms/util/MyBase64.java b/app/src/main/java/com/adam/aslfms/util/MyBase64.java index 0c939ce0..70b60a9c 100644 --- a/app/src/main/java/com/adam/aslfms/util/MyBase64.java +++ b/app/src/main/java/com/adam/aslfms/util/MyBase64.java @@ -62,7 +62,7 @@ public class MyBase64 { public static final int URL_SAFE = 8; /** - * Flag to pass to {@link Base64OutputStream} to indicate that it + * Flag to pass to {@link MyBase64} OutputStream to indicate that it * should not close the output stream it is wrapping when it * itself is closed. */ diff --git a/app/src/main/java/com/adam/aslfms/util/ScrobblesDatabase.java b/app/src/main/java/com/adam/aslfms/util/ScrobblesDatabase.java index e3689362..f9b6994c 100644 --- a/app/src/main/java/com/adam/aslfms/util/ScrobblesDatabase.java +++ b/app/src/main/java/com/adam/aslfms/util/ScrobblesDatabase.java @@ -504,21 +504,29 @@ public CorrectionRule fetchCorrectioneRule(int id) { return rule; } - public void rebuildDataBaseOnce() { - mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_SCROBBLES); + public void rebuildCoreNetappDatabaseOnce(){ + Log.d(TAG, "dropping sql corenetapp "); mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_CORRNETAPP); - // TODO add migration of old rules if/when necessary + Log.d(TAG, "create sql corrnetapp: " + DATABASE_CREATE_CORRNETAPP); + mDb.execSQL(DATABASE_CREATE_CORRNETAPP); + } + + public void rebuildCorrectionsDatabaseOnce(){ + Log.d(TAG, "dropping sql corrections "); mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_CORRECTION_RULES); mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_RULE_CHANGES); mDb.execSQL("DROP TRIGGER IF EXISTS " + TRIGGER_NAME_CHECK_CORRECTION_RULES); - Log.d(TAG, "create sql scrobbles: " + DATABASE_CREATE_SCROBBLES); - Log.d(TAG, "create sql corrnetapp: " + DATABASE_CREATE_CORRNETAPP); - - mDb.execSQL(DATABASE_CREATE_SCROBBLES); - mDb.execSQL(DATABASE_CREATE_CORRNETAPP); - // Tables and trigger for updating scrobbles based on rules. + Log.d(TAG, "create sql corrections: " + DATABASE_CREATE_CORRECTION_RULES); mDb.execSQL(DATABASE_CREATE_CORRECTION_RULES); mDb.execSQL(DATABASE_CREATE_RULE_CHANGES); mDb.execSQL(TRIGGGER_CREATE_CHECK_CORRECTION_RULES); } + + + public void rebuildScrobblesDatabaseOnce(){ + Log.d(TAG, "dropping sql scrobbles "); + mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_SCROBBLES); + Log.d(TAG, "create sql scrobbles: " + DATABASE_CREATE_SCROBBLES); + mDb.execSQL(DATABASE_CREATE_SCROBBLES); + } } diff --git a/app/src/main/res/layout/activity_permissions.xml b/app/src/main/res/layout/activity_permissions.xml index 0e718a4f..baa16782 100644 --- a/app/src/main/res/layout/activity_permissions.xml +++ b/app/src/main/res/layout/activity_permissions.xml @@ -1,6 +1,5 @@ Date: Sun, 15 Sep 2019 14:22:53 -0400 Subject: [PATCH 2/2] xml xml --- app/src/androidTest/res/layout/main.xml | 3 +-- app/src/main/res/layout/theme_options.xml | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/src/androidTest/res/layout/main.xml b/app/src/androidTest/res/layout/main.xml index 3a5f117d..33198632 100644 --- a/app/src/androidTest/res/layout/main.xml +++ b/app/src/androidTest/res/layout/main.xml @@ -2,8 +2,7 @@ + android:layout_height="fill_parent"> - - \ No newline at end of file