forked from github/wulkanowy-mirror
Add ProgressDialog when logging in.
This commit is contained in:
parent
6415e673c8
commit
b31b3532ad
@ -1,6 +1,8 @@
|
|||||||
package leszcz_team.wulkanowy.activity.main;
|
package leszcz_team.wulkanowy.activity.main;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@ -29,16 +31,19 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
String urlForStepTwo;
|
String urlForStepTwo;
|
||||||
String urlForStepThree;
|
String urlForStepThree;
|
||||||
|
|
||||||
|
ProgressDialog progress;
|
||||||
|
|
||||||
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
||||||
|
|
||||||
activity = mainAC;
|
activity = mainAC;
|
||||||
|
progress = new ProgressDialog(activity);
|
||||||
|
|
||||||
if (emailT.equals("Debug")){
|
if (countyT.equals("Debug")){
|
||||||
urlForStepOne = activity.getString(R.string.urlStepOneDebug);
|
urlForStepOne = activity.getString(R.string.urlStepOneDebug);
|
||||||
urlForStepTwo = activity.getString(R.string.urlStepTwoDebug);
|
urlForStepTwo = activity.getString(R.string.urlStepTwoDebug);
|
||||||
urlForStepThree = activity.getString(R.string.urlStepThreeDebug);
|
urlForStepThree = activity.getString(R.string.urlStepThreeDebug);
|
||||||
county = activity.getString(R.string.countyDebug);
|
county = activity.getString(R.string.countyDebug);
|
||||||
email = activity.getString(R.string.emailDebug);
|
email = emailT;
|
||||||
password = passwordT;
|
password = passwordT;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -51,6 +56,16 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
|
||||||
|
progress.setTitle(activity.getText(R.string.login_title));
|
||||||
|
progress.setMessage(activity.getText(R.string.please_wait));
|
||||||
|
progress.setCancelable(false);
|
||||||
|
progress.show();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
@ -125,6 +140,7 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
|
progress.dismiss();
|
||||||
if (!userMesage.isEmpty()){
|
if (!userMesage.isEmpty()){
|
||||||
Toast.makeText(activity, userMesage , Toast.LENGTH_LONG).show();
|
Toast.makeText(activity, userMesage , Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user