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

140 {
141 return cluster.getHeight() > 0
142 ? cluster.getHeight()
143 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
144 }

◆ getPointerPosition()

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

Definition at line 146 of file TouchPointerView.java.

147 {
148 return new float[] { cluster.getX(), cluster.getY() };
149 }

◆ getPointerWidth()

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

Definition at line 132 of file TouchPointerView.java.

133 {
134 return cluster.getWidth() > 0
135 ? cluster.getWidth()
136 : getResources().getDimensionPixelSize(R.dimen.tp_cluster_size);
137 }

◆ onLayout()

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

Definition at line 187 of file TouchPointerView.java.

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

◆ setRemoteCursor()

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

Definition at line 320 of file TouchPointerView.java.

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

◆ setTouchPointerListener()

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

Definition at line 127 of file TouchPointerView.java.

128 {
129 this.listener = listener;
130 }

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