| 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.chromoting; | 5 package org.chromium.chromoting; |
| 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.Color; | 10 import android.graphics.Color; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (progress >= 1) { | 91 if (progress >= 1) { |
| 92 mRunning = false; | 92 mRunning = false; |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Animation grows from 0 to |size|, and goes from fully opaque to t
ransparent for a | 97 // Animation grows from 0 to |size|, and goes from fully opaque to t
ransparent for a |
| 98 // seamless fading-out effect. The animation needs to have more than
one color so it's | 98 // seamless fading-out effect. The animation needs to have more than
one color so it's |
| 99 // visible over any background color. | 99 // visible over any background color. |
| 100 float radius = size * progress; | 100 float radius = size * progress; |
| 101 int alpha = (int)((1 - progress) * 0xff); | 101 int alpha = (int) ((1 - progress) * 0xff); |
| 102 | 102 |
| 103 int transparentBlack = Color.argb(0, 0, 0, 0); | 103 int transparentBlack = Color.argb(0, 0, 0, 0); |
| 104 int white = Color.argb(alpha, 0xff, 0xff, 0xff); | 104 int white = Color.argb(alpha, 0xff, 0xff, 0xff); |
| 105 int black = Color.argb(alpha, 0, 0, 0); | 105 int black = Color.argb(alpha, 0, 0, 0); |
| 106 mPaint.setShader(new RadialGradient(x, y, radius, | 106 mPaint.setShader(new RadialGradient(x, y, radius, |
| 107 new int[] {transparentBlack, white, black, transparentBlack}
, | 107 new int[] {transparentBlack, white, black, transparentBlack}
, |
| 108 new float[] {0.0f, 0.8f, 0.9f, 1.0f}, Shader.TileMode.CLAMP)
); | 108 new float[] {0.0f, 0.8f, 0.9f, 1.0f}, Shader.TileMode.CLAMP)
); |
| 109 canvas.drawCircle(x, y, radius, mPaint); | 109 canvas.drawCircle(x, y, radius, mPaint); |
| 110 } | 110 } |
| 111 } | 111 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 | 364 |
| 365 @Override | 365 @Override |
| 366 public void showActionBar() { | 366 public void showActionBar() { |
| 367 mDesktop.showActionBar(); | 367 mDesktop.showActionBar(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 @Override | 370 @Override |
| 371 public void showKeyboard() { | 371 public void showKeyboard() { |
| 372 InputMethodManager inputManager = | 372 InputMethodManager inputManager = |
| 373 (InputMethodManager)getContext().getSystemService(Context.INPUT_
METHOD_SERVICE); | 373 (InputMethodManager) getContext().getSystemService(Context.INPUT
_METHOD_SERVICE); |
| 374 inputManager.showSoftInput(this, 0); | 374 inputManager.showSoftInput(this, 0); |
| 375 } | 375 } |
| 376 | 376 |
| 377 @Override | 377 @Override |
| 378 public void transformationChanged() { | 378 public void transformationChanged() { |
| 379 requestRepaint(); | 379 requestRepaint(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 @Override | 382 @Override |
| 383 public void setAnimationEnabled(boolean enabled) { | 383 public void setAnimationEnabled(boolean enabled) { |
| 384 synchronized (mAnimationLock) { | 384 synchronized (mAnimationLock) { |
| 385 if (enabled && !mInputAnimationRunning) { | 385 if (enabled && !mInputAnimationRunning) { |
| 386 requestRepaint(); | 386 requestRepaint(); |
| 387 } | 387 } |
| 388 mInputAnimationRunning = enabled; | 388 mInputAnimationRunning = enabled; |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 } | 391 } |
| OLD | NEW |