diff --git a/README.md b/README.md index 041e232..7cb0fed 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ NPS Client app for android written in kotlin. ## Building -The application targets android 10 (API 29) with a minimum version of android 6 (API 23). +The application targets android 13 (API 33) with a minimum version of android 6 (API 23). 1. Create a `keystore` using android studio: `Build > Generate Signed Bundle / APK > Next > Create new` 2. Create a `keystore.properties` file in the root directory of the repo. diff --git a/app/build.gradle b/app/build.gradle index 281c610..dc3d3ac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,40 +1,41 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-parcelize' + id 'kotlin-kapt' +} -def keystorePropertiesFile = rootProject.file("keystore.properties") def keystoreProperties = new Properties() - -keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +def keystorePropertiesFile = rootProject.file('keystore.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} android { - compileSdkVersion 30 - buildToolsVersion "29.0.3" + namespace 'com.illusionware.npsbrowser' + compileSdkVersion 33 defaultConfig { applicationId "com.illusionware.npsbrowser" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 33 versionCode 1 versionName "0.1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - dataBinding { - enabled = true - } - - viewBinding { - enabled = true + buildFeatures { + dataBinding = true + viewBinding = true } signingConfigs { release { - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - keyAlias = keystoreProperties['keyAlias'] + keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] } } @@ -45,10 +46,12 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } + buildToolsVersion '33.0.1' } @@ -60,25 +63,25 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'androidx.core:core-ktx:1.6.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0" - implementation 'com.github.doyaaaaaken:kotlin-csv-jvm:0.11.1' + implementation 'androidx.appcompat:appcompat:1.6.0' + implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' + implementation 'com.github.doyaaaaaken:kotlin-csv-jvm:1.8.0' implementation 'com.github.wrdlbrnft:sorted-list-adapter:0.3.0.27' implementation "androidx.cardview:cardview:1.0.0" - implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' - implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' - implementation 'androidx.preference:preference-ktx:1.1.1' + implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' + implementation 'androidx.navigation:navigation-ui-ktx:2.5.3' + implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.2.1' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation 'com.google.android.material:material:1.4.0' - implementation 'com.github.bumptech.glide:glide:4.12.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation 'com.google.android.material:material:1.8.0' + implementation 'com.github.bumptech.glide:glide:4.14.2' + annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 550722f..f0b49aa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> @@ -15,7 +14,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/NPSTheme"> - + diff --git a/app/src/main/java/com/illusionware/npsbrowser/AppData.kt b/app/src/main/java/com/illusionware/npsbrowser/AppData.kt index c2070ba..a195d6f 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/AppData.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/AppData.kt @@ -41,17 +41,17 @@ data class AppData( return result } - override fun isSameModelAs(model: T): Boolean { + override fun isSameModelAs(model: T): Boolean { if (model is AppData) { - val other: AppData = model as AppData + val other: AppData = model return "${other.titleID} ${other.title}" == "$titleID $title" } return false } - override fun isContentTheSameAs(model: T): Boolean { + override fun isContentTheSameAs(model: T): Boolean { if (model is AppData) { - val other: AppData = model as AppData + val other: AppData = model return title?.equals(other.title) ?: (other.title == null) } return false diff --git a/app/src/main/java/com/illusionware/npsbrowser/ThemePreference.kt b/app/src/main/java/com/illusionware/npsbrowser/ThemePreference.kt index 288265f..883ed94 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/ThemePreference.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/ThemePreference.kt @@ -6,11 +6,11 @@ import androidx.appcompat.app.AppCompatDelegate import androidx.preference.ListPreference class ThemePreference : ListPreference { - constructor(context : Context?, attrs : AttributeSet?, defStyleAttr : Int) : super(context, attrs, defStyleAttr) + constructor(context : Context?, attrs : AttributeSet?, defStyleAttr : Int) : super(context!!, attrs, defStyleAttr) - constructor(context : Context?, attrs : AttributeSet?) : super(context, attrs) + constructor(context : Context?, attrs : AttributeSet?) : super(context!!, attrs) - constructor(context : Context?) : super(context) + constructor(context : Context?) : super(context!!) override fun callChangeListener(newValue : Any?) : Boolean { AppCompatDelegate.setDefaultNightMode(when ((newValue as String).toInt()) { diff --git a/app/src/main/java/com/illusionware/npsbrowser/fragments/SettingsFragment.kt b/app/src/main/java/com/illusionware/npsbrowser/fragments/SettingsFragment.kt index 8630afe..a47cf70 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/fragments/SettingsFragment.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/fragments/SettingsFragment.kt @@ -12,7 +12,7 @@ class SettingsFragment : Fragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - PreferenceManager.setDefaultValues(context, R.xml.root_preferences, false); + PreferenceManager.setDefaultValues(requireContext(), R.xml.root_preferences, false) activity?.supportFragmentManager ?.beginTransaction() ?.replace( @@ -35,7 +35,7 @@ class SettingsFragment : Fragment() { class PrefsFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.root_preferences, rootKey) - PreferenceManager.setDefaultValues(context, R.xml.root_preferences, false); + PreferenceManager.setDefaultValues(requireContext(), R.xml.root_preferences, false) } } diff --git a/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt b/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt index bd7e0f5..f439e4c 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt @@ -42,7 +42,7 @@ class SingleAppFragment : Fragment() { view?.findViewById(R.id.singleAppTitle)?.text = "[${app.titleID}] ${app.title}" if (app.fileSize != null) { - view?.findViewById(R.id.singleAppSize)?.text = prettifySize() + view?.findViewById(R.id.singleAppSize)?.text = prettifySize() } else { view?.findViewById(R.id.singleAppSizeTitle)?.visibility = View.INVISIBLE } @@ -53,43 +53,46 @@ class SingleAppFragment : Fragment() { view?.findViewById(R.id.singleAppFwVerTitle)?.visibility = View.INVISIBLE } if (app.license == "MISSING") { - view?.findViewById(R.id.singleAppError)?.text = "Warning: No license was provided for this app." + view?.findViewById(R.id.singleAppError)?.text = getString(R.string.no_license) + view?.findViewById