Example usage for android.app Dialog Dialog

List of usage examples for android.app Dialog Dialog

Introduction

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

Prototype

public Dialog(@NonNull Context context, @StyleRes int themeResId) 

Source Link

Document

Creates a dialog window that uses a custom dialog style.

Usage

From source file:com.appolis.move.AcMoveDetails.java

/**
 * /*from   ww  w. java2 s  . c o m*/
 * @param mContext
 * @param newClass
 * @param strMessages
 */
public void showPopUp(final Context mContext, final Class<?> newClass, final String strMessages) {
    String message;
    if (strMessages.equals(GlobalParams.BLANK)) {
        message = GlobalParams.WRONG_USER;
    } else {
        message = strMessages;
    }

    final Dialog dialog = new Dialog(mContext, R.style.Dialog_NoTitle);
    dialog.setContentView(R.layout.dialogwarning);
    // set the custom dialog components - text, image and button      
    TextView text2 = (TextView) dialog.findViewById(R.id.tvScantitle2);
    text2.setText(message);

    LanguagePreferences langPref = new LanguagePreferences(mContext);
    Button dialogButtonOk = (Button) dialog.findViewById(R.id.dialogButtonOK);
    dialogButtonOk.setText(langPref.getPreferencesString(GlobalParams.OK, GlobalParams.OK));

    dialogButtonOk.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
            scanFlag = GlobalParams.FLAG_ACTIVE;
        }
    });
    dialog.show();
}

