OSDN Git Service

リファクタリング
[evermemo/source.git] / workspace / EverMemo / src / com / yuji / em / utility / PrefUtilImpl.java
index 5d18ea6..98b7d55 100644 (file)
@@ -6,6 +6,8 @@ import android.content.SharedPreferences.Editor;
 import android.content.pm.PackageManager.NameNotFoundException;\r
 \r
 public class PrefUtilImpl implements PrefUtil {\r
+       private static final String EVER_MEMO_ACTIVITY = "EverMemoActivity";\r
+       private static final String PACKAGE_COM_YUJI_EM = "com.yuji.em";\r
        private Context context;\r
 \r
        public PrefUtilImpl(Context context) {\r
@@ -16,9 +18,9 @@ public class PrefUtilImpl implements PrefUtil {
                synchronized (this) {\r
                        SharedPreferences pref = null;\r
                        try {\r
-                               Context ctxt = context.createPackageContext("com.yuji.em",\r
+                               Context ctxt = context.createPackageContext(PACKAGE_COM_YUJI_EM,\r
                                                Context.CONTEXT_RESTRICTED);\r
-                               pref = ctxt.getSharedPreferences("EverMemoActivity",\r
+                               pref = ctxt.getSharedPreferences(EVER_MEMO_ACTIVITY,\r
                                                Context.MODE_WORLD_READABLE\r
                                                                | Context.MODE_WORLD_WRITEABLE);\r
                        } catch (NameNotFoundException e) {\r
@@ -42,9 +44,9 @@ public class PrefUtilImpl implements PrefUtil {
                synchronized (this) {\r
                        SharedPreferences pref = null;\r
                        try {\r
-                               Context ctxt = context.createPackageContext("com.yuji.em",\r
+                               Context ctxt = context.createPackageContext(PACKAGE_COM_YUJI_EM,\r
                                                Context.CONTEXT_RESTRICTED);\r
-                               pref = ctxt.getSharedPreferences("EverMemoActivity",\r
+                               pref = ctxt.getSharedPreferences(EVER_MEMO_ACTIVITY,\r
                                                Context.MODE_WORLD_READABLE);\r
                        } catch (NameNotFoundException e) {\r
                                Debug.d(this, null, e);\r