Search in sources :

Example 11 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project material-components-android by material-components.

the class BottomSheetDialogTest method showDialog.

private void showDialog() {
    Context context = activityTestRule.getActivity();
    mDialog = new BottomSheetDialog(context);
    AppCompatTextView text = new AppCompatTextView(context);
    StringBuilder builder = new StringBuilder();
    builder.append("It is fine today. ");
    text.setText(builder);
    mDialog.setContentView(text);
    mDialog.show();
}
Also used : Context(android.content.Context) AppCompatTextView(android.support.v7.widget.AppCompatTextView)

Example 12 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project CircularReveal by ozodrukh.

the class SpringSettingsBottomDialog method createConfigurationView.

private SeekBar createConfigurationView(CharSequence label, int defaultVal, SeekBar.OnSeekBarChangeListener changeListener) {
    final TextView labelView = new AppCompatTextView(getContext(), null, R.style.TextAppearance_AppCompat_Caption);
    labelView.setText(label);
    labelView.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(8)));
    final SeekBar seekBar = new SeekBar(getContext());
    seekBar.setProgress(defaultVal);
    seekBar.setMax(100);
    seekBar.setOnSeekBarChangeListener(changeListener);
    seekBar.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(16)));
    addView(labelView);
    addView(seekBar);
    return seekBar;
}
Also used : SeekBar(android.widget.SeekBar) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) TextView(android.widget.TextView)

Example 13 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project qksms by moezbhatti.

the class QKPopupActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mRes = getResources();
    setFinishOnTouchOutside(mPrefs.getBoolean(SettingsFragment.QUICKREPLY_TAP_DISMISS, true));
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    setContentView(getLayoutResource());
    ((QKLinearLayout) findViewById(R.id.popup)).setBackgroundTint(ThemeManager.getBackgroundColor());
    View title = findViewById(R.id.title);
    if (title != null && title instanceof AppCompatTextView) {
        title.setVisibility(View.GONE);
    }
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView) QKLinearLayout(com.moez.QKSMS.ui.view.QKLinearLayout) View(android.view.View) AppCompatTextView(android.support.v7.widget.AppCompatTextView)

Example 14 with AppCompatTextView

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

the class BackupRestoreFragment method showPopup.

public void showPopup(final View v) {
    PopupMenu popup = new PopupMenu(mActivity, v);
    popup.getMenuInflater().inflate(R.menu.bakmgr_menu, popup.getMenu());
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(final MenuItem menuItem) {
            final CharSequence text = ((AppCompatTextView) v).getText();
            final String FileName = text.toString();
            final AppCompatDialog dialog = new AppCompatDialog(mActivity);
            dialog.setTitle(R.string.setname);
            dialog.setContentView(R.layout.dialog_input);
            final AppCompatButton bGo = (AppCompatButton) dialog.findViewById(R.id.bGoBackup);
            final AppCompatEditText etFileName = (AppCompatEditText) dialog.findViewById(R.id.etFileName);
            if (bGo == null || etFileName == null)
                return false;
            //If current item is 0 (first item) a recovery backup will be edited or created
            final File path = mPager.getCurrentItem() == 0 ? Const.PathToRecoveryBackups : Const.PathToKernelBackups;
            try {
                switch(menuItem.getItemId()) {
                    case R.id.iRestore:
                        File backup = new File(path, FileName);
                        FlashUtil RestoreUtil = new FlashUtil(mActivity, backup, mPager.getCurrentItem() == 0 ? FlashUtil.JOB_RESTORE_RECOVERY : FlashUtil.JOB_RESTORE_KERNEL);
                        RestoreUtil.execute();
                        return true;
                    case R.id.iRename:
                        etFileName.setHint(FileName);
                        bGo.setOnClickListener(new View.OnClickListener() {

                            @Override
                            public void onClick(View v) {
                                String Name;
                                if (etFileName.getText() != null && etFileName.isEnabled() && !etFileName.getText().toString().equals("")) {
                                    //User has defined a name for the backup. Use it.
                                    Name = etFileName.getText().toString();
                                } else {
                                    //Use hint as backup name. Normally the correct version
                                    //and Recovery System (if Rashr could read it out of
                                    //"/cache/recovery/last_log"
                                    Name = String.valueOf(etFileName.getHint());
                                }
                                if (!Name.endsWith(RashrApp.DEVICE.getRecoveryExt())) {
                                    //Append extension
                                    Name += RashrApp.DEVICE.getRecoveryExt();
                                }
                                File renamedBackup = new File(path, Name);
                                if (renamedBackup.exists()) {
                                    Toast.makeText(mActivity, R.string.backupalready, Toast.LENGTH_SHORT).show();
                                    // if backup already exists, let the user chose a new name
                                    onMenuItemClick(menuItem);
                                } else {
                                    File Backup = new File(path, FileName);
                                    if (Backup.renameTo(renamedBackup)) {
                                        mAdapter.reload();
                                    } else {
                                        Toast.makeText(mActivity, R.string.rename_failed, Toast.LENGTH_SHORT).show();
                                    }
                                }
                                dialog.dismiss();
                            }
                        });
                        dialog.show();
                        return true;
                    case R.id.iDeleteBackup:
                        backup = new File(path, text.toString());
                        if (backup.delete()) {
                            Toast.makeText(mActivity, mContext.getString(R.string.bak_deleted), Toast.LENGTH_SHORT).show();
                        }
                        mAdapter.reload();
                        return true;
                    default:
                        return false;
                }
            } catch (Exception e) {
                if (e.getMessage().contains("EINVAL") && text.toString().contains(":")) {
                    AlertDialog.Builder adialog = new AlertDialog.Builder(mContext);
                    adialog.setMessage(R.string.check_name);
                    adialog.setMessage(R.string.ok);
                    adialog.show();
                }
                RashrApp.ERRORS.add(Const.RASHR_TAG + " " + e);
                return false;
            }
        }
    });
    popup.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) MenuItem(android.view.MenuItem) View(android.view.View) AdapterView(android.widget.AdapterView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) ListView(android.widget.ListView) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatEditText(android.support.v7.widget.AppCompatEditText) AppCompatDialog(android.support.v7.app.AppCompatDialog) File(java.io.File) PopupMenu(android.support.v7.widget.PopupMenu)