From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    final Dialog dialog;
    ProgressDialog pdialog;/*from  w  w w  .  j  ava  2s.c om*/
    AlertDialog.Builder builder;
    LayoutInflater inflater;

    switch (id) {
    case Constants.DIALOG_LOGIN:
        dialog = new LoginDialog(this, mSettings, false) {
            @Override
            public void onLoginChosen(String user, String password) {
                removeDialog(Constants.DIALOG_LOGIN);
                new MyLoginTask(user, password).execute();
            }
        };
        break;

    case Constants.DIALOG_COMMENT_CLICK:
        dialog = new CommentClickDialog(this, mSettings);
        break;

    case Constants.DIALOG_REPLY: {
        dialog = new Dialog(this, mSettings.getDialogTheme());
        dialog.setContentView(R.layout.compose_reply_dialog);
        final EditText replyBody = (EditText) dialog.findViewById(R.id.body);
        final Button replySaveButton = (Button) dialog.findViewById(R.id.reply_save_button);
        final Button replyCancelButton = (Button) dialog.findViewById(R.id.reply_cancel_button);

        replySaveButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mReplyTargetName != null) {
                    new CommentReplyTask(mReplyTargetName).execute(replyBody.getText().toString());
                    dialog.dismiss();
                } else {
                    Common.showErrorToast("Error replying. Please try again.", Toast.LENGTH_SHORT,
                            CommentsListActivity.this);
                }
            }
        });
        replyCancelButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mVoteTargetThing.setReplyDraft(replyBody.getText().toString());
                dialog.cancel();
            }
        });
        dialog.setCancelable(false); // disallow the BACK key
        dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                replyBody.setText("");
            }
        });
        break;
    }

    case Constants.DIALOG_EDIT: {
        dialog = new Dialog(this, mSettings.getDialogTheme());
        dialog.setContentView(R.layout.compose_reply_dialog);
        final EditText replyBody = (EditText) dialog.findViewById(R.id.body);
        final Button replySaveButton = (Button) dialog.findViewById(R.id.reply_save_button);
        final Button replyCancelButton = (Button) dialog.findViewById(R.id.reply_cancel_button);

        replyBody.setText(mEditTargetBody);

        replySaveButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (mReplyTargetName != null) {
                    new EditTask(mReplyTargetName).execute(replyBody.getText().toString());
                    dialog.dismiss();
                } else {
                    Common.showErrorToast("Error editing. Please try again.", Toast.LENGTH_SHORT,
                            CommentsListActivity.this);
                }
            }
        });
        replyCancelButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                dialog.cancel();
            }
        });
        dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                replyBody.setText("");
            }
        });
        break;
    }

    case Constants.DIALOG_DELETE:
        builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        builder.setTitle("Really delete this?");
        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                removeDialog(Constants.DIALOG_DELETE);
                new DeleteTask(mDeleteTargetKind).execute(mReplyTargetName);
            }
        }).setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        dialog = builder.create();
        break;

    case Constants.DIALOG_SORT_BY:
        builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        builder.setTitle("Sort by:");
        int selectedSortBy = -1;
        for (int i = 0; i < Constants.CommentsSort.SORT_BY_URL_CHOICES.length; i++) {
            if (Constants.CommentsSort.SORT_BY_URL_CHOICES[i].equals(mSettings.getCommentsSortByUrl())) {
                selectedSortBy = i;
                break;
            }
        }
        builder.setSingleChoiceItems(Constants.CommentsSort.SORT_BY_CHOICES, selectedSortBy,
                sortByOnClickListener);
        dialog = builder.create();
        break;

    case Constants.DIALOG_REPORT:
        builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        builder.setTitle("Really report this?");
        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                removeDialog(Constants.DIALOG_REPORT);
                new ReportTask(mReportTargetName.toString()).execute();
            }
        }).setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        dialog = builder.create();
        break;

    // "Please wait"
    case Constants.DIALOG_DELETING:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Deleting...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    case Constants.DIALOG_EDITING:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Submitting edit...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    case Constants.DIALOG_LOGGING_IN:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Logging in...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    case Constants.DIALOG_REPLYING:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Sending reply...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    case Constants.DIALOG_FIND:
        inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View content = inflater.inflate(R.layout.dialog_find, null);
        final EditText find_box = (EditText) content.findViewById(R.id.input_find_box);
        //          final CheckBox wrap_box = (CheckBox) content.findViewById(R.id.find_wrap_checkbox);

        builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        builder.setView(content);
        builder.setTitle(R.string.find).setPositiveButton(R.string.find, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                String search_text = find_box.getText().toString().toLowerCase();
                //               findCommentText(search_text, wrap_box.isChecked(), false);
                findCommentText(search_text, true, false);
            }
        }).setNegativeButton("Cancel", null);
        dialog = builder.create();
        break;
    default:
        throw new IllegalArgumentException("Unexpected dialog id " + id);
    }
    return dialog;
}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlideEngineLayout() {

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    float height = metrics.heightPixels;
    float width = metrics.widthPixels;

    int left840 = (int) ((width / 100) * 65.625);

    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog enginedialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    enginedialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    enginedialog.setContentView(R.layout.enginedialoglayout);
    enginedialog.getWindow().getAttributes().windowAnimations = R.style.EngineDialogAnimation;
    enginedialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = enginedialog.getWindow().getAttributes();
    lp.dimAmount = 0f;//from  w w w . j a  v  a2s.  c o m

    final CheckBox chkengine_hood = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_hood);
    final CheckBox chkengine_backHood = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_backHood);
    final CheckBox chkengine_underEngine = (CheckBox) enginedialog.getWindow()
            .findViewById(R.id.engine_underEngine);
    final CheckBox chkengine_brakeOil = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_brakeOil);
    final CheckBox chkengine_engineOil = (CheckBox) enginedialog.getWindow()
            .findViewById(R.id.engine_engineOil);
    final CheckBox chkengine_waterCoolant = (CheckBox) enginedialog.getWindow()
            .findViewById(R.id.engine_waterCoolant);
    final CheckBox chkengine_belt = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_belt);
    final CheckBox chkengine_gear = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_gear);
    final CheckBox chkengine_liquidLevel = (CheckBox) enginedialog.getWindow()
            .findViewById(R.id.engine_liquidLevel);
    final CheckBox chkengine_soundOut = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_soundOut);
    final CheckBox chkengine_soundIn = (CheckBox) enginedialog.getWindow().findViewById(R.id.engine_soundIn);

    // Change font
    chkengine_hood.setTypeface(type);
    chkengine_backHood.setTypeface(type);
    chkengine_underEngine.setTypeface(type);
    chkengine_brakeOil.setTypeface(type);
    chkengine_engineOil.setTypeface(type);
    chkengine_waterCoolant.setTypeface(type);
    chkengine_belt.setTypeface(type);
    chkengine_gear.setTypeface(type);
    chkengine_liquidLevel.setTypeface(type);
    chkengine_soundOut.setTypeface(type);
    chkengine_soundIn.setTypeface(type);

    enginedialog.setCanceledOnTouchOutside(true);
    enginedialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            headengine.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadengine = new TranslateAnimation(0, 0, 490, -500);
            slideoutheadengine.setDuration(300);
            slideoutheadengine.setFillAfter(true);
            headengine.startAnimation(slideoutheadengine);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("engine_hood", chkengine_hood.isChecked());
            mp.put("engine_backHood", chkengine_backHood.isChecked());
            mp.put("engine_underEngine", chkengine_underEngine.isChecked());
            mp.put("engine_brakeOil", chkengine_brakeOil.isChecked());
            mp.put("engine_engineOil", chkengine_engineOil.isChecked());
            mp.put("engine_waterCoolant", chkengine_waterCoolant.isChecked());
            mp.put("engine_belt", chkengine_belt.isChecked());
            mp.put("engine_gear", chkengine_gear.isChecked());
            mp.put("engine_liquidLevel", chkengine_liquidLevel.isChecked());
            mp.put("engine_soundOut", chkengine_soundOut.isChecked());
            mp.put("engine_soundIn", chkengine_soundIn.isChecked());

            filterStore("engine", mp);
            save(mp);

        }
    });

    TextView engine = (TextView) enginedialog.getWindow().findViewById(R.id.Engine);
    engine.setTypeface(type);
    Button engineback = (Button) enginedialog.getWindow().findViewById(R.id.Engineback);
    engineback.setTypeface(type);
    engineback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            enginedialog.dismiss();

            headengine.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadengine = new TranslateAnimation(0, 0, 490, -500);
            slideoutheadengine.setDuration(300);
            slideoutheadengine.setFillAfter(true);
            headengine.startAnimation(slideoutheadengine);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("engine_hood", chkengine_hood.isChecked());
            mp.put("engine_backHood", chkengine_backHood.isChecked());
            mp.put("engine_underEngine", chkengine_underEngine.isChecked());
            mp.put("engine_brakeOil", chkengine_brakeOil.isChecked());
            mp.put("engine_engineOil", chkengine_engineOil.isChecked());
            mp.put("engine_waterCoolant", chkengine_waterCoolant.isChecked());
            mp.put("engine_belt", chkengine_belt.isChecked());
            mp.put("engine_gear", chkengine_gear.isChecked());
            mp.put("engine_liquidLevel", chkengine_liquidLevel.isChecked());
            mp.put("engine_soundOut", chkengine_soundOut.isChecked());
            mp.put("engine_soundIn", chkengine_soundIn.isChecked());

            filterStore("engine", mp);
            save(mp);

        }
    });

    chkengine_hood.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_backHood.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_underEngine.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_brakeOil.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_engineOil.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_waterCoolant.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_belt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_gear.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_liquidLevel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_soundOut.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkengine_soundIn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalEngine(increment);
            } else {
                increment = false;
                getTotalEngine(increment);
            }
            EngineProgress.setProgress(PercenEngine);
            percenengine.setText("" + PercenEngine + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    headengine.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadengine = new TranslateAnimation(0, 0, 0, 490);
    slideheadengine.setDuration(300);
    slideheadengine.setFillAfter(true);
    headengine.startAnimation(slideheadengine);

    enginedialog.show();

    WindowManager.LayoutParams params = enginedialog.getWindow().getAttributes();
    params.y = 1;
    params.x = left840;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    enginedialog.getWindow().setAttributes(params);

    chkengine_hood.setChecked(load("engine_hood"));
    chkengine_backHood.setChecked(load("engine_backHood"));
    chkengine_underEngine.setChecked(load("engine_underEngine"));
    chkengine_brakeOil.setChecked(load("engine_brakeOil"));
    chkengine_engineOil.setChecked(load("engine_engineOil"));
    chkengine_waterCoolant.setChecked(load("engine_waterCoolant"));
    chkengine_belt.setChecked(load("engine_belt"));
    chkengine_gear.setChecked(load("engine_gear"));
    chkengine_liquidLevel.setChecked(load("engine_liquidLevel"));
    chkengine_soundOut.setChecked(load("engine_soundOut"));
    chkengine_soundIn.setChecked(load("engine_soundIn"));

}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlideExteriorLayout() {
    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog exteriordialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    exteriordialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    exteriordialog.setContentView(R.layout.exteriordialoglayout);
    exteriordialog.getWindow().getAttributes().windowAnimations = R.style.ExteriorDialogAnimation;
    exteriordialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = exteriordialog.getWindow().getAttributes();
    lp.dimAmount = 0f;/* w w  w .  j a v  a 2 s  .c o m*/

    final CheckBox chkoutside_color = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_color);
    final CheckBox chkoutside_window = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_window);
    final CheckBox chkoutside_doorHood = (CheckBox) exteriordialog.getWindow()
            .findViewById(R.id.outside_doorHood);
    final CheckBox chkoutside_jack = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_jack);
    final CheckBox chkoutside_wrench = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_wrench);
    final CheckBox chkoutside_tires = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_tires);
    final CheckBox chkoutside_light = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_light);
    final CheckBox chkoutside_seal = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_seal);
    final CheckBox chkoutside_tirePart = (CheckBox) exteriordialog.getWindow()
            .findViewById(R.id.outside_tirePart);

    // Change font
    chkoutside_color.setTypeface(type);
    chkoutside_window.setTypeface(type);
    chkoutside_doorHood.setTypeface(type);
    chkoutside_jack.setTypeface(type);
    chkoutside_wrench.setTypeface(type);
    chkoutside_tires.setTypeface(type);
    chkoutside_light.setTypeface(type);
    chkoutside_seal.setTypeface(type);
    chkoutside_tirePart.setTypeface(type);

    exteriordialog.setCanceledOnTouchOutside(true);
    exteriordialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            headexterior.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadexterior = new TranslateAnimation(0, 0, 380, -400);
            slideoutheadexterior.setDuration(500);
            slideoutheadexterior.setFillAfter(true);
            headexterior.startAnimation(slideoutheadexterior);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("outside_color", chkoutside_color.isChecked());
            mp.put("outside_window", chkoutside_window.isChecked());
            mp.put("outside_doorHood", chkoutside_doorHood.isChecked());
            mp.put("outside_jack", chkoutside_jack.isChecked());
            mp.put("outside_wrench", chkoutside_wrench.isChecked());
            mp.put("outside_tires", chkoutside_tires.isChecked());
            mp.put("outside_light", chkoutside_light.isChecked());
            mp.put("outside_seal", chkoutside_seal.isChecked());
            mp.put("outside_tirePart", chkoutside_tirePart.isChecked());

            filterStore("exterior", mp);
            save(mp);

        }
    });

    TextView exterior = (TextView) exteriordialog.getWindow().findViewById(R.id.Exterior);
    exterior.setTypeface(type);
    Button exteriorback = (Button) exteriordialog.getWindow().findViewById(R.id.Exteriorback);
    exteriorback.setTypeface(type);
    exteriorback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            exteriordialog.dismiss();

            headexterior.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadexterior = new TranslateAnimation(0, 0, 380, -400);
            slideoutheadexterior.setDuration(500);
            slideoutheadexterior.setFillAfter(true);
            headexterior.startAnimation(slideoutheadexterior);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("outside_color", chkoutside_color.isChecked());
            mp.put("outside_window", chkoutside_window.isChecked());
            mp.put("outside_doorHood", chkoutside_doorHood.isChecked());
            mp.put("outside_jack", chkoutside_jack.isChecked());
            mp.put("outside_wrench", chkoutside_wrench.isChecked());
            mp.put("outside_tires", chkoutside_tires.isChecked());
            mp.put("outside_light", chkoutside_light.isChecked());
            mp.put("outside_seal", chkoutside_seal.isChecked());
            mp.put("outside_tirePart", chkoutside_tirePart.isChecked());

            filterStore("exterior", mp);
            save(mp);

        }
    });

    chkoutside_color.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_window.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_doorHood.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_jack.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_wrench.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_tires.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_light.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_seal.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkoutside_tirePart.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalExterior(increment);
            } else {
                increment = false;
                getTotalExterior(increment);
            }
            ExteriorProgress.setProgress(PercenExterior);
            percenexterior.setText("" + PercenExterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    headexterior.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadexterior = new TranslateAnimation(0, 0, 0, 380);
    slideheadexterior.setDuration(500);
    slideheadexterior.setFillAfter(true);
    headexterior.startAnimation(slideheadexterior);

    exteriordialog.show();

    WindowManager.LayoutParams params = exteriordialog.getWindow().getAttributes();
    params.y = 0;
    params.x = 60;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    exteriordialog.getWindow().setAttributes(params);

    chkoutside_color.setChecked(load("outside_color"));
    chkoutside_window.setChecked(load("outside_window"));
    chkoutside_doorHood.setChecked(load("outside_doorHood"));
    chkoutside_jack.setChecked(load("outside_jack"));
    chkoutside_wrench.setChecked(load("outside_wrench"));
    chkoutside_tires.setChecked(load("outside_tires"));
    chkoutside_light.setChecked(load("outside_light"));
    chkoutside_seal.setChecked(load("outside_seal"));
    chkoutside_tirePart.setChecked(load("outside_tirePart"));

}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlideInteriorLayout() {
    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog interiordialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    interiordialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    interiordialog.setContentView(R.layout.interiordialoglayout);
    interiordialog.getWindow().getAttributes().windowAnimations = R.style.InteriorDialogAnimation;
    interiordialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = interiordialog.getWindow().getAttributes();
    lp.dimAmount = 0f;//  w  ww.j a va  2 s. co  m

    final CheckBox chkinside_seat = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_seat);
    final CheckBox chkinside_console = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_console);
    final CheckBox chkinside_steeringWheel = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_steeringWheel);
    final CheckBox chkinside_transmission = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_transmission);
    final CheckBox chkinside_sideDoors = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_sideDoors);
    final CheckBox chkinside_dashBoard = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_dashBoard);
    final CheckBox chkinside_carpet = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_carpet);
    final CheckBox chkinside_curtain = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_curtain);
    final CheckBox chkinside_seatBelt = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_seatBelt);
    final CheckBox chkinside_backDoor = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_backDoor);
    final CheckBox chkinside_lidOil = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_lidOil);
    final CheckBox chkinside_setSeat = (CheckBox) interiordialog.getWindow().findViewById(R.id.inside_setSeat);
    final CheckBox chkinside_brakePedal = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_brakePedal);
    final CheckBox chkinside_accelerator = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_accelerator);
    final CheckBox chkinside_handBrake = (CheckBox) interiordialog.getWindow()
            .findViewById(R.id.inside_handBrake);

    // Change font
    chkinside_seat.setTypeface(type);
    chkinside_console.setTypeface(type);
    chkinside_steeringWheel.setTypeface(type);
    chkinside_transmission.setTypeface(type);
    chkinside_sideDoors.setTypeface(type);
    chkinside_dashBoard.setTypeface(type);
    chkinside_carpet.setTypeface(type);
    chkinside_curtain.setTypeface(type);
    chkinside_seatBelt.setTypeface(type);
    chkinside_backDoor.setTypeface(type);
    chkinside_lidOil.setTypeface(type);
    chkinside_setSeat.setTypeface(type);
    chkinside_brakePedal.setTypeface(type);
    chkinside_accelerator.setTypeface(type);
    chkinside_handBrake.setTypeface(type);

    interiordialog.setCanceledOnTouchOutside(true);
    interiordialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            headinterior.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadinterior = new TranslateAnimation(0, 0, 180, 800);
            slideoutheadinterior.setDuration(500);
            slideoutheadinterior.setFillAfter(true);
            headinterior.startAnimation(slideoutheadinterior);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("inside_seat", chkinside_seat.isChecked());
            mp.put("inside_console", chkinside_console.isChecked());
            mp.put("inside_steeringWheel", chkinside_steeringWheel.isChecked());
            mp.put("inside_transmission", chkinside_transmission.isChecked());
            mp.put("inside_sideDoors", chkinside_sideDoors.isChecked());
            mp.put("inside_dashBoard", chkinside_dashBoard.isChecked());
            mp.put("inside_carpet", chkinside_carpet.isChecked());
            mp.put("inside_curtain", chkinside_curtain.isChecked());
            mp.put("inside_seatBelt", chkinside_seatBelt.isChecked());
            mp.put("inside_backDoor", chkinside_backDoor.isChecked());
            mp.put("inside_lidOil", chkinside_lidOil.isChecked());
            mp.put("inside_setSeat", chkinside_setSeat.isChecked());
            mp.put("inside_brakePedal", chkinside_brakePedal.isChecked());
            mp.put("inside_accelerator", chkinside_accelerator.isChecked());
            mp.put("inside_handBrake", chkinside_handBrake.isChecked());

            filterStore("interior", mp);
            save(mp);
        }
    });
    TextView interior = (TextView) interiordialog.getWindow().findViewById(R.id.Interior);
    interior.setTypeface(type);
    Button interiorback = (Button) interiordialog.getWindow().findViewById(R.id.Interiorback);
    interiorback.setTypeface(type);
    interiorback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            interiordialog.dismiss();

            headinterior.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadinterior = new TranslateAnimation(0, 0, 180, 800);
            slideoutheadinterior.setDuration(500);
            slideoutheadinterior.setFillAfter(true);
            headinterior.startAnimation(slideoutheadinterior);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("inside_seat", chkinside_seat.isChecked());
            mp.put("inside_console", chkinside_console.isChecked());
            mp.put("inside_steeringWheel", chkinside_steeringWheel.isChecked());
            mp.put("inside_transmission", chkinside_transmission.isChecked());
            mp.put("inside_sideDoors", chkinside_sideDoors.isChecked());
            mp.put("inside_dashBoard", chkinside_dashBoard.isChecked());
            mp.put("inside_carpet", chkinside_carpet.isChecked());
            mp.put("inside_curtain", chkinside_curtain.isChecked());
            mp.put("inside_seatBelt", chkinside_seatBelt.isChecked());
            mp.put("inside_backDoor", chkinside_backDoor.isChecked());
            mp.put("inside_lidOil", chkinside_lidOil.isChecked());
            mp.put("inside_setSeat", chkinside_setSeat.isChecked());
            mp.put("inside_brakePedal", chkinside_brakePedal.isChecked());
            mp.put("inside_accelerator", chkinside_accelerator.isChecked());
            mp.put("inside_handBrake", chkinside_handBrake.isChecked());

            filterStore("interior", mp);
            save(mp);

        }
    });

    chkinside_seat.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_console.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_steeringWheel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_transmission.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_sideDoors.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_dashBoard.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_carpet.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_curtain.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_seatBelt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_backDoor.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_lidOil.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_setSeat.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_brakePedal.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_accelerator.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkinside_handBrake.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalInterior(increment);
            } else {
                increment = false;
                getTotalInterior(increment);
            }
            InteriorProgress.setProgress(PercenInterior);
            perceninterior.setText("" + PercenInterior + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    headinterior.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadinterior = new TranslateAnimation(0, 0, 800, 180);
    slideheadinterior.setDuration(500);
    slideheadinterior.setFillAfter(true);
    headinterior.startAnimation(slideheadinterior);

    interiordialog.show();

    WindowManager.LayoutParams params = interiordialog.getWindow().getAttributes();
    params.y = 180;
    params.x = 60;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    interiordialog.getWindow().setAttributes(params);

    chkinside_seat.setChecked(load("inside_seat"));
    chkinside_console.setChecked(load("inside_console"));
    chkinside_steeringWheel.setChecked(load("inside_steeringWheel"));
    chkinside_transmission.setChecked(load("inside_transmission"));
    chkinside_sideDoors.setChecked(load("inside_sideDoors"));
    chkinside_dashBoard.setChecked(load("inside_dashBoard"));
    chkinside_carpet.setChecked(load("inside_carpet"));
    chkinside_curtain.setChecked(load("inside_curtain"));
    chkinside_seatBelt.setChecked(load("inside_seatBelt"));
    chkinside_backDoor.setChecked(load("inside_backDoor"));
    chkinside_lidOil.setChecked(load("inside_lidOil"));
    chkinside_setSeat.setChecked(load("inside_setSeat"));
    chkinside_brakePedal.setChecked(load("inside_brakePedal"));
    chkinside_accelerator.setChecked(load("inside_accelerator"));
    chkinside_handBrake.setChecked(load("inside_handBrake"));

}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlideDocumentLayout() {
    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog documentdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    documentdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    documentdialog.setContentView(R.layout.documentdialoglayout);
    documentdialog.getWindow().getAttributes().windowAnimations = R.style.DocumentDialogAnimation;
    documentdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = documentdialog.getWindow().getAttributes();
    lp.dimAmount = 0f;/*from   w  ww.  ja  v  a 2s .  c o  m*/

    final CheckBox chkinsurance = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_insurance);
    final CheckBox chkactTaxLabel = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_actTaxLabel);
    final CheckBox chkbill = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_bill);
    final CheckBox chklicensePlate = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_licensePlate);
    final CheckBox chklicenseManual = (CheckBox) documentdialog.getWindow()
            .findViewById(R.id.doc_licenseManual);
    final CheckBox chkcarPartPaper = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carPartPaper);
    final CheckBox chkcarManual = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carManual);
    final CheckBox chklicenseRegister = (CheckBox) documentdialog.getWindow()
            .findViewById(R.id.doc_licenseRegister);
    final CheckBox chkgift = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_gift);

    // Change font
    chkinsurance.setTypeface(type);
    chkactTaxLabel.setTypeface(type);
    chkbill.setTypeface(type);
    chklicensePlate.setTypeface(type);
    chklicenseManual.setTypeface(type);
    chkcarPartPaper.setTypeface(type);
    chkcarManual.setTypeface(type);
    chklicenseRegister.setTypeface(type);
    chkgift.setTypeface(type);

    documentdialog.setCanceledOnTouchOutside(true);
    documentdialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {

            headdocument.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800);
            slideoutheaddocument.setDuration(500);
            slideoutheaddocument.setFillAfter(true);
            headdocument.startAnimation(slideoutheaddocument);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("doc_insurance", chkinsurance.isChecked());
            mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked());
            mp.put("doc_bill", chkbill.isChecked());
            mp.put("doc_licensePlate", chklicensePlate.isChecked());
            mp.put("doc_licenseManual", chklicenseManual.isChecked());
            mp.put("doc_carPartPaper", chkcarPartPaper.isChecked());
            mp.put("doc_carManual", chkcarManual.isChecked());
            mp.put("doc_licenseRegister", chklicenseRegister.isChecked());
            mp.put("doc_gift", chkgift.isChecked());

            filterStore("document", mp);
            save(mp);

        }
    });

    TextView document = (TextView) documentdialog.getWindow().findViewById(R.id.Document);
    document.setTypeface(type);
    Button documentback = (Button) documentdialog.getWindow().findViewById(R.id.Documentback);
    documentback.setTypeface(type);
    documentback.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            documentdialog.dismiss();

            headdocument.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800);
            slideoutheaddocument.setDuration(500);
            slideoutheaddocument.setFillAfter(true);
            headdocument.startAnimation(slideoutheaddocument);

            Map<String, Boolean> mp = new HashMap<String, Boolean>();

            mp.put("doc_insurance", chkinsurance.isChecked());
            mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked());
            mp.put("doc_bill", chkbill.isChecked());
            mp.put("doc_licensePlate", chklicensePlate.isChecked());
            mp.put("doc_licenseManual", chklicenseManual.isChecked());
            mp.put("doc_carPartPaper", chkcarPartPaper.isChecked());
            mp.put("doc_carManual", chkcarManual.isChecked());
            mp.put("doc_licenseRegister", chklicenseRegister.isChecked());
            mp.put("doc_gift", chkgift.isChecked());

            filterStore("document", mp);
            save(mp);

        }

    });

    chkinsurance.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkactTaxLabel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkbill.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chklicensePlate.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chklicenseManual.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkcarPartPaper.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkcarManual.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chklicenseRegister.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    chkgift.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean increment = true;
            if (((CheckBox) v).isChecked()) {
                getTotalDocument(increment);
            } else {
                increment = false;
                getTotalDocument(increment);
            }
            DocumentProgress.setProgress(PercenDocument);
            percendocument.setText("" + PercenDocument + "%");
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    headdocument.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheaddocument = new TranslateAnimation(0, 0, 800, 350);
    slideheaddocument.setDuration(500);
    slideheaddocument.setFillAfter(true);
    headdocument.startAnimation(slideheaddocument);

    documentdialog.show();

    WindowManager.LayoutParams params = documentdialog.getWindow().getAttributes();
    params.y = 350;
    params.x = 60;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    documentdialog.getWindow().setAttributes(params);

    chkinsurance.setChecked(load("doc_insurance"));
    chkactTaxLabel.setChecked(load("doc_actTaxLabel"));
    chkbill.setChecked(load("doc_bill"));
    chklicensePlate.setChecked(load("doc_licensePlate"));
    chklicenseManual.setChecked(load("doc_licenseManual"));
    chkcarPartPaper.setChecked(load("doc_carPartPaper"));
    chkcarManual.setChecked(load("doc_carManual"));
    chklicenseRegister.setChecked(load("doc_licenseRegister"));
    chkgift.setChecked(load("doc_gift"));

}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

