Example usage for android.app Dialog requestWindowFeature

List of usage examples for android.app Dialog requestWindowFeature

Introduction

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

Prototype

public final boolean requestWindowFeature(int featureId) 

Source Link

Document

Enable extended window features.

Usage

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

private void checkMixedMountPoint(final ArrayList<LocalFileLastModifiedMaintListItem> maint_list) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (!prefs.getBoolean(SMBSYNC_SUPPRESS_WARNING_MIXED_MP, false)) {
        boolean mixed_mp = false;
        String mp_name = null;//w w  w  . ja v a 2  s  .  com
        for (int i = 0; i < mGp.profileAdapter.getCount(); i++) {
            ProfileListItem s_pli = mGp.profileAdapter.getItem(i);
            if (s_pli.getType().equals(SMBSYNC_PROF_TYPE_SYNC)
                    && s_pli.getActive().equals(SMBSYNC_PROF_ACTIVE)) {
                ProfileListItem o_pli = null;
                if (s_pli.getMasterType().equals(SMBSYNC_PROF_TYPE_LOCAL)) {
                    o_pli = getProfileListItem(SMBSYNC_PROF_TYPE_LOCAL, s_pli.getMasterName());
                } else {
                    o_pli = getProfileListItem(SMBSYNC_PROF_TYPE_LOCAL, s_pli.getTargetName());
                }
                if (o_pli != null) {
                    if (mp_name != null) {
                        //                     Log.v("","mp_name="+o_pli.getLocalMountPoint());
                        if (!o_pli.getLocalMountPoint().equals(mp_name)) {
                            mixed_mp = true;
                            break;
                        }
                    } else {
                        //                     Log.v("","mp_name init ="+mp_name);
                        mp_name = o_pli.getLocalMountPoint();
                    }
                }
            }
        }
        //         Log.v("","mixed_mp="+mixed_mp);
        if (!mixed_mp) {
            checkLastModifiedCorrupted(maint_list);
        } else {
            final Dialog dialog = new Dialog(mContext);//, android.R.style.Theme_Black);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.mixed_mount_point_dialog);
            TextView title = (TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_title);
            title.setText(mContext.getString(R.string.msgs_common_dialog_warning));
            title.setTextColor(Color.YELLOW);

            ((TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_subtitle))
                    .setText(mContext.getString(R.string.msgs_local_file_modified_maint_mixed_old_new_title));

            ((TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_msg))
                    .setText(mContext.getString(R.string.msgs_local_file_modified_maint_mixed_old_new_msg));

            final Button btnOk = (Button) dialog.findViewById(R.id.common_dialog_btn_ok);
            final CheckBox cbSuppr = (CheckBox) dialog.findViewById(R.id.mixed_mount_point_dialog_suppress);

            CommonDialog.setDlgBoxSizeCompact(dialog);
            cbSuppr.setChecked(false);
            // OK?
            btnOk.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    dialog.dismiss();
                    if (cbSuppr.isChecked()) {
                        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
                        prefs.edit().putBoolean(SMBSYNC_SUPPRESS_WARNING_MIXED_MP, true).commit();
                    }
                    checkLastModifiedCorrupted(maint_list);
                }
            });
            // Cancel?
            dialog.setOnCancelListener(new Dialog.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface arg0) {
                    btnOk.performClick();
                }
            });
            //            dialog.setOnKeyListener(new DialogOnKeyListener(mContext));
            //            dialog.setCancelable(false);
            dialog.show();
        }
    }
}

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));
}

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  ww  w  . j  a v a 2s  .  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

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  ww.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.swetha.easypark.GetParkingLots.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    if (!isGooglePlayServicesAvailable()) {
        finish();/*from   w w w  . j  a  v  a  2  s  . c o m*/
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.getparkinglots);

    SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    googleMap = supportMapFragment.getMap();

    googleMap.setMyLocationEnabled(true);
    LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    gps_enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

    if (gps_enabled) {
        Criteria criteria = new Criteria();

        provider = locationManager.getBestProvider(criteria, true);

        if (provider != null && !provider.equals("")) {

            locationManager.requestLocationUpdates(provider, 500, 1, GetParkingLots.this);
            // Get the location from the given provider 
            location = locationManager.getLastKnownLocation(provider);

        }
    }
    Log.i("GetParkingLots", "Value of network_enabled and location" + network_enabled + location);
    if (location == null && network_enabled) {

        location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
        locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 500, 1, GetParkingLots.this);

    }

    if (location == null && !network_enabled && !gps_enabled) {
        Toast.makeText(getBaseContext(), "Enable your location services", Toast.LENGTH_LONG).show();
    }
    if (location != null)
        onLocationChanged(location);
    else {

        Toast.makeText(getBaseContext(), "Location can't be retrieved", Toast.LENGTH_SHORT).show();
    }

    tv_fromTime = (TextView) findViewById(R.id.tv_fromTime);
    fromTimeString = Constants.dtf.format(new Date()).toString();
    tv_fromTime.setText(fromTimeString);
    long lval = DateTimeHelpers.convertToLongFromTime(Constants.dtf.format(new Date()).toString());
    Log.i("GetParkingLots",
            "The value of current time:" + Constants.dtf.format(new Date()).toString() + "in long is" + lval);
    Log.i("GetParkingLots",
            "The value of current time:" + lval + "in long is" + DateTimeHelpers.convertToTimeFromLong(lval));
    tv_toTime = (TextView) findViewById(R.id.tv_ToTime);
    // Parsing the date
    toTimeString = Constants.dtf.format(new Date()).toString();
    tv_toTime.setText(toTimeString);

    btnFromTime = (Button) findViewById(R.id.fromButton);
    btnFromTime.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            // Create the dialog
            final Dialog mDateTimeDialog = new Dialog(GetParkingLots.this);
            // Inflate the root layout
            final RelativeLayout mDateTimeDialogView = (RelativeLayout) getLayoutInflater()
                    .inflate(R.layout.date_time_dialog, null);
            // Grab widget instance
            mDateTimePicker = (DateTimePicker) mDateTimeDialogView.findViewById(R.id.DateTimePicker);
            mDateTimePicker.setDateChangedListener(GetParkingLots.this);

            // Update demo TextViews when the "OK" button is clicked 
            ((Button) mDateTimeDialogView.findViewById(R.id.SetDateTime))
                    .setOnClickListener(new OnClickListener() {
                        Calendar cal;

                        @SuppressWarnings("deprecation")
                        public void onClick(View v) {
                            mDateTimePicker.clearFocus();
                            try {
                                cal = new GregorianCalendar(mDateTimePicker.getYear(),
                                        Integer.parseInt(mDateTimePicker.getMonth()), mDateTimePicker.getDay(),
                                        mDateTimePicker.getHour(), mDateTimePicker.getMinute());
                                fromTimeString = DateTimeHelpers.dtf.format(cal.getTime());
                                tv_fromTime.setText(fromTimeString);
                            } catch (Exception e) {
                                final AlertDialog alertDialog = new AlertDialog.Builder(GetParkingLots.this)
                                        .create();

                                alertDialog.setMessage("Enter a valid date");

                                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int which) {

                                        alertDialog.dismiss();
                                    }
                                });

                                alertDialog.show();
                            }

                            mDateTimeDialog.dismiss();
                        }
                    });

            // Cancel the dialog when the "Cancel" button is clicked
            ((Button) mDateTimeDialogView.findViewById(R.id.CancelDialog))
                    .setOnClickListener(new OnClickListener() {

                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            mDateTimeDialog.cancel();
                        }
                    });

            // Reset Date and Time pickers when the "Reset" button is clicked

            ((Button) mDateTimeDialogView.findViewById(R.id.ResetDateTime))
                    .setOnClickListener(new OnClickListener() {

                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            mDateTimePicker.reset();
                        }
                    });

            // Setup TimePicker
            // No title on the dialog window
            mDateTimeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            // Set the dialog content view
            mDateTimeDialog.setContentView(mDateTimeDialogView);
            // Display the dialog
            mDateTimeDialog.show();

        }
    });

    btnToTime = (Button) findViewById(R.id.toButton);
    btnToTime.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            // Create the dialog
            final Dialog mDateTimeDialog = new Dialog(GetParkingLots.this);
            // Inflate the root layout
            final RelativeLayout mDateTimeDialogView = (RelativeLayout) getLayoutInflater()
                    .inflate(R.layout.date_time_dialog, null);
            // Grab widget instance
            final DateTimePicker mDateTimePicker = (DateTimePicker) mDateTimeDialogView
                    .findViewById(R.id.DateTimePicker);
            mDateTimePicker.setDateChangedListener(GetParkingLots.this);

            // Update demo TextViews when the "OK" button is clicked 
            ((Button) mDateTimeDialogView.findViewById(R.id.SetDateTime))
                    .setOnClickListener(new OnClickListener() {
                        Calendar cal;

                        @SuppressWarnings("deprecation")
                        public void onClick(View v) {
                            mDateTimePicker.clearFocus();

                            Log.i("toButton", "Value of ToString before cal" + toTimeString);
                            try {
                                cal = new GregorianCalendar(mDateTimePicker.getYear(),
                                        Integer.parseInt(mDateTimePicker.getMonth()), mDateTimePicker.getDay(),
                                        mDateTimePicker.getHour(), mDateTimePicker.getMinute());
                                toTimeString = DateTimeHelpers.dtf.format(cal.getTime());
                                Log.i("toButton", "Value of ToString before cal" + toTimeString);

                                tv_toTime.setText(toTimeString);

                            } catch (Exception e) // fixing the bug where the user doesnt enter anything in the textbox
                            {
                                final AlertDialog alertDialog = new AlertDialog.Builder(GetParkingLots.this)
                                        .create();

                                alertDialog.setMessage("Enter a valid date");
                                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int which) {
                                        alertDialog.dismiss();
                                    }
                                });

                                alertDialog.show();
                            }
                            //dateTimeTo = new DateTime(mDateTimePicker.getYear(), Integer.parseInt(mDateTimePicker.getMonth()) ,  mDateTimePicker.getDay(),  mDateTimePicker.getHour(),  mDateTimePicker.getMinute()); ;

                            mDateTimeDialog.dismiss();
                        }
                    });

            ((Button) mDateTimeDialogView.findViewById(R.id.CancelDialog))
                    .setOnClickListener(new OnClickListener() {

                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            mDateTimeDialog.cancel();
                        }
                    });

            // Reset Date and Time pickers when the "Reset" button is clicked

            ((Button) mDateTimeDialogView.findViewById(R.id.ResetDateTime))
                    .setOnClickListener(new OnClickListener() {

                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            mDateTimePicker.reset();
                        }
                    });

            // Setup TimePicker
            // No title on the dialog window
            mDateTimeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            // Set the dialog content view
            mDateTimeDialog.setContentView(mDateTimeDialogView);
            // Display the dialog
            mDateTimeDialog.show();

        }
    });

    btnGetParkingLots = (Button) findViewById(R.id.getNearByParkingLotsButton);
    btnGetParkingLots.setOnClickListener(new View.OnClickListener() {

        @SuppressWarnings("deprecation")
        public void onClick(View v) {
            et_search = (EditText) findViewById(R.id.edittextsearch);
            rg = (RadioGroup) findViewById(R.id.rg);
            checkedRbId = rg.getCheckedRadioButtonId();
            Log.i("LOG_TAG: GetParkingLots", "checked radiobutton id is" + checkedRbId);

            if (checkedRbId == R.id.rbradius) {
                isRadiusIndicator = true;
                radius = et_search.getText().toString();
            } else {
                isRadiusIndicator = false;
                zipcode = et_search.getText().toString();
            }

            final Intent intent = new Intent(GetParkingLots.this, DisplayVacantParkingLots.class);
            Log.i(TAG, "Inside getNearByParkingLots");
            Log.i(TAG, "Value of fromString" + fromTimeString);
            long lFromVal = DateTimeHelpers.convertToLongFromTime(fromTimeString);
            Log.i(TAG, "Value of ToString" + toTimeString);
            long lToVal = DateTimeHelpers.convertToLongFromTime(toTimeString);
            if ((lToVal - lFromVal) < Constants.thrityMinInMilliSeconds) {
                final AlertDialog alertDialog = new AlertDialog.Builder(GetParkingLots.this).create();

                alertDialog.setMessage("You have to park the car for at least 30 min");

                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                        alertDialog.dismiss();
                    }
                });

                alertDialog.show();

            } else {
                intent.putExtra(LATITUDE, latitude);
                intent.putExtra(LONGITUDE, longitude);
                intent.putExtra(FROMTIME, lFromVal);
                intent.putExtra(TOTIME, lToVal);
                intent.putExtra(RadiusOrZIPCODE, isRadiusIndicator);
                if (isRadiusIndicator)
                    try {

                        intent.putExtra(RADIUS, Double.parseDouble(radius));
                        startActivity(intent);
                    } catch (Exception e) {
                        final AlertDialog alertDialog = new AlertDialog.Builder(GetParkingLots.this).create();

                        alertDialog.setMessage("Enter valid radius");

                        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {

                                alertDialog.dismiss();

                            }
                        });

                        alertDialog.show();
                    }
                else {
                    try {

                        intent.putExtra(ZIPCODE, Long.parseLong(zipcode));
                        startActivity(intent);
                    } catch (Exception e) {
                        final AlertDialog alertDialog = new AlertDialog.Builder(GetParkingLots.this).create();

                        alertDialog.setMessage("Enter a valid Zip code");

                        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                alertDialog.dismiss();

                            }
                        });

                        alertDialog.show();
                    }
                }

            }

        }
    });

}

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;// w ww.  jav  a  2 s  .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 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  ww  . j ava  2  s  .com

    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.sentaroh.android.SMBSync2.SyncTaskUtility.java

