FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
com.freerdp.freerdpcore.presentation.SessionView Class Reference
Inheritance diagram for com.freerdp.freerdpcore.presentation.SessionView:
Collaboration diagram for com.freerdp.freerdpcore.presentation.SessionView:

Data Structures

interface  SessionViewListener
 

Public Member Functions

 SessionView (Context context)
 
 SessionView (Context context, AttributeSet attrs)
 
 SessionView (Context context, AttributeSet attrs, int defStyle)
 
boolean onHoverEvent (MotionEvent event)
 
void setScaleGestureDetector (ScaleGestureDetector scaleGestureDetector)
 
void setSessionViewListener (SessionViewListener sessionViewListener)
 
void addInvalidRegion (Rect invalidRegion)
 
void invalidateRegion ()
 
void onSurfaceChange (SessionState session)
 
float getZoom ()
 
void setZoom (float factor)
 
boolean isAtMaxZoom ()
 
boolean isAtMinZoom ()
 
boolean zoomIn (float factor)
 
boolean zoomOut (float factor)
 
void setTouchPointerPadding (int width, int height)
 
int getTouchPointerPaddingWidth ()
 
int getTouchPointerPaddingHeight ()
 
void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
 
void onDraw (@NonNull Canvas canvas)
 
boolean dispatchKeyEventPreIme (KeyEvent event)
 
boolean onTouchEvent (MotionEvent event)
 
InputConnection onCreateInputConnection (EditorInfo outAttrs)
 

Static Public Attributes

static final float MAX_SCALE_FACTOR = 3.0f
 
static final float MIN_SCALE_FACTOR = 1.0f
 

Detailed Description

Definition at line 41 of file SessionView.java.

Constructor & Destructor Documentation

◆ SessionView() [1/3]

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

Definition at line 65 of file SessionView.java.

66 {
67 super(context);
68 initSessionView(context);
69 }

◆ SessionView() [2/3]

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

Definition at line 71 of file SessionView.java.

72 {
73 super(context, attrs);
74 initSessionView(context);
75 }

◆ SessionView() [3/3]

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

Definition at line 77 of file SessionView.java.

78 {
79 super(context, attrs, defStyle);
80 initSessionView(context);
81 }

Member Function Documentation

◆ addInvalidRegion()

void com.freerdp.freerdpcore.presentation.SessionView.addInvalidRegion ( Rect  invalidRegion)
inline

Definition at line 126 of file SessionView.java.

127 {
128 // correctly transform invalid region depending on current scaling
129 invalidRegionF.set(invalidRegion);
130 scaleMatrix.mapRect(invalidRegionF);
131 invalidRegionF.roundOut(invalidRegion);
132
133 invalidRegions.add(invalidRegion);
134 }

◆ dispatchKeyEventPreIme()

boolean com.freerdp.freerdpcore.presentation.SessionView.dispatchKeyEventPreIme ( KeyEvent  event)
inline

Definition at line 249 of file SessionView.java.

250 {
251 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK &&
252 event.getAction() == KeyEvent.ACTION_DOWN)
253 ((SessionActivity)this.getContext()).onBackPressed();
254 return super.dispatchKeyEventPreIme(event);
255 }

◆ getTouchPointerPaddingHeight()

int com.freerdp.freerdpcore.presentation.SessionView.getTouchPointerPaddingHeight ( )
inline

Definition at line 221 of file SessionView.java.

222 {
223 return touchPointerPaddingHeight;
224 }

◆ getTouchPointerPaddingWidth()

int com.freerdp.freerdpcore.presentation.SessionView.getTouchPointerPaddingWidth ( )
inline

Definition at line 216 of file SessionView.java.

217 {
218 return touchPointerPaddingWidth;
219 }

◆ getZoom()

float com.freerdp.freerdpcore.presentation.SessionView.getZoom ( )
inline

Definition at line 156 of file SessionView.java.

157 {
158 return scaleFactor;
159 }

◆ invalidateRegion()

void com.freerdp.freerdpcore.presentation.SessionView.invalidateRegion ( )
inline

Definition at line 136 of file SessionView.java.

137 {
138 invalidate(invalidRegions.pop());
139 }

◆ isAtMaxZoom()

boolean com.freerdp.freerdpcore.presentation.SessionView.isAtMaxZoom ( )
inline

Definition at line 173 of file SessionView.java.

174 {
175 return (scaleFactor > (MAX_SCALE_FACTOR - SCALE_FACTOR_DELTA));
176 }

◆ isAtMinZoom()

boolean com.freerdp.freerdpcore.presentation.SessionView.isAtMinZoom ( )
inline

Definition at line 178 of file SessionView.java.

179 {
180 return (scaleFactor < (MIN_SCALE_FACTOR + SCALE_FACTOR_DELTA));
181 }

◆ onCreateInputConnection()

InputConnection com.freerdp.freerdpcore.presentation.SessionView.onCreateInputConnection ( EditorInfo  outAttrs)
inline

Definition at line 439 of file SessionView.java.

440 {
441 super.onCreateInputConnection(outAttrs);
442 outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
443 return null;
444 }

◆ onDraw()

void com.freerdp.freerdpcore.presentation.SessionView.onDraw ( @NonNull Canvas  canvas)
inline

Definition at line 233 of file SessionView.java.

