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)
 

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 74 of file TouchPointerView.java.

75 {
76 this(context, null);
77 }

◆ TouchPointerView() [2/3]

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

Definition at line 79 of file TouchPointerView.java.

80 {
81 this(context, attrs, 0);
82 }

◆ TouchPointerView() [3/3]

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

Definition at line 84 of file TouchPointerView.java.

85 {
86 super(context, attrs, defStyle);
87 initTouchPointer(context);
88 }

Member Function Documentation

◆ getPointerHeight()

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

Definition at line 143 of file TouchPointerView.java.

144 {
145 return cluster.getHeight() > 0
146 ? cluster.getHeight()
147 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
148 }

◆ getPointerPosition()

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

Definition at line 150 of file TouchPointerView.java.

151 {
152 return new float[] { cluster.getX(), cluster.getY() };
153 }

◆ getPointerWidth()

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

Definition at line 136 of file TouchPointerView.java.

137 {
138 return cluster.getWidth() > 0
139 ? cluster.getWidth()
140 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
141 }

◆ onLayout()

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

Definition at line 191 of file TouchPointerView.java.

192 {
193 super.onLayout(changed, l, t, r, b);
194 if (!placed && getWidth() > 0 && cluster.getWidth() > 0)
195 {
196 placed = true;
197 setClusterTranslation((getWidth() - cluster.getWidth()) / 2.0f,
198 (getHeight() - cluster.getHeight()) / 2.0f);
199 }
200 else
201 {
202 setClusterTranslation(cluster.getTranslationX(), cluster.getTranslationY());
203 }
204 }

◆ setRemoteCursor()

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

Definition at line 324 of file TouchPointerView.java.

325 {
326 ViewGroup.LayoutParams lp = cursor.getLayoutParams();
327 if (pixels == null || width <= 0 || height <= 0)
328 {
329 cursor.setImageResource(R.drawable.ic_cursor);
330 ImageViewCompat.setImageTintList(cursor, ColorStateList.valueOf(cursorTint));
331 int s = getResources().getDimensionPixelSize(R.dimen.tp_cursor_size);
332 lp.width = s;
333 lp.height = s;
334 cursor.setLayoutParams(lp);
335 cursor.setTranslationX(0);
336 cursor.setTranslationY(0);
337 return;
338 }
339 Bitmap bmp = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
340 float scale = 40 * density / height;
341 if (scale < 1.2f)
342 scale = 1.2f;
343 if (scale > 3.0f)
344 scale = 3.0f;
345 ImageViewCompat.setImageTintList(cursor, null);
346 // filterBitmap=false -> nearest-neighbour scaling keeps the small cursor crisp
347 BitmapDrawable bd = new BitmapDrawable(getResources(), bmp);
348 bd.setFilterBitmap(false);
349 cursor.setImageDrawable(bd);
350 lp.width = Math.round(width * scale);
351 lp.height = Math.round(height * scale);
352 cursor.setLayoutParams(lp);
353 // place the bitmap hotspot pixel on the cluster's top-left corner (0,0)
354 cursor.setTranslationX(-hotX * scale);
355 cursor.setTranslationY(-hotY * scale);
356 }

◆ setTouchPointerListener()

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

Definition at line 131 of file TouchPointerView.java.

132 {
133 this.listener = listener;
134 }

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