summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/Dashboard.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/bitmaskclient/Dashboard.java')
-rw-r--r--src/se/leap/bitmaskclient/Dashboard.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java
index 7b47c667..0e6cb657 100644
--- a/src/se/leap/bitmaskclient/Dashboard.java
+++ b/src/se/leap/bitmaskclient/Dashboard.java
@@ -31,9 +31,11 @@ import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.ProgressDialog;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
@@ -66,6 +68,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
private ProgressDialog mProgressDialog;
private ProgressBar mProgressBar;
+ private ProviderAPIBroadcastReceiver_Update providerAPI_broadcast_receiver_update;
private static Context app;
private static SharedPreferences preferences;
private static Provider provider;
@@ -85,6 +88,11 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
PRNGFixes.apply();
mProgressBar = (ProgressBar) findViewById(R.id.progressbar_dashboard);
+ providerAPI_broadcast_receiver_update = new ProviderAPIBroadcastReceiver_Update();
+ IntentFilter update_intent_filter = new IntentFilter(ProviderAPI.UPDATE_ACTION);
+ update_intent_filter.addCategory(Intent.CATEGORY_DEFAULT);
+ registerReceiver(providerAPI_broadcast_receiver_update, update_intent_filter);
+
ConfigHelper.setSharedPreferences(getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE));
preferences = ConfigHelper.shared_preferences;
@@ -94,6 +102,12 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
else
buildDashboard();
}
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(providerAPI_broadcast_receiver_update);
+ }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
@@ -375,5 +389,13 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
public static Context getAppContext() {
return app;
}
-
+
+ public class ProviderAPIBroadcastReceiver_Update extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ int update = intent.getIntExtra(ProviderAPI.UPDATE_DATA, 0);
+ mProgressBar.setProgress(update);
+ }
+ }
}