本文整理汇总了Java中org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest类的典型用法代码示例。如果您正苦于以下问题:Java PaymentRequestObserverForTest类的具体用法?Java PaymentRequestObserverForTest怎么用?Java PaymentRequestObserverForTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaymentRequestObserverForTest类属于org.chromium.chrome.browser.payments.ui.PaymentRequestUI包,在下文中一共展示了PaymentRequestObserverForTest类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EditorView
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest; //导入依赖的package包/类
/**
* Builds the editor view.
*
* @param activity The activity on top of which the UI should be displayed.
* @param observerForTest Optional event observer for testing.
*/
public EditorView(Activity activity, PaymentRequestObserverForTest observerForTest) {
super(activity, R.style.FullscreenWhite);
mContext = activity;
mObserverForTest = observerForTest;
mHandler = new Handler();
mEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
mDoneButton.performClick();
return true;
} else if (actionId == EditorInfo.IME_ACTION_NEXT) {
View next = v.focusSearch(View.FOCUS_FORWARD);
if (next != null) {
next.requestFocus();
return true;
}
}
return false;
}
};
mHalfRowMargin = activity.getResources().getDimensionPixelSize(
R.dimen.payments_section_large_spacing);
mFieldViews = new ArrayList<>();
mEditableTextFields = new ArrayList<>();
mDropdownFields = new ArrayList<>();
final Pattern cardNumberPattern = Pattern.compile("^[\\d- ]*$");
mCardNumberInputFilter = new InputFilter() {
@Override
public CharSequence filter(
CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
// Accept deletions.
if (start == end) return null;
// Accept digits, "-", and spaces.
if (cardNumberPattern.matcher(source.subSequence(start, end)).matches()) {
return null;
}
// Reject everything else.
return "";
}
};
mCardNumberFormatter = new CreditCardNumberFormattingTextWatcher();
new AsyncTask<Void, Void, PhoneNumberFormattingTextWatcher>() {
@Override
protected PhoneNumberFormattingTextWatcher doInBackground(Void... unused) {
return new PhoneNumberFormattingTextWatcher();
}
@Override
protected void onPostExecute(PhoneNumberFormattingTextWatcher result) {
mPhoneFormatter = result;
if (mPhoneInput != null) {
mPhoneInput.addTextChangedListener(mPhoneFormatter);
}
}
}.execute();
}
示例2: EditorDialog
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest; //导入依赖的package包/类
/**
* Builds the editor dialog.
*
* @param activity The activity on top of which the UI should be displayed.
* @param observerForTest Optional event observer for testing.
*/
public EditorDialog(Activity activity, PaymentRequestObserverForTest observerForTest) {
super(activity, R.style.FullscreenWhite);
// Sets transparent background for animating content view.
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mContext = activity;
mObserverForTest = observerForTest;
mHandler = new Handler();
mEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
mDoneButton.performClick();
return true;
} else if (actionId == EditorInfo.IME_ACTION_NEXT) {
View next = v.focusSearch(View.FOCUS_FORWARD);
if (next != null) {
next.requestFocus();
return true;
}
}
return false;
}
};
mHalfRowMargin = activity.getResources().getDimensionPixelSize(
R.dimen.payments_section_large_spacing);
mDropdownTopPadding = activity.getResources().getDimensionPixelSize(
R.dimen.payments_section_dropdown_top_padding);
mFieldViews = new ArrayList<>();
mEditableTextFields = new ArrayList<>();
mDropdownFields = new ArrayList<>();
final Pattern cardNumberPattern = Pattern.compile("^[\\d- ]*$");
mCardNumberInputFilter = new InputFilter() {
@Override
public CharSequence filter(
CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
// Accept deletions.
if (start == end) return null;
// Accept digits, "-", and spaces.
if (cardNumberPattern.matcher(source.subSequence(start, end)).matches()) {
return null;
}
// Reject everything else.
return "";
}
};
mCardNumberFormatter = new CreditCardNumberFormattingTextWatcher();
mPhoneFormatter = new PhoneNumberUtil.FormatTextWatcher();
}