234 {
235 super.onDraw(canvas);
236
237 canvas.save();
238 canvas.concat(scaleMatrix);
239 canvas.drawColor(Color.BLACK);
240 if (surface != null)
241 {
242 surface.draw(canvas);
243 }
244 canvas.restore();
245 }

◆ onHoverEvent()

boolean com.freerdp.freerdpcore.presentation.SessionView.onHoverEvent ( MotionEvent  event)
inline

Definition at line 100 of file SessionView.java.

101 {
102 if (event.getAction() == MotionEvent.ACTION_HOVER_MOVE)
103 {
104 // Handle hover move event
105 float x = event.getX();
106 float y = event.getY();
107 // Perform actions based on the hover position (x, y)
108 MotionEvent mappedEvent = mapTouchEvent(event);
109 LibFreeRDP.sendCursorEvent(currentSession.getInstance(), (int)mappedEvent.getX(),
110 (int)mappedEvent.getY(), Mouse.getMoveEvent());
111 }
112 // Return true to indicate that you've handled the event
113 return true;
114 }

◆ onMeasure()

void com.freerdp.freerdpcore.presentation.SessionView.onMeasure ( int  widthMeasureSpec,
int  heightMeasureSpec 
)
inline

Definition at line 226 of file SessionView.java.

227 {
228 Log.v(TAG, width + "x" + height);
229 this.setMeasuredDimension((int)(width * scaleFactor) + touchPointerPaddingWidth,
230 (int)(height * scaleFactor) + touchPointerPaddingHeight);
231 }

◆ onSurfaceChange()

void com.freerdp.freerdpcore.presentation.SessionView.onSurfaceChange ( SessionState  session)
inline

Definition at line 141 of file SessionView.java.

142 {
143 surface = session.getSurface();
144 Bitmap bitmap = surface.getBitmap();
145 width = bitmap.getWidth();
146 height = bitmap.getHeight();
147 surface.setBounds(0, 0, width, height);
148
149 setMinimumWidth(width);
150 setMinimumHeight(height);
151
152 requestLayout();
153 currentSession = session;
154 }

◆ onTouchEvent()

boolean com.freerdp.freerdpcore.presentation.SessionView.onTouchEvent ( MotionEvent  event)
inline

Definition at line 278 of file SessionView.java.

279 {
280 boolean res = gestureDetector.onTouchEvent(event);
281 res |= doubleGestureDetector.onTouchEvent(event);
282 return res;
283 }

◆ setScaleGestureDetector()

void com.freerdp.freerdpcore.presentation.SessionView.setScaleGestureDetector ( ScaleGestureDetector  scaleGestureDetector)
inline

Definition at line 116 of file SessionView.java.

117 {
118 doubleGestureDetector.setScaleGestureDetector(scaleGestureDetector);
119 }

◆ setSessionViewListener()

void com.freerdp.freerdpcore.presentation.SessionView.setSessionViewListener ( SessionViewListener  sessionViewListener)
inline

Definition at line 121 of file SessionView.java.

122 {
123 this.sessionViewListener = sessionViewListener;
124 }

◆ setTouchPointerPadding()

void com.freerdp.freerdpcore.presentation.SessionView.setTouchPointerPadding ( int  width,
int  height 
)
inline

Definition at line 209 of file SessionView.java.

210 {
211 touchPointerPaddingWidth = width;
212 touchPointerPaddingHeight = height;
213 requestLayout();
214 }

◆ setZoom()

void com.freerdp.freerdpcore.presentation.SessionView.setZoom ( float  factor)
inline

Definition at line 161 of file SessionView.java.

162 {
163 // calc scale matrix and inverse scale matrix (to correctly transform the view and moues
164 // coordinates)
165 scaleFactor = factor;
166 scaleMatrix.setScale(scaleFactor, scaleFactor);
167 invScaleMatrix.setScale(1.0f / scaleFactor, 1.0f / scaleFactor);
168
169 // update layout
170 requestLayout();
171 }

◆ zoomIn()

boolean com.freerdp.freerdpcore.presentation.SessionView.zoomIn ( float  factor)
inline

Definition at line 183 of file SessionView.java.

184 {
185 boolean res = true;
186 scaleFactor += factor;
187 if (scaleFactor > (MAX_SCALE_FACTOR - SCALE_FACTOR_DELTA))
188 {
189 scaleFactor = MAX_SCALE_FACTOR;
190 res = false;
191 }
192 setZoom(scaleFactor);
193 return res;
194 }

◆ zoomOut()

boolean com.freerdp.freerdpcore.presentation.SessionView.zoomOut ( float  factor)
inline

Definition at line 196 of file SessionView.java.

197 {
198 boolean res = true;
199 scaleFactor -= factor;
200 if (scaleFactor < (MIN_SCALE_FACTOR + SCALE_FACTOR_DELTA))
201 {
202 scaleFactor = MIN_SCALE_FACTOR;
203 res = false;
204 }
205 setZoom(scaleFactor);
206 return res;
207 }

Field Documentation

◆ MAX_SCALE_FACTOR

final float com.freerdp.freerdpcore.presentation.SessionView.MAX_SCALE_FACTOR = 3.0f
static

Definition at line 43 of file SessionView.java.

◆ MIN_SCALE_FACTOR

final float com.freerdp.freerdpcore.presentation.SessionView.MIN_SCALE_FACTOR = 1.0f
static

Definition at line 44 of file SessionView.java.


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