com.rengwuxian.materialedittext.MaterialEditText Java Examples

The following examples show how to use com.rengwuxian.materialedittext.MaterialEditText. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initEditnewpasssworddialog(){
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_editpassworddialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_password_edit_password);
    final TextView texttitle=(TextView)centerview.findViewById(R.id.title_text_password);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok_password);
    final AlertDialog alertDialog_editpassword=builder.setView(centerview).create();
    texttitle.setText("创建新的密码");
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (Means.isedittext_empty(materialEditText_password)){
                Toast.makeText(AboutActivity.this, "请输入新密码", Toast.LENGTH_SHORT).show();
            }else {
                if (materialEditText_password.getText().toString().length()!=6){
                    Toast.makeText(AboutActivity.this, "请输入六位密码", Toast.LENGTH_SHORT).show();
                }else {
                    prestenerImp_about.putpasswordOnSeting(materialEditText_password.getText().toString());
                    alertDialog_editpassword.dismiss();
                }
            }
        }
    });
    alertDialog_editpassword.show();
}
 
Example #2
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initEditpassworddialog(){//实例化一个重新编辑密码的dialog
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_editpassworddialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_password_edit_password);
    final TextView texttitle=(TextView)centerview.findViewById(R.id.title_text_password);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok_password);
    final AlertDialog alertDialog_editpassword=builder.setView(centerview).create();
    texttitle.setText("请输入旧密码");
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (prestenerImp_about.iscurrentthepasswordfromSeting(materialEditText_password.getText().toString())){
                initEditnewpasssworddialog();
                alertDialog_editpassword.dismiss();
            }else {
                Toast.makeText(AboutActivity.this, "输入密码有误", Toast.LENGTH_SHORT).show();
            }
        }
    });
    alertDialog_editpassword.show();
}
 
Example #3
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initQuestionddialog(){//实例化一个重新编辑密保的dialog
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_editquestiondialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_question_edit_question);
    final TextView texttitle=(TextView)centerview.findViewById(R.id.title_text_question);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok_question);
    final AlertDialog alertDialog_editpassword=builder.setView(centerview).create();
    texttitle.setText("请输入旧密保");
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (prestenerImp_about.iscurrentthequestionfromSeting(materialEditText_password.getText().toString())){
                alertDialog_editpassword.dismiss();
                initeditnewQuestiondialog();
            }else {
                Toast.makeText(AboutActivity.this, "输入旧的密保有误", Toast.LENGTH_SHORT).show();
            }
        }
    });
    alertDialog_editpassword.show();
}
 
Example #4
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initeditnewQuestiondialog(){
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_editquestiondialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_question_edit_question);
    final TextView texttitle=(TextView)centerview.findViewById(R.id.title_text_question);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok_question);
    final AlertDialog alertDialog_editpassword=builder.setView(centerview).create();
    texttitle.setText("请输入新密保");
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (Means.isedittext_empty(materialEditText_password)){
                Toast.makeText(AboutActivity.this, "请输入密保", Toast.LENGTH_SHORT).show();
            }else {
                prestenerImp_about.putquestionOnSeting(materialEditText_password.getText().toString());
                alertDialog_editpassword.dismiss();
            }
        }
    });
    alertDialog_editpassword.show();
}
 
Example #5
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initiscurrentQuestiondialog(){
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_editquestiondialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_question_edit_question);
    final TextView texttitle=(TextView)centerview.findViewById(R.id.title_text_question);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok_question);
    final AlertDialog alertDialog_editpassword=builder.setView(centerview).create();
    texttitle.setText("请输入密保");
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (Means.isedittext_empty(materialEditText_password)){
                Toast.makeText(AboutActivity.this, "请输入密保", Toast.LENGTH_SHORT).show();
            }else {
                if (prestenerImp_about.iscurrentthequestionfromSeting(materialEditText_password.getText().toString())){
                    alertDialog_editpassword.dismiss();
                    prestenerImp_about.showthecurrentpasswordOnAboutactivity();
                }else {
                    Toast.makeText(AboutActivity.this, "密保错误请重新输入", Toast.LENGTH_SHORT).show();
                }
            }
        }
    });
    alertDialog_editpassword.show();
}
 
