[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] Use ProgressBar instead of off center ProgressDialog



commit f930ced0efd84e0ebb413aa254d4b2bfe9d731d8
Author: lexi <bird.s.lex@xxxxxxxxx>
Date:   Mon Feb 26 13:49:11 2018 -0500

    Use ProgressBar instead of off center ProgressDialog
---
 .../org/torproject/android/ui/AppManagerActivity.java    | 16 ++++++----------
 app/src/main/res/layout/layout_apps.xml                  |  7 +++++++
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
index c223d39c..6d29a85f 100644
--- a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
@@ -11,13 +11,11 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;
 
-import org.torproject.android.BuildConfig;
 import org.torproject.android.service.OrbotConstants;
 import org.torproject.android.R;
 import org.torproject.android.service.util.TorServiceUtils;
 import org.torproject.android.service.vpn.TorifiedApp;
 
-import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -40,12 +38,14 @@ import android.widget.CheckBox;
 import android.widget.GridView;
 import android.widget.ImageView;
 import android.widget.ListAdapter;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 
 public class AppManagerActivity extends AppCompatActivity implements OnClickListener, OrbotConstants {
 
     private GridView listApps;
     private ListAdapter adapterApps;
+    private ProgressBar progressBar;
     private final static String TAG = "Orbot";
     PackageManager pMgr = null;
 
@@ -57,7 +57,8 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
         this.setContentView(R.layout.layout_apps);
         setTitle(R.string.apps_mode);
         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+        listApps = findViewById(R.id.applistview);
+        progressBar = findViewById(R.id.progressBar);
     }
 
     /*
@@ -94,20 +95,15 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
     @Override
     protected void onResume() {
         super.onResume();
-        listApps = (GridView) findViewById(R.id.applistview);
         mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
         reloadApps();
     }
 
     private void reloadApps () {
-
         new AsyncTask<Void, Void, Void>() {
-            private ProgressDialog dialog;
-
             protected void onPreExecute() {
                 // Pre Code
-                dialog = new ProgressDialog(AppManagerActivity.this, android.support.v4.app.DialogFragment.STYLE_NO_TITLE);
-                dialog.show();
+                progressBar.setVisibility(View.VISIBLE);
             }
             protected Void doInBackground(Void... unused) {
                 loadApps(mPrefs);
@@ -115,7 +111,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
             }
             protected void onPostExecute(Void unused) {
                 listApps.setAdapter(adapterApps);
-                dialog.cancel();
+                progressBar.setVisibility(View.GONE);
             }
         }.execute();
 
diff --git a/app/src/main/res/layout/layout_apps.xml b/app/src/main/res/layout/layout_apps.xml
index b04887e1..e597163f 100644
--- a/app/src/main/res/layout/layout_apps.xml
+++ b/app/src/main/res/layout/layout_apps.xml
@@ -4,6 +4,13 @@
     android:layout_height="match_parent"
     android:duplicateParentState="true">
 
+    <ProgressBar
+        android:id="@+id/progressBar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:visibility="gone" />
+
     <GridView
         android:id="@+id/applistview"
         android:layout_width="match_parent"



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits