Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

In this page you can find the example usage for android.graphics Color TRANSPARENT.

Prototype

int TRANSPARENT

To view the source code for android.graphics Color TRANSPARENT.

Click Source Link

Usage

From source file:com.mdlive.sav.MDLiveProviderDetails.java

/**
 * Parses JSON response from Cigna Coach request and displays popup displaying the extracted info
 *
 * data structure:/*from   ww  w. ja v  a  2s  .c o  m*/
 * "appointment_instructions" : {
 *      "title" : "Schedule an Appointment",
 *      "description" : "To schedule a video coaching appointment, please call:",
 *      "team_name" : "Marriott TakeCare Team",
 *      "toll_free_number" : "1-800-700-1092",
 *      "additional_info" : "Se habla Espaol"
 *  }
 *
 * @param response      HTTP response object
 */
private void handleCignaCoachSuccessResponse(String response) {
    //Fetch Data From the Services
    //Log.e("Response details", "************\n**********"+response.toString());
    JsonParser parser = new JsonParser();
    JsonObject responseObj = null, profileObj = null, providerObj = null, appointment_obj = null;
    String dialog_title = null, dialog_desc = null, dialog_teamname = null, dialog_extrainfo = null,
            phonenumber = null;
    try {
        responseObj = (JsonObject) parser.parse(response.toString());
        profileObj = responseObj.get("doctor_profile").getAsJsonObject();
        providerObj = profileObj.get("provider_details").getAsJsonObject();
        appointment_obj = providerObj.get("appointment_instructions").getAsJsonObject();

        dialog_title = appointment_obj.get("title").getAsString();
        dialog_desc = appointment_obj.get("description").getAsString();
        dialog_teamname = appointment_obj.get("team_name").getAsString();
        phonenumber = appointment_obj.get("toll_free_number").getAsString();
        dialog_extrainfo = appointment_obj.get("additional_info").getAsString();

    } catch (NullPointerException nex) {
        //Log.e("Error details", "************\n" + nex.getMessage());
        /*Toast.makeText(this, R.string.mdl_cignacoach_data_error, Toast.LENGTH_SHORT).show();*/
        Snackbar.make(findViewById(android.R.id.content), getString(R.string.mdl_cignacoach_data_error),
                Snackbar.LENGTH_SHORT).show();
        return;
    }

    final String dialog_phonenumber = phonenumber;

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MDLiveProviderDetails.this);
    LayoutInflater inflater = MDLiveProviderDetails.this.getLayoutInflater();
    View dialogView = inflater.inflate(R.layout.cignacoach_popup, null);
    messagesView = dialogView;
    alertDialogBuilder.setView(dialogView);

    // populate the dialog's text fields
    final TextView txt_title = (TextView) dialogView.findViewById(R.id.title);
    txt_title.setText(dialog_title);
    final TextView txt_desc = (TextView) dialogView.findViewById(R.id.desc);
    txt_desc.setText(dialog_desc);
    final TextView txt_team = (TextView) dialogView.findViewById(R.id.team);
    txt_team.setText(dialog_teamname);
    final TextView txt_phone = (TextView) dialogView.findViewById(R.id.phone);
    txt_phone.setText(getString(R.string.mdl_cignacoach_phonenumber, dialog_phonenumber));
    final TextView txt_extra = (TextView) dialogView.findViewById(R.id.extra);
    txt_extra.setText(dialog_extrainfo);

    alertDialogBuilder.setCancelable(true);

    // create alert dialog
    final AlertDialog alertDialog = alertDialogBuilder.create();
    // suppress default background to allow rounded corners to show through
    alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

    txt_phone.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (ContextCompat.checkSelfPermission(MDLiveProviderDetails.this,
                    Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {

                ActivityCompat.requestPermissions(MDLiveProviderDetails.this,
                        new String[] { android.Manifest.permission.CALL_PHONE },
                        MDLiveProviderDetails.PERMISSION_ACCESS_PHONE);
            } else {
                Intent callIntent = new Intent(Intent.ACTION_CALL);
                callIntent.setData(Uri.parse("tel:" + dialog_phonenumber));
                startActivity(callIntent);
            }
            alertDialog.dismiss();
        }
    });

    // display it
    alertDialog.show();

}

From source file:com.skytree.epubtest.BookViewActivity.java

