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,
int which )
{
boolean firstVersion =
Utils.onFirstVersion( m_activity );
FirstRunDialog.show( m_activity,
!firstVersion );
FirstRunDialog.show( m_activity );
}
} )
.setPositiveButton( R.string.button_ok, null )

View file

@ -36,8 +36,10 @@ import org.eehouse.android.xw4.loc.LocUtils;
*/
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
// launch the browser with an intent eventually.
final WebView view = new WebView( context );
@ -58,7 +60,7 @@ public class FirstRunDialog {
{
if ( !m_loaded ) {
m_loaded = true;
if ( isUpgrade ) {
if ( showSurvey ) {
view.loadUrl( "javascript:showSurvey();" );
}
}

View file

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

View file

@ -531,7 +531,7 @@ public class Utils {
s_isFirstBootEver = new Boolean( -1 == prevVersion );
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 ) {
SharedPreferences.Editor editor = prefs.edit();
if ( newVersion ) {