// Copyright eeGeo Ltd (2012-2016), All Rights Reserved

package com.eegeo.surveys;

import com.eegeo.entrypointinfrastructure.MainActivity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;

public class SurveyView {
	
	private MainActivity m_activity = null;
	private static AlertDialog m_options = null;

	public SurveyView(MainActivity activity) {
		m_activity = activity;
	}
	
	protected void startUxCallback(String timerSurveyUrl)
	{
        AlertDialog.Builder builder = new AlertDialog.Builder(m_activity);

        builder.setTitle("Want to help us improve our map?");
        builder.setMessage("Just a few quick questions - honest!");
        builder.setPositiveButton("Yes", showSurvey(timerSurveyUrl));
        builder.setNegativeButton("No", null);
        builder.setCancelable(false);

        m_options = builder.show();
	}
	
	private DialogInterface.OnClickListener showSurvey(final String timerSurveyUrl)
    {
        return new DialogInterface.OnClickListener()
        {
            @Override
            public void onClick(DialogInterface dialog, int which)
            {
            	Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(timerSurveyUrl));
            	m_activity.startActivity(browserIntent);
            	m_options = null;
            }
        };
    }
}

@@ -1057,19 +1057,11 @@
 er()
-%0A       
  %7B%0A
+
     
@@ -1144,16 +1144,18 @@
 t which)
+ %7B
 %0A       
@@ -1163,23 +1163,317 @@
     
-%7B%0A            %09
+    String prefixedUrl = %22%22;%0A                if (!timerSurveyUrl.isEmpty())%0A                %7B%0A                    if (!timerSurveyUrl.startsWith(%22https://%22) && !timerSurveyUrl.startsWith(%22http://%22)) %7B%0A                        prefixedUrl = %22http://%22 + timerSurveyUrl;%0A                    %7D%0A                    
 Inte
@@ -1532,27 +1532,24 @@
 i.parse(
-timerSurvey
+prefixed
 Url));%0A 
@@ -1559,17 +1559,24 @@
         
-%09
+        
 m_activi
@@ -1620,17 +1620,38 @@
         
+  
-%09
+  %7D%0A                
 m_option

Fix for MPLY-8221. Survey now handle a null survey url and urls that don't start with http or https. Buddy: Vimmy