Example usage for android.view.animation TranslateAnimation setFillAfter

List of usage examples for android.view.animation TranslateAnimation setFillAfter

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation setFillAfter.

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

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  .  ja  v  a  2s.c om
     * 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

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;//from w  w  w . ja va 2s .c  o 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 SlidePowerLayout() {

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

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

    int left500 = (int) ((width / 100) * 39);
    int top200 = (int) ((width / 100) * 15.7);

    final SharedPreferences settings = getSharedPreferences("mysettings", 0);
    final SharedPreferences.Editor editor = settings.edit();
    final Dialog powerdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog);
    powerdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    powerdialog.setContentView(R.layout.powerdialoglayout);
    powerdialog.getWindow().getAttributes().windowAnimations = R.style.PowerDialogAnimation;
    powerdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    // make everything around Dialog brightness than default
    WindowManager.LayoutParams lp = powerdialog.getWindow().getAttributes();
    lp.dimAmount = 0f;/*from   www  . j  ava2 s.  c o m*/

    final CheckBox chkpower_headLight = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_headLight);
    final CheckBox chkpower_dim = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_dim);
    final CheckBox chkpower_highBeam = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_highBeam);
    final CheckBox chkpower_dashBoardLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_dashBoardLight);
    final CheckBox chkpower_cabinSeatLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_cabinSeatLight);
    final CheckBox chkpower_sideDoorLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_sideDoorLight);
    final CheckBox chkpower_turnSignal = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_turnSignal);
    final CheckBox chkpower_air = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_air);
    final CheckBox chkpower_thermometer = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_thermometer);
    final CheckBox chkpower_horn = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_horn);
    final CheckBox chkpower_wipe = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_wipe);
    final CheckBox chkpower_rainSensor = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_rainSensor);
    final CheckBox chkpower_thirdBrakeLight = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_thirdBrakeLight);
    final CheckBox chkpower_antiFoggyBack = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_antiFoggyBack);
    final CheckBox chkpower_antiFoggySide = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_antiFoggySide);
    final CheckBox chkpower_steeringWheelTest = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_steeringWheelTest);
    final CheckBox chkpower_steeringWheelSet = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_steeringWheelSet);
    final CheckBox chkpower_carStereo = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_carStereo);
    final CheckBox chkpower_electronicWindow = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_electronicWindow);
    final CheckBox chkpower_sideMirror = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_sideMirror);
    final CheckBox chkpower_warnDoor = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_warnDoor);
    final CheckBox chkpower_warnSeatBelt = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_warnSeatBelt);
    final CheckBox chkpower_warnHandBrake = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_warnHandBrake);
    final CheckBox chkpower_clock = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_clock);
    final CheckBox chkpower_remoteKey = (CheckBox) powerdialog.getWindow().findViewById(R.id.power_remoteKey);
    final CheckBox chkpower_centralLock = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_centralLock);
    final CheckBox chkpower_transmissionPosition = (CheckBox) powerdialog.getWindow()
            .findViewById(R.id.power_transmissionPosition);

    // change font
    chkpower_headLight.setTypeface(type);
    chkpower_dim.setTypeface(type);
    chkpower_highBeam.setTypeface(type);
    chkpower_dashBoardLight.setTypeface(type);
    chkpower_cabinSeatLight.setTypeface(type);
    chkpower_sideDoorLight.setTypeface(type);
    chkpower_turnSignal.setTypeface(type);
    chkpower_air.setTypeface(type);
    chkpower_thermometer.setTypeface(type);
    chkpower_horn.setTypeface(type);
    chkpower_wipe.setTypeface(type);
    chkpower_rainSensor.setTypeface(type);
    chkpower_thirdBrakeLight.setTypeface(type);
    chkpower_antiFoggyBack.setTypeface(type);
    chkpower_antiFoggySide.setTypeface(type);
    chkpower_steeringWheelTest.setTypeface(type);
    chkpower_steeringWheelSet.setTypeface(type);
    chkpower_carStereo.setTypeface(type);
    chkpower_electronicWindow.setTypeface(type);
    chkpower_sideMirror.setTypeface(type);
    chkpower_warnDoor.setTypeface(type);
    chkpower_warnSeatBelt.setTypeface(type);
    chkpower_warnHandBrake.setTypeface(type);
    chkpower_clock.setTypeface(type);
    chkpower_remoteKey.setTypeface(type);
    chkpower_centralLock.setTypeface(type);
    chkpower_transmissionPosition.setTypeface(type);

    powerdialog.setCanceledOnTouchOutside(true);
    powerdialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            headpower.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadpower = new TranslateAnimation(0, 0, 200, 800);
            slideoutheadpower.setDuration(500);
            slideoutheadpower.setFillAfter(true);
            headpower.startAnimation(slideoutheadpower);

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

            mp.put("power_headLight", chkpower_headLight.isChecked());
            mp.put("power_dim", chkpower_dim.isChecked());
            mp.put("power_highBeam", chkpower_highBeam.isChecked());
            mp.put("power_dashBoardLight", chkpower_dashBoardLight.isChecked());
            mp.put("power_cabinSeatLight", chkpower_cabinSeatLight.isChecked());
            mp.put("power_sideDoorLight", chkpower_sideDoorLight.isChecked());
            mp.put("power_turnSignal", chkpower_turnSignal.isChecked());
            mp.put("power_air", chkpower_air.isChecked());
            mp.put("power_thermometer", chkpower_thermometer.isChecked());
            mp.put("power_horn", chkpower_horn.isChecked());
            mp.put("power_wipe", chkpower_wipe.isChecked());
            mp.put("power_rainSensor", chkpower_rainSensor.isChecked());
            mp.put("power_thirdBrakeLight", chkpower_thirdBrakeLight.isChecked());
            mp.put("power_antiFoggyBack", chkpower_antiFoggyBack.isChecked());
            mp.put("power_antiFoggySide", chkpower_antiFoggySide.isChecked());
            mp.put("power_steeringWheelTest", chkpower_steeringWheelTest.isChecked());
            mp.put("power_steeringWheelSet", chkpower_steeringWheelSet.isChecked());
            mp.put("power_carStereo", chkpower_carStereo.isChecked());
            mp.put("power_electronicWindow", chkpower_electronicWindow.isChecked());
            mp.put("power_sideMirror", chkpower_sideMirror.isChecked());
            mp.put("power_warnDoor", chkpower_warnDoor.isChecked());
            mp.put("power_warnSeatBelt", chkpower_warnSeatBelt.isChecked());
            mp.put("power_warnHandBrake", chkpower_warnHandBrake.isChecked());
            mp.put("power_clock", chkpower_clock.isChecked());
            mp.put("power_remoteKey", chkpower_remoteKey.isChecked());
            mp.put("power_centralLock", chkpower_centralLock.isChecked());
            mp.put("power_transmissionPosition", chkpower_transmissionPosition.isChecked());

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

        }
    });

    TextView power = (TextView) powerdialog.getWindow().findViewById(R.id.Power);
    power.setTypeface(type);
    Button powerback = (Button) powerdialog.getWindow().findViewById(R.id.Powerback);
    powerback.setTypeface(type);
    powerback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            powerdialog.dismiss();

            headpower.setVisibility(ImageView.VISIBLE);
            TranslateAnimation slideoutheadpower = new TranslateAnimation(0, 0, 200, 800);
            slideoutheadpower.setDuration(500);
            slideoutheadpower.setFillAfter(true);
            headpower.startAnimation(slideoutheadpower);

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

            mp.put("power_headLight", chkpower_headLight.isChecked());
            mp.put("power_dim", chkpower_dim.isChecked());
            mp.put("power_highBeam", chkpower_highBeam.isChecked());
            mp.put("power_dashBoardLight", chkpower_dashBoardLight.isChecked());
            mp.put("power_cabinSeatLight", chkpower_cabinSeatLight.isChecked());
            mp.put("power_sideDoorLight", chkpower_sideDoorLight.isChecked());
            mp.put("power_turnSignal", chkpower_turnSignal.isChecked());
            mp.put("power_air", chkpower_air.isChecked());
            mp.put("power_thermometer", chkpower_thermometer.isChecked());
            mp.put("power_horn", chkpower_horn.isChecked());
            mp.put("power_wipe", chkpower_wipe.isChecked());
            mp.put("power_rainSensor", chkpower_rainSensor.isChecked());
            mp.put("power_thirdBrakeLight", chkpower_thirdBrakeLight.isChecked());
            mp.put("power_antiFoggyBack", chkpower_antiFoggyBack.isChecked());
            mp.put("power_antiFoggySide", chkpower_antiFoggySide.isChecked());
            mp.put("power_steeringWheelTest", chkpower_steeringWheelTest.isChecked());
            mp.put("power_steeringWheelSet", chkpower_steeringWheelSet.isChecked());
            mp.put("power_carStereo", chkpower_carStereo.isChecked());
            mp.put("power_electronicWindow", chkpower_electronicWindow.isChecked());
            mp.put("power_sideMirror", chkpower_sideMirror.isChecked());
            mp.put("power_warnDoor", chkpower_warnDoor.isChecked());
            mp.put("power_warnSeatBelt", chkpower_warnSeatBelt.isChecked());
            mp.put("power_warnHandBrake", chkpower_warnHandBrake.isChecked());
            mp.put("power_clock", chkpower_clock.isChecked());
            mp.put("power_remoteKey", chkpower_remoteKey.isChecked());
            mp.put("power_centralLock", chkpower_centralLock.isChecked());
            mp.put("power_transmissionPosition", chkpower_transmissionPosition.isChecked());

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

        }
    });

    chkpower_headLight.setOnClickListener(new OnClickListener() {

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

    chkpower_dim.setOnClickListener(new OnClickListener() {

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

    chkpower_highBeam.setOnClickListener(new OnClickListener() {

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

    chkpower_dashBoardLight.setOnClickListener(new OnClickListener() {

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

    chkpower_cabinSeatLight.setOnClickListener(new OnClickListener() {

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

    chkpower_sideDoorLight.setOnClickListener(new OnClickListener() {

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

    chkpower_turnSignal.setOnClickListener(new OnClickListener() {

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

    chkpower_air.setOnClickListener(new OnClickListener() {

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

    chkpower_thermometer.setOnClickListener(new OnClickListener() {

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

    chkpower_horn.setOnClickListener(new OnClickListener() {

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

    chkpower_wipe.setOnClickListener(new OnClickListener() {

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

    chkpower_rainSensor.setOnClickListener(new OnClickListener() {

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

    chkpower_thirdBrakeLight.setOnClickListener(new OnClickListener() {

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

    chkpower_antiFoggyBack.setOnClickListener(new OnClickListener() {

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

    chkpower_antiFoggySide.setOnClickListener(new OnClickListener() {

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

    chkpower_steeringWheelTest.setOnClickListener(new OnClickListener() {

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

    chkpower_steeringWheelSet.setOnClickListener(new OnClickListener() {

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

    chkpower_carStereo.setOnClickListener(new OnClickListener() {

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

    chkpower_electronicWindow.setOnClickListener(new OnClickListener() {

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

    chkpower_sideMirror.setOnClickListener(new OnClickListener() {

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

    chkpower_warnDoor.setOnClickListener(new OnClickListener() {

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

    chkpower_warnSeatBelt.setOnClickListener(new OnClickListener() {

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

    chkpower_warnHandBrake.setOnClickListener(new OnClickListener() {

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

    chkpower_clock.setOnClickListener(new OnClickListener() {

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

    chkpower_remoteKey.setOnClickListener(new OnClickListener() {

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

    chkpower_centralLock.setOnClickListener(new OnClickListener() {

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

    chkpower_transmissionPosition.setOnClickListener(new OnClickListener() {

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

    headpower.setVisibility(ImageView.VISIBLE);
    TranslateAnimation slideheadpower = new TranslateAnimation(0, 0, 800, 200);
    slideheadpower.setDuration(300);
    slideheadpower.setFillAfter(true);
    headpower.startAnimation(slideheadpower);

    powerdialog.show();
    WindowManager.LayoutParams params = powerdialog.getWindow().getAttributes();
    params.y = top200;
    params.x = left500;
    params.gravity = Gravity.TOP | Gravity.LEFT;
    powerdialog.getWindow().setAttributes(params);

    isSaveCheckBox();

    chkpower_headLight.setChecked(load("power_headLight"));
    chkpower_dim.setChecked(load("power_dim"));
    chkpower_highBeam.setChecked(load("power_highBeam"));
    chkpower_dashBoardLight.setChecked(load("power_dashBoardLight"));
    chkpower_cabinSeatLight.setChecked(load("power_cabinSeatLight"));
    chkpower_sideDoorLight.setChecked(load("power_sideDoorLight"));
    chkpower_turnSignal.setChecked(load("power_turnSignal"));
    chkpower_air.setChecked(load("power_air"));
    chkpower_thermometer.setChecked(load("power_thermometer"));
    chkpower_horn.setChecked(load("power_horn"));
    chkpower_wipe.setChecked(load("power_wipe"));
    chkpower_rainSensor.setChecked(load("power_rainSensor"));
    chkpower_thirdBrakeLight.setChecked(load("power_thirdBrakeLight"));
    chkpower_antiFoggyBack.setChecked(load("power_antiFoggyBack"));
    chkpower_antiFoggySide.setChecked(load("power_antiFoggySide"));
    chkpower_steeringWheelTest.setChecked(load("power_steeringWheelTest"));
    chkpower_steeringWheelSet.setChecked(load("power_steeringWheelSet"));
    chkpower_carStereo.setChecked(load("power_carStereo"));
    chkpower_electronicWindow.setChecked(load("power_electronicWindow"));
    chkpower_sideMirror.setChecked(load("power_sideMirror"));
    chkpower_warnDoor.setChecked(load("power_warnDoor"));
    chkpower_warnSeatBelt.setChecked(load("power_warnSeatBelt"));
    chkpower_warnHandBrake.setChecked(load("power_warnHandBrake"));
    chkpower_clock.setChecked(load("power_clock"));
    chkpower_remoteKey.setChecked(load("power_remoteKey"));
    chkpower_centralLock.setChecked(load("power_centralLock"));
    chkpower_transmissionPosition.setChecked(load("power_transmissionPosition"));

}

From source file:com.xmobileapp.rockplayer.RockPlayer.java

/********************************
 * /*ww w  .  j  ava2 s  .c  om*/
 * switch between different UI modes
 * 
 ********************************/
public void setNormalView() {
    if (VIEW_STATE == NORMAL_VIEW) {

    } else if (VIEW_STATE == LIST_EXPANDED_VIEW) {
        /*
         * Animate fading of the current playing layout
         */

        /*
         * Put album navigator full screen (this will happen in the end of the animation)
         */
        RelativeLayout.LayoutParams params = (LayoutParams) albumNavigatorLayoutOuter.getLayoutParams();
        params.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_playing_container);
        albumNavigatorLayoutOuter.setLayoutParams(params);

        /*
         * Animate growth of the album navigator
         */
        int slideAmount = currentPlayingLayout.getWidth();
        albumNavigatorLayoutOuter.bringToFront();
        TranslateAnimation slideRight = new TranslateAnimation(-slideAmount, 0, 0, 0);
        slideRight.setFillAfter(true);
        slideRight.setDuration(250);
        slideRight.setAnimationListener(slideRightAnimationListener);
        albumNavigatorLayoutOuter.startAnimation(slideRight);

    } else if (VIEW_STATE == FULLSCREEN_VIEW) {

        setBackground();

        AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
        fadeOut.setFillAfter(true);
        fadeOut.setDuration(300);
        this.mainUIContainer.startAnimation(fadeOut);

        showFullScreenHandler.sendEmptyMessageDelayed(VIEW_STATE, 300);

        VIEW_STATE = FULLSCREEN_VIEW;

    }

    VIEW_STATE = NORMAL_VIEW;
    return;
}

From source file:com.xmobileapp.rockplayer.RockPlayer.java

public void setListExpandedView() {

    try {/* ww  w. j  a  va 2  s .  c om*/
        /*
         * Animate fading of the current playing layout
         */
        Rotate3dAnimation perspectiveFullLeft = new Rotate3dAnimation(0, 0, // X-axis rotation
                90, 90, // Y-axis rotation
                0, 0, // Z-axis rotation
                100, 100, // rotation center
                0.0f, // Z-depth
                false); //reverse movement
        perspectiveFullLeft.setFillAfter(true);
        perspectiveFullLeft.setDuration(1);
        currentPlayingLayout.startAnimation(perspectiveFullLeft);

        // hide parts of mainUI

        /*
         * Animate growth of the album navigator
         */
        int slideAmount = display.getWidth() - albumNavigatorList.getWidth();
        TranslateAnimation slideLeft = new TranslateAnimation(slideAmount, 0, 0, 0);
        slideLeft.setFillAfter(true);
        slideLeft.setDuration(400);
        albumNavigatorLayoutOuter.startAnimation(slideLeft);

        /*
         * Put album navigator full screen
         */
        RelativeLayout.LayoutParams params = (LayoutParams) albumNavigatorLayoutOuter.getLayoutParams();
        params.addRule(RelativeLayout.RIGHT_OF, 0);
        albumNavigatorLayoutOuter.setLayoutParams(params);
        //albumNavigatorLayout.setBackgroundColor(Color.WHITE);
        //            
        //            LayoutParams paramsList = (LayoutParams) albumNavigatorList.getLayoutParams();
        //            paramsList.width = display.getWidth();
        //            albumNavigatorList.setLayoutParams(paramsList);

        //         currentPlayingLayout.setVisibility(View.GONE);

        VIEW_STATE = LIST_EXPANDED_VIEW;
    } catch (Exception e) {
        e.printStackTrace();
    }

    return;

}

From source file:com.zoffcc.applications.zanavi.Navit.java

static void animate_bottom_bar_down() {
    final FrameLayout a = (FrameLayout) Global_Navit_Object.findViewById(R.id.bottom_bar_slide);

    // System.out.println("FRAG:animate_bottom_bar_down:014");

    // set bottom end positon correctly??
    bottom_y_margin_bottom_bar_touch = Navit.map_view_height + Navit.actionBarHeight + bottom_bar_px
            - Navit.bottom_bar_slider_shadow_px;

    final int move_by = (int) (bottom_y_margin_bottom_bar_touch - cur_y_margin_bottom_bar_touch);
    TranslateAnimation animation = new TranslateAnimation(0, 0, 0, move_by); //  new TranslateAnimation(xFrom,xTo, yFrom,yTo)
    animation.setDuration(bottom_bar_snap_duration); // animation duration
    animation.setFillAfter(true);
    animation.setFillEnabled(true);/*from   ww  w .j  a  v a2s .  c om*/
    animation.setRepeatCount(0); // animation repeat count
    animation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            // set bottom end positon correctly??
            bottom_y_margin_bottom_bar_touch = Navit.map_view_height + Navit.actionBarHeight + bottom_bar_px
                    - Navit.bottom_bar_slider_shadow_px;

            cur_y_margin_bottom_bar_touch = bottom_y_margin_bottom_bar_touch;
            RelativeLayout.LayoutParams relativeParams = (RelativeLayout.LayoutParams) a.getLayoutParams();
            relativeParams.setMargins(0, (int) bottom_y_margin_bottom_bar_touch, 0, 0); // left, top, right, bottom
            a.setLayoutParams(relativeParams);
            a.requestLayout();

            TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0);
            anim.setFillAfter(true);
            anim.setFillEnabled(true);
            anim.setDuration(1);
            a.startAnimation(anim);

            // remove roadbook fragment -----------
            try {
                if (road_book != null) {
                    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                    // System.out.println("FRAG:dettach:002");
                    fragmentTransaction.detach(road_book);
                    fragmentTransaction.remove(road_book).commit();
                    road_book = null;
                }
            } catch (Exception ef) {
            }
            // remove roadbook fragment -----------

        }
    });
    a.startAnimation(animation);
}

From source file:com.zoffcc.applications.zanavi.Navit.java

void animate_bottom_bar_up() {
    final FrameLayout a = (FrameLayout) findViewById(R.id.bottom_bar_slide);
    TranslateAnimation animation = new TranslateAnimation(0, 0, 0, -cur_y_margin_bottom_bar_touch);
    animation.setDuration(bottom_bar_snap_duration); // animation duration
    animation.setFillAfter(true);
    animation.setFillEnabled(true);// w  w  w  .  j  a  v a  2s  .c o m
    animation.setRepeatCount(0); // animation repeat count
    animation.setAnimationListener(new AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            cur_y_margin_bottom_bar_touch = 0;
            RelativeLayout.LayoutParams relativeParams = (RelativeLayout.LayoutParams) a.getLayoutParams();
            relativeParams.setMargins(0, (int) cur_y_margin_bottom_bar_touch, 0, 0); // left, top, right, bottom
            a.setLayoutParams(relativeParams);
            a.requestLayout();

            TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0);
            anim.setFillAfter(true);
            anim.setFillEnabled(true);
            anim.setDuration(1);
            a.startAnimation(anim);
        }
    });
    a.startAnimation(animation);
}