Example #6
Source File: LoginActivity.java    From Social with Apache License 2.0 6 votes vote down vote up
@Override
public void initView(){

    ActionBar actionBar = getSupportActionBar();
    actionBar.setLogo(R.mipmap.ic_arrow_back_white_24dp);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle("登录");

    mBtnLogin = (ButtonFlat)this.findViewById(R.id.id_login_activity_btn_login);
    mBtnLogin.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    mBtnRegister = (ButtonFlat)this.findViewById(R.id.id_login_activity_btn_regist);
    mBtnRegister.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    mBtnForget = (ButtonFlat)this.findViewById(R.id.id_login_activity_btn_forget);
    mBtnForget.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    mEtPassword = (MaterialEditText)this.findViewById(R.id.id_login_activity_et_password);
    mEtUsername = (MaterialEditText)this.findViewById(R.id.id_login_activity_et_username);

    mIvQqLogin = (ImageView)this.findViewById(R.id.id_login_activity_iv_qq_login);
    mIvQqLogin.setOnClickListener(this);

    mBtnRegister.setOnClickListener(this);
    mBtnLogin.setOnClickListener(this);
}
 
Example #7
Source File: SubjectGradeFragment.java    From Bangumi-Android with MIT License 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mProgressBar = (ProgressBar) getView()
            .findViewById(R.id.subject_grade_progress_bar_wrapper)
            .findViewById(R.id.progress_bar);
    mSubjectGradeWrapper = (LinearLayout) getView().findViewById(R.id.subject_grade_wrapper);
    mSubjectStatus = (TextView) getView().findViewById(R.id.subject_status);
    mSubjectRating = (TextView) getView().findViewById(R.id.subject_rating);
    mSubjectComment = (TextView) getView().findViewById(R.id.subject_comment);
    mSubjectStatusField = (RadioGroup) getView().findViewById(R.id.subject_status_field);
    mSubjectRatingField = (Slider) getView().findViewById(R.id.subject_rating_field);
    mSubjectCommentField = (MaterialEditText) getView().findViewById(R.id.subject_comment_field);

    mSubjectStatusField.setOnCheckedChangeListener(this);
}
 
Example #8
Source File: RegistActivity.java    From Social with Apache License 2.0 6 votes vote down vote up
private void initData(){
    btn_regist = (ButtonFlat)this.findViewById(R.id.id_regist_btn_regist);
    btn_regist.setOnClickListener(this);
    btn_regist.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));

    rb_man = (RadioButton)this.findViewById(R.id.id_regist_rb_man);
    rb_woman = (RadioButton)this.findViewById(R.id.id_regist_rb_woman);

    et_age = (MaterialEditText)this.findViewById(R.id.id_regist_et_age);
    et_username = (MaterialEditText)this.findViewById(R.id.id_regist_et_username);
    et_password = (MaterialEditText)this.findViewById(R.id.id_regist_et_password);
    et_ensure_password = (MaterialEditText)this.findViewById(R.id.id_regist_et_ensurepassword);
    et_recommend_name = (MaterialEditText)this.findViewById(R.id.id_regist_et_recommend_name);
    iv_head  = (CircleImageView)this.findViewById(R.id.id_regist_iv_head);
    iv_head.setOnClickListener(this);
}
 
Example #9
Source File: LoginFragment.java    From Bangumi-Android with MIT License 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    initProgressDialog();

    mUsernameField = (MaterialEditText) getView().findViewById(R.id.username_field);
    mPasswordField = (MaterialEditText) getView().findViewById(R.id.password_field);

    Button loginBtn = (Button) getView().findViewById(R.id.btn_login);
    loginBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String username = mUsernameField.getText().toString();
            String password = mPasswordField.getText().toString();

            if (isInputsValid(username, password)) {
                showProgressDialog();
                login(username, password);
            }

        }
    });
}
 