public void showSelectSdcardMsg(final NotifyEvent ntfy, String msg) {
    final Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.show_select_sdcard_dlg);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.show_select_sdcard_dlg_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.show_select_sdcard_dlg_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);

    final TextView dlg_msg = (TextView) dialog.findViewById(R.id.show_select_sdcard_dlg_msg);
    dlg_msg.setText(msg);/*from  www  . j  av a2s.c om*/
    ;

    final ImageView func_view = (ImageView) dialog.findViewById(R.id.show_select_sdcard_dlg_image);

    try {
        InputStream is = mContext.getResources().getAssets()
                .open(mContext.getString(R.string.msgs_main_external_sdcard_select_required_select_msg_file));
        Bitmap bm = BitmapFactory.decodeStream(is);
        func_view.setImageBitmap(bm);
    } catch (IOException e) {
        /* ? */
    }

    final Button btnOk = (Button) dialog.findViewById(R.id.show_select_sdcard_dlg_btn_ok);
    final Button btnCancel = (Button) dialog.findViewById(R.id.show_select_sdcard_dlg_btn_cancel);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    // OK?
    btnOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
            ntfy.notifyToListener(true, null);
        }
    });
    // Cancel?
    btnCancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
            ntfy.notifyToListener(false, null);
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btnCancel.performClick();
        }
    });

    dialog.show();

}

