修复礼物栏自定义数量过长导致的闪退问题
This commit is contained in:
parent
d899975495
commit
3ab91a74d1
@ -54,7 +54,9 @@ public class GiftNumberPopup extends BottomPopupView {
|
|||||||
new XPopup.Builder(getContext())
|
new XPopup.Builder(getContext())
|
||||||
.asCustom(new InputCustomPopup(getContext(),
|
.asCustom(new InputCustomPopup(getContext(),
|
||||||
getContext().getString(R.string.the_title_financier3),
|
getContext().getString(R.string.the_title_financier3),
|
||||||
R.string.custom_quantity, true).setListener(new InputCustomPopup.InputCustomListener() {
|
R.string.custom_quantity, true)
|
||||||
|
.setMaxValue(4)
|
||||||
|
.setListener(new InputCustomPopup.InputCustomListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfirm(String text) {
|
public void onConfirm(String text) {
|
||||||
if (!TextUtils.isEmpty(text)) {
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.InputFilter;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -22,6 +23,7 @@ public class InputCustomPopup extends CenterPopupView {
|
|||||||
private String message = "";
|
private String message = "";
|
||||||
private int title = R.string.dialog_tip;
|
private int title = R.string.dialog_tip;
|
||||||
private boolean isType;
|
private boolean isType;
|
||||||
|
private int maxValue=0;
|
||||||
|
|
||||||
public InputCustomPopup(@NonNull Context context, String message, int title) {
|
public InputCustomPopup(@NonNull Context context, String message, int title) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -36,6 +38,11 @@ public class InputCustomPopup extends CenterPopupView {
|
|||||||
this.isType = isType;
|
this.isType = isType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InputCustomPopup setMaxValue(int maxValue) {
|
||||||
|
this.maxValue = maxValue;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public InputCustomPopup(@NonNull Context context, int title) {
|
public InputCustomPopup(@NonNull Context context, int title) {
|
||||||
super(context);
|
super(context);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -53,6 +60,9 @@ public class InputCustomPopup extends CenterPopupView {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
EditText content = findViewById(R.id.content);
|
EditText content = findViewById(R.id.content);
|
||||||
TextView titleText = findViewById(R.id.title);
|
TextView titleText = findViewById(R.id.title);
|
||||||
|
if(maxValue>0){
|
||||||
|
content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxValue)});
|
||||||
|
}
|
||||||
|
|
||||||
if (isType) {
|
if (isType) {
|
||||||
content.setHint(message);
|
content.setHint(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user