mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
On some devices a downloaded wordlist shows up twice, once in Internal
and again in Downloads. I assume that's because the two directories are the same, so fix by tracking directories that have been checked and not checking the same twice.
This commit is contained in:
parent
1614ebd551
commit
685971532a
1 changed files with 11 additions and 4 deletions
|
@ -128,10 +128,13 @@ public class DictUtils {
|
||||||
// changes?
|
// changes?
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void tryDir( Context context, File dir, boolean strict,
|
private static void tryDir( Context context, HashSet<File> seen,
|
||||||
|
File dir, boolean strict,
|
||||||
DictLoc loc, ArrayList<DictAndLoc> al )
|
DictLoc loc, ArrayList<DictAndLoc> al )
|
||||||
{
|
{
|
||||||
if ( null != dir ) {
|
if ( null != dir && !seen.contains( dir ) ) {
|
||||||
|
seen.add( dir );
|
||||||
|
|
||||||
String[] list = dir.list();
|
String[] list = dir.list();
|
||||||
if ( null != list ) {
|
if ( null != list ) {
|
||||||
for ( String file : list ) {
|
for ( String file : list ) {
|
||||||
|
@ -162,8 +165,12 @@ public class DictUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tryDir( context, getSDDir( context ), false, DictLoc.EXTERNAL, al );
|
HashSet<File> dirs = new HashSet<File>();
|
||||||
tryDir( context, getDownloadDir( context ), true,
|
dirs.add( context.getFilesDir() );
|
||||||
|
|
||||||
|
tryDir( context, dirs, getSDDir( context ), false,
|
||||||
|
DictLoc.EXTERNAL, al );
|
||||||
|
tryDir( context, dirs, getDownloadDir( context ), true,
|
||||||
DictLoc.DOWNLOAD, al );
|
DictLoc.DOWNLOAD, al );
|
||||||
|
|
||||||
s_dictListCache =
|
s_dictListCache =
|
||||||
|
|
Loading…
Add table
Reference in a new issue