提交 6d499903 authored 作者: lgd's avatar lgd

1.修改入库控件属性

2.//TODO 坩埚下单,mes其他页面,mes用户反馈空也展示,编辑任务担当无法修改
上级 ce65f23e
...@@ -28,7 +28,7 @@ import io.reactivex.Observable; ...@@ -28,7 +28,7 @@ import io.reactivex.Observable;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
/** /**
* 添加发货 * 入库申请
* author : flexible * author : flexible
* email : lgd19940421@163.com * email : lgd19940421@163.com
* github: https://github.com/FlexibleXd * github: https://github.com/FlexibleXd
...@@ -54,6 +54,8 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity { ...@@ -54,6 +54,8 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity {
@Override @Override
protected void initView() { protected void initView() {
ButterKnife.bind(this); ButterKnife.bind(this);
WorkUtils.addDecimalsListener(etNum);
WorkUtils.addNumListener(etRemark, tvRemarkNum);
} }
@Override @Override
...@@ -68,22 +70,6 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity { ...@@ -68,22 +70,6 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity {
@Override @Override
protected void initEvent() { protected void initEvent() {
etRemark.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
tvRemarkNum.setText(s.length() + "/140");
}
});
} }
...@@ -118,9 +104,9 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity { ...@@ -118,9 +104,9 @@ public class AddStockApplyAddActivity extends WorkToolBarActivity {
observable = RtfUtils.getRtf().addPoStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param)); observable = RtfUtils.getRtf().addPoStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
} else if (TextUtils.equals(orderType, OrderType.SUPPLIER.getCode())) { } else if (TextUtils.equals(orderType, OrderType.SUPPLIER.getCode())) {
observable = RtfUtils.getRtf().addFoStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param)); observable = RtfUtils.getRtf().addFoStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
}else if (TextUtils.equals(orderType, OrderType.CRUCIBLE.getCode())) { } else if (TextUtils.equals(orderType, OrderType.CRUCIBLE.getCode())) {
observable = RtfUtils.getRtf().addStockCoApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param)); observable = RtfUtils.getRtf().addStockCoApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
}else if (TextUtils.equals(orderType, OrderType.IN.getCode())) { } else if (TextUtils.equals(orderType, OrderType.IN.getCode())) {
observable = RtfUtils.getRtf().addStockIoApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param)); observable = RtfUtils.getRtf().addStockIoApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
} else { } else {
observable = RtfUtils.getRtf().addStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param)); observable = RtfUtils.getRtf().addStockApplyAdd(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
......
...@@ -7,7 +7,9 @@ import android.database.Cursor; ...@@ -7,7 +7,9 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
...@@ -711,12 +713,11 @@ public class WorkUtils { ...@@ -711,12 +713,11 @@ public class WorkUtils {
private static int curSelection; private static int curSelection;
/*** /***
* 保留两位小数 * 保留小数
* @param editText * @param editText
* @param length 整数数字长度
*/ */
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
public static void keepTwoDecimals(EditText editText) { public static void keepDecimals(EditText editText) {
String number = editText.getText().toString(); String number = editText.getText().toString();
//第一位不能输入小点 //第一位不能输入小点
if (number.length() == 1 && TextUtils.equals(number.substring(0, 1), POINTER)) { if (number.length() == 1 && TextUtils.equals(number.substring(0, 1), POINTER)) {
...@@ -744,4 +745,55 @@ public class WorkUtils { ...@@ -744,4 +745,55 @@ public class WorkUtils {
} }
} }
} }
/***
* 保留小数监听
* @param editText
*/
public static void addDecimalsListener(EditText editText) {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
keepDecimals(editText);
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
/***
* 140监听
* @param editText
*/
public static void addNumListener(EditText editText, TextView textView) {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.length() > 140) {
editText.setText(s.toString().substring(0, 140));
editText.setSelection(140);
} else {
textView.setText(s.length() + "/140");
}
}
});
}
} }
...@@ -41,7 +41,7 @@ public class AddAndReduceView extends LinearLayout implements View.OnClickListen ...@@ -41,7 +41,7 @@ public class AddAndReduceView extends LinearLayout implements View.OnClickListen
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
WorkUtils.keepTwoDecimals(tvNum); WorkUtils.keepDecimals(tvNum);
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论