From 075b4884e9b7bec259eb3d03cd4de8c4ded14941 Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Tue, 22 Oct 2024 06:51:15 -0500 Subject: [PATCH 01/14] Enable linter warnings for old SDKs --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9a1b77e..38d5db1 100644 --- a/build.gradle +++ b/build.gradle @@ -43,8 +43,8 @@ android { lintOptions { disable 'IconDensities', 'ClickableViewAccessibility', 'AndroidGradlePluginVersion', - 'CustomViewStyleable', 'TypographyFractions', 'OldTargetApi', - 'NonConstantResourceId', 'ExpiredTargetSdkVersion', 'MissingInflatedId' + 'CustomViewStyleable', 'TypographyFractions', + 'NonConstantResourceId', 'MissingInflatedId' // abortOnError false } } From 5132679b7bce76070851237af2995705eb0d6cc6 Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Tue, 22 Oct 2024 06:55:52 -0500 Subject: [PATCH 02/14] Update gradle plugin --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 38d5db1..c2b9b24 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.5.1' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From ce50d7dfcee8cb56c2f4e6525036c164bf06cbd6 Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Tue, 22 Oct 2024 06:50:54 -0500 Subject: [PATCH 03/14] Update SDK to Android 15 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c2b9b24..4695daf 100644 --- a/build.gradle +++ b/build.gradle @@ -23,13 +23,13 @@ allprojects { apply plugin: 'com.android.application' android { - compileSdkVersion 28 + compileSdk 35 namespace "org.billthefarmer.tuner" defaultConfig { applicationId "org.billthefarmer.tuner" minSdkVersion 23 - targetSdkVersion 28 + targetSdkVersion 35 versionName "1.56" versionCode 156 From 3a88d2b67b1902e0115795460473df2239ca2983 Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Tue, 22 Oct 2024 06:56:48 -0500 Subject: [PATCH 04/14] Perform suggested gradle updates --- build.gradle | 9 +++------ gradle.properties | 3 +++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 4695daf..6b0c78e 100644 --- a/build.gradle +++ b/build.gradle @@ -40,11 +40,8 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - - lintOptions { - disable 'IconDensities', 'ClickableViewAccessibility', 'AndroidGradlePluginVersion', - 'CustomViewStyleable', 'TypographyFractions', - 'NonConstantResourceId', 'MissingInflatedId' - // abortOnError false + lint { + disable 'IconDensities', 'ClickableViewAccessibility', 'AndroidGradlePluginVersion', 'CustomViewStyleable', 'TypographyFractions', 'NonConstantResourceId', 'MissingInflatedId' } + } diff --git a/gradle.properties b/gradle.properties index f98a4cc..990a2bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,4 @@ +android.defaults.buildfeatures.buildconfig=true +android.nonFinalResIds=false +android.nonTransitiveRClass=false org.gradle.jvmargs=-Xmx1536M \ No newline at end of file From 78006cb5d22e8b8fc524a5ab77b41c2316ff07e6 Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Tue, 22 Oct 2024 07:20:17 -0500 Subject: [PATCH 05/14] Update version number --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 6b0c78e..b28bbe1 100644 --- a/build.gradle +++ b/build.gradle @@ -30,8 +30,8 @@ android { applicationId "org.billthefarmer.tuner" minSdkVersion 23 targetSdkVersion 35 - versionName "1.56" - versionCode 156 + versionName "1.57" + versionCode 157 buildConfigField "long", "BUILT", System.currentTimeMillis() + "L" } From f938495347cd44622551ea359755fa3d2377ac9a Mon Sep 17 00:00:00 2001 From: Robbie Nesmith Date: Sat, 26 Oct 2024 21:10:22 -0500 Subject: [PATCH 06/14] Add activity to edit custom temperaments --- src/main/AndroidManifest.xml | 3 + .../tuner/CustomTemperament.java | 74 +++++++++++++++++++ .../billthefarmer/tuner/SettingsFragment.java | 1 - src/main/res/layout/temperament_editor.xml | 26 +++++++ src/main/res/xml/preferences.xml | 8 ++ 5 files changed, 111 insertions(+), 1 deletion(-) create mode 100755 src/main/java/org/billthefarmer/tuner/CustomTemperament.java create mode 100755 src/main/res/layout/temperament_editor.xml diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 23d0456..599ffd9 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -27,6 +27,9 @@ + + + diff --git a/src/main/java/org/billthefarmer/tuner/CustomTemperament.java b/src/main/java/org/billthefarmer/tuner/CustomTemperament.java new file mode 100755 index 0000000..98fcd64 --- /dev/null +++ b/src/main/java/org/billthefarmer/tuner/CustomTemperament.java @@ -0,0 +1,74 @@ +package org.billthefarmer.tuner; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; + +public class CustomTemperament extends Activity { + + private static final String CUSTOM_FILE = "Custom.txt"; + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.temperament_editor); + + EditText customTemperamentsText = findViewById(R.id.customTemperamentText); + Button saveButton = findViewById(R.id.saveButton); + + // Check custom temperaments file + File custom = new File(getExternalFilesDir(null), + CUSTOM_FILE); + + if (custom.exists()) { + try + { + FileInputStream fis = new FileInputStream(custom); + InputStreamReader sr = new InputStreamReader(fis); + BufferedReader reader = new BufferedReader(sr); + + StringBuilder fileText = new StringBuilder(); + String line; + while((line = reader.readLine()) != null) { + fileText.append(line); + fileText.append("\n"); + } + customTemperamentsText.setText(fileText); + reader.close(); + } + + catch(Exception e) + { + Log.e("CustomTemperaments", "Error loading custom temperaments", e); + return; + } + } + + saveButton.setOnClickListener(view -> { + String textToSave = customTemperamentsText.getText().toString(); + + try { + if (!custom.exists()) { + custom.createNewFile(); + } + FileWriter fw = new FileWriter(custom); + + fw.write(textToSave); + fw.close(); + finish(); + } catch (IOException ioe) { + Log.e("CustomTemperaments", "Error saving custom temperaments", ioe); + } + }); + } +} diff --git a/src/main/java/org/billthefarmer/tuner/SettingsFragment.java b/src/main/java/org/billthefarmer/tuner/SettingsFragment.java index eeeefd2..dc5f7af 100644 --- a/src/main/java/org/billthefarmer/tuner/SettingsFragment.java +++ b/src/main/java/org/billthefarmer/tuner/SettingsFragment.java @@ -59,7 +59,6 @@ public class SettingsFragment extends android.preference.PreferenceFragment private static final String TAG = "Tuner"; private static final String CUSTOM_FILE = "Custom.txt"; - private static final String CUSTOM_PATH = "Tuner/Custom.txt"; private String summary; diff --git a/src/main/res/layout/temperament_editor.xml b/src/main/res/layout/temperament_editor.xml new file mode 100755 index 0000000..eb17d23 --- /dev/null +++ b/src/main/res/layout/temperament_editor.xml @@ -0,0 +1,26 @@ + + + + + +