use of com.instructure.parentapp.asynctask.LogoutAsyncTask in project instructure-android by instructure.
the class BaseParentActivity method showMismatchedRegionDialog.
private void showMismatchedRegionDialog(final String regionString, final Context context) {
new AlertDialog.Builder(context).setTitle(R.string.unauthorizedRegion).setMessage(getString(R.string.mismatchedRegionMessage, getReadableRegion(this, regionString))).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Prefs prefs = new Prefs(BaseParentActivity.this, getString(R.string.app_name_parent));
String parentId = prefs.load(Const.ID, "");
UserManager.getStudentsForParentAirwolf(ApiPrefs.getAirwolfDomain(), parentId, new StatusCallback<List<Student>>() {
@Override
public void onResponse(@NonNull Response<List<Student>> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
if (response.body() != null && !response.body().isEmpty()) {
// They have students that they are observing, take them to that activity
startActivity(StudentViewActivity.createIntent(BaseParentActivity.this, response.body()));
overridePendingTransition(0, 0);
finish();
} else {
// Log the user out
new LogoutAsyncTask(BaseParentActivity.this, "").execute();
}
}
});
}
}).setCancelable(false).show();
}
use of com.instructure.parentapp.asynctask.LogoutAsyncTask in project instructure-android by instructure.
the class SettingsActivity method logoutWarning.
private void logoutWarning() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.logout_warning);
builder.setPositiveButton(R.string.logout_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AnalyticUtils.trackButtonPressed(AnalyticUtils.LOG_OUT);
new LogoutAsyncTask(SettingsActivity.this, "").execute();
dialog.dismiss();
}
});
builder.setNegativeButton(R.string.logout_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
final AlertDialog logoutWarningDialog = builder.create();
logoutWarningDialog.show();
}
Aggregations