Example 15 with AppCompatTextView

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

the class FlashAsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragment = inflater.inflate(R.layout.fragment_flash_as, container, false);
    AppCompatTextView tvFlashAs = (AppCompatTextView) fragment.findViewById(R.id.tvFlashAs);
    tvFlashAs.setText(String.format(getString(R.string.flash_as), mImg.getName()));
    mOptAsRecovery = (RadioButton) fragment.findViewById(R.id.optAsRecovery);
    mOptAsKernel = (RadioButton) fragment.findViewById(R.id.optAsKernel);
    mButFlashAs = (AppCompatButton) fragment.findViewById(R.id.bFlashAs);
    final AppCompatButton ButCancel = (AppCompatButton) fragment.findViewById(R.id.bCancel);
    ButCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!mCloseApp) {
                new AlertDialog.Builder(mContext).setTitle(R.string.exit_app).setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        mActivity.finish();
                    }
                }).setNegativeButton(R.string.negative, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        mActivity.switchTo(FlashFragment.newInstance(mActivity));
                    }
                }).setCancelable(false).show();
            } else {
                mActivity.finish();
            }
        }
    });
    View.OnClickListener listener = new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (view.getTag().toString().equals("recovery")) {
                mOptAsKernel.setChecked(false);
            } else {
                mOptAsRecovery.setChecked(false);
            }
            mButFlashAs.setEnabled(true);
        }
    };
    mButFlashAs.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (mImg.exists()) {
                int job = mOptAsRecovery.isChecked() ? FlashUtil.JOB_FLASH_RECOVERY : FlashUtil.JOB_FLASH_KERNEL;
                final FlashUtil flashUtil = new FlashUtil(mActivity, mImg, job);
                flashUtil.setOnTaskDoneListener(new FlashUtil.OnTaskDoneListener() {

                    @Override
                    public void onSuccess() {
                        flashUtil.showRebootDialog();
                    }

                    @Override
                    public void onFail(Exception e) {
                    }
                });
                flashUtil.execute();
            } else {
                mActivity.finish();
            }
        }
    });
    mOptAsRecovery.setOnClickListener(listener);
    mOptAsKernel.setOnClickListener(listener);
    ViewGroup parent;
    if (!RashrApp.DEVICE.isRecoverySupported()) {
        if ((parent = (ViewGroup) mOptAsRecovery.getParent()) != null) {
            parent.removeView(mOptAsRecovery);
            mOptAsKernel.setChecked(true);
        }
    }
    if (!RashrApp.DEVICE.isKernelSupported()) {
        if ((parent = (ViewGroup) mOptAsKernel.getParent()) != null) {
            parent.removeView(mOptAsKernel);
        }
    }
    return fragment;
}
Also used : DialogInterface(android.content.DialogInterface) ViewGroup(android.view.ViewGroup) AppCompatTextView(android.support.v7.widget.AppCompatTextView) View(android.view.View) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatButton(android.support.v7.widget.AppCompatButton)

Aggregations

AppCompatTextView (android.support.v7.widget.AppCompatTextView)20 View (android.view.View)10 AppCompatButton (android.support.v7.widget.AppCompatButton)4 Espresso.onView (android.support.test.espresso.Espresso.onView)3 MediumTest (android.support.test.filters.MediumTest)3 ViewGroup (android.view.ViewGroup)3 TextView (android.widget.TextView)3 File (java.io.File)3 Test (org.junit.Test)3 DialogInterface (android.content.DialogInterface)2 AlertDialog (android.support.v7.app.AlertDialog)2 RecyclerView (android.support.v7.widget.RecyclerView)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 TestFloatingBehavior (android.support.design.testapp.custom.TestFloatingBehavior)1 ActionBar (android.support.v7.app.ActionBar)1