diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/DialogHelper.java b/QKSMS/src/main/java/com/moez/QKSMS/common/DialogHelper.java index 836631e7..f55b2b5d 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/DialogHelper.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/DialogHelper.java @@ -63,12 +63,16 @@ public class DialogHelper { } public static void showChangelog(QKActivity context) { + context.showProgressDialog(); + String url = "https://qksms-changelog.firebaseio.com/changes.json"; StringRequest request = new StringRequest(url, response -> { Log.d(TAG, "onComplete: " + response); + context.hideProgressDialog(); }, error -> { Log.d(TAG, "onError: " + error.getMessage()); + context.hideProgressDialog(); }); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java index 43b7c37f..3b6c0de8 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java @@ -1,5 +1,6 @@ package com.moez.QKSMS.ui.base; +import android.app.ProgressDialog; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.PorterDuff; @@ -33,6 +34,7 @@ public abstract class QKActivity extends ActionBarActivity { private QKTextView mTitle; private ImageView mOverflowButton; private Menu mMenu; + private ProgressDialog mProgressDialog; protected Resources mRes; protected SharedPreferences mPrefs; @@ -42,6 +44,10 @@ public abstract class QKActivity extends ActionBarActivity { super.onCreate(savedInstanceState); mRes = getResources(); getPrefs(); // set the preferences if they haven't been set. this method takes care of that logic for us + + mProgressDialog = new ProgressDialog(this); + mProgressDialog.setIndeterminate(true); + mProgressDialog.setCancelable(false); } /** @@ -70,6 +76,14 @@ public abstract class QKActivity extends ActionBarActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(show); } + public void showProgressDialog() { + mProgressDialog.show(); + } + + public void hideProgressDialog() { + mProgressDialog.hide(); + } + public SharedPreferences getPrefs() { if (mPrefs == null) { mPrefs = PreferenceManager.getDefaultSharedPreferences(this);