Example #10
Source File: AddRecruitActivity.java    From Social with Apache License 2.0 6 votes vote down vote up
private void initData(){
    btn_submit = (ButtonFlat)this.findViewById(R.id.id_add_recruit_activity_btn_submit);
    btn_submit.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    btn_submit.setOnClickListener(this);

    btn_take_photo = (ButtonFlat)this.findViewById(R.id.id_add_recruit_activity_btn_take_photo);
    btn_take_photo.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    btn_take_photo.setOnClickListener(this);

    gridView1 = (GridView) findViewById(R.id.gridView1);

    list_image_path = new ArrayList<>();

    et_phone = (MaterialEditText)this.findViewById(R.id.id_add_recruit_activity_et_phone);
    et_companyname = (MaterialEditText)this.findViewById(R.id.id_add_recruit_activity_et_companyname);
    et_link = (MaterialEditText)this.findViewById(R.id.id_add_recruit_activity_et_link);
    et_requitement = (MaterialEditText)this.findViewById(R.id.id_add_recruit_activity_et_requirement);
    et_address = (MaterialEditText)this.findViewById(R.id.id_add_recruit_activity_et_address);
    et_address.setText(SharedPreferenceUtil.getAddress());
}
 
Example #11
Source File: SearchMainActivity.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private void showSearchDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater lif = LayoutInflater.from(this);
    View view = lif.inflate(R.layout.door_img_dialog_layout, null);
    TextView tvTextView = ViewUtility.findViewById(view, R.id.doorTitle);
    final MaterialEditText me = ViewUtility.findViewById(view, R.id.doorEditText);
    Button mButton = ViewUtility.findViewById(view, R.id.doorCheckBtn);
    SearchWhat sw = getSearchWhat();
    if (sw == SearchWhat.status) {
        tvTextView.setText("搜索微博");
    } else {
        tvTextView.setText("搜索用户");
    }

    builder.setView(view);
    final AlertDialog alertDialog = builder.create();
    alertDialog.show();

    mButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            search(me.getText().toString().trim());
            alertDialog.cancel();
        }
    });
}
 
Example #12
Source File: SearchMainActivity.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private void showSearchDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater lif = LayoutInflater.from(this);
    View view = lif.inflate(R.layout.door_img_dialog_layout, null);
    TextView tvTextView = ViewUtility.findViewById(view, R.id.doorTitle);
    final MaterialEditText me = ViewUtility.findViewById(view, R.id.doorEditText);
    Button mButton = ViewUtility.findViewById(view, R.id.doorCheckBtn);
    SearchWhat sw = getSearchWhat();
    if (sw == SearchWhat.status) {
        tvTextView.setText("搜索微博");
    } else {
        tvTextView.setText("搜索用户");
    }

    builder.setView(view);
    final AlertDialog alertDialog = builder.create();
    alertDialog.show();

    mButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            search(me.getText().toString().trim());
            alertDialog.cancel();
        }
    });
}
 
Example #13
Source File: LoginForgotPasswordActivity.java    From android with MIT License 5 votes vote down vote up
/**
 * Implements OnEditorActionListener
 * Validate fields on IME_ACTION_NEXT or IME_ACTION_DONE
 *
 * @param v
 * @param actionId
 * @param event
 * @return
 */
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_GO) {
        if (((MaterialEditText) v).validate()) {
            resetPassword();
        }
    }

    return false;
}
 
Example #14
Source File: LoginEmailActivity.java    From android with MIT License 5 votes vote down vote up
/**
 * Implements OnEditorActionListener
 * Validate fields on IME_ACTION_NEXT or IME_ACTION_DONE
 *
 * @param v
 * @param actionId
 * @param event
 * @return
 */
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_NEXT) {
        // return true for invalid value, to block action
        return !((MaterialEditText) v).validate();
    } else if (actionId == EditorInfo.IME_ACTION_GO) {
        if (((MaterialEditText) v).validate()) {
            submitForm();
        }
    }

    return false;
}
 
Example #15
Source File: LoginSignUpActivity.java    From android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    vName = (MaterialEditText) findViewById(R.id.name);

    setListeners();
    addValidators();
}
 
