Example usage for android.app AlertDialog THEME_DEVICE_DEFAULT_LIGHT

List of usage examples for android.app AlertDialog THEME_DEVICE_DEFAULT_LIGHT

Introduction

In this page you can find the example usage for android.app AlertDialog THEME_DEVICE_DEFAULT_LIGHT.

Prototype

int THEME_DEVICE_DEFAULT_LIGHT

To view the source code for android.app AlertDialog THEME_DEVICE_DEFAULT_LIGHT.

Click Source Link

Document

Special theme constant for #AlertDialog(Context,int) : use the device's default alert theme with a light background.

Usage

From source file:com.remobile.dialogs.Notification.java

@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog() {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(this.cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {//from  w  w w .j av  a2  s . c  o  m
        return new ProgressDialog(this.cordova.getActivity());
    }
}

From source file:com.fvd.nimbus.BrowseActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // if statement prevents force close error when picture isn't selected
    if (progressDialog != null) {
        progressDialog.dismiss();/*from  ww w.ja  v a  2s  .  c  om*/
    }
    if (requestCode == 6) {
        serverHelper.getInstance().setCallback(this, this);
        saveCSS = prefs.getString("clipStyle", "1").equals("1");
        //Log.i("nimbus",saveCSS==true?"true":"false");
        wv.eval(String.format("javascript:android.fvdSaveCss(%s)", saveCSS == true ? "true" : "false"));
        if ("1".equals(prefs.getString("userAgent", "1"))) {
            wv.setUserAgent(null);
        } else
            wv.setUserAgent(deskAgent);
    } else if (requestCode == 3) {
        if (resultCode == RESULT_OK || resultCode == RESULT_FIRST_USER) {
            userMail = data.getStringExtra("userMail");
            userPass = data.getStringExtra("userPass");
            //sendRequest("user:auth", String.format("\"email\":\"%s\",\"password\":\"%s\"",userMail,userPass));
            if (resultCode == RESULT_OK)
                sendRequest("user:auth",
                        String.format("\"email\":\"%s\",\"password\":\"%s\"", userMail, userPass));
            else
                serverHelper.getInstance().sendOldRequest("user_register", String.format(
                        "{\"action\": \"user_register\",\"email\":\"%s\",\"password\":\"%s\",\"_client_software\": \"ff_addon\"}",
                        userMail, userPass), "");
        }
    } else if (requestCode == 4) {
        if (resultCode == RESULT_OK) {
            if (serverHelper.getInstance().canShare()) {
                serverHelper.getInstance().shareNote();
            }
        }
    } else if (requestCode == 5) {
        if (resultCode == RESULT_OK) {
            DataExchange cl = (DataExchange) data.getExtras().getSerializable("content");
            if (sessionId.length() == 0 || userPass.length() == 0)
                showSettings();
            else {
                if (prefs.getBoolean("check_fast", false)) {
                    sendNote(wv.getTitle(), cl.getContent(), parent, tag);
                    clipData.setContent("");
                } else {
                    serverHelper.getInstance().setCallback(this, this);
                    if (appSettings.sessionId.length() > 0) {
                        serverHelper.getInstance().sendRequest("notes:getFolders", "", "");
                    }
                }
            }
        }
        wv.endSelectionMode();
    } else if (requestCode == 11) {
        if (appSettings.sessionId != "") {
            sessionId = appSettings.sessionId;
            userPass = appSettings.userPass;
            if (lastAction != "") {
                serverHelper.getInstance().sendRequest(lastAction, "", "");
            } else if (clipData != null && clipData.getContent().length() > 0) {
                if (prefs.getBoolean("check_fast", false)) {
                    sendNote(clipData.getTitle(), clipData.getContent(), parent, tag);
                    clipData.setContent("");
                } else {
                    serverHelper.getInstance().setCallback(this, this);
                    if (appSettings.sessionId.length() > 0) {
                        serverHelper.getInstance().sendRequest("notes:getFolders", "", "");
                    }
                }
            }
        }
    } else if (requestCode == 7) {

        if (resultCode == RESULT_OK && data != null) {
            try {
                DataExchange xdata = (DataExchange) data.getExtras().getSerializable("xdata");
                parent = xdata.getId();
                tag = xdata.getTags();
                String xtitle = xdata.getTitle();
                clipData.setTitle(xtitle);
                //clipData.setTags(tag);
                if (sessionId.length() == 0 || userPass.length() == 0)
                    showSettings();
                else {
                    sendNote(xtitle, clipData.getContent(), parent, tag);
                    clipData.setContent("");
                }
            } catch (Exception e) {
                BugReporter.Send("BrowseAct", e.getMessage());
            }
        }

    } else if (requestCode == SHOW_SETTINGS) {
        switch (resultCode) {
        case RESULT_FIRST_USER + 1:
            Intent i = new Intent(getApplicationContext(), PrefsActivity.class);
            startActivity(i);

            overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
            break;
        case RESULT_FIRST_USER + 2:
            if (appSettings.sessionId.length() == 0)
                showLogin();
            else {
                appSettings.sessionId = "";
                //serverHelper.getInstance().setSessionId(appSettings.sessionId);
                Editor e = prefs.edit();
                e.putString("userMail", userMail);
                e.putString("userPass", "");
                e.putString("sessionId", appSettings.sessionId);
                e.commit();
                showLogin();
            }
            break;
        case RESULT_FIRST_USER + 3:
            try {
                startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id=" + getApplicationInfo().packageName)));
            } catch (Exception e) {
            }
        case RESULT_FIRST_USER + 4:
            Uri uri = Uri.parse(
                    "http://help.everhelper.me/customer/portal/articles/1376820-nimbus-clipper-for-android---quick-guide");
            Intent it = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(it);
            //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
            overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
            break;
        case RESULT_FIRST_USER + 5:
            final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this,
                    AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            alertDialogBuilder.setMessage(getScriptContent("license.txt")).setCancelable(false)
                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // no alert dialog shown
                            //alertDialogShown = null;
                            // canceled
                            setResult(RESULT_CANCELED);
                            // and finish
                            //finish();
                        }
                    });
            // create alert dialog
            final AlertDialog alertDialog = alertDialogBuilder.create();
            alertDialog.setTitle(getString(R.string.license_title));

            // and show
            //alertDialogShown = alertDialog;
            try {
                alertDialog.show();
            } catch (final java.lang.Exception e) {
                // nothing to do
            } catch (final java.lang.Error e) {
                // nothing to do
            }
            break;
        default:
            break;
        }
    }
}