From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java

private void editDirFilter(final int edit_idx, final AdapterFilterList fa, final FilterListItem fli,
        final String filter) {

    // ??/* ww w  .j av a2 s .co m*/
    final Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setContentView(R.layout.filter_edit_dlg);

    LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.filter_edit_dlg_view);
    ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.filter_edit_dlg_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.filter_edit_dlg_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);

    CommonDialog.setDlgBoxSizeCompact(dialog);
    final EditText et_filter = (EditText) dialog.findViewById(R.id.filter_edit_dlg_filter);
    et_filter.setText(filter);
    // CANCEL?
    final Button btn_cancel = (Button) dialog.findViewById(R.id.filter_edit_dlg_cancel_btn);
    btn_cancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
            //            glblParms.profileListView.setSelectionFromTop(currentViewPosX,currentViewPosY);
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btn_cancel.performClick();
        }
    });
    // OK?
    Button btn_ok = (Button) dialog.findViewById(R.id.filter_edit_dlg_ok_btn);
    btn_ok.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            TextView dlg_msg = (TextView) dialog.findViewById(R.id.filter_edit_dlg_msg);

            String newfilter = et_filter.getText().toString();
            if (!filter.equals(newfilter)) {
                if (isFilterExists(newfilter, fa)) {
                    String mtxt = mContext.getString(R.string.msgs_filter_list_duplicate_filter_specified);
                    dlg_msg.setText(String.format(mtxt, newfilter));
                    return;
                }
            }
            dialog.dismiss();

            fa.remove(fli);
            fa.insert(fli, edit_idx);
            fli.setFilter(newfilter);

            et_filter.setText("");

            fa.setNotifyOnChange(true);
            fa.sort(new Comparator<FilterListItem>() {
                @Override
                public int compare(FilterListItem lhs, FilterListItem rhs) {
                    return lhs.getFilter().compareToIgnoreCase(rhs.getFilter());
                };
            });
            //            p_ntfy.notifyToListener(true, null);
        }
    });
    //      dialog.setOnKeyListener(new DialogOnKeyListener(context));
    //      dialog.setCancelable(false);
    dialog.show();

}