Example #16
Source File: FinderDialog.java    From 920-text-editor-v2 with Apache License 2.0 5 votes vote down vote up
ViewHolder(View view) {
    mFindEditText = (DrawClickableEditText) view.findViewById(R.id.find_edit_text);
    mReplaceEditText = (DrawClickableEditText) view.findViewById(R.id.replace_edit_text);
    mReplaceCheckBox = (CheckBox) view.findViewById(R.id.replace_check_box);
    mCaseSensitiveCheckBox = (CheckBox) view.findViewById(R.id.case_sensitive_check_box);
    mWholeWordsOnlyCheckBox = (CheckBox) view.findViewById(R.id.whole_words_only_check_box);
    mRegexCheckBox = (CheckBox) view.findViewById(R.id.regex_check_box);
    mInPathCheckBox = (CheckBox) view.findViewById(R.id.in_path_check_box);
    mPathEditText = (MaterialEditText) view.findViewById(R.id.path_edit_text);
    mBrowserBtn = view.findViewById(R.id.browserBtn);
    mRecursivelyCheckBox = (CheckBox) view.findViewById(R.id.recursively_check_box);
    mPathLayout = view.findViewById(R.id.pathLayout);
}
 
Example #17
Source File: ModifyUserDataActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
public void initData(){
    btn_save = (ButtonFlat)this.findViewById(R.id.id_modify_user_data_btn_save);
    btn_save.setBackgroundColor(getResources().getColor(R.color.colorPrimary));

    et_nickname = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_nickname);
    et_city = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_city);
    et_signature = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_signature);
    //et_phone = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_phone);
    et_email = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_email);

    rb_man = (RadioButton)this.findViewById(R.id.id_modify_user_data_rb_man);
    rb_woman = (RadioButton)this.findViewById(R.id.id_modify_user_data_rb_woman);

    rl_modity_user_head = (RelativeLayout)this.findViewById(R.id.id_modify_user_data_rl_modify_head);
    iv_head = (CircleImageView)this.findViewById(R.id.id_modify_user_data_iv_userhead);

    rl_modity_user_head.setOnClickListener(this);
    btn_save.setOnClickListener(this);

    et_age = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_age);
    et_occupation = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_occupation);
    et_constellation = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_constellation);
    et_hight = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_hight);
    et_weight = (MaterialEditText)this.findViewById(R.id.id_modify_user_data_et_weight);
    tv_figure = (TextView)this.findViewById(R.id.id_modify_user_data_tv_figure);
    tv_emotion = (TextView)this.findViewById(R.id.id_modify_user_data_tv_emotion);

    et_occupation.setOnClickListener(this);
    et_constellation.setOnClickListener(this);
    tv_figure.setOnClickListener(this);
    tv_emotion.setOnClickListener(this);



    setInitData();
}
 
Example #18
Source File: AddPostActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_post_activity_layout);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_ADD_POST:
                    handleAddPost(msg);
                    break;
            }
        }
    };

    recruit_id = getIntent().getStringExtra("recruit_id");

    ActionBar ab = this.getSupportActionBar();
    ab.setLogo(R.mipmap.ic_arrow_back_white_24dp);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle("添加职位");

    btn_submit = (ButtonFlat)this.findViewById(R.id.id_add_post_activity_btn_submit);
    btn_submit.setBackgroundColor(this.getResources().getColor(R.color.colorPrimary));

    et_postname = (MaterialEditText)this.findViewById(R.id.id_add_post_activity_et_postname);
    et_salary = (MaterialEditText)this.findViewById(R.id.id_add_post_activity_et_salary);
    et_requirement = (MaterialEditText)this.findViewById(R.id.id_add_post_activity_et_requirement);
    et_description = (MaterialEditText)this.findViewById(R.id.id_add_post_activity_et_description);

    btn_submit.setOnClickListener(this);

}
 