From source file:com.fvd.nimbus.PaintActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    ContentResolver cr;/*  www  . j  av a2 s .  c o m*/
    InputStream is;
    if (requestCode == TAKE_PHOTO) {
        showProgress(false);
        if (resultCode == -1) {
            try {
                if (data != null) {
                    if (data.hasExtra("data")) {
                        //Bitmap bm = ;
                        drawView.setVisibility(View.INVISIBLE);
                        drawView.recycle();
                        drawView.setBitmap((Bitmap) data.getParcelableExtra("data"), 0);
                        drawView.setVisibility(View.VISIBLE);

                    }
                } else {
                    if (outputFileUri != null) {
                        cr = getContentResolver();
                        try {
                            is = cr.openInputStream(outputFileUri);
                            Bitmap bmp = BitmapFactory.decodeStream(is);
                            if (bmp.getWidth() != -1 && bmp.getHeight() != -1) {
                                drawView.setVisibility(View.INVISIBLE);
                                drawView.recycle();
                                drawView.setBitmap(bmp, 0);
                                drawView.setVisibility(View.VISIBLE);
                            }
                        } catch (Exception e) {
                            appSettings.appendLog("paint:onCreate  " + e.getMessage());
                        }
                    }
                }
            } catch (Exception e) {
                appSettings.appendLog("main:onActivityResult: exception -  " + e.getMessage());
            }
        }
        ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(0);
    } else if (requestCode == TAKE_PICTURE) {
        showProgress(false);
        if (resultCode == -1 && data != null) {
            boolean temp = false;
            try {
                Uri resultUri = data.getData();
                String drawString = resultUri.getPath();
                InputStream input = getContentResolver().openInputStream(resultUri);

                drawView.setVisibility(View.INVISIBLE);
                drawView.recycle();
                drawView.setBitmap(BitmapFactory.decodeStream(input), 0);
                //drawView.forceRedraw();
                drawView.setVisibility(View.VISIBLE);
            } catch (Exception e) {
                appSettings.appendLog("main:onActivityResult  " + e.getMessage());

            }
        }
        ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(0);
    } else if (requestCode == SHOW_SETTINGS) {
        switch (resultCode) {
        case RESULT_FIRST_USER + 1:
            Intent i = new Intent(getApplicationContext(), PrefsActivity.class);
            startActivity(i);
            //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
            overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
            break;
        case RESULT_FIRST_USER + 2:
            if (appSettings.sessionId.length() == 0)
                showLogin();
            else {
                appSettings.sessionId = "";
                //serverHelper.getInstance().setSessionId(appSettings.sessionId);
                Editor e = prefs.edit();
                e.putString("userMail", userMail);
                e.putString("userPass", "");
                e.putString("sessionId", appSettings.sessionId);
                e.commit();
                showLogin();
            }
            break;
        case RESULT_FIRST_USER + 3:
            try {
                startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id=" + getApplicationInfo().packageName)));
            } catch (Exception e) {
            }
        case RESULT_FIRST_USER + 4:
            Uri uri = Uri.parse(
                    "http://help.everhelper.me/customer/portal/articles/1376820-nimbus-clipper-for-android---quick-guide");
            Intent it = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(it);
            //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
            overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
            break;
        case RESULT_FIRST_USER + 5:
            final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this,
                    AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            alertDialogBuilder.setMessage(getScriptContent("license.txt")).setCancelable(false)
                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // no alert dialog shown
                            //alertDialogShown = null;
                            // canceled
                            setResult(RESULT_CANCELED);
                            // and finish
                            //finish();
                        }
                    });
            // create alert dialog
            final AlertDialog alertDialog = alertDialogBuilder.create();
            alertDialog.setTitle(getString(R.string.license_title));

            // and show
            //alertDialogShown = alertDialog;
            try {
                alertDialog.show();
            } catch (final java.lang.Exception e) {
                // nothing to do
            } catch (final java.lang.Error e) {
                // nothing to do
            }
            break;
        default:
            break;
        }
    }

    if (requestCode == 3) {
        if (resultCode == RESULT_OK || resultCode == RESULT_FIRST_USER) {
            userMail = data.getStringExtra("userMail");
            userPass = data.getStringExtra("userPass");
            if (resultCode == RESULT_OK)
                sendRequest("user:auth",
                        String.format("\"email\":\"%s\",\"password\":\"%s\"", userMail, userPass));
            else
                serverHelper.getInstance().sendOldRequest("user_register", String.format(
                        "{\"action\": \"user_register\",\"email\":\"%s\",\"password\":\"%s\",\"_client_software\": \"ff_addon\"}",
                        userMail, userPass), "");
        }
    } else if (requestCode == 11) {
        if (appSettings.sessionId != "") {
            sessionId = appSettings.sessionId;
            userPass = appSettings.userPass;
            sendShot();
        }
    } else if (requestCode == 4) {
        if (resultCode == RESULT_OK) {
            String id = data.getStringExtra("id").toString();
            serverHelper.getInstance().shareShot(id);
        }
    } else if (resultCode == RESULT_OK) {
        drawView.setColour(dColor);
        setPaletteColor(dColor);
        Uri resultUri = data.getData();
        String drawString = resultUri.getPath();
        String galleryString = getGalleryPath(resultUri);

        if (galleryString != null) {
            drawString = galleryString;
        }
        // else another file manager was used
        else {
            if (drawString.contains("//")) {
                drawString = drawString.substring(drawString.lastIndexOf("//"));
            }
        }

        // set the background to the selected picture
        if (drawString.length() > 0) {
            Drawable drawBackground = Drawable.createFromPath(drawString);
            drawView.setBackgroundDrawable(drawBackground);
        }

    }
}

