Search in sources :

Example 1 with AppCompatCheckBox

use of android.support.v7.widget.AppCompatCheckBox in project SearchView by lapism.

the class SearchView method setTextColor.

public void setTextColor(@ColorInt int color) {
    mTextColor = color;
    mSearchEditText.setTextColor(mTextColor);
    for (int i = 0, n = mFiltersContainer.getChildCount(); i < n; i++) {
        View child = mFiltersContainer.getChildAt(i);
        if (child instanceof AppCompatCheckBox)
            ((AppCompatCheckBox) child).setTextColor(mTextColor);
    }
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox)

Example 2 with AppCompatCheckBox

use of android.support.v7.widget.AppCompatCheckBox in project SearchView by lapism.

the class SearchView method dispatchFilters.

private void dispatchFilters() {
    if (mSearchFiltersStates != null) {
        for (int i = 0, j = 0, n = mFiltersContainer.getChildCount(); i < n; i++) {
            View view = mFiltersContainer.getChildAt(i);
            if (view instanceof AppCompatCheckBox) {
                boolean isChecked = ((AppCompatCheckBox) view).isChecked();
                mSearchFiltersStates.set(j, isChecked);
                mSearchFilters.get(j).setChecked(isChecked);
                j++;
            }
        }
    }
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox)

Example 3 with AppCompatCheckBox

use of android.support.v7.widget.AppCompatCheckBox in project Rashr by DsLNeXuS.

the class BackupRestoreFragment method createBackup.

public void createBackup(final boolean RecoveryBackup) {
    String prefix;
    String CurrentName;
    String EXT;
    if (RecoveryBackup) {
        prefix = "recovery";
        EXT = RashrApp.DEVICE.getRecoveryExt();
        CurrentName = RashrApp.DEVICE.getRecoveryVersion();
    } else {
        prefix = "kernel";
        EXT = RashrApp.DEVICE.getKernelExt();
        CurrentName = RashrApp.DEVICE.getKernelVersion();
    }
    final AppCompatDialog dialog = new AppCompatDialog(mContext);
    dialog.setTitle(R.string.setname);
    dialog.setContentView(R.layout.dialog_input);
    final AppCompatButton bGoBackup = (AppCompatButton) dialog.findViewById(R.id.bGoBackup);
    final AppCompatEditText etFileName = (AppCompatEditText) dialog.findViewById(R.id.etFileName);
    final AppCompatCheckBox optName = (AppCompatCheckBox) dialog.findViewById(R.id.cbOptInput);
    if (bGoBackup == null || etFileName == null || optName == null)
        return;
    final String NameHint = prefix + "-from-" + Calendar.getInstance().get(Calendar.DATE) + "-" + Calendar.getInstance().get(Calendar.MONTH) + "-" + Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.HOUR) + "-" + Calendar.getInstance().get(Calendar.MINUTE) + EXT;
    optName.setText(CurrentName);
    optName.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            etFileName.setEnabled(!optName.isChecked());
        }
    });
    etFileName.setHint(NameHint);
    bGoBackup.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String EXT;
            File Path;
            final int JOB;
            if (RecoveryBackup) {
                EXT = RashrApp.DEVICE.getRecoveryExt();
                Path = Const.PathToRecoveryBackups;
                JOB = FlashUtil.JOB_BACKUP_RECOVERY;
            } else {
                EXT = RashrApp.DEVICE.getKernelExt();
                Path = Const.PathToKernelBackups;
                JOB = FlashUtil.JOB_BACKUP_KERNEL;
            }
            CharSequence Name = "";
            if (optName.isChecked()) {
                Name = optName.getText() + EXT;
            } else {
                if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) {
                    Name = etFileName.getText().toString();
                }
                if (Name.equals("")) {
                    Name = String.valueOf(etFileName.getHint());
                }
                if (!Name.toString().endsWith(EXT)) {
                    Name = Name + EXT;
                }
            }
            final File fBACKUP = new File(Path, Name.toString());
            if (fBACKUP.exists()) {
                Toast.makeText(mActivity, R.string.backupalready, Toast.LENGTH_SHORT).show();
            } else {
                final FlashUtil BackupCreator = new FlashUtil(mActivity, fBACKUP, JOB);
                BackupCreator.setOnTaskDoneListener(new FlashUtil.OnTaskDoneListener() {

                    @Override
                    public void onSuccess() {
                        mAdapter.reload();
                    }

                    @Override
                    public void onFail(Exception e) {
                        String msg;
                        if (e != null) {
                            msg = e.toString();
                        } else {
                            msg = getString(R.string.bak_error);
                        }
                        Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
                    }
                });
                BackupCreator.execute();
            }
            dialog.dismiss();
        }
    });
    dialog.show();
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) ListView(android.widget.ListView) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox) AppCompatEditText(android.support.v7.widget.AppCompatEditText) AppCompatDialog(android.support.v7.app.AppCompatDialog) File(java.io.File)

