Archived
Upgraded dependencies; started work on entry import & export via JSON
This commit is contained in:
+12
-11
@@ -5,7 +5,7 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
|
||||
@@ -33,11 +33,11 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
jvmTarget = '17'
|
||||
}
|
||||
viewBinding.enabled = true
|
||||
namespace 'com.denizd.textbasic'
|
||||
@@ -45,19 +45,20 @@ android {
|
||||
|
||||
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 '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.preference:preference:1.2.0'
|
||||
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.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
implementation "com.github.skydoves:colorpickerview:2.2.4"
|
||||
|
||||
implementation "androidx.room:room-runtime:2.5.1"
|
||||
kapt "androidx.room:room-compiler:2.5.1"
|
||||
implementation "androidx.room:room-runtime:2.6.0"
|
||||
kapt "androidx.room:room-compiler:2.6.0"
|
||||
}
|
||||
@@ -12,6 +12,10 @@ interface EntryDao {
|
||||
@Query("SELECT * FROM entries ORDER BY position")
|
||||
fun getAllEntries(): LiveData<List<Entry>>
|
||||
|
||||
// Get entries synchronously (no LiveData)
|
||||
@Query("SELECT * FROM entries ORDER BY position")
|
||||
fun getAllEntriesSync(): List<Entry>
|
||||
|
||||
@Insert
|
||||
fun insertEntries(newEntries: List<Entry>)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.denizd.textbasic.db
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import com.denizd.textbasic.util.SettingsPreference
|
||||
import com.google.gson.Gson
|
||||
|
||||
class QuoteStorage private constructor(context: Context) {
|
||||
|
||||
@@ -139,4 +140,10 @@ class QuoteStorage private constructor(context: Context) {
|
||||
fun noMigrationNecessary() {
|
||||
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()
|
||||
}
|
||||
|
||||
// Log.d("asdfasdf", storage.exportEntriesAsJson())
|
||||
|
||||
quoteAdapter = QuoteAdapter(storage.getAllQuotes(), this)
|
||||
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(context)
|
||||
|
||||
Reference in New Issue
Block a user