From source file:org.xingjitong.LinphoneActivity.java

@SuppressLint("NewApi")
private void initPopupWindow() {
    Log.v("yyppdebug", "yyppoption init 000");
    view = getLayoutInflater().inflate(R.layout.option_menu, null);
    pop = new PopupWindow(view, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    pop.setOutsideTouchable(true);/*  ww w .j a  v  a  2 s. c  o m*/

    // ??
    mlayout_setting = (LinearLayout) view.findViewById(R.id.option_menu_aaa);
    mlayout_about = (LinearLayout) view.findViewById(R.id.option_menu_bbb);
    mlayout_exit = (LinearLayout) view.findViewById(R.id.option_menu_ccc);

    mlayout_setting.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            if (pop.isShowing()) {
                pop.dismiss();

                isPopShowing = false;
            }
            //do somethiing
            LinphoneActivity.instance().changeCurrentFragment(FragmentsAvailable.TITTLE_SETTINGS, null);
            //-----------------

        }
    });

    mlayout_about.setOnClickListener(new View.OnClickListener() {

        @SuppressLint("NewApi")
        public void onClick(View v) {
            if (pop.isShowing()) {
                pop.dismiss();
                isPopShowing = false;

            }
            //do something...

            AlertDialog.Builder buildernew = new AlertDialog.Builder(LinphoneActivity.instance(),
                    AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            String tmpmsg = "?????????www.wecare200.com";
            buildernew.setIconAttribute(android.R.attr.alertDialogIcon);
            buildernew.setTitle("?");
            buildernew.setMessage(tmpmsg);

            buildernew.setNegativeButton("?", new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub

                }
            });

            buildernew.create().show();

            //---------------------------------------------------------

        }
    });

    mlayout_exit.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            if (pop.isShowing()) {
                pop.dismiss();
                isPopShowing = false;
            }
            //do something...

            //LinphoneActivity.instance().exit();
            //----------------------------------
            startActivity(new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));

        }
    });
}