Search in sources :

Example 96 with Dialog

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();
    }
}
Also used : ProgressDialog(android.app.ProgressDialog) Dialog(android.app.Dialog) Intent(android.content.Intent)

Example 97 with Dialog

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;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) WebView(android.webkit.WebView)

Example 98 with 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());
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Dialog(android.app.Dialog) ShadowDialog(org.robolectric.shadows.ShadowDialog) Test(org.junit.Test)

Example 99 with Dialog

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();
        }
    }
}
Also used : Button(android.widget.Button) Dialog(android.app.Dialog) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 100 with Dialog

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;
}
Also used : Dialog(android.app.Dialog) LinearLayout(android.widget.LinearLayout)

Aggregations

Dialog (android.app.Dialog)792 View (android.view.View)317 AlertDialog (android.app.AlertDialog)256 TextView (android.widget.TextView)219 DialogInterface (android.content.DialogInterface)200 Intent (android.content.Intent)97 Bundle (android.os.Bundle)94 Context (android.content.Context)93 AlertDialog (android.support.v7.app.AlertDialog)93 ListView (android.widget.ListView)87 EditText (android.widget.EditText)84 Button (android.widget.Button)80 AdapterView (android.widget.AdapterView)79 NonNull (android.support.annotation.NonNull)77 LayoutInflater (android.view.LayoutInflater)75 ImageView (android.widget.ImageView)70 ArrayList (java.util.ArrayList)64 LinearLayout (android.widget.LinearLayout)54 WindowManager (android.view.WindowManager)52 ProgressDialog (android.app.ProgressDialog)51