move survey-display logic into one place so it's always right

This commit is contained in:
Eric House 2014-08-18 07:53:23 -07:00
parent 432badf889
commit 38b9420fa0
4 changed files with 7 additions and 8 deletions

View file

@ -458,10 +458,7 @@ public class DlgDelegate {
public void onClick( DialogInterface dlg, public void onClick( DialogInterface dlg,
int which ) int which )
{ {
boolean firstVersion = FirstRunDialog.show( m_activity );
Utils.onFirstVersion( m_activity );
FirstRunDialog.show( m_activity,
!firstVersion );
} }
} ) } )
.setPositiveButton( R.string.button_ok, null ) .setPositiveButton( R.string.button_ok, null )

View file

@ -36,8 +36,10 @@ import org.eehouse.android.xw4.loc.LocUtils;
*/ */
public class FirstRunDialog { public class FirstRunDialog {
public static void show( final Context context, final boolean isUpgrade ) public static void show( final Context context )
{ {
final boolean showSurvey = !Utils.onFirstVersion( context );
// This won't support e.g mailto refs. Probably want to // This won't support e.g mailto refs. Probably want to
// launch the browser with an intent eventually. // launch the browser with an intent eventually.
final WebView view = new WebView( context ); final WebView view = new WebView( context );
@ -58,7 +60,7 @@ public class FirstRunDialog {
{ {
if ( !m_loaded ) { if ( !m_loaded ) {
m_loaded = true; m_loaded = true;
if ( isUpgrade ) { if ( showSurvey ) {
view.loadUrl( "javascript:showSurvey();" ); view.loadUrl( "javascript:showSurvey();" );
} }
} }

View file

@ -765,7 +765,7 @@ public class GamesListDelegate extends ListDelegateBase
boolean isUpgrade = Utils.firstBootThisVersion( m_activity ); boolean isUpgrade = Utils.firstBootThisVersion( m_activity );
if ( isUpgrade && !s_firstShown ) { if ( isUpgrade && !s_firstShown ) {
FirstRunDialog.show( m_activity, isUpgrade ); FirstRunDialog.show( m_activity );
s_firstShown = true; s_firstShown = true;
} }

View file

@ -531,7 +531,7 @@ public class Utils {
s_isFirstBootEver = new Boolean( -1 == prevVersion ); s_isFirstBootEver = new Boolean( -1 == prevVersion );
int firstVersion = prefs.getInt( FIRST_VERSION_KEY, Integer.MAX_VALUE ); int firstVersion = prefs.getInt( FIRST_VERSION_KEY, Integer.MAX_VALUE );
s_firstVersion = new Boolean( firstVersion < thisVersion ); s_firstVersion = new Boolean( firstVersion >= thisVersion );
if ( newVersion || Integer.MAX_VALUE == firstVersion ) { if ( newVersion || Integer.MAX_VALUE == firstVersion ) {
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
if ( newVersion ) { if ( newVersion ) {