Example #19
Source File: AddGroupActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void initData(){
    iv_group_img = (CircleImageView)this.findViewById(R.id.id_add_group_iv_group_img);
    iv_group_img.setOnClickListener(this);
    et_group_description = (MaterialEditText)this.findViewById(R.id.id_add_group_et_description);
    et_groupname = (MaterialEditText)this.findViewById(R.id.id_add_group_et_groupname);
    tv_choose_point = (TextView)this.findViewById(R.id.id_add_group_tv_choose_point);
    btn_submit = (ButtonRectangle)this.findViewById(R.id.id_add_group_btn_add);
    btn_submit.setOnClickListener(this);
    tv_choose_point.setOnClickListener(this);

    rb_private_1 = (RadioButton)this.findViewById(R.id.id_add_group_rb_private_1);
    rb_private_2 = (RadioButton)this.findViewById(R.id.id_add_group_rb_private_2);
    rb_public_1 = (RadioButton)this.findViewById(R.id.id_add_group_rb_public_1);
    rb_public_2 = (RadioButton)this.findViewById(R.id.id_add_group_rb_public_2);
}
 
Example #20
Source File: Means.java    From Memory-capsule with Apache License 2.0 5 votes vote down vote up
public static boolean isedittext_empty(MaterialEditText editText){//判断editext是否为空
    if (editText.getText().toString().isEmpty()){
        return true;
    }else {
        return false;
    }
}
 
Example #21
Source File: AboutActivity.java    From Memory-capsule with Apache License 2.0 5 votes vote down vote up
private void initpassworddialog(){//实例化一个创建密码和密保问题的Dialog
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater layoutInflater=LayoutInflater.from(this);
    View centerview=layoutInflater.inflate(R.layout.activity_set_passworddialog,null);
    final MaterialEditText materialEditText_password=(MaterialEditText)centerview.findViewById(R.id.set_dialog_password_edit);
    final MaterialEditText materialEditText_question=(MaterialEditText)centerview.findViewById(R.id.set_dialog_question_edit);
    Button button_ok=(Button)centerview.findViewById(R.id.set_dialog_password_ok);
    alertDialog_creatpassword=builder.setView(centerview).create();
    button_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (Means.isedittext_empty(materialEditText_password)&Means.isedittext_empty(materialEditText_question)){
                Toast.makeText(AboutActivity.this, "请输入密码和密保", Toast.LENGTH_SHORT).show();
            }else if (Means.isedittext_empty(materialEditText_password)|Means.isedittext_empty(materialEditText_question)){
                Toast.makeText(AboutActivity.this, "请输入密码或密保", Toast.LENGTH_SHORT).show();
            }else {
                if (materialEditText_password.getText().toString().length()!=6){
                    Toast.makeText(AboutActivity.this, "密码为6位数字", Toast.LENGTH_SHORT).show();
                }else {
                    prestenerImp_about.putpasswordandquestionOnSeting(materialEditText_password.getText().toString(),
                            materialEditText_question.getText().toString());
                    alertDialog_creatpassword.dismiss();
                }
            }
        }
    });
    alertDialog_creatpassword.show();
}
 
Example #22
Source File: ModifyRecruitActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.modify_recruit_activity_layout);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_MODIFY_RECRUIT:
                    handleModifyRecruit(msg);
                    break;
            }
        }
    };

    recruit_id = getIntent().getStringExtra("recruit_id");
    companyname = getIntent().getStringExtra("companyname");
    link = getIntent().getStringExtra("link");
    phone = getIntent().getStringExtra("phone");
    address = getIntent().getStringExtra("address");
    requirement = getIntent().getStringExtra("requirement");

    ActionBar actionBar = getSupportActionBar();
    actionBar.setLogo(R.mipmap.ic_arrow_back_white_24dp);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle("修改招聘信息");

    btn_submit = (ButtonFlat)this.findViewById(R.id.id_modify_recruit_activity_btn_submit);
    btn_submit.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    btn_submit.setOnClickListener(this);

    et_phone = (MaterialEditText)this.findViewById(R.id.id_modify_recruit_activity_et_phone);
    et_companyname = (MaterialEditText)this.findViewById(R.id.id_modify_recruit_activity_et_companyname);
    et_link = (MaterialEditText)this.findViewById(R.id.id_modify_recruit_activity_et_link);
    et_requitement = (MaterialEditText)this.findViewById(R.id.id_modify_recruit_activity_et_requirement);
    et_address = (MaterialEditText)this.findViewById(R.id.id_modify_recruit_activity_et_address);

    et_companyname.setText(companyname);
    et_link.setText(link);
    et_phone.setText(phone);
    et_address.setText(address);
    et_requitement.setText(requirement);


}
 
