FreeRDP
Loading...
Searching...
No Matches
com.freerdp.freerdpcore.presentation.TouchPointerView Class Reference
Inheritance diagram for com.freerdp.freerdpcore.presentation.TouchPointerView:
Collaboration diagram for com.freerdp.freerdpcore.presentation.TouchPointerView:

Data Structures

interface  TouchPointerListener
 

Public Member Functions

 TouchPointerView (Context context)
 
 TouchPointerView (Context context, AttributeSet attrs)
 
 TouchPointerView (Context context, AttributeSet attrs, int defStyle)
 
void setTouchPointerListener (TouchPointerListener listener)
 
int getPointerWidth ()
 
int getPointerHeight ()
 
float[] getPointerPosition ()
 
void setRemoteCursor (int[] pixels, int width, int height, int hotX, int hotY)
 

Protected Member Functions

void onLayout (boolean changed, int l, int t, int r, int b)
 
void onDetachedFromWindow ()
 
void onVisibilityChanged (View changedView, int visibility)
 

Detailed Description

Definition at line 37 of file TouchPointerView.java.

Constructor & Destructor Documentation

◆ TouchPointerView() [1/3]

com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerView ( Context  context)
inline

Definition at line 199 of file TouchPointerView.java.

200 {
201 this(context, null);
202 }

◆ TouchPointerView() [2/3]

com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerView ( Context  context,
AttributeSet  attrs 
)
inline

Definition at line 204 of file TouchPointerView.java.

205 {
206 this(context, attrs, 0);
207 }

◆ TouchPointerView() [3/3]

com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerView ( Context  context,
AttributeSet  attrs,
int  defStyle 
)
inline

Definition at line 209 of file TouchPointerView.java.

210 {
211 super(context, attrs, defStyle);
212 initTouchPointer(context);
213 }

Member Function Documentation

◆ getPointerHeight()

int com.freerdp.freerdpcore.presentation.TouchPointerView.getPointerHeight ( )
inline

Definition at line 264 of file TouchPointerView.java.

265 {
266 return cluster.getHeight() > 0
267 ? cluster.getHeight()
268 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
269 }

◆ getPointerPosition()

float[] com.freerdp.freerdpcore.presentation.TouchPointerView.getPointerPosition ( )
inline

Definition at line 271 of file TouchPointerView.java.

272 {
273 return new float[] { cluster.getX(), cluster.getY() };
274 }

◆ getPointerWidth()

int com.freerdp.freerdpcore.presentation.TouchPointerView.getPointerWidth ( )
inline

Definition at line 257 of file TouchPointerView.java.

258 {
259 return cluster.getWidth() > 0
260 ? cluster.getWidth()
261 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
262 }

◆ onDetachedFromWindow()

void com.freerdp.freerdpcore.presentation.TouchPointerView.onDetachedFromWindow ( )
inlineprotected

Definition at line 413 of file TouchPointerView.java.

414 {
415 cancelHeldGestures();
416 super.onDetachedFromWindow();
417 }

◆ onLayout()

void com.freerdp.freerdpcore.presentation.TouchPointerView.onLayout ( boolean  changed,
int  l,
int  t,
int  r,
int  b 
)
inlineprotected

Definition at line 326 of file TouchPointerView.java.

327 {
328 super.onLayout(changed, l, t, r, b);
329 if (!placed && getWidth() > 0 && cluster.getWidth() > 0)
330 {
331 placed = true;
332 setClusterTranslation((getWidth() - cluster.getWidth()) / 2.0f,
333 (getHeight() - cluster.getHeight()) / 2.0f);
334 }
335 else
336 {
337 setClusterTranslation(cluster.getTranslationX(), cluster.getTranslationY());
338 }
339 }

◆ onVisibilityChanged()

void com.freerdp.freerdpcore.presentation.TouchPointerView.onVisibilityChanged ( View  changedView,
int  visibility 
)
inlineprotected

Definition at line 419 of file TouchPointerView.java.

420 {
421 super.onVisibilityChanged(changedView, visibility);
422 if (visibility != VISIBLE)
423 cancelHeldGestures();
424 }

◆ setRemoteCursor()

void com.freerdp.freerdpcore.presentation.TouchPointerView.setRemoteCursor ( int[]  pixels,
int  width,
int  height,
int  hotX,
int  hotY 
)
inline

Definition at line 427 of file TouchPointerView.java.

428 {
429 ViewGroup.LayoutParams lp = cursor.getLayoutParams();
430 if (pixels == null || width <= 0 || height <= 0)
431 {
432 cursor.setImageResource(R.drawable.ic_cursor);
433 ImageViewCompat.setImageTintList(cursor, ColorStateList.valueOf(cursorTint));
434 int s = getResources().getDimensionPixelSize(R.dimen.tp_cursor_size);
435 lp.width = s;
436 lp.height = s;
437 cursor.setLayoutParams(lp);
438 cursor.setTranslationX(0);
439 cursor.setTranslationY(0);
440 return;
441 }
442 Bitmap bmp = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
443 float scale = 40 * density / height;
444 if (scale < 1.2f)
445 scale = 1.2f;
446 if (scale > 3.0f)
447 scale = 3.0f;
448 ImageViewCompat.setImageTintList(cursor, null);
449 // filterBitmap=false -> nearest-neighbour scaling keeps the small cursor crisp
450 BitmapDrawable bd = new BitmapDrawable(getResources(), bmp);
451 bd.setFilterBitmap(false);
452 cursor.setImageDrawable(bd);
453 lp.width = Math.round(width * scale);
454 lp.height = Math.round(height * scale);
455 cursor.setLayoutParams(lp);
456 // place the bitmap hotspot pixel on the cluster's top-left corner (0,0)
457 cursor.setTranslationX(-hotX * scale);
458 cursor.setTranslationY(-hotY * scale);
459 }

◆ setTouchPointerListener()

void com.freerdp.freerdpcore.presentation.TouchPointerView.setTouchPointerListener ( TouchPointerListener  listener)
inline

Definition at line 252 of file TouchPointerView.java.

253 {
254 this.listener = listener;
255 }

The documentation for this class was generated from the following file: