use of android.app.Dialog in project JamsMusicPlayer by psaravan.
the class AsyncGoogleMusicAuthenticationTask method onPostExecute.
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
if (mFirstRun) {
pd.dismiss();
}
//Perform an action based on the operation's result code.
if (result.equals("GOOGLE_PLAY_SERVICES_AVAILABILITY_EXCEPTION")) {
Dialog d = GooglePlayServicesUtil.getErrorDialog(availabilityExceptionStatusCode, mActivity, REQUEST_CODE_RECOVER_FROM_PLAY_SERVICES_ERROR);
d.show();
} else if (result.equals("USER_RECOVERABLE_AUTH_EXCEPTION")) {
//45 is an arbitrary value that identifies this activity's result.
LauncherActivity.mAccountName = mAccountName;
SettingsActivity____.mAccountName = mAccountName;
if (mActivity != null) {
mActivity.startActivityForResult(userRecoverableExceptionIntent, 45);
}
} else if (result.equals("GOOGLE_AUTH_EXCEPTION") || result.equals("GENERIC_EXCEPTION")) {
Toast.makeText(mContext, R.string.unknown_error_google_music, Toast.LENGTH_LONG).show();
} else if (result.equals("AUTHENTICATED")) {
if (mFirstRun) {
String text = mContext.getResources().getString(R.string.signed_in_as) + " " + mAccountName;
Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
} else if (mFirstRunFromSettings) {
//Start scanning the library to add GMusic songs.
String text = mContext.getResources().getString(R.string.signed_in_as) + " " + mAccountName;
Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
//Seting the "REBUILD_LIBRARY" flag to true will force MainActivity to rescan the folders.
mApp.getSharedPreferences().edit().putBoolean("REBUILD_LIBRARY", true).commit();
//Restart the app.
final Intent i = mActivity.getBaseContext().getPackageManager().getLaunchIntentForPackage(mActivity.getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mActivity.finish();
mActivity.startActivity(i);
}
mApp.getSharedPreferences().edit().putBoolean("GOOGLE_PLAY_MUSIC_ENABLED", true).commit();
} else {
Toast.makeText(mContext, R.string.unknown_error_google_music, Toast.LENGTH_LONG).show();
}
}
use of android.app.Dialog in project JamsMusicPlayer by psaravan.
the class LicensesDialog method create.
public Dialog create() {
//Get resources
final WebView webView = new WebView(mContext);
webView.loadDataWithBaseURL(null, mLicensesText, "text/html", "utf-8", null);
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle(mTitleText).setView(webView).setPositiveButton(mCloseText, new Dialog.OnClickListener() {
public void onClick(final DialogInterface dialogInterface, final int i) {
dialogInterface.dismiss();
}
});
final AlertDialog dialog = builder.create();
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(final DialogInterface dialog) {
if (mOnDismissListener != null) {
mOnDismissListener.onDismiss(dialog);
}
}
});
return dialog;
}
use of android.app.Dialog in project robolectric by robolectric.
the class ShadowDialogFragmentTest method removeUsingTransaction_shouldDismissTheDialog.
@Test
public void removeUsingTransaction_shouldDismissTheDialog() throws Exception {
dialogFragment.show(fragmentManager, null);
FragmentTransaction t = fragmentManager.beginTransaction();
t.remove(dialogFragment);
t.commit();
Dialog dialog = ShadowDialog.getLatestDialog();
assertFalse(dialog.isShowing());
assertTrue(shadowOf(dialog).hasBeenDismissed());
}
use of android.app.Dialog in project SMSSDK-for-Cocos2d by MobClub.
the class SmartVerifyPage method showNotifyDialog.
/**
* 按返回键时,弹出的提示对话框
*/
private void showNotifyDialog() {
int resId = ResHelper.getStyleRes(activity, "CommonDialog");
if (resId > 0) {
final Dialog dialog = new Dialog(getContext(), resId);
LinearLayout layout = BackVerifyDialogLayout.create(activity);
if (layout != null) {
dialog.setContentView(layout);
resId = ResHelper.getIdRes(activity, "tv_dialog_hint");
TextView tv = (TextView) dialog.findViewById(resId);
resId = ResHelper.getStringRes(activity, "smssdk_close_identify_page_dialog");
if (resId > 0) {
tv.setText(resId);
}
resId = ResHelper.getIdRes(activity, "btn_dialog_ok");
Button waitBtn = (Button) dialog.findViewById(resId);
resId = ResHelper.getStringRes(activity, "smssdk_wait");
if (resId > 0) {
waitBtn.setText(resId);
}
waitBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
}
});
resId = ResHelper.getIdRes(activity, "btn_dialog_cancel");
Button backBtn = (Button) dialog.findViewById(resId);
resId = ResHelper.getStringRes(activity, "smssdk_back");
if (resId > 0) {
backBtn.setText(resId);
}
backBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
finish();
}
});
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
}
}
use of android.app.Dialog in project SMSSDK-for-Cocos2d by MobClub.
the class CommonDialog method ProgressDialog.
/**
*加载对话框
*/
public static final Dialog ProgressDialog(Context context) {
int resId = ResHelper.getStyleRes(context, "CommonDialog");
if (resId > 0) {
final Dialog dialog = new Dialog(context, resId);
LinearLayout layout = ProgressDialogLayout.create(context);
if (layout != null) {
dialog.setContentView(layout);
return dialog;
}
}
return null;
}
Aggregations