From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java

public void renameProfile(final SyncTaskItem pli, final NotifyEvent p_ntfy) {

    // ??/*from  ww  w  .ja  v  a 2 s  . com*/
    final Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setContentView(R.layout.single_item_input_dlg);

    LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.single_item_input_dlg_view);
    ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.single_item_input_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.single_item_input_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);

    //      final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg);
    final TextView dlg_cmp = (TextView) dialog.findViewById(R.id.single_item_input_name);
    final Button btn_ok = (Button) dialog.findViewById(R.id.single_item_input_ok_btn);
    final Button btn_cancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn);
    final EditText etInput = (EditText) dialog.findViewById(R.id.single_item_input_dir);

    title.setText(mContext.getString(R.string.msgs_rename_profile));

    dlg_cmp.setVisibility(TextView.GONE);
    CommonDialog.setDlgBoxSizeCompact(dialog);
    etInput.setText(pli.getSyncTaskName());
    btn_ok.setEnabled(false);
    etInput.addTextChangedListener(new TextWatcher() {
        @Override
        public void afterTextChanged(Editable arg0) {
            if (!arg0.toString().equals(pli.getSyncTaskName()))
                btn_ok.setEnabled(true);
            else
                btn_ok.setEnabled(false);
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }
    });

    //OK button
    btn_ok.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
            String new_name = etInput.getText().toString();

            pli.setSyncTaskName(new_name);

            mGp.syncTaskAdapter.sort();
            mGp.syncTaskAdapter.notifyDataSetChanged();

            saveSyncTaskListToFile(mGp, mContext, util, false, "", "", mGp.syncTaskAdapter.getArrayList(),
                    false);

            SyncTaskUtility.setAllSyncTaskToUnchecked(true, mGp.syncTaskAdapter);

            p_ntfy.notifyToListener(true, null);
        }
    });
    // CANCEL?
    btn_cancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btn_cancel.performClick();
        }
    });
    //      dialog.setCancelable(false);
    //      dialog.setOnKeyListener(new DialogOnKeyListener(context));
    dialog.show();

}