Upgraded dependencies; started work on entry import & export via JSON

This commit is contained in:
denizk0461
2023-11-01 10:24:00 +01:00
parent cd075e9560
commit 62bbba447f
8 changed files with 31 additions and 17 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
<option name="testRunner" value="GRADLE" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Embedded JDK" /> <option name="gradleJvm" value="jbr-17" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
+1 -1
View File
@@ -21,7 +21,7 @@
</map> </map>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
Generated
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
</project> </project>
+12 -11
View File
@@ -5,7 +5,7 @@ plugins {
} }
android { android {
compileSdk 33 compileSdk 34
defaultConfig { defaultConfig {
@@ -33,11 +33,11 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_17
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = '17'
} }
viewBinding.enabled = true viewBinding.enabled = true
namespace 'com.denizd.textbasic' namespace 'com.denizd.textbasic'
@@ -45,19 +45,20 @@ android {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.10.1' implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0' implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference:1.2.0' implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3' implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
implementation 'com.google.code.gson:gson:2.10.1'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation "com.github.skydoves:colorpickerview:2.2.4" implementation "com.github.skydoves:colorpickerview:2.2.4"
implementation "androidx.room:room-runtime:2.5.1" implementation "androidx.room:room-runtime:2.6.0"
kapt "androidx.room:room-compiler:2.5.1" kapt "androidx.room:room-compiler:2.6.0"
} }
@@ -12,6 +12,10 @@ interface EntryDao {
@Query("SELECT * FROM entries ORDER BY position") @Query("SELECT * FROM entries ORDER BY position")
fun getAllEntries(): LiveData<List<Entry>> fun getAllEntries(): LiveData<List<Entry>>
// Get entries synchronously (no LiveData)
@Query("SELECT * FROM entries ORDER BY position")
fun getAllEntriesSync(): List<Entry>
@Insert @Insert
fun insertEntries(newEntries: List<Entry>) fun insertEntries(newEntries: List<Entry>)
@@ -3,6 +3,7 @@ package com.denizd.textbasic.db
import android.content.Context import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import com.denizd.textbasic.util.SettingsPreference import com.denizd.textbasic.util.SettingsPreference
import com.google.gson.Gson
class QuoteStorage private constructor(context: Context) { class QuoteStorage private constructor(context: Context) {
@@ -139,4 +140,10 @@ class QuoteStorage private constructor(context: Context) {
fun noMigrationNecessary() { fun noMigrationNecessary() {
prefs.edit().putBoolean(SettingsPreference.NEEDS_MIGRATION.key, false).apply() prefs.edit().putBoolean(SettingsPreference.NEEDS_MIGRATION.key, false).apply()
} }
fun exportEntriesAsJson(): String = Gson().toJson(dao.getAllEntriesSync().map { e -> e.text })
fun importEntriesFromJson(json: String) {
// TODO
}
} }
@@ -32,6 +32,8 @@ class QuoteFragment : BaseFragment(R.layout.fragment_quote), QuoteAdapter.OnDele
storage.migrateEntries() storage.migrateEntries()
} }
// Log.d("asdfasdf", storage.exportEntriesAsJson())
quoteAdapter = QuoteAdapter(storage.getAllQuotes(), this) quoteAdapter = QuoteAdapter(storage.getAllQuotes(), this)
binding.recyclerView.layoutManager = LinearLayoutManager(context) binding.recyclerView.layoutManager = LinearLayoutManager(context)
+3 -3
View File
@@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.0.1' apply false id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.0.1' apply false id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
} }
task clean(type: Delete) { tasks.register('clean', Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }