forked from upstream-mirrors/quik
Basic progress dialog support
This commit is contained in:
@@ -63,12 +63,16 @@ public class DialogHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showChangelog(QKActivity context) {
|
public static void showChangelog(QKActivity context) {
|
||||||
|
context.showProgressDialog();
|
||||||
|
|
||||||
String url = "https://qksms-changelog.firebaseio.com/changes.json";
|
String url = "https://qksms-changelog.firebaseio.com/changes.json";
|
||||||
|
|
||||||
StringRequest request = new StringRequest(url, response -> {
|
StringRequest request = new StringRequest(url, response -> {
|
||||||
Log.d(TAG, "onComplete: " + response);
|
Log.d(TAG, "onComplete: " + response);
|
||||||
|
context.hideProgressDialog();
|
||||||
}, error -> {
|
}, error -> {
|
||||||
Log.d(TAG, "onError: " + error.getMessage());
|
Log.d(TAG, "onError: " + error.getMessage());
|
||||||
|
context.hideProgressDialog();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.moez.QKSMS.ui.base;
|
package com.moez.QKSMS.ui.base;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
@@ -33,6 +34,7 @@ public abstract class QKActivity extends ActionBarActivity {
|
|||||||
private QKTextView mTitle;
|
private QKTextView mTitle;
|
||||||
private ImageView mOverflowButton;
|
private ImageView mOverflowButton;
|
||||||
private Menu mMenu;
|
private Menu mMenu;
|
||||||
|
private ProgressDialog mProgressDialog;
|
||||||
|
|
||||||
protected Resources mRes;
|
protected Resources mRes;
|
||||||
protected SharedPreferences mPrefs;
|
protected SharedPreferences mPrefs;
|
||||||
@@ -42,6 +44,10 @@ public abstract class QKActivity extends ActionBarActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mRes = getResources();
|
mRes = getResources();
|
||||||
getPrefs(); // set the preferences if they haven't been set. this method takes care of that logic for us
|
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);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showProgressDialog() {
|
||||||
|
mProgressDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideProgressDialog() {
|
||||||
|
mProgressDialog.hide();
|
||||||
|
}
|
||||||
|
|
||||||
public SharedPreferences getPrefs() {
|
public SharedPreferences getPrefs() {
|
||||||
if (mPrefs == null) {
|
if (mPrefs == null) {
|
||||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user