Search in sources :

Example 31 with AppCompatEditText

use of android.support.v7.widget.AppCompatEditText in project krypton-android by kryptco.

the class OnboardingCreateFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_teams_onboarding_create, container, false);
    Button createTeamButton = rootView.findViewById(R.id.createTeamOBButton);
    createTeamButton.setEnabled(false);
    AppCompatEditText teamNameEditText = rootView.findViewById(R.id.teamName);
    teamNameEditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString().length() == 0) {
                createTeamButton.setEnabled(false);
            } else {
                createTeamButton.setEnabled(true);
            }
        }
    });
    createTeamButton.setOnClickListener(v -> {
        CreateTeamProgress progress = new CreateTeamProgress(v.getContext());
        progress.updateTeamData((s, d) -> {
            d.name = teamNameEditText.getText().toString();
            return CreateStage.AUDIT_LOGS;
        });
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_right, R.anim.exit_to_left).replace(R.id.fragment_teams, new OnboardingAuditLogsFragment()).commitNowAllowingStateLoss();
        }
    });
    return rootView;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) AppCompatEditText(android.support.v7.widget.AppCompatEditText) Button(android.widget.Button) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) View(android.view.View)

Example 32 with AppCompatEditText

use of android.support.v7.widget.AppCompatEditText in project MTweaks-KernelAdiutorMOD by morogoku.

the class SecurityActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_security);
    final String password = Utils.decodeString(getIntent().getStringExtra(PASSWORD_INTENT));
    AppCompatEditText editText = (AppCompatEditText) findViewById(R.id.edittext);
    mPasswordWrong = findViewById(R.id.password_wrong);
    editText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString().equals(password)) {
                mPasswordWrong.setVisibility(View.GONE);
                setResult(1);
                finish();
            } else {
                mPasswordWrong.setVisibility(editable.toString().isEmpty() ? View.GONE : View.VISIBLE);
            }
        }
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Prefs.getBoolean("fingerprint", false, this)) {
        mFingerprintManagerCompat = FingerprintManagerCompat.from(this);
        if (mFingerprintManagerCompat.isHardwareDetected() && mFingerprintManagerCompat.hasEnrolledFingerprints() && getSystemService(KeyguardManager.class).isDeviceSecure()) {
            loadFingerprint();
        }
    }
}
Also used : AppCompatEditText(android.support.v7.widget.AppCompatEditText) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 33 with AppCompatEditText

use of android.support.v7.widget.AppCompatEditText in project MTweaks-KernelAdiutorMOD by morogoku.

the class ViewUtils method dialogEditTexts.

public static Dialog dialogEditTexts(String text, String text2, String hint, String hint2, final DialogInterface.OnClickListener negativeListener, final onDialogEditTextsListener onDialogEditTextListener, Context context) {
    LinearLayout layout = new LinearLayout(context);
    layout.setOrientation(LinearLayout.VERTICAL);
    int padding = (int) context.getResources().getDimension(R.dimen.dialog_padding);
    layout.setPadding(padding, padding, padding, padding);
    final AppCompatEditText editText = new AppCompatEditText(context);
    editText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (text != null) {
        editText.append(text);
    }
    if (hint != null) {
        editText.setHint(hint);
    }
    editText.setSingleLine(true);
    final AppCompatEditText editText2 = new AppCompatEditText(context);
    editText2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    if (text2 != null) {
        editText2.setText(text2);
    }
    if (hint2 != null) {
        editText2.setHint(hint2);
    }
    editText2.setSingleLine(true);
    layout.addView(editText);
    layout.addView(editText2);
    Dialog dialog = new Dialog(context).setView(layout);
    if (negativeListener != null) {
        dialog.setNegativeButton(context.getString(R.string.cancel), negativeListener);
    }
    if (onDialogEditTextListener != null) {
        dialog.setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                onDialogEditTextListener.onClick(editText.getText().toString(), editText2.getText().toString());
            }
        }).setOnDismissListener(new DialogInterface.OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
                if (negativeListener != null) {
                    negativeListener.onClick(dialog, 0);
                }
            }
        });
    }
    return dialog;
}
Also used : AppCompatEditText(android.support.v7.widget.AppCompatEditText) DialogInterface(android.content.DialogInterface) Dialog(com.moro.mtweaks.views.dialog.Dialog) LinearLayout(android.widget.LinearLayout)

Example 34 with AppCompatEditText

use of android.support.v7.widget.AppCompatEditText in project EssayJoke by qiyei2015.

the class SkinAppCompatViewInflater method createView.

