本文整理汇总了Java中com.rengwuxian.materialedittext.MaterialEditText类的典型用法代码示例。如果您正苦于以下问题:Java MaterialEditText类的具体用法?Java MaterialEditText怎么用?Java MaterialEditText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaterialEditText类属于com.rengwuxian.materialedittext包,在下文中一共展示了MaterialEditText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
setToolbar(true);
getSupportActionBar().setTitle(R.string.login);
final MaterialEditText emailEditText = (MaterialEditText) findViewById(R.id.email_login);
final MaterialEditText passwordEditText = (MaterialEditText) findViewById(R.id.password_login);
final Button loginButton = (Button) findViewById(R.id.login);
loginButton.setOnClickListener((View v) -> {
final String email = Utils.getEditTextString(emailEditText);
final String password = Utils.getEditTextString(passwordEditText);
if (StringUtils.isAValidString(email) && StringUtils.isAValidString(password)
&& StringUtils.isAValidEmail(email) && StringUtils.isAValidPassword(password)) {
final Message message = new LoginMessageImpl(email, password);
login(message);
} else {
showDialog(R.string.login, R.string.incorrect_login_data);
}
});
}
示例2: showSearchDialog
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void showSearchDialog() {
final MaterialEditText editText = new MaterialEditText(FanjuNewsActivity.this);
editText.setHint(R.string.input_http);
editText.setMetTextColor(Color.parseColor("#009688"));
editText.setPrimaryColor(Color.parseColor("#009688"));
editText.setMaxCharacters(100);
editText.setErrorColor(Color.parseColor("#ff0000"));
AlertDialog.Builder builder = new AlertDialog.Builder(FanjuNewsActivity.this)
.setTitle(R.string.search_video)
.setView(editText, 30, 20, 20, 20)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doSearch(editText.getText().toString());
}
});
builder.create().show();
}
示例3: showAddDialog
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void showAddDialog() {
final MaterialEditText editText = new MaterialEditText(FindBookActivity.this);
editText.setHint(R.string.input_hint);
editText.setMetTextColor(Color.parseColor("#009688"));
editText.setPrimaryColor(Color.parseColor("#009688"));
editText.setMaxCharacters(20);
editText.setErrorColor(Color.parseColor("#ff0000"));
AlertDialog.Builder builder = new AlertDialog.Builder(FindBookActivity.this)
.setTitle(R.string.add_book)
.setView(editText, 30, 20, 20, 20)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doSearch(editText.getText().toString());
}
});
builder.create().show();
}
示例4: showSearchDialog
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void showSearchDialog() {
final MaterialEditText editText = new MaterialEditText(FanjuVideoActivity.this);
editText.setHint(R.string.input_http);
editText.setMetTextColor(Color.parseColor("#009688"));
editText.setPrimaryColor(Color.parseColor("#009688"));
editText.setMaxCharacters(100);
editText.setErrorColor(Color.parseColor("#ff0000"));
AlertDialog.Builder builder = new AlertDialog.Builder(FanjuVideoActivity.this)
.setTitle(R.string.search_video)
.setView(editText, 30, 20, 20, 20)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doSearch(editText.getText().toString());
}
});
builder.create().show();
}
示例5: findViews
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void findViews(){
toolbar = (Toolbar) findViewById(R.id.toolbar_new_word);
toolbar.setTitle("新词条");
toolbar.setTitleTextColor(Color.WHITE);
toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white);
et_new_word = (MaterialEditText) findViewById(R.id.et_new_word);
spinner = (ButtonFlat) findViewById(R.id.spinner_new_word_lang);
setupSpinner();
checkBox = (CheckBox) findViewById(R.id.cb_anonymous);
tv_time = (TextView) findViewById(R.id.tv_time);
tv_time.setVisibility(View.GONE);
tv_hint = (TextView) findViewById(R.id.tv_record_hint);
ib_delete = (ImageButton) findViewById(R.id.ib_delete);
ib_delete.setVisibility(View.GONE);
bt_main = (ButtonFloatSmall) findViewById(R.id.bt_record);
bt_main.setDrawableIcon(getResources().getDrawable(R.drawable.iconfont_microphone));
bt_main.setRippleSpeed(20f);
}
示例6: onActivityCreated
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@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);
}
}
});
}
示例7: onActivityCreated
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@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);
}
示例8: InitMain
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
void InitMain()
{
SignInButton = (FlatButton) findViewById(R.id.SignIn);
UserNameEditText = (MaterialEditText) findViewById(R.id.UserName);
PasswordEditText = (MaterialEditText) findViewById(R.id.Password);
SignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(LoginRunnable).start();
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(UserNameEditText.getWindowToken(), 0);
imm.hideSoftInputFromWindow(PasswordEditText.getWindowToken(), 0);
SignInButton.setEnabled(false);
UserNameEditText.setEnabled(false);
PasswordEditText.setEnabled(false);
}
});
restorePrefs();
}
示例9: getEditionValue
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@Override
public Object getEditionValue()
{
if (editionView instanceof MaterialEditText)
{
String value = ((MaterialEditText) editionView).getText().toString();
if (TextUtils.isEmpty(value))
{
return null;
}
else if ("-".equals(value))
{
return null;
}
else
{
return Double.parseDouble(value);
}
}
return null;
}
示例10: setupEditionView
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@Override
public View setupEditionView(Object value)
{
MaterialEditText edit = (MaterialEditText) super.setupEditionView(value);
edit.addTextChangedListener(new DecimalTextWatcher(edit, 10, 2));
edit.setFloatingLabelText(getLabelText(getCurrencyLabel()));
if ((((AmountFieldRepresentation) data).isEnableFractions()))
{
edit.setInputType(EditorInfo.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
| EditorInfo.TYPE_NUMBER_FLAG_SIGNED);
}
else
{
edit.setInputType(EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED);
}
return edit;
}
示例11: getEditionValue
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
@Override
public Object getEditionValue()
{
if (editionView instanceof MaterialEditText)
{
String value = ((MaterialEditText) editionView).getText().toString();
if (TextUtils.isEmpty(value))
{
return null;
}
else if ("-".equals(value))
{
return null;
}
else
{
return Double.parseDouble(value);
}
}
return null;
}
示例12: initValidationEt
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void initValidationEt() {
final MaterialEditText validationEt = (MaterialEditText) findViewById(R.id.validationEt);
validationEt.addValidator(new RegexpValidator("Only Integer Valid!", "\\d+"));
final Button validateBt = (Button) findViewById(R.id.validateBt);
validateBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// validate
validationEt.validate();
}
});
}
示例13: isFileNameOk
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
public static String isFileNameOk(Context context, MaterialEditText fileName, String suffix, String parentPath, boolean needCheckExist) {
if (fileName.getText() == null) {
fileName.setError(context.getString(R.string.empty_name_tip));
return null;
}
String name = fileName.getText().toString().trim();
if (TextUtils.isEmpty(name)) {
fileName.setError(context.getString(R.string.empty_name_tip));
return null;
} else if (FileUtils.hasIllegalChar(name)) {
fileName.setError(context.getString(R.string.file_name_illegal));
return null;
} else if (FileUtils.fileNameOnlyOne(name)) {
fileName.setError(context.getString(R.string.file_name_unqualified));
return null;
}
if (needCheckExist){
File file = new File(parentPath, name + suffix);
if (file.exists()) {
fileName.setError(context.getString(R.string.same_name));
return null;
}
}
return name + suffix;
}
示例14: startFilterActivity
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private void startFilterActivity(String selectColum, MaterialEditText filter_value) {
Intent intent = new Intent(SqlTabDatasActivity.this, SqlTabDatasActivity.class);
intent.putExtra(SqlTabDatasActivity.TABLE_KEY, mTableName);
intent.putExtra(SqlTabDatasActivity.DB_NAME, getIntent().getStringExtra(DB_NAME));
intent.putExtra(SqlTabDatasActivity.DATA_SOURCE, SqlConstant.TABLE_DATAS_FILTER);
intent.putExtra(SqlTabDatasActivity.FILTER_COLUM, selectColum);
intent.putExtra(SqlTabDatasActivity.FILTER_KEY, filter_value.getText().toString());
startActivity(intent);
}
示例15: hasSameTable
import com.rengwuxian.materialedittext.MaterialEditText; //导入依赖的package包/类
private boolean hasSameTable(MaterialEditText fileName) {
boolean hasSame = false;
String tableName, fileNameStr;
for (int i = 0; i < mTableNames.size(); i++) {
tableName = mTableNames.get(i).toLowerCase();
fileNameStr = fileName.getText().toString().trim().toLowerCase();
if (tableName.equals(fileNameStr)) {
hasSame = true;
fileName.setError(this.getResources().getString(R.string.same_name));
}
}
return hasSame;
}