From a27e8c4c04f45c3a9f44b3434d5260aa1d5d9f98 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 1 May 2018 07:00:14 -0700 Subject: [PATCH] move static method into enum --- .../main/java/org/eehouse/android/xw4/DictUtils.java | 12 +++++++++++- .../java/org/eehouse/android/xw4/DictsDelegate.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java index f75732054..3596e311a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java @@ -60,7 +60,17 @@ public class DictUtils { } // keep in sync with loc_names string-array - public enum DictLoc { UNKNOWN, BUILT_IN, INTERNAL, EXTERNAL, DOWNLOAD }; + public enum DictLoc { + UNKNOWN, + BUILT_IN, + INTERNAL, + EXTERNAL, + DOWNLOAD; + public boolean needsStoragePermission() + { + return this == DOWNLOAD; + } + }; public static final String INVITED = "invited"; private static DictAndLoc[] s_dictListCache = null; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java index 7bf5ae7b1..19ede5444 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java @@ -662,7 +662,7 @@ public class DictsDelegate extends ListDelegateBase private void moveDicts( String[] selNames, DictLoc toLoc ) { - if ( DictUtils.needsStoragePermission( toLoc ) ) { + if ( toLoc.needsStoragePermission() ) { tryGetPerms( Perm.STORAGE, R.string.move_dict_rationale, Action.MOVE_CONFIRMED, selNames, toLoc ); } else {