Example #23
Source File: EditTextFactory.java    From android-json-form-wizard with MIT License 4 votes vote down vote up
@Override
public List<View> getViewsFromJson(String stepName, Context context, JSONObject jsonObject, CommonListener listener) throws Exception {
    int minLength = MIN_LENGTH;
    int maxLength= MAX_LENGTH;
    List<View> views = new ArrayList<>(1);
    MaterialEditText editText = (MaterialEditText) LayoutInflater.from(context).inflate(
            R.layout.item_edit_text, null);
    editText.setHint(jsonObject.getString("hint"));
    editText.setFloatingLabelText(jsonObject.getString("hint"));
    editText.setId(ViewUtil.generateViewId());
    editText.setTag(R.id.key, jsonObject.getString("key"));
    editText.setTag(R.id.type, jsonObject.getString("type"));

    if (!TextUtils.isEmpty(jsonObject.optString("value"))) {
        editText.setText(jsonObject.optString("value"));
    }

    //add validators
    JSONObject requiredObject = jsonObject.optJSONObject("v_required");
    if(requiredObject != null) {
        String requiredValue = requiredObject.getString("value");
        if (!TextUtils.isEmpty(requiredValue)) {
            if (Boolean.TRUE.toString().equalsIgnoreCase(requiredValue)) {
                editText.addValidator(new RequiredValidator(requiredObject.getString("err")));
            }
        }
    }

    JSONObject minLengthObject = jsonObject.optJSONObject("v_min_length");
    if(minLengthObject != null) {
        String minLengthValue = minLengthObject.optString("value");
        if (!TextUtils.isEmpty(minLengthValue)) {
            minLength = Integer.parseInt(minLengthValue);
            editText.addValidator(new MinLengthValidator(minLengthObject.getString("err"), Integer.parseInt(minLengthValue)));
        }
    }

    JSONObject maxLengthObject = jsonObject.optJSONObject("v_max_length");
    if(maxLengthObject != null) {
        String maxLengthValue = maxLengthObject.optString("value");
        if (!TextUtils.isEmpty(maxLengthValue)) {
            maxLength = Integer.parseInt(maxLengthValue);
            editText.addValidator(new MaxLengthValidator(maxLengthObject.getString("err"), Integer.parseInt(maxLengthValue)));
        }
    }

    editText.setMaxCharacters(maxLength);
    editText.setMinCharacters(minLength);

    JSONObject regexObject = jsonObject.optJSONObject("v_regex");
    if(regexObject != null) {
        String regexValue = regexObject.optString("value");
        if (!TextUtils.isEmpty(regexValue)) {
            editText.addValidator(new RegexpValidator(regexObject.getString("err"), regexValue));
        }
    }

    JSONObject emailObject = jsonObject.optJSONObject("v_email");
    if(emailObject != null) {
        String emailValue = emailObject.optString("value");
        if (!TextUtils.isEmpty(emailValue)) {
            if (Boolean.TRUE.toString().equalsIgnoreCase(emailValue)) {
                editText.addValidator(new RegexpValidator(emailObject.getString("err"), android.util.Patterns.EMAIL_ADDRESS.toString()));
            }
        }
    }

    JSONObject urlObject = jsonObject.optJSONObject("v_url");
    if(urlObject != null) {
        String urlValue = urlObject.optString("value");
        if (!TextUtils.isEmpty(urlValue)) {
            if (Boolean.TRUE.toString().equalsIgnoreCase(urlValue)) {
                editText.addValidator(new RegexpValidator(urlObject.getString("err"), Patterns.WEB_URL.toString()));
            }
        }
    }

    JSONObject numericObject = jsonObject.optJSONObject("v_numeric");
    if(numericObject != null) {
        String numericValue = numericObject.optString("value");
        if (!TextUtils.isEmpty(numericValue)) {
            if (Boolean.TRUE.toString().equalsIgnoreCase(numericValue)) {
                editText.addValidator(new RegexpValidator(numericObject.getString("err"), "[0-9]+"));
            }
        }
    }

    // edit type check
    String editType = jsonObject.optString("edit_type");
    if (!TextUtils.isEmpty(editType)) {
        if (editType.equals("number")) {
            editText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
        }
    }

    editText.addTextChangedListener(new GenericTextWatcher(stepName, editText));
    views.add(editText);
    return views;
}
 
