move static method into enum

This commit is contained in:
Eric House 2018-05-01 07:00:14 -07:00
parent 1e766ee52d
commit a27e8c4c04
2 changed files with 12 additions and 2 deletions

View file

@ -60,7 +60,17 @@ public class DictUtils {
} }
// keep in sync with loc_names string-array // 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"; public static final String INVITED = "invited";
private static DictAndLoc[] s_dictListCache = null; private static DictAndLoc[] s_dictListCache = null;

View file

@ -662,7 +662,7 @@ public class DictsDelegate extends ListDelegateBase
private void moveDicts( String[] selNames, DictLoc toLoc ) private void moveDicts( String[] selNames, DictLoc toLoc )
{ {
if ( DictUtils.needsStoragePermission( toLoc ) ) { if ( toLoc.needsStoragePermission() ) {
tryGetPerms( Perm.STORAGE, R.string.move_dict_rationale, tryGetPerms( Perm.STORAGE, R.string.move_dict_rationale,
Action.MOVE_CONFIRMED, selNames, toLoc ); Action.MOVE_CONFIRMED, selNames, toLoc );
} else { } else {