Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(814)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java

Issue 234563005: Fix for unable to enter decimal in number input field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.os.SystemClock; 7 import android.os.SystemClock;
8 import android.text.Editable; 8 import android.text.Editable;
9 import android.text.InputType; 9 import android.text.InputType;
10 import android.text.Selection; 10 import android.text.Selection;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; 94 outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
95 } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTel ) { 95 } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTel ) {
96 // Telephone 96 // Telephone
97 // Number and telephone do not have both a Tab key and an 97 // Number and telephone do not have both a Tab key and an
98 // action in default OSK, so set the action to NEXT 98 // action in default OSK, so set the action to NEXT
99 outAttrs.inputType = InputType.TYPE_CLASS_PHONE; 99 outAttrs.inputType = InputType.TYPE_CLASS_PHONE;
100 outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; 100 outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
101 } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeNum ber) { 101 } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeNum ber) {
102 // Number 102 // Number
103 outAttrs.inputType = InputType.TYPE_CLASS_NUMBER 103 outAttrs.inputType = InputType.TYPE_CLASS_NUMBER
104 | InputType.TYPE_NUMBER_VARIATION_NORMAL; 104 | InputType.TYPE_NUMBER_VARIATION_NORMAL
105 | InputType.TYPE_NUMBER_FLAG_DECIMAL;
105 outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; 106 outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
106 } 107 }
107 outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); 108 outAttrs.initialSelStart = Selection.getSelectionStart(mEditable);
108 outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); 109 outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable);
109 mLastUpdateSelectionStart = Selection.getSelectionStart(mEditable); 110 mLastUpdateSelectionStart = Selection.getSelectionStart(mEditable);
110 mLastUpdateSelectionEnd = Selection.getSelectionEnd(mEditable); 111 mLastUpdateSelectionEnd = Selection.getSelectionEnd(mEditable);
111 112
112 Selection.setSelection(mEditable, outAttrs.initialSelStart, outAttrs.ini tialSelEnd); 113 Selection.setSelection(mEditable, outAttrs.initialSelStart, outAttrs.ini tialSelEnd);
113 updateSelectionIfRequired(); 114 updateSelectionIfRequired();
114 } 115 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 @VisibleForTesting 467 @VisibleForTesting
467 ImeState getImeStateForTesting() { 468 ImeState getImeStateForTesting() {
468 String text = mEditable.toString(); 469 String text = mEditable.toString();
469 int selectionStart = Selection.getSelectionStart(mEditable); 470 int selectionStart = Selection.getSelectionStart(mEditable);
470 int selectionEnd = Selection.getSelectionEnd(mEditable); 471 int selectionEnd = Selection.getSelectionEnd(mEditable);
471 int compositionStart = getComposingSpanStart(mEditable); 472 int compositionStart = getComposingSpanStart(mEditable);
472 int compositionEnd = getComposingSpanEnd(mEditable); 473 int compositionEnd = getComposingSpanEnd(mEditable);
473 return new ImeState(text, selectionStart, selectionEnd, compositionStart , compositionEnd); 474 return new ImeState(text, selectionStart, selectionEnd, compositionStart , compositionEnd);
474 } 475 }
475 } 476 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698