mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
if the download dir doesn't exist (and on my "Blaze 4G" the function
getDownloadCacheDirectory() returns a path that doesn't) then don't offer to move things there.
This commit is contained in:
parent
27935752a8
commit
4dd094b2b3
2 changed files with 27 additions and 10 deletions
|
@ -560,6 +560,11 @@ public class DictUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static boolean haveDownloadDir()
|
||||
{
|
||||
return null != getDownloadDir();
|
||||
}
|
||||
|
||||
private static File getDownloadDir()
|
||||
{
|
||||
File result = null;
|
||||
|
|
|
@ -263,15 +263,6 @@ public class DictsActivity extends ExpandableListActivity
|
|||
message = Utils.format( this, R.string.move_dictf,
|
||||
m_adapter.getSelChildView().getText() );
|
||||
|
||||
String[] items = new String[3];
|
||||
for ( int ii = 0; ii < 3; ++ii ) {
|
||||
DictLoc loc = itemToRealLoc(ii);
|
||||
if ( loc.equals( m_moveFromLoc ) ) {
|
||||
m_moveFromItem = ii;
|
||||
}
|
||||
items[ii] = m_locNames[loc.ordinal()];
|
||||
}
|
||||
|
||||
OnClickListener newSelLstnr =
|
||||
new OnClickListener() {
|
||||
public void onClick( DialogInterface dlgi, int item ) {
|
||||
|
@ -307,7 +298,8 @@ public class DictsActivity extends ExpandableListActivity
|
|||
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
.setTitle( message )
|
||||
.setSingleChoiceItems( items, m_moveFromItem, newSelLstnr )
|
||||
.setSingleChoiceItems( makeDictDirItems(), m_moveFromItem,
|
||||
newSelLstnr )
|
||||
.setPositiveButton( R.string.button_move, lstnr )
|
||||
.setNegativeButton( R.string.button_cancel, null )
|
||||
.create();
|
||||
|
@ -716,6 +708,26 @@ public class DictsActivity extends ExpandableListActivity
|
|||
XWPrefs.setClosedLangs( this, asArray );
|
||||
}
|
||||
|
||||
|
||||
private String[] makeDictDirItems()
|
||||
{
|
||||
boolean showDownload = DictUtils.haveDownloadDir();
|
||||
int nItems = showDownload ? 3 : 2;
|
||||
int nextI = 0;
|
||||
String[] items = new String[nItems];
|
||||
for ( int ii = 0; ii < 3; ++ii ) {
|
||||
DictLoc loc = itemToRealLoc(ii);
|
||||
if ( !showDownload && DictLoc.DOWNLOAD == loc ) {
|
||||
continue;
|
||||
}
|
||||
if ( loc.equals( m_moveFromLoc ) ) {
|
||||
m_moveFromItem = nextI;
|
||||
}
|
||||
items[nextI++] = m_locNames[loc.ordinal()];
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static Intent mkDownloadIntent( Context context, String dict_url )
|
||||
{
|
||||
Uri uri = Uri.parse( dict_url );
|
||||
|
|
Loading…
Add table
Reference in a new issue