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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/TouchInputHandler.java

Issue 2410353002: Moving logic for System UI state changes into DesktopCanvas class (Closed)
Patch Set: Created 4 years, 2 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 | « remoting/android/java/src/org/chromium/chromoting/DesktopCanvas.java ('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.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.Matrix; 8 import android.graphics.Matrix;
9 import android.graphics.PointF; 9 import android.graphics.PointF;
10 import android.graphics.Rect; 10 import android.graphics.Rect;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 @Override 243 @Override
244 public void run(InputModeChangedEventParameter parameter) { 244 public void run(InputModeChangedEventParameter parameter) {
245 handleInputModeChanged(parameter, injector); 245 handleInputModeChanged(parameter, injector);
246 } 246 }
247 }); 247 });
248 248
249 attachEvent(desktop.onSystemUiVisibilityChanged(), 249 attachEvent(desktop.onSystemUiVisibilityChanged(),
250 new Event.ParameterRunnable<SystemUiVisibilityChangedEventParame ter>() { 250 new Event.ParameterRunnable<SystemUiVisibilityChangedEventParame ter>() {
251 @Override 251 @Override
252 public void run(SystemUiVisibilityChangedEventParameter para meter) { 252 public void run(SystemUiVisibilityChangedEventParameter para meter) {
253 handleSystemUiVisibilityChanged(parameter); 253 mDesktopCanvas.onSystemUiVisibilityChanged(parameter);
254 } 254 }
255 }); 255 });
256 256
257 attachEvent(renderStub.onClientSizeChanged(), 257 attachEvent(renderStub.onClientSizeChanged(),
258 new Event.ParameterRunnable<SizeChangedEventParameter>() { 258 new Event.ParameterRunnable<SizeChangedEventParameter>() {
259 @Override 259 @Override
260 public void run(SizeChangedEventParameter parameter) { 260 public void run(SizeChangedEventParameter parameter) {
261 handleClientSizeChanged(parameter.width, parameter.heigh t); 261 handleClientSizeChanged(parameter.width, parameter.heigh t);
262 } 262 }
263 }); 263 });
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 default: 342 default:
343 // Unreachable, but required by Google Java style and findbugs. 343 // Unreachable, but required by Google Java style and findbugs.
344 assert false : "Unreached"; 344 assert false : "Unreached";
345 } 345 }
346 346
347 // Ensure the cursor state is updated appropriately. 347 // Ensure the cursor state is updated appropriately.
348 mRenderStub.setCursorVisibility(mRenderData.drawCursor); 348 mRenderStub.setCursorVisibility(mRenderData.drawCursor);
349 } 349 }
350 350
351 private void handleSystemUiVisibilityChanged(
352 SystemUiVisibilityChangedEventParameter parameter) {
353 if (parameter.systemUiVisible) {
354 mDesktopCanvas.setSystemUiOffsetValues(parameter.left, parameter.top ,
355 mRenderData.screenWidth - parameter.right,
356 mRenderData.screenHeight - parameter.bottom);
357 } else {
358 mDesktopCanvas.clearSystemUiOffsets();
359 }
360 }
361
362 private boolean handleTouchEvent(MotionEvent event) { 351 private boolean handleTouchEvent(MotionEvent event) {
363 // Give the underlying input strategy a chance to observe the current mo tion event before 352 // Give the underlying input strategy a chance to observe the current mo tion event before
364 // passing it to the gesture detectors. This allows the input strategy to react to the 353 // passing it to the gesture detectors. This allows the input strategy to react to the
365 // event or save the payload for use in recreating the gesture remotely. 354 // event or save the payload for use in recreating the gesture remotely.
366 mInputStrategy.onMotionEvent(event); 355 mInputStrategy.onMotionEvent(event);
367 356
368 // Avoid short-circuit logic evaluation - ensure all gesture detectors s ee all events so 357 // Avoid short-circuit logic evaluation - ensure all gesture detectors s ee all events so
369 // that they generate correct notifications. 358 // that they generate correct notifications.
370 boolean handled = mScroller.onTouchEvent(event); 359 boolean handled = mScroller.onTouchEvent(event);
371 handled |= mZoomer.onTouchEvent(event); 360 handled |= mZoomer.onTouchEvent(event);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 float[] mappedPoints = mapScreenPointToImagePoint(screenX, screenY); 680 float[] mappedPoints = mapScreenPointToImagePoint(screenX, screenY);
692 681
693 float imageWidth = (float) mRenderData.imageWidth + EPSILON; 682 float imageWidth = (float) mRenderData.imageWidth + EPSILON;
694 float imageHeight = (float) mRenderData.imageHeight + EPSILON; 683 float imageHeight = (float) mRenderData.imageHeight + EPSILON;
695 684
696 return mappedPoints[0] < -EPSILON || mappedPoints[0] > imageWidth 685 return mappedPoints[0] < -EPSILON || mappedPoints[0] > imageWidth
697 || mappedPoints[1] < -EPSILON || mappedPoints[1] > imageHeig ht; 686 || mappedPoints[1] < -EPSILON || mappedPoints[1] > imageHeig ht;
698 } 687 }
699 } 688 }
700 } 689 }
OLDNEW
« no previous file with comments | « remoting/android/java/src/org/chromium/chromoting/DesktopCanvas.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698