Example 4 with AppCompatCheckBox

use of android.support.v7.widget.AppCompatCheckBox in project Rashr by DsLNeXuS.

the class SettingsFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View root = inflater.inflate(R.layout.fragment_settings, container, false);
    final AppCompatButton bSetDevName = (AppCompatButton) root.findViewById(R.id.bSetDevName);
    final AppCompatCheckBox cbShowAds = (AppCompatCheckBox) root.findViewById(R.id.cbShowAds);
    final AppCompatCheckBox cbLog = (AppCompatCheckBox) root.findViewById(R.id.cbLog);
    //        final AppCompatCheckBox cbDarkUI = (AppCompatCheckBox) root.findViewById(R.id.cbDarkUI);
    final AppCompatCheckBox cbCheckUpdates = (AppCompatCheckBox) root.findViewById(R.id.cbCheckUpdates);
    final AppCompatCheckBox cbHideUpToDateHint = (AppCompatCheckBox) root.findViewById(R.id.cbShowUpToDateHints);
    final AppCompatCheckBox cbSkipSizeCheck = (AppCompatCheckBox) root.findViewById(R.id.cbSkipSizeChecking);
    final AppCompatCheckBox cbSkipValidate = (AppCompatCheckBox) root.findViewById(R.id.cbSkipValidateImages);
    final AppCompatButton bShowLogs = (AppCompatButton) root.findViewById(R.id.bShowLogs);
    final AppCompatButton bReport = (AppCompatButton) root.findViewById(R.id.bReport);
    final AppCompatButton bShowChangelog = (AppCompatButton) root.findViewById(R.id.bShowChangelog);
    final AppCompatButton bReset = (AppCompatButton) root.findViewById(R.id.bReset);
    final AppCompatButton bClearCache = (AppCompatButton) root.findViewById(R.id.bClearCache);
    final AppCompatButton bShowLicences = (AppCompatButton) root.findViewById(R.id.bShowLicenses);
    //        cbDarkUI.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME,
    //                Const.PREF_KEY_DARK_UI));
    cbShowAds.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_ADS));
    cbLog.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_LOG));
    cbCheckUpdates.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_CHECK_UPDATES));
    cbShowAds.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_ADS));
    cbHideUpToDateHint.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_HIDE_UPDATE_HINTS));
    cbSkipSizeCheck.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_SKIP_SIZE_CHECK));
    cbSkipValidate.setChecked(Common.getBooleanPref(root.getContext(), Const.PREF_NAME, Const.PREF_KEY_SKIP_IMAGE_CHECK));
    //        cbDarkUI.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    //            @Override
    //            public void onCheckedChanged(CompoundButton view, boolean isChecked) {
    //                Common.setBooleanPref(view.getContext(), Const.PREF_NAME,
    //                        Const.PREF_KEY_DARK_UI, isChecked);
    //                RashrActivity.isDark = isChecked;
    //            }
    //        });
    cbLog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            Common.setBooleanPref(view.getContext(), Const.PREF_NAME, Const.PREF_KEY_LOG, isChecked);
            root.findViewById(R.id.bShowLogs).setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE);
        }
    });
    cbCheckUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            Common.setBooleanPref(view.getContext(), Const.PREF_NAME, Const.PREF_KEY_CHECK_UPDATES, isChecked);
        }
    });
    cbShowAds.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            Common.setBooleanPref(view.getContext(), Const.PREF_NAME, Const.PREF_KEY_ADS, isChecked);
        }
    });
    cbHideUpToDateHint.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            Common.setBooleanPref(view.getContext(), Const.PREF_NAME, Const.PREF_KEY_HIDE_UPDATE_HINTS, isChecked);
        }
    });
    cbSkipSizeCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Common.setBooleanPref(buttonView.getContext(), Const.PREF_NAME, Const.PREF_KEY_SKIP_SIZE_CHECK, isChecked);
        }
    });
    cbSkipValidate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Common.setBooleanPref(buttonView.getContext(), Const.PREF_NAME, Const.PREF_KEY_SKIP_IMAGE_CHECK, isChecked);
        }
    });
    final RashrActivity activity = (RashrActivity) getActivity();
    bReport.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ReportDialog dialog = new ReportDialog(activity, "");
            dialog.show();
        }
    });
    bShowLogs.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            showLogs();
        }
    });
    bShowLogs.setVisibility(cbLog.isChecked() ? View.VISIBLE : View.INVISIBLE);
    bReset.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AppCompatActivity activity = (AppCompatActivity) getActivity();
            SharedPreferences.Editor editor = activity.getSharedPreferences(Const.PREF_NAME, Context.MODE_PRIVATE).edit();
            editor.clear().apply();
            editor = activity.getSharedPreferences(Const.PREF_NAME, Context.MODE_PRIVATE).edit();
            editor.clear().apply();
            RashrActivity.firstSetup(v.getContext());
        }
    });
    bClearCache.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final AlertDialog.Builder ConfirmationDialog = new AlertDialog.Builder(v.getContext());
            ConfirmationDialog.setTitle(R.string.warning);
            ConfirmationDialog.setMessage(R.string.delete_confirmation);
            ConfirmationDialog.setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (!Common.deleteFolder(Const.PathToCWM, false) || !Common.deleteFolder(Const.PathToTWRP, false) || !Common.deleteFolder(Const.PathToPhilz, false) || !Common.deleteFolder(Const.PathToStockRecovery, false) || !Common.deleteFolder(Const.PathToStockKernel, false)) {
                        Toast.makeText(getActivity(), R.string.delete_failed, Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(getActivity(), R.string.files_deleted, Toast.LENGTH_SHORT).show();
                    }
                }
            });
            ConfirmationDialog.setNegativeButton(R.string.negative, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            });
            ConfirmationDialog.show();
        }
    });
    bShowChangelog.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SettingsFragment.showChangelog(v.getContext());
        }
    });
    bShowLicences.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new LicensesDialog.Builder(v.getContext()).setNotices(R.raw.licenses_notice).setIncludeOwnLicense(true).build().show();
        }
    });
    bSetDevName.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final AppCompatEditText et = new AppCompatEditText(v.getContext());
            AlertDialog.Builder inputDialog = new AlertDialog.Builder(v.getContext());
            String dev_name = Common.getStringPref(v.getContext(), Const.PREF_NAME, Const.PREF_KEY_DEVICE_NAME);
            if (dev_name.equals(""))
                dev_name = RashrApp.DEVICE.getName();
            et.setText(dev_name);
            inputDialog.setTitle(R.string.device_name);
            inputDialog.setView(et);
            inputDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String name = et.getText().toString();
                    if (!name.equals("")) {
                        Common.setStringPref(getContext(), Const.PREF_NAME, Const.PREF_KEY_DEVICE_NAME, et.getText().toString());
                        Snackbar.make(bSetDevName, R.string.please_restart, Snackbar.LENGTH_SHORT).show();
                    }
                }
            });
            inputDialog.setNeutralButton(R.string.reset, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Common.setStringPref(getContext(), Const.PREF_NAME, Const.PREF_KEY_DEVICE_NAME, Build.DEVICE.toLowerCase());
                }
            });
            inputDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            });
            inputDialog.show();
        }
    });
    return root;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) AppCompatActivity(android.support.v7.app.AppCompatActivity) LicensesDialog(de.psdev.licensesdialog.LicensesDialog) View(android.view.View) WebView(android.webkit.WebView) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox) AppCompatEditText(android.support.v7.widget.AppCompatEditText) CompoundButton(android.widget.CompoundButton)

