summaryrefslogtreecommitdiffstats
path: root/android/src
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-06 01:27:01 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-06 01:27:01 +0000
commit93640fc22847e70f0070061ed1effc5d063dd600 (patch)
tree7b2d6b56d058caef04f11b8ae9db6ba7ab233f07 /android/src
parentc31a2f3bbb5e30c49e39b6ebc71bafa77ff3f655 (diff)
downloadrockbox-93640fc22847e70f0070061ed1effc5d063dd600.tar.gz
rockbox-93640fc22847e70f0070061ed1effc5d063dd600.tar.bz2
rockbox-93640fc22847e70f0070061ed1effc5d063dd600.zip
Android: only display progress dialog when extraction happens
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28514 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src')
-rw-r--r--android/src/org/rockbox/RockboxActivity.java36
1 files changed, 19 insertions, 17 deletions
diff --git a/android/src/org/rockbox/RockboxActivity.java b/android/src/org/rockbox/RockboxActivity.java
index f5c658871f..b9a8c54204 100644
--- a/android/src/org/rockbox/RockboxActivity.java
+++ b/android/src/org/rockbox/RockboxActivity.java
@@ -37,7 +37,6 @@ import android.widget.Toast;
public class RockboxActivity extends Activity
{
- private ProgressDialog loadingdialog;
private RockboxService rbservice;
/** Called when the activity is first created. */
@@ -49,38 +48,41 @@ public class RockboxActivity extends Activity
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
- /* Do not try starting the service if it's already running */
- if (isRockboxRunning())
- return;
-
- /* prepare a please wait dialog in case we need
- * to wait for unzipping libmisc.so
- */
- loadingdialog = new ProgressDialog(this);
- loadingdialog.setMessage("Rockbox is loading. Please wait...");
- loadingdialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- loadingdialog.setIndeterminate(true);
- loadingdialog.setCancelable(false);
- loadingdialog.show();
-
Intent intent = new Intent(this, RockboxService.class);
intent.putExtra("callback", new ResultReceiver(new Handler(getMainLooper())) {
+ private ProgressDialog loadingdialog;
+
+ private void createProgressDialog()
+ {
+ loadingdialog = new ProgressDialog(RockboxActivity.this);
+ loadingdialog.setMessage("Rockbox is loading. Please wait...");
+ loadingdialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ loadingdialog.setIndeterminate(true);
+ loadingdialog.setCancelable(false);
+ loadingdialog.show();
+ }
+
@Override
protected void onReceiveResult(final int resultCode, final Bundle resultData)
{
switch (resultCode) {
case RockboxService.RESULT_LIB_LOADED:
rbservice = RockboxService.get_instance();
- loadingdialog.setIndeterminate(true);
+ if (loadingdialog != null)
+ loadingdialog.setIndeterminate(true);
break;
case RockboxService.RESULT_LIB_LOAD_PROGRESS:
+ if (loadingdialog == null)
+ createProgressDialog();
+
loadingdialog.setIndeterminate(false);
loadingdialog.setMax(resultData.getInt("max", 100));
loadingdialog.setProgress(resultData.getInt("value", 0));
break;
case RockboxService.RESULT_FB_INITIALIZED:
attachFramebuffer();
- loadingdialog.dismiss();
+ if (loadingdialog != null)
+ loadingdialog.dismiss();
break;
case RockboxService.RESULT_ERROR_OCCURED:
Toast.makeText(RockboxActivity.this, resultData.getString("error"), Toast.LENGTH_LONG);