project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/MainActivity.java
branchhedgeroid
changeset 5671 ba4c3a4c8b09
parent 5621 ea796c83ea47
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/MainActivity.java	Thu Sep 01 14:54:43 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/MainActivity.java	Thu Sep 01 14:55:31 2011 +0200
@@ -19,13 +19,16 @@
 package org.hedgewars.mobile;
 
 import org.hedgewars.mobile.Downloader.DownloadActivity;
+import org.hedgewars.mobile.Downloader.DownloadService;
 
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
+import android.widget.Toast;
 
 public class MainActivity extends Activity {
 
@@ -52,7 +55,12 @@
 
 	private OnClickListener startGameClicker = new OnClickListener(){
 		public void onClick(View v){
-			startActivity(new Intent(getApplicationContext(), StartGameActivity.class));
+			if(PreferenceManager.getDefaultSharedPreferences(MainActivity.this).getBoolean(DownloadService.PREF_DOWNLOADED, false))
+				startActivity(new Intent(getApplicationContext(), StartGameActivity.class));
+			else {
+				Toast.makeText(MainActivity.this, R.string.download_userexplain, Toast.LENGTH_LONG).show();
+				startActivityForResult(new Intent(getApplicationContext(), DownloadActivity.class), 0);
+			}
 		}
 	};