private void SlideSettingLayout() {

    SharedPreferences mSharedPrefs = getSharedPreferences("mysettings", Context.MODE_PRIVATE);

    // Bundle seek = getIntent().getExtras();
    final Dialog settingdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    settingdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    settingdialog.setContentView(R.layout.settingdialoglayout);

    final SeekBar powerseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Powerbar);
    final SeekBar engineseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Enginebar);
    final SeekBar exteriorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Exteriorbar);
    // exteriorseekbar.setIndeterminate(false);
    final SeekBar interiorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Interiorbar);
    final SeekBar documentseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Documentbar);
    // seekbar.putInt("Powerbar", powerseekbarValue).commit();
    // if(seek != null){
    Log.i("insettings", "seekbar : power-> " + mSharedPrefs.getInt("Powerbar", 0));
    Log.i("insettings", "seekbar : engine->" + mSharedPrefs.getInt("Enginebar", 0));
    Log.i("insettings", "seekbar : exterior->" + mSharedPrefs.getInt("Exteriorbar", 0));
    Log.i("insettings", "seekbar : interior->" + mSharedPrefs.getInt("Interiorbar", 0));
    Log.i("insettings", "seekbar : document->" + mSharedPrefs.getInt("Documentbar", 0));
    powerseekbar.setProgress(mSharedPrefs.getInt("Powerbar", 0));
    engineseekbar.setProgress(mSharedPrefs.getInt("Enginebar", 0));
    exteriorseekbar.setProgress(mSharedPrefs.getInt("Exteriorbar", 0));
    interiorseekbar.setProgress(mSharedPrefs.getInt("Interiorbar", 0));
    documentseekbar.setProgress(mSharedPrefs.getInt("Documentbar", 0));

    /*// ww  w .  jav a 2s  .com
     * for(Map.Entry<String, Integer> entry : mapSetting.entrySet()){
     * if("interior".equals(entry.getKey())) edit.putInt("Interiorbar",
     * entry.getValue()); else if("power".equals(entry.getKey()))
     * edit.putInt("Powerbar", entry.getValue()); else
     * if("engine".equals(entry.getKey())) edit.putInt("Enginebar",
     * entry.getValue()); else if("exterior".equals(entry.getKey()))
     * edit.putInt("Exteriorbar", entry.getValue()); else
     * edit.putInt("Documentbar", entry.getValue());
     * 
     * //Log.i("checkSettingsName", "checkSettingsName : " +
     * entry.getKey()); }
     */

    // ****************************************************check exist
    // current setting

    int powerBar = mSharedPrefs.getInt("Powerbar", 0);
    int engineBar = mSharedPrefs.getInt("Enginebar", 0);
    int exteriorBar = mSharedPrefs.getInt("Exteriorbar", 0);
    int interiorBar = mSharedPrefs.getInt("Interiorbar", 0);
    int documentBar = mSharedPrefs.getInt("Documentbar", 0);

    Log.i("power_setting", "*****in setting******power setting : " + powerBar);
    Log.i("engine_setting", "engine setting : " + engineBar);
    Log.i("exterior_setting", "exterior setting : " + exteriorBar);
    Log.i("interior_setting", "interior setting : " + interiorBar);
    Log.i("document_setting", "document setting : " + documentBar);

    // }
    TextView setting = (TextView) settingdialog.getWindow().findViewById(R.id.Setting);
    TextView priority = (TextView) settingdialog.getWindow().findViewById(R.id.Priority);
    TextView low = (TextView) settingdialog.getWindow().findViewById(R.id.Low);
    TextView high = (TextView) settingdialog.getWindow().findViewById(R.id.High);
    TextView textexterior = (TextView) settingdialog.getWindow().findViewById(R.id.textexterior);
    TextView textinterior = (TextView) settingdialog.getWindow().findViewById(R.id.textinterior);
    TextView textpower = (TextView) settingdialog.getWindow().findViewById(R.id.textpower);
    TextView textengine = (TextView) settingdialog.getWindow().findViewById(R.id.textengine);
    TextView textdocument = (TextView) settingdialog.getWindow().findViewById(R.id.textdocument);
    TextView one = (TextView) settingdialog.getWindow().findViewById(R.id.one);
    TextView two = (TextView) settingdialog.getWindow().findViewById(R.id.two);
    TextView three = (TextView) settingdialog.getWindow().findViewById(R.id.three);
    TextView four = (TextView) settingdialog.getWindow().findViewById(R.id.four);
    TextView five = (TextView) settingdialog.getWindow().findViewById(R.id.five);

    setting.setTypeface(type);
    priority.setTypeface(type);
    low.setTypeface(type);
    high.setTypeface(type);
    textexterior.setTypeface(type);
    textinterior.setTypeface(type);
    textpower.setTypeface(type);
    textengine.setTypeface(type);
    textdocument.setTypeface(type);
    one.setTypeface(type);
    two.setTypeface(type);
    three.setTypeface(type);
    four.setTypeface(type);
    five.setTypeface(type);

    settingdialog.getWindow().getAttributes().windowAnimations = R.style.SettingDialogAnimation;
    settingdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = settingdialog.getWindow().getAttributes();
    lp.dimAmount = 0f;
    settingdialog.setCanceledOnTouchOutside(true);
    settingdialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {

            headsetting.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadsetting = new TranslateAnimation(0, 0, 0, -468);
            slideoutheadsetting.setDuration(500);
            slideoutheadsetting.setFillAfter(true);
            headsetting.startAnimation(slideoutheadsetting);

        }
    });

    Button btnsave = (Button) settingdialog.getWindow().findViewById(R.id.save);
    btnsave.setTypeface(type);
    btnsave.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            settingdialog.dismiss();

            headsetting.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadsetting = new TranslateAnimation(0, 0, 0, -468);
            slideoutheadsetting.setDuration(500);
            slideoutheadsetting.setFillAfter(true);
            headsetting.startAnimation(slideoutheadsetting);

            powerseekbarValue = powerseekbar.getProgress();
            engineseekbarValue = engineseekbar.getProgress();
            exteriorseekbarValue = exteriorseekbar.getProgress();
            interiorseekbarValue = interiorseekbar.getProgress();
            documentseekbarValue = documentseekbar.getProgress();

            Priority();

            SharedPreferences mSharedPrefs = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
            Editor seekbar = mSharedPrefs.edit();
            seekbar.putInt("Powerbar", powerseekbarValue);
            seekbar.putInt("Enginebar", engineseekbarValue);
            seekbar.putInt("Exteriorbar", exteriorseekbarValue);
            seekbar.putInt("Interiorbar", interiorseekbarValue);
            seekbar.putInt("Documentbar", documentseekbarValue);
            seekbar.commit();

            /*
             * int powerBar = shared2.getInt("Powerbar", 0); int engineBar =
             * shared2.getInt("Enginebar", 0); int exteriorBar =
             * shared2.getInt("Exteriorbar", 0); int interiorBar =
             * shared2.getInt("Interiorbar", 0); int documentBar =
             * shared2.getInt("Documentbar", 0);
             */
            RatioProgress.setProgress(PercenRatio);
            Ratiotext.setText("Rating of the Vehicle.   " + PercenRatio + "  %");
            CheckRatio();
        }
    });

    Button btnreset = (Button) settingdialog.getWindow().findViewById(R.id.reset);
    btnreset.setTypeface(type);
    btnreset.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            AlertDialog alertDialog = new AlertDialog.Builder(CarCheckListActivity.this).setTitle("Reset")
                    .setMessage("Do you really want to clear data?")
                    .setPositiveButton("Cancel", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // do nothing
                        }
                    }).setNegativeButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            Intent intent = getIntent();
                            SharedPreferences sharedPreferences = getSharedPreferences("mysettings",
                                    Context.MODE_PRIVATE);
                            sharedPreferences.edit().clear().commit();

                            /*
                             * int CheckDocumentTotal,
                             * CheckPowerTotal, CheckEngineTotal,
                             * CheckExteriorTotal,
                             * CheckInteriorTotal, PercenDocument,
                             * PercenPower, PercenEngine,
                             * PercenExterior, PercenInterior,
                             * PercenRatio, Checknum,
                             * powerseekbarValue,
                             * engineseekbarValue,
                             * exteriorseekbarValue,
                             * interiorseekbarValue,
                             * documentseekbarValue, sumPriority,
                             * PowerPriority, EnginePriority,
                             * ExteriorPriority, InteriorPriority,
                             * DocumentPriority,
                             * documentprogressValue;
                             */

                            /*
                             * Log.i("checkreset",
                             * "BEFORE CLEAR -> CheckDocumentTotal : "
                             * + CheckDocumentTotal);
                             * Log.i("checkreset",
                             * "CheckPowerTotal : " +
                             * CheckPowerTotal); Log.i("checkreset",
                             * "CheckEngineTotal : " +
                             * CheckEngineTotal);
                             * Log.i("checkreset",
                             * "CheckExteriorTotal : " +
                             * CheckExteriorTotal);
                             * Log.i("checkreset",
                             * "CheckInteriorTotal : " +
                             * CheckInteriorTotal);
                             * Log.i("checkreset",
                             * "PercenDocument : " +
                             * PercenDocument); Log.i("checkreset",
                             * "PercenPower : " + PercenPower);
                             * Log.i("checkreset", "PercenEngine : "
                             * + PercenEngine); Log.i("checkreset",
                             * "PercenExterior : " +
                             * PercenExterior); Log.i("checkreset",
                             * "PercenInterior : " +
                             * PercenInterior); Log.i("checkreset",
                             * "PercenRatio : " + PercenRatio);
                             * Log.i("checkreset", "Checknum : " +
                             * Checknum); Log.i("checkreset",
                             * "powerseekbarValue : " +
                             * powerseekbarValue);
                             * Log.i("checkreset",
                             * "engineseekbarValue : " +
                             * engineseekbarValue);
                             * Log.i("checkreset",
                             * "interiorseekbarValue : " +
                             * interiorseekbarValue);
                             * Log.i("checkreset",
                             * "exteriorseekbarValue : " +
                             * exteriorseekbarValue);
                             * Log.i("checkreset",
                             * "documentseekbarValue : " +
                             * documentseekbarValue);
                             * Log.i("checkreset", "sumPriority : "
                             * + sumPriority); Log.i("checkreset",
                             * "PowerPriority : " + PowerPriority);
                             * Log.i("checkreset",
                             * "EnginePriority : " +
                             * EnginePriority); Log.i("checkreset",
                             * "ExteriorPriority : " +
                             * ExteriorPriority);
                             * Log.i("checkreset",
                             * "InteriorPriority : " +
                             * InteriorPriority);
                             * Log.i("checkreset",
                             * "DocumentPriority : " +
                             * DocumentPriority);
                             */

                            getIntent().removeExtra("power");
                            getIntent().removeExtra("engine");
                            getIntent().removeExtra("exterior");
                            getIntent().removeExtra("interior");
                            getIntent().removeExtra("document");
                            //startActivity(intent);
                            Intent ii = new Intent(getApplicationContext(), CarCheckListActivity.class);
                            startActivity(ii);
                            finish();

                        }
                    }).show();
        }
    });

    Button btnChangeLanguage = (Button) settingdialog.getWindow().findViewById(R.id.change_language);
    btnChangeLanguage.setTypeface(type);
    btnChangeLanguage.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent myIntent = new Intent(CarCheckListActivity.this, ChangeLanguage.class);

            // th
            myIntent.putExtra("power", PercenPower);
            myIntent.putExtra("engine", PercenEngine);
            myIntent.putExtra("exterior", PercenExterior);
            myIntent.putExtra("interior", PercenInterior);
            myIntent.putExtra("document", PercenDocument);
            myIntent.putExtra("numpower", CheckPowerTotal);
            myIntent.putExtra("numengine", CheckEngineTotal);
            myIntent.putExtra("numexterior", CheckExteriorTotal);
            myIntent.putExtra("numinterior", CheckInteriorTotal);
            myIntent.putExtra("numdocument", CheckDocumentTotal);

            SharedPreferences shared = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
            Editor editor = shared.edit();
            int powerBar = shared.getInt("Powerbar", 0);
            int engineBar = shared.getInt("Enginebar", 0);
            int exteriorBar = shared.getInt("Exteriorbar", 0);
            int interiorBar = shared.getInt("Interiorbar", 0);
            int documentBar = shared.getInt("Documentbar", 0);

            Log.i("power_setting", "power setting : " + powerBar);
            Log.i("engine_setting", "engine setting : " + engineBar);
            Log.i("exterior_setting", "exterior setting : " + exteriorBar);
            Log.i("interior_setting", "interior setting : " + interiorBar);
            Log.i("document_setting", "document setting : " + documentBar);

            Log.i("checkInList", "Check in List : " + shared.getInt("checknum", 0));
            CarCheckListActivity.this.startActivity(myIntent);
            finish();
        }
    });

    Button btnRecord = (Button) settingdialog.getWindow().findViewById(R.id.record);
    btnRecord.setTypeface(type);

    btnRecord.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.i("record", "record onClick");
            final AlertDialog.Builder adb = new AlertDialog.Builder(getApplicationContext());
            adb.setTitle("Warning Dialog");
            adb.setMessage("you must select more than one checklist.");
            adb.setPositiveButton("Ok", null);

            SharedPreferences shared = getSharedPreferences("mysettings", MODE_PRIVATE);

            powerWeight = shared.getInt("Powerbar", 0);
            engineWeight = shared.getInt("Enginebar", 0);
            exteriorWeight = shared.getInt("Exteriorbar", 0);
            interiorWeight = shared.getInt("Interiorbar", 0);
            documentWeight = shared.getInt("Documentbar", 0);

            String display = "before record activity >> " + powerWeight + "|" + engineWeight + "|"
                    + exteriorWeight + "|" + interiorWeight + "|" + documentWeight;
            Log.i("display", display);

            Log.i("checklist", "" + PercenPower);
            Log.i("checklist", "" + PercenEngine);
            Log.i("checklist", "" + PercenExterior);
            Log.i("checklist", "" + PercenInterior);
            Log.i("checklist", "" + PercenDocument);

            // checking scope
            isSaveCheckBox();
            // progressCheckListLog();
            // checking scope

            CarCheckListActivity.this.startActivity(intent);
            finish();
        }
    });

    Button btnList = (Button) settingdialog.getWindow().findViewById(R.id.list);
    btnList.setTypeface(type);

    btnList.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Checknumcheckbox();

            Intent listSaving = new Intent(getApplicationContext(), ListSaveActivity.class);
            startActivity(listSaving);
            finish();
        }
    });

    headsetting.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadsetting = new TranslateAnimation(0, 0, -468, 0);
    slideheadsetting.setDuration(500);
    slideheadsetting.setFillAfter(true);
    headsetting.startAnimation(slideheadsetting);

    settingdialog.show();

    WindowManager.LayoutParams params = settingdialog.getWindow().getAttributes();
    params.y = 0;
    params.x = 60;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    settingdialog.getWindow().setAttributes(params);

    powerseekbarValue = mSharedPrefs.getInt("Powerbar", 0);
    engineseekbarValue = mSharedPrefs.getInt("Enginebar", 0);
    exteriorseekbarValue = mSharedPrefs.getInt("Exteriorbar", 0);
    interiorseekbarValue = mSharedPrefs.getInt("Interiorbar", 0);
    documentseekbarValue = mSharedPrefs.getInt("Documentbar", 0);

    PowerPriority = powerseekbarValue + 1;
    EnginePriority = engineseekbarValue + 1;
    ExteriorPriority = exteriorseekbarValue + 1;
    InteriorPriority = interiorseekbarValue + 1;
    DocumentPriority = documentseekbarValue + 1;

    /*
     * powerseekbar.setProgress(mSharedPrefs.getInt("Powerbar", 0));
     * engineseekbar.setProgress(mSharedPrefs.getInt("Enginebar", 0));
     * exteriorseekbar.setProgress(mSharedPrefs.getInt("Exteriorbar", 0));
     * interiorseekbar.setProgress(mSharedPrefs.getInt("Interior", 0));
     * documentseekbar.setProgress(mSharedPrefs.getInt("Documentbar", 0));
     */

    powerseekbar.setProgress(powerseekbarValue);
    engineseekbar.setProgress(engineseekbarValue);
    exteriorseekbar.setProgress(exteriorseekbarValue);
    interiorseekbar.setProgress(interiorseekbarValue);
    documentseekbar.setProgress(documentseekbarValue);

}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

