Impl実装

This commit is contained in:
ろむねこ 2023-12-14 10:18:24 +09:00
parent 922168c86b
commit 960f159a31
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -1,17 +1,29 @@
package one.nem.lacerta.utils.impl; package one.nem.lacerta.utils.impl;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import dagger.hilt.android.qualifiers.ApplicationContext;
import one.nem.lacerta.utils.repository.SharedPrefUtils; import one.nem.lacerta.utils.repository.SharedPrefUtils;
public class SharedPrefUtilsImpl implements SharedPrefUtils{ public class SharedPrefUtilsImpl implements SharedPrefUtils{
private final Context applicationContext;
public SharedPrefUtilsImpl(@ApplicationContext Context applicationContext) {
this.applicationContext = applicationContext;
}
@Override @Override
public SharedPreferences.Editor getEditor() { public SharedPreferences.Editor getEditor() {
return null; // Editorの取得
return applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE).edit(); // TODO-rca: 決め打ちやめる?
} }
@Override @Override
public SharedPreferences.Editor getEditor(String name) { public SharedPreferences.Editor getEditor(String name) {
return null; // Editorの取得
return applicationContext.getSharedPreferences(name, Context.MODE_PRIVATE).edit();
} }
} }