mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
show an error Toast when db file export fails
Right now I seem to be writing it someplace I'm not supposed to
This commit is contained in:
parent
3dea7bd205
commit
58680980e2
3 changed files with 13 additions and 8 deletions
|
@ -1851,14 +1851,14 @@ public class DBUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void loadDB( Context context )
|
||||
public static boolean loadDB( Context context )
|
||||
{
|
||||
copyGameDB( context, false );
|
||||
return copyGameDB( context, false );
|
||||
}
|
||||
|
||||
public static void saveDB( Context context )
|
||||
public static boolean saveDB( Context context )
|
||||
{
|
||||
copyGameDB( context, true );
|
||||
return copyGameDB( context, true );
|
||||
}
|
||||
|
||||
public static boolean copyFileStream( FileOutputStream fos,
|
||||
|
@ -2443,8 +2443,9 @@ public class DBUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static void copyGameDB( Context context, boolean toSDCard )
|
||||
private static boolean copyGameDB( Context context, boolean toSDCard )
|
||||
{
|
||||
boolean success = false;
|
||||
String name = DBHelper.getDBName();
|
||||
File gamesDB = context.getDatabasePath( name );
|
||||
|
||||
|
@ -2465,10 +2466,12 @@ public class DBUtils {
|
|||
new FileOutputStream( toSDCard? sdcardDB : gamesDB );
|
||||
copyFileStream( dest, src );
|
||||
invalGroupsCache();
|
||||
success = true;
|
||||
}
|
||||
} catch( java.io.FileNotFoundException fnfe ) {
|
||||
Log.ex( TAG, fnfe );
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// Copy my .apk to the Downloads directory, from which a user could more
|
||||
|
|
|
@ -1529,8 +1529,9 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
storeGroupPositions( null );
|
||||
mkListAdapter();
|
||||
} else if ( R.id.games_menu_storedb == id ) {
|
||||
DBUtils.saveDB( m_activity );
|
||||
showToast( R.string.db_store_done );
|
||||
int msgID = DBUtils.saveDB( m_activity )
|
||||
? R.string.db_store_done : R.string.db_store_failed;
|
||||
showToast( msgID );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -2307,7 +2307,8 @@
|
|||
<string name="pref_item_update_summary">Get intermediate builds</string>
|
||||
<string name="checking_title">Checking</string>
|
||||
<string name="checking_for_fmt">Checking for wordlists in %1$s…</string>
|
||||
<string name="db_store_done">SD card write complete.</string>
|
||||
<string name="db_store_done">SD card write complete</string>
|
||||
<string name="db_store_failed">SD card write failed</string>
|
||||
<string name="confirm_drop_mqtt">Are you sure you want to drop this
|
||||
game’s ability to communicate via the internet?</string>
|
||||
<string name="confirm_drop_relay_bt">Bluetooth only works for nearby
|
||||
|
|
Loading…
Add table
Reference in a new issue