public void menuToggle(int motionin, int motionout, int fragment) {

    /*/*from w w w .  j  av  a 2  s . com*/
     * final Dialog settingdialog = new Dialog(CarCheckListActivity.this,
     * R.style.backgrounddialog); settingdialog.dismiss();
     */

    new Dialog(CarCheckListActivity.this, R.style.backgrounddialog).dismiss();

    headsetting.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideoutheadsetting = new TranslateAnimation(0, 0, 0, -468);
    slideoutheadsetting.setDuration(500);
    slideoutheadsetting.setFillAfter(true);
    headsetting.startAnimation(slideoutheadsetting);

    int prefer = getSharedPreferences("mysettings", MODE_PRIVATE).getInt("already", 1);
    if (prefer == 1) {
        getSharedPreferences("mysettings", MODE_PRIVATE).edit().putInt("already", 0).commit();

        FragmentTransaction ft = getFragmentManager().beginTransaction().setCustomAnimations(motionin,
                motionout);
        FragmentManager fm = getFragmentManager();
        Fragment fmTarget = fm.findFragmentById(fragment);
        ft.show(fmTarget);
        ft.commit();
    } else {
        getSharedPreferences("mysettings", MODE_PRIVATE).edit().putInt("already", 1).commit();
        FragmentTransaction ft = getFragmentManager().beginTransaction().setCustomAnimations(motionin,
                motionout);
        FragmentManager fm = getFragmentManager();
        final Fragment fmTarget = fm.findFragmentById(fragment);
        ft.hide(fmTarget);
        ft.commit();
    }
}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