public final View createView(View parent, final String name, @NonNull Context context, @NonNull AttributeSet attrs, boolean inheritContext, boolean readAndroidTheme, boolean readAppTheme) {
    final Context originalContext = context;
    // by using the parent's context
    if (inheritContext && parent != null) {
        context = parent.getContext();
    }
    if (readAndroidTheme || readAppTheme) {
        // We then apply the theme on the context, if specified
        context = themifyContext(context, attrs, readAndroidTheme, readAppTheme);
    }
    View view = null;
    // We need to 'inject' our tint aware Views in place of the standard framework versions
    switch(name) {
        case "TextView":
            view = new AppCompatTextView(context, attrs);
            break;
        case "ImageView":
            view = new AppCompatImageView(context, attrs);
            break;
        case "Button":
            view = new AppCompatButton(context, attrs);
            break;
        case "EditText":
            view = new AppCompatEditText(context, attrs);
            break;
        case "Spinner":
            view = new AppCompatSpinner(context, attrs);
            break;
        case "ImageButton":
            view = new AppCompatImageButton(context, attrs);
            break;
        case "CheckBox":
            view = new AppCompatCheckBox(context, attrs);
            break;
        case "RadioButton":
            view = new AppCompatRadioButton(context, attrs);
            break;
        case "CheckedTextView":
            view = new AppCompatCheckedTextView(context, attrs);
            break;
        case "AutoCompleteTextView":
            view = new AppCompatAutoCompleteTextView(context, attrs);
            break;
        case "MultiAutoCompleteTextView":
            view = new AppCompatMultiAutoCompleteTextView(context, attrs);
            break;
        case "RatingBar":
            view = new AppCompatRatingBar(context, attrs);
            break;
        case "SeekBar":
            view = new AppCompatSeekBar(context, attrs);
            break;
    }
    if (view == null) {
        // If the original context does not equal our themed context, then we need to manually
        // inflate it using the name so that android:theme takes effect.
        view = createViewFromTag(context, name, attrs);
    }
    if (view != null) {
        // If we have created a view, check it's android:onClick
        checkOnClickListener(view, attrs);
    }
    return view;
}
Also used : Context(android.content.Context) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) AppCompatRatingBar(android.support.v7.widget.AppCompatRatingBar) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) View(android.view.View) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatSpinner(android.support.v7.widget.AppCompatSpinner) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox) AppCompatEditText(android.support.v7.widget.AppCompatEditText) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView)

Example 35 with AppCompatEditText

use of android.support.v7.widget.AppCompatEditText in project AnExplorer by 1hakr.

the class CreateConnectionFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    final LayoutInflater dialogInflater = getActivity().getLayoutInflater();
    final View view = dialogInflater.inflate(R.layout.dialog_create_connection, null, false);
    name = (AppCompatEditText) view.findViewById(R.id.name);
    host = (AppCompatEditText) view.findViewById(R.id.host);
    port = (AppCompatEditText) view.findViewById(R.id.port);
    path = (AppCompatEditText) view.findViewById(R.id.path);
    hostContainer = view.findViewById(R.id.hostContainer);
    pathContainer = view.findViewById(R.id.pathContainer);
    username = (AppCompatEditText) view.findViewById(R.id.username);
    usernameContainer = view.findViewById(R.id.usernameContainer);
    password = (AppCompatEditText) view.findViewById(R.id.password);
    passwordContainer = view.findViewById(R.id.passwordContainer);
    scheme = (AppCompatSpinner) view.findViewById(R.id.scheme);
    anonymous = (AppCompatCheckBox) view.findViewById(R.id.anonymous);
    anonymous.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            usernameContainer.setVisibility(b ? View.GONE : View.VISIBLE);
            passwordContainer.setVisibility(b ? View.GONE : View.VISIBLE);
        }
    });
    if (connection_id != 0) {
        NetworkConnection connection = NetworkConnection.fromConnectionId(getActivity(), connection_id);
        ArrayAdapter myAdap = (ArrayAdapter) scheme.getAdapter();
        int spinnerPosition = myAdap.getPosition(connection.getScheme().toUpperCase());
        scheme.setSelection(spinnerPosition);
        name.setText(connection.getName());
        host.setText(connection.getHost());
        port.setText(Integer.toString(connection.getPort()));
        path.setText(connection.getPath());
        username.setText(connection.getUserName());
        password.setText(connection.getPassword());
        anonymous.setChecked(connection.isAnonymousLogin());
        if (SERVER.equals(connection.getType())) {
            hostContainer.setVisibility(View.GONE);
            pathContainer.setVisibility(View.VISIBLE);
        }
    }
    builder.setTitle((connection_id == 0 ? "New" : "Edit") + " Connection");
    builder.setView(view);
    builder.setPositiveButton(connection_id == 0 ? "ADD" : "SAVE", new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            final BaseActivity activity = (BaseActivity) getActivity();
            NetworkConnection networkConnection = getNetworkConnection();
            if (validate(networkConnection)) {
                new CreateConnectionTask(activity, networkConnection).executeOnExecutor(ProviderExecutor.forAuthority(ExplorerProvider.AUTHORITY));
            }
        }
    });
    builder.setNegativeButton(android.R.string.cancel, null);
    return builder.create();
}
Also used : Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) NetworkConnection(dev.dworks.apps.anexplorer.network.NetworkConnection) View(android.view.View) LayoutInflater(android.view.LayoutInflater) BaseActivity(dev.dworks.apps.anexplorer.BaseActivity) OnClickListener(android.content.DialogInterface.OnClickListener) CompoundButton(android.widget.CompoundButton) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

AppCompatEditText (android.support.v7.widget.AppCompatEditText)37 View (android.view.View)20 DialogInterface (android.content.DialogInterface)16 AlertDialog (android.support.v7.app.AlertDialog)13 TextView (android.widget.TextView)11 Editable (android.text.Editable)10 AppCompatButton (android.support.v7.widget.AppCompatButton)8 TextWatcher (android.text.TextWatcher)7 LinearLayout (android.widget.LinearLayout)7 File (java.io.File)7 Context (android.content.Context)6 TextInputLayout (android.support.design.widget.TextInputLayout)6 AppCompatCheckBox (android.support.v7.widget.AppCompatCheckBox)6 AppCompatTextView (android.support.v7.widget.AppCompatTextView)6 ColorDrawable (android.graphics.drawable.ColorDrawable)5 AdapterView (android.widget.AdapterView)5 SuppressLint (android.annotation.SuppressLint)4 AppCompatDialog (android.support.v7.app.AppCompatDialog)4 RelativeLayout (android.widget.RelativeLayout)4 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)4