Example 5 with AppCompatCheckBox

use of android.support.v7.widget.AppCompatCheckBox in project AndroidDevelop by 7449.

the class CheckAdapter method onBind.

@Override
protected void onBind(ViewHolder holder, int position, AppModel appModel) {
    boolean isShowApp = AppUtils.isEquals(appModel.getPkgName());
    AppCompatCheckBox checkBox = holder.getAppCompatCheckBox(R.id.check_cb_check);
    AppCompatTextView textView = holder.getAppCompatTextView(R.id.check_tv_app_name);
    textView.setText(appModel.getAppLabel());
    TextDrawableUtils.setAppDrawable(textView, appModel.getAppIcon());
    textView.setScaleX(isShowCheckBox ? 0.9f : 1);
    textView.setScaleY(isShowCheckBox ? 0.9f : 1);
    checkBox.setChecked(booleanArray.get(position));
    checkBox.setVisibility(isShowCheckBox && !isShowApp ? View.VISIBLE : View.GONE);
    holder.setBackgroundColor(holder.itemView, AppUtils.getColor(!isShowApp));
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox)

Aggregations

AppCompatCheckBox (android.support.v7.widget.AppCompatCheckBox)7 View (android.view.View)5 AppCompatButton (android.support.v7.widget.AppCompatButton)3 AppCompatEditText (android.support.v7.widget.AppCompatEditText)3 DialogInterface (android.content.DialogInterface)2 AlertDialog (android.support.v7.app.AlertDialog)2 AppCompatTextView (android.support.v7.widget.AppCompatTextView)2 CardView (android.support.v7.widget.CardView)2 RecyclerView (android.support.v7.widget.RecyclerView)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 File (java.io.File)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 AppCompatDialog (android.support.v7.app.AppCompatDialog)1 WebView (android.webkit.WebView)1 CompoundButton (android.widget.CompoundButton)1 LinearLayout (android.widget.LinearLayout)1 FileChooserDialog (de.mkrtchyan.utils.FileChooserDialog)1