public ImageButton makeImageButton(int id, int resId, int width, int height) {
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height
    Drawable icon;/*  w  ww .  j a va  2  s. c o  m*/
    ImageButton button = new ImageButton(this);
    button.setAdjustViewBounds(true);
    button.setId(id);
    button.setOnClickListener(listener);
    button.setBackgroundColor(Color.TRANSPARENT);
    icon = getResources().getDrawable(resId);
    icon.setBounds(0, 0, width, height);

    Bitmap iconBitmap = ((BitmapDrawable) icon).getBitmap();
    Bitmap bitmapResized = Bitmap.createScaledBitmap(iconBitmap, width, height, false);
    button.setImageBitmap(bitmapResized);
    button.setVisibility(View.VISIBLE);
    param.width = (int) (width);
    param.height = (int) (height);
    button.setLayoutParams(param);
    return button;
}

From source file:com.skytree.epubtest.BookViewActivity.java

public TextView makeLabel(int id, String text, int gravity, float textSize, int textColor) {
    TextView label = new TextView(this);
    label.setId(id);/*  w w w  . jav a 2s  . c o  m*/
    label.setGravity(gravity);
    label.setBackgroundColor(Color.TRANSPARENT);
    label.setText(text);
    label.setTextColor(textColor);
    label.setTextSize(textSize);
    return label;
}

From source file:com.android.contacts.quickcontact.QuickContactActivity.java

private void updateStatusBarColor() {
    if (mScroller == null || !CompatUtils.isLollipopCompatible()) {
        return;/* w w w .j  a  v a  2 s.  com*/
    }
    final int desiredStatusBarColor;
    // Only use a custom status bar color if QuickContacts touches the top of the viewport.
    if (mScroller.getScrollNeededToBeFullScreen() <= 0) {
        desiredStatusBarColor = mStatusBarColor;
    } else {
        desiredStatusBarColor = Color.TRANSPARENT;
    }
    // Animate to the new color.
    final ObjectAnimator animation = ObjectAnimator.ofInt(getWindow(), "statusBarColor",
            getWindow().getStatusBarColor(), desiredStatusBarColor);
    animation.setDuration(ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION);
    animation.setEvaluator(new ArgbEvaluator());
    animation.start();
}

From source file:com.haomee.chat.activity.ChatActivity.java

public View init_grid_viewpager_data(List<String> images_path_list, List<String> iamges_name_list,
        final int current_page, final int type_size, final String package_id, final int type) {

    View view = LayoutInflater.from(this).inflate(R.layout.express_grid, null);
    GridView grid = (GridView) view.findViewById(R.id.gridView1);
    grid.setSelector(new ColorDrawable(Color.TRANSPARENT));
    final NewExpressAdapter2 grid_adapter = new NewExpressAdapter2(ChatActivity.this);
    grid.setAdapter(grid_adapter);/* w w  w  .j  a v a 2  s.c  om*/
    final List<String> current_page_path;
    final List<String> current_page_name;
    int total_page = 0;
    if (type_size == 1) {// 
        total_page = (images_path_list.size() - 1) / 10 + 1;
        page_size = 10;
    } else if (type_size == 2) {// ?
        total_page = (images_path_list.size() - 1) / 20 + 1;
        page_size = 20;
    }
    if (current_page < total_page - 1) {
        current_page_path = images_path_list.subList(current_page * page_size, (current_page + 1) * page_size);
        current_page_name = iamges_name_list.subList(current_page * page_size, (current_page + 1) * page_size);
    } else {
        current_page_path = images_path_list.subList(current_page * page_size, images_path_list.size());
        current_page_name = iamges_name_list.subList(current_page * page_size, images_path_list.size());
    }
    grid_adapter.setData(current_page_path, current_page_name, type_size);
    grid.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String[] path_list = current_page_path.get(position).split("/");
            String[] file_name = path_list[path_list.length - 1].split("#");
            String[] current_id = file_name[0].split("\\.");
            String temp_type = "";
            if (type == TYPE_GIF) {
                temp_type = ".gif";
            } else {
                temp_type = ".png";
            }
            sendTextByExpression(type, package_id, current_id[0], current_page_name.get(position),
                    PathConst.URL_EXPRESS_PREFIX + package_id + "/" + current_id[0] + temp_type, type_size);
        }
    });
    return view;
}

From source file:com.skytree.epubtest.BookViewActivity.java

