OLD | NEW |
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.ui; | 5 package org.chromium.ui; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Runnable openRunnable = new Runnable() { | 144 Runnable openRunnable = new Runnable() { |
145 @Override | 145 @Override |
146 public void run() { | 146 public void run() { |
147 // Not passing InputMethodManager.SHOW_IMPLICIT as it does not t
rigger the | 147 // Not passing InputMethodManager.SHOW_IMPLICIT as it does not t
rigger the |
148 // keyboard in landscape mode. | 148 // keyboard in landscape mode. |
149 InputMethodManager imm = | 149 InputMethodManager imm = |
150 (InputMethodManager) view.getContext().getSystemService( | 150 (InputMethodManager) view.getContext().getSystemService( |
151 Context.INPUT_METHOD_SERVICE); | 151 Context.INPUT_METHOD_SERVICE); |
152 // Third-party touches disk on showSoftInput call. http://crbug.
com/619824, | 152 // Third-party touches disk on showSoftInput call. http://crbug.
com/619824, |
153 // http://crbug.com/635118 | 153 // http://crbug.com/635118 |
154 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskRe
ads(); | 154 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWr
ites(); |
155 StrictMode.allowThreadDiskWrites(); | |
156 try { | 155 try { |
157 imm.showSoftInput(view, 0); | 156 imm.showSoftInput(view, 0); |
158 } catch (IllegalArgumentException e) { | 157 } catch (IllegalArgumentException e) { |
159 if (attempt.incrementAndGet() <= KEYBOARD_RETRY_ATTEMPTS) { | 158 if (attempt.incrementAndGet() <= KEYBOARD_RETRY_ATTEMPTS) { |
160 handler.postDelayed(this, KEYBOARD_RETRY_DELAY_MS); | 159 handler.postDelayed(this, KEYBOARD_RETRY_DELAY_MS); |
161 } else { | 160 } else { |
162 Log.e(TAG, "Unable to open keyboard. Giving up.", e); | 161 Log.e(TAG, "Unable to open keyboard. Giving up.", e); |
163 } | 162 } |
164 } finally { | 163 } finally { |
165 StrictMode.setThreadPolicy(oldPolicy); | 164 StrictMode.setThreadPolicy(oldPolicy); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 * attached to the view hierarchy. | 379 * attached to the view hierarchy. |
381 * | 380 * |
382 * @param view The view to be removed from the parent. | 381 * @param view The view to be removed from the parent. |
383 */ | 382 */ |
384 public static void removeViewFromParent(View view) { | 383 public static void removeViewFromParent(View view) { |
385 ViewGroup parent = (ViewGroup) view.getParent(); | 384 ViewGroup parent = (ViewGroup) view.getParent(); |
386 if (parent == null) return; | 385 if (parent == null) return; |
387 parent.removeView(view); | 386 parent.removeView(view); |
388 } | 387 } |
389 } | 388 } |
OLD | NEW |