SharedPrefUtilsメソッド追加

This commit is contained in:
r-ca committed 2024-01-21 19:07:33 +09:00
1 parent af626f4dc0
commit ec7adbe331
2 files changed
+14

No files matched your search

@@ -26,4 +26,14 @@ public class SharedPrefUtilsImpl implements SharedPrefUtils{
// Editorの取得 // Editorの取得
return applicationContext.getSharedPreferences(name, Context.MODE_PRIVATE).edit(); return applicationContext.getSharedPreferences(name, Context.MODE_PRIVATE).edit();
} }
@Override
public SharedPreferences getSharedPreferences(String name) {
return applicationContext.getSharedPreferences(name, Context.MODE_PRIVATE);
}
@Override
public SharedPreferences getSharedPreferences() {
return applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE); // TODO-rca: 決め打ちやめる?
}
} }
@@ -10,4 +10,8 @@ public interface SharedPrefUtils {
// TODO-rca: 名称をenumで管理する? // TODO-rca: 名称をenumで管理する?
SharedPreferences.Editor getEditor(String name); SharedPreferences.Editor getEditor(String name);
SharedPreferences getSharedPreferences(String name);
SharedPreferences getSharedPreferences();
} }