public void filterStore(String menuName, Map<String, Boolean> mp) {
    // progressCheckListMemo();
    SharedPreferences sharedPreferences = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    String tmp = "";
    // Log.i("filter", "infileter : " + menuName);
    for (Map.Entry<String, Boolean> entry : mp.entrySet()) {
        editor.putBoolean(entry.getKey(), entry.getValue());

        editor.commit();/*from   w  w  w.  j  av  a 2  s . c  om*/
        String result = (entry.getValue()) ? "t" : "f";
        tmp += entry.getKey() + "-" + result + ",";
    }
    final Dialog settingdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    settingdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    settingdialog.setContentView(R.layout.settingdialoglayout);

    final SeekBar powerSeekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Powerbar);
    final SeekBar engineSeekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Enginebar);
    final SeekBar exteriorSeekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Exteriorbar);
    final SeekBar interiorSeekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Interiorbar);
    final SeekBar documentSeekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Documentbar);
    tmp = tmp.substring(0, tmp.length() - 1);

    // Log.i("store", menuName + " : " + tmp);
    editor.putString(menuName, tmp);
    Log.i("checknum", "CHECKNUM IN FILTERSTORE : " + Checknum);
    editor.putInt("checknum", Checknum);
    editor.putInt("percentRatio", PercenRatio);
    intent.putExtra(menuName, tmp);
    editor.commit();
    String checklistInMem = sharedPreferences.getString(menuName, "");
    Log.i("inmem", "*** " + checklistInMem);
    editor.putInt("checknum", Checknum);
    editor.commit();
    // CHECK
    // ------------------------------------------------------------------------------------
    // checkBug("ON CANCEL ");
    editor.putInt("PercenPower", PercenPower);
    editor.putInt("PercenEngine", PercenEngine);
    editor.putInt("PercenExterior", PercenExterior);
    editor.putInt("PercenInterior", PercenInterior);
    editor.putInt("PercenDocument", PercenDocument);
    editor.commit();
}

From source file:com.xplink.android.carchecklist.CarCheckListActivity.java

public void getSettingShared() {
    SharedPreferences mSharedPrefs = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
    final Dialog settingdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    settingdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    settingdialog.setContentView(R.layout.settingdialoglayout);
    final SeekBar powerseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Powerbar);
    final SeekBar engineseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Enginebar);
    final SeekBar exteriorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Exteriorbar);
    final SeekBar interiorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Interiorbar);
    final SeekBar documentseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Documentbar);
    // seekbar.putInt("Powerbar", powerseekbarValue).commit();
    // powerseekbar.setProgress(4);
    // Log.i("seek", "setProgress(4)");
    engineseekbar.setProgress(mSharedPrefs.getInt("Enginebar", 0));
    exteriorseekbar.setProgress(mSharedPrefs.getInt("Exteriorbar", 0));
    interiorseekbar.setProgress(mSharedPrefs.getInt("Interiorbar", 0));
    documentseekbar.setProgress(mSharedPrefs.getInt("Documentbar", 0));
}