-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c550746
commit f24e9b2
Showing
7 changed files
with
166 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
/* | ||
* Copyright (c) 2022 Prateek Singh <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation; either version 3 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ichi2.anki | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import com.google.gson.Gson | ||
import com.ichi2.anki.services.DeckMetaDataService | ||
import com.ichi2.anki.worker.DeckMetaDataWorker | ||
import timber.log.Timber | ||
|
||
class DeckMetaDataPreference(context: Context) { | ||
|
@@ -21,22 +37,22 @@ class DeckMetaDataPreference(context: Context) { | |
return sharedPreferences.getString(key, default)!! | ||
} | ||
|
||
fun setMetaData(key: String, value: DeckMetaDataService.Meta) { | ||
fun setMetaData(key: String, value: DeckMetaDataWorker.Meta) { | ||
val json: String = Gson().toJson(value) | ||
sharedPreferences.edit() | ||
.putString(key, json) | ||
.apply() | ||
Timber.tag("META").e(json) | ||
} | ||
|
||
fun getMetaData(key: String): DeckMetaDataService.Meta? { | ||
fun getMetaData(key: String): DeckMetaDataWorker.Meta? { | ||
val jsonData = sharedPreferences | ||
.getString(key, null) | ||
|
||
return if (jsonData == null) { | ||
null | ||
} else { | ||
Gson().fromJson(jsonData, DeckMetaDataService.Meta::class.java) | ||
Gson().fromJson(jsonData, DeckMetaDataWorker.Meta::class.java) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 0 additions & 135 deletions
135
AnkiDroid/src/main/java/com/ichi2/anki/services/DeckMetaDataService.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.