mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
reread preferences in case of an upgrade. Fixes bug where default
port was 0 because the new key, meant to change the value, was not being initialized. It's a hack to use a side-effect to determine whether this is an upgrade, but since I'm already calculating it didn't see any point to doing it again.
This commit is contained in:
parent
1e5a856287
commit
8bf8383d60
2 changed files with 7 additions and 6 deletions
|
@ -39,7 +39,7 @@ public class FirstRunDialog {
|
|||
private static final String HIDDEN_PREFS = "xwprefs_hidden";
|
||||
private static final String SHOWN_VERSION_KEY = "SHOWN_VERSION_KEY";
|
||||
|
||||
static void show( Context context, boolean skipCheck )
|
||||
static boolean show( Context context, boolean skipCheck )
|
||||
{
|
||||
int thisVersion = 0;
|
||||
int shownVersion = 0;
|
||||
|
@ -61,7 +61,8 @@ public class FirstRunDialog {
|
|||
shownVersion = prefs.getInt( SHOWN_VERSION_KEY, 0 );
|
||||
}
|
||||
|
||||
if ( skipCheck || shownVersion < thisVersion ) {
|
||||
boolean isUpgrade = shownVersion < thisVersion;
|
||||
if ( skipCheck || isUpgrade ) {
|
||||
showDialog( context );
|
||||
|
||||
if ( !skipCheck ) {
|
||||
|
@ -70,6 +71,7 @@ public class FirstRunDialog {
|
|||
editor.commit();
|
||||
}
|
||||
}
|
||||
return isUpgrade;
|
||||
}
|
||||
|
||||
private static void showDialog( Context context )
|
||||
|
|
|
@ -64,10 +64,11 @@ public class GamesList extends XWListActivity
|
|||
|
||||
m_handler = new Handler();
|
||||
|
||||
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, false );
|
||||
|
||||
setContentView(R.layout.game_list);
|
||||
|
||||
boolean isUpgrade = FirstRunDialog.show( this, false );
|
||||
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, isUpgrade );
|
||||
|
||||
// setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
|
||||
|
||||
registerForContextMenu( getListView() );
|
||||
|
@ -94,8 +95,6 @@ public class GamesList extends XWListActivity
|
|||
m_adapter = new GameListAdapter( this );
|
||||
setListAdapter( m_adapter );
|
||||
|
||||
FirstRunDialog.show( this, false );
|
||||
|
||||
RelayReceiver.RestartTimer( this );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue