From ec7adbe33141577528f9960df26c483992fa515c Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 21 Jan 2024 19:07:33 +0900 Subject: [PATCH] =?UTF-8?q?SharedPrefUtils=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/utils/impl/SharedPrefUtilsImpl.java | 10 ++++++++++ .../nem/lacerta/utils/repository/SharedPrefUtils.java | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/utils/src/main/java/one/nem/lacerta/utils/impl/SharedPrefUtilsImpl.java b/utils/src/main/java/one/nem/lacerta/utils/impl/SharedPrefUtilsImpl.java index f976b46b..14f493a5 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/impl/SharedPrefUtilsImpl.java +++ b/utils/src/main/java/one/nem/lacerta/utils/impl/SharedPrefUtilsImpl.java @@ -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: 決め打ちやめる? + } } diff --git a/utils/src/main/java/one/nem/lacerta/utils/repository/SharedPrefUtils.java b/utils/src/main/java/one/nem/lacerta/utils/repository/SharedPrefUtils.java index 68d21ae7..0be1859b 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/repository/SharedPrefUtils.java +++ b/utils/src/main/java/one/nem/lacerta/utils/repository/SharedPrefUtils.java @@ -10,4 +10,8 @@ public interface SharedPrefUtils { // TODO-rca: 名称をenumで管理する? SharedPreferences.Editor getEditor(String name); + SharedPreferences getSharedPreferences(String name); + + SharedPreferences getSharedPreferences(); + }