public void makeControls() {
    this.removeControls();
    Theme theme = getCurrentTheme();//from   w  w  w. j  av  a2  s . c om

    int bs = 38;
    if (this.isRotationLocked)
        rotationButton = this.makeImageButton(9000, R.drawable.rotationlocked2x, ps(42), ps(42));
    else
        rotationButton = this.makeImageButton(9000, R.drawable.rotation2x, ps(42), ps(42));
    listButton = this.makeImageButton(9001, R.drawable.list2x, getPS(bs), getPS(bs));
    fontButton = this.makeImageButton(9002, R.drawable.font2x, getPS(bs), getPS(bs));
    searchButton = this.makeImageButton(9003, R.drawable.search2x, getPS(bs), getPS(bs));
    rotationButton.setOnTouchListener(new ImageButtonHighlighterOnTouchListener(rotationButton));
    listButton.setOnTouchListener(new ImageButtonHighlighterOnTouchListener(listButton));
    fontButton.setOnTouchListener(new ImageButtonHighlighterOnTouchListener(fontButton));
    searchButton.setOnTouchListener(new ImageButtonHighlighterOnTouchListener(searchButton));

    titleLabel = this.makeLabel(3000, title, Gravity.CENTER_HORIZONTAL, 17, Color.argb(240, 94, 61, 35)); // setTextSize in android uses sp (Scaled Pixel) as default, they say that sp guarantees the device dependent size, but as usual in android it can't be 100% sure.    
    authorLabel = this.makeLabel(3000, author, Gravity.CENTER_HORIZONTAL, 17, Color.argb(240, 94, 61, 35));
    pageIndexLabel = this.makeLabel(3000, "......", Gravity.CENTER_HORIZONTAL, 13, Color.argb(240, 94, 61, 35));
    secondaryIndexLabel = this.makeLabel(3000, "......", Gravity.CENTER_HORIZONTAL, 13,
            Color.argb(240, 94, 61, 35));

    //      rv.customView.addView(rotationButton);
    //      rv.customView.addView(listButton);
    //      rv.customView.addView(fontButton);
    //      rv.customView.addView(searchButton);      
    rv.customView.addView(titleLabel);
    rv.customView.addView(authorLabel);

    ePubView.addView(rotationButton);
    ePubView.addView(listButton);
    ePubView.addView(fontButton);
    if (!rv.isScrollMode())
        ePubView.addView(searchButton);
    //      ePubView.addView(titleLabel);
    //      ePubView.addView(authorLabel);

    ePubView.addView(pageIndexLabel);
    ePubView.addView(secondaryIndexLabel);

    seekBar = new SkySeekBar(this);
    seekBar.setMax(999);
    seekBar.setId(999);
    RectShape rectShape = new RectShape();
    ShapeDrawable thumb = new ShapeDrawable(rectShape);

    thumb.getPaint().setColor(theme.seekThumbColor);
    thumb.setIntrinsicHeight(getPS(28));
    thumb.setIntrinsicWidth(getPS(28));
    seekBar.setThumb(thumb);
    seekBar.setBackgroundColor(Color.TRANSPARENT);
    seekBar.setOnSeekBarChangeListener(new SeekBarDelegate());
    seekBar.setProgressDrawable(new DottedDrawable(theme.seekBarColor));
    seekBar.setThumbOffset(-3);
    seekBar.setMinimumHeight(24);

    int filterColor = theme.controlColor;
    rotationButton.setColorFilter(filterColor);
    listButton.setColorFilter(filterColor);
    fontButton.setColorFilter(filterColor);
    searchButton.setColorFilter(filterColor);

    authorLabel.setTextColor(filterColor);
    titleLabel.setTextColor(filterColor);
    pageIndexLabel.setTextColor(filterColor);
    secondaryIndexLabel.setTextColor(filterColor);

    ePubView.addView(seekBar);
}

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 w w .  ja v  a 2  s  . com

    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.klinker.android.launcher.launcher3.Launcher.java

private void setWorkspaceBackground(int background) {
    switch (background) {
    case WORKSPACE_BACKGROUND_TRANSPARENT:
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        break;//from w w w .  j  av a2  s  .  co m
    case WORKSPACE_BACKGROUND_BLACK:
        getWindow().setBackgroundDrawable(null);
        break;
    default:
        getWindow().setBackgroundDrawable(mWorkspaceBackgroundDrawable);
    }
}

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

    /*//from  ww w  .  ja va2  s .co m
     * 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);

}