How to use _fling method in uiautomator

Best Python code snippet using uiautomator

pdfview.py

Source:pdfview.py Github

copy

Full Screen

...189 elif action == 'SwipeLeft':190 self.page = min(self.page+1,self.render.getPageCount()-1)191 self._display_current_page()192 elif action == 'Fling':193 self._fling(-param)194 elif action == 'Scroll':195 self._scroll(param) 196 @run_on_ui_thread 197 def _build_layout(self):198 mActivity = PythonActivity.mActivity 199 context = mActivity.getApplicationContext()200 imgview = ImageView(context)201 scrollview = ScrollView(context)202 scrollview.addView(imgview)203 layout = LinearLayout(mActivity)204 layout.setOrientation(LinearLayout.VERTICAL)205 layout.setVerticalGravity(Gravity.CENTER_VERTICAL)206 layout.addView(scrollview)207 self.layout = layout208 self.imgview = imgview209 self.scrollview = scrollview210 @run_on_ui_thread 211 def _instantiate(self):212 mActivity = PythonActivity.mActivity 213 mActivity.addContentView(self.layout, LayoutParams(-1,-1))214 self.key_listener = KeyListener(self.dismiss)215 self.touch_listener = TouchListener(self._touch_action)216 self.imgview.setOnKeyListener(self.key_listener)217 self.scrollview.setOnTouchListener(self.touch_listener)218 219 @run_on_ui_thread 220 def _destroy_layout(self):221 if self.layout:222 parent = cast(ViewGroup, self.layout.getParent())223 if parent is not None: parent.removeView(self.layout)224 @run_on_ui_thread225 def _fling(self,velocityY):226 if self.scrollview:227 self.scrollview.fling(velocityY)228 @run_on_ui_thread229 def _scroll(self,distanceY):230 if self.scrollview:231 self.scrollview.smoothScrollBy(0,distanceY)232 @run_on_ui_thread233 def _set_image_bitmap(self):234 if self.imgview:235 self.imgview.setImageBitmap(self.bitmap)236 237 ...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

1from ._Fling import *2from ._IRs import *3from ._Led import *4from ._Tap import *...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run uiautomator automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful