SharedPrefUtilsメソッド追加

This commit is contained in:
r-ca 2024-01-21 19:07:33 +09:00
parent af626f4dc0
commit ec7adbe331
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 14 additions and 0 deletions

View File

@ -26,4 +26,14 @@ public class SharedPrefUtilsImpl implements SharedPrefUtils{
// Editorの取得
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: 決め打ちやめる?
}
}

View File

@ -10,4 +10,8 @@ public interface SharedPrefUtils {
// TODO-rca: 名称をenumで管理する
SharedPreferences.Editor getEditor(String name);
SharedPreferences getSharedPreferences(String name);
SharedPreferences getSharedPreferences();
}