Example #24
Source File: ModifyPostActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.modify_post_activity_layout);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_MODIFY_POST:
                    handleModify(msg);
                    break;

            }
        }
    };

    post_id = getIntent().getStringExtra("post_id");
    postname= getIntent().getStringExtra("postname");
    salary = getIntent().getStringExtra("salary");
    description = getIntent().getStringExtra("description");
    requirement = getIntent().getStringExtra("requirement");


    ActionBar ab = this.getSupportActionBar();
    ab.setLogo(R.mipmap.ic_arrow_back_white_24dp);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle("修改职位信息");


    btn_submit = (ButtonFlat)this.findViewById(R.id.id_modify_post_activity_btn_submit);
    btn_submit.setBackgroundColor(this.getResources().getColor(R.color.colorPrimary));

    et_postname = (MaterialEditText)this.findViewById(R.id.id_modify_post_activity_et_postname);
    et_salary = (MaterialEditText)this.findViewById(R.id.id_modify_post_activity_et_salary);
    et_requirement = (MaterialEditText)this.findViewById(R.id.id_modify_post_activity_et_requirement);
    et_description = (MaterialEditText)this.findViewById(R.id.id_modify_post_activity_et_description);

    et_postname.setText(postname);
    et_salary.setText(salary);
    et_description.setText(description);
    et_requirement.setText(requirement);

    btn_submit.setOnClickListener(this);
}
 
Example #25
Source File: LoginFragment.java    From Social with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.login_fragment_layout,container,false);
    btn_login = (ButtonFlat)view.findViewById(R.id.id_login_fg_btn_login);
    btn_login.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    btn_regist = (ButtonFlat)view.findViewById(R.id.id_login_fg_btn_regist);
    btn_regist.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    btn_forget = (ButtonFlat)view.findViewById(R.id.id_login_fg_btn_forget);
    btn_forget.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    et_password = (MaterialEditText)view.findViewById(R.id.id_login_fg_et_password);
    et_username = (MaterialEditText)view.findViewById(R.id.id_login_fg_et_username);

    iv_qq_login = (ImageView)view.findViewById(R.id.id_login_fg_iv_qq_login);
    iv_qq_login.setOnClickListener(this);

    btn_regist.setOnClickListener(this);
    btn_login.setOnClickListener(this);

    SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user", getActivity().MODE_PRIVATE);
    if (sharedPreferences != null){
        password = SharedPreferenceUtil.getPassword();
        username = SharedPreferenceUtil.getUserName();
        et_password.setText(password);
        et_username.setText(username);
    }

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_LOGIN:
                    handleLogin(msg);
                    break;
                default:
                    break;
            }
        }
    };

    return view;
}
 
Example #26
Source File: EditActivity.java    From Memory-capsule with Apache License 2.0 4 votes vote down vote up
/**
 * //实例化一个edittext
 */
private void initEdittextView(){
    materialEditText=(MaterialEditText)this.findViewById(R.id.add_noteinfoedittext);
}
 
Example #27
Source File: LoginEmailActivity.java    From android with MIT License 3 votes vote down vote up
/**
 * Implements OnFocusChangeListener
 * Validate fields on focus-loss
 *
 * @param v
 * @param hasFocus
 */
@Override
public void onFocusChange(View v, boolean hasFocus) {
    if (!hasFocus) {
        ((MaterialEditText) v).validate();
    }
}