I am using Appium to test my Android App. I made a Edit text with a X (clear icon) right of the text and when user click on this icon then Edit text become empty.The issue is how can I test this Click in Appium Testing.
here is my xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Edit Text"
android:padding="12dp"
android:drawableRight="#android:drawable/ic_delete"// X icon at right side of edit text
>
<requestFocus />
</EditText>
and Here is the code
passwordEditText.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
final int DRAWABLE_LEFT = 0;
final int DRAWABLE_TOP = 1;
final int DRAWABLE_RIGHT = 2;
final int DRAWABLE_BOTTOM = 3;
if (event.getAction() == MotionEvent.ACTION_UP) {
if (event.getRawX() >= (passwordEditText.getRight() - passwordEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
passwordEditText.setText(null);
return true;
}
}
return false;
}
});
Send some text to your edit text using send keys method.. Then click on your x button and get text from edit text and verify entered text is cleared.. Is this what you wanted to verify?
Related
I need to open phone's contact book on the click of EditText's drawableRight. Click event on drawableRight is working fine But the problem is, when I click/touch on anywhere on EditText it is also execute click event and open contact list.
I take help for manage click event on drawableRight from here Please check this link.
I don't want to open contact list when I click on EditText, I only want to open it when I click drawableRight (image). So how solve this problem?
Here is my code:
EditText mobile_number;
mobile_number = (EditText)view.findViewById(R.id.mobile_number1);
mobile_number.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
final int DRAWABLE_LEFT = 0;
final int DRAWABLE_TOP = 1;
final int DRAWABLE_RIGHT = 2;
final int DRAWABLE_BOTTOM = 3;
if(event.getAction()==MotionEvent.ACTION_UP){
if(event.getRawX()>=(mobile_number.getRight()-mobile_number.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()));
{
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent,PICK_CONTACT);
return true;
}
}
return true;
}
});
Here is my layout code:
<LinearLayout
android:layout_width="fill_parent"
android:id="#+id/linearlayout_two1"
android:layout_below="#+id/linearlayout_one1"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:orientation="vertical"
>
<EditText
android:layout_width="300dp"
android:hint="Enter Your Mobile Number"
android:textSize="15sp"
android:id="#+id/mobile_number1"
android:paddingLeft="30dp"
android:layout_height="wrap_content"
android:drawableRight="#drawable/editbox_icon"
/>
</LinearLayout>
Instead of using getRawX(), try replacing that line with
if (event.getX() >= (mobile_number.getWidth() - mobile_number
.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
EDIT: I believe View.getRight() returns the position of the right edge of the View relative to its parent, while TouchEvent.getRawX() returns the absolute X position on the screen.
EDIT AGAIN TO DEMONSTRATE MY POINT:
MainActivity.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.meremammal.www.edittextdrawable.MainActivity">
<!-- This layout is only here to demonstrate a situation that breaks the usage of getRawX() -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true">
<EditText
android:id="#+id/edit_text"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:text="Hello World!"
android:drawableRight="#android:drawable/ic_input_add"/>
</RelativeLayout>
</RelativeLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
EditText mEditText;
Context mContext;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mEditText = (EditText) findViewById(R.id.edit_text);
mEditText.setOnTouchListener(new View.OnTouchListener() {
private float touchX = 0;
#Override
public boolean onTouch(View v, MotionEvent event) {
int drawableLeft = mEditText.getRight() - mEditText
.getCompoundDrawables()[2].getBounds().width();
// This detects the location of touch on ACTION_DOWN, but because it is
// using getRawX() and getRight() and the EditText's parent is not at the
// left of the screen, it will respond when clicked in the middle of the
// EditText. Instead, use getX() and EditText.getWidth()
if (event.getAction() == MotionEvent.ACTION_DOWN && event.getRawX() >= drawableLeft) {
touchX = event.getRawX();
return true;
} else if (event.getAction() == MotionEvent.ACTION_UP && touchX >= drawableLeft) {
Toast.makeText(mContext, "Clicked Button", Toast.LENGTH_SHORT).show();
touchX = 0;
return true;
} else {
return mEditText.onTouchEvent(event);
}
}
});
}
}
You don't have access to the right image as far my knowledge, unless you create custom EditText class. I suggest to use a RelativeLayout, with one editText and one imageView, and set OnClickListener over the image view as below:
<RelativeLayout
android:id="#+id/rlSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/edit_text"
android:padding="5dip" >
<EditText
android:id="#+id/txtSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/imgSearch"
android:background="#00000000"
android:ems="10"/>
<ImageView
android:id="#+id/imgSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/btnsearch" />
</RelativeLayout>
Make a Linear layout with horizontal orientation and add a edit-text and image-view with proper weight..
Then Give on click for each item separately.....
Just chage the last return to false. Also you have to remove the comma ; at the end of if statement.
I have an imageView and when I need to let the user click only on a specific location (the white space) as shown in the image below, any suggestion?
here is my xml
<RelativeLayout
android:id="#+id/lockRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="5dp"
>
<ImageView
android:id="#+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#drawable/image" />
</RelativeLayout>
and here is the code
private View.OnTouchListener imageViewOnClickListener = new View.OnTouchListener() {
#Override
public boolean onTouch(View view, MotionEvent event) {
int x = (int)event.getX();
int y = (int)event.getY();
if (event.getAction() == MotionEvent.ACTION_DOWN){
//here i want if he clicked on specific location to go to another activity
Intent intent = new Intent(context, ViewerActivity.class);
context.startActivity(intent);
}
return true;
}
};
I don't know if i should use onClick or onTouchClick!!
You could implement the OnTouchListener.
anImageView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
//Check between +- 10px jsu tto have some are to hit
int centerX = (v.getWidth() /2);
if(event.getX() > centerX - 10)
&& event.getX() < centerX + 10)){
//Do your magic
}
}
return true;
}
});
The event contains the coordinates for the event.
Then you can compare that either to the the boundaries you set up or get the correct pixel from the image an check if it is white.
I would advise to put another transparent control in your relative layout on top of ImageView with paddings you need, and subscribe to its onClick event. This way you can be sure only proper area was clicked.
What i did is I used two images One for Show your Image and Secound is show only Some Part of that where you want to click
Please Note My Secound Image is my transparent image. So use one1 as a transparent image. And use its Click Event.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#xml/shape"
android:gravity="center" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/one1" />
</LinearLayout>
now create xml and create shape.xml file which is give to Linearlayout
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="20dip" />
<stroke
android:width="100dip"
android:color="#A0ffffff" />
i found a solution by myself: thanks all for replying:
private View.OnTouchListener imageViewOnClickListener = new View.OnTouchListener() {
#Override
public boolean onTouch(View view, MotionEvent event) {
int x = (int) event.getX();
if (173 <= x && x <= 671) {
Intent intent = new Intent(context, NextActivity.class);
context.startActivity(intent);
}
return true;
}
};
The problem:
To make a long story short, I would like to insert a custom clickable Drawable (or something that looks like a little button and acts like a single character) inside an EditText.
Research:
I've read some documentation as well as related questions and I almost achieved the result I want (see "Code" section). It's a little bit tricky, but I wasn't able to find another way out. I'm using Html.fromHtml(source, imageGetter, tagHandler) to insert the drawable I need with a link and then implementing a custom LinkMovementMethod to handle clicks on it.
But there are some things I would like to avoid:
If there are no text after my drawable, it gets clicked even if I click anywhere right to it. So I'm not able to place a cursor next to it without moving it manually.
On some devices the cursor appears at the very beginning of EditText every time I perform a click, except cases when I click drawable.
Code:
Inserting drawable with a link and setting the custom LinkMovementMethod:
Html.ImageGetter imgGetter = new Html.ImageGetter() {
#Override
public Drawable getDrawable(String source) {
Drawable drawable = getResources().getDrawable(R.drawable.blip_icon_read);
//Making it as small as a character
drawable.setBounds(0, 0, (int)getTextSize(), (int)getTextSize());
return drawable;
}
};
String buttonSrc = "<a href='button://" + "somedata" + "'><img src=/></a>";
myEditText.append(Html.fromHtml(buttonSrc, imgGetter, null));
myEditText.setMovementMethod(MyLinkMovementMethod.getInstance(context));
Custom LinkMovementMethod:
public class MyLinkMovementMethod extends LinkMovementMethod {
private static Context movementContext;
private static MyLinkMovementMethod linkMovementMethod = new MyLinkMovementMethod();
public boolean onTouchEvent(android.widget.TextView widget, android.text.Spannable buffer, android.view.MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_UP) {
int x = (int) event.getX();
int y = (int) event.getY();
x -= widget.getTotalPaddingLeft();
y -= widget.getTotalPaddingTop();
x += widget.getScrollX();
y += widget.getScrollY();
Layout layout = widget.getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
if (link.length != 0) {
URI uri;
try {
uri = new URI(link[0].getURL());
} catch (URISyntaxException e) {
e.printStackTrace();
return true;
}
if (uri.getScheme().equals("button")) {
//Doing stuff here
}
return true;
}
}
return super.onTouchEvent(widget, buffer, event);
}
public static android.text.method.MovementMethod getInstance(Context c) {
movementContext = c;
return linkMovementMethod;
}
}
Layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="#+id/my_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:textColor="#android:color/black"
android:scrollbars="vertical"
android:textCursorDrawable="#null"
android:gravity="top" >
</EditText>
</LinearLayout>
Questions:
Is there any way to avoid things I described in the end of "Research" section using this approach?
Is there another approach I should use?
Will be glad to read advices or any ideas. Thank you.
this seems to work (unless i dont really understand your idea)
public class MyMovementMethod extends ArrowKeyMovementMethod {
#Override
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
int x = (int) event.getX();
int y = (int) event.getY();
x -= widget.getTotalPaddingLeft();
y -= widget.getTotalPaddingTop();
x += widget.getScrollX();
y += widget.getScrollY();
Layout layout = widget.getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
MyClickableSpan[] link = buffer.getSpans(off, off, MyClickableSpan.class);
if (link.length != 0 && off != buffer.length()) {
link[0].doSomething();
return true;
}
}
return super.onTouchEvent(widget, buffer, event);
}
}
class MyClickableSpan extends ImageSpan {
public MyClickableSpan(Bitmap b) {
super(b);
}
public void doSomething() {
Log.d(TAG, "doSomething ***********************************************");
}
}
to test it add the following in Activity.onCreate:
LinearLayout ll = new LinearLayout(this);
EditText et = new EditText(this);
SpannableStringBuilder b = new SpannableStringBuilder();
b.append("Attach the specified markup object to the ");
int start = b.length();
b.append("x");
int end = b.length();
b.append(" range start end of the text, or move the object to that range if it was...");
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
b.setSpan(new MyClickableSpan(bitmap), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
et.setText(b);
et.setMovementMethod(new MyMovementMethod());
ll.addView(et);
setContentView(ll);
just use a ScrollView as parentView will help you.
Like this
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="45dp"
android:layout_below="#id/header_container"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/title"
android:hint="输入标题"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:inputType="text"
android:textSize="22sp"
android:singleLine="true"
android:textCursorDrawable="#color/cursor_white"
android:background="#drawable/bg_edittext_title_white"
android:padding="5dp"
>
</EditText>
<EditText
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:gravity="start|top"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="10dp"
android:inputType="textMultiLine"
android:minHeight="220dp"
android:singleLine="false"
android:textCursorDrawable="#color/cursor_white"
android:hint="输入内容"
android:padding="5dp"
/>
</LinearLayout>
</ScrollView>
I have searched to find a solution to this problem without anyluck.
I have a simpe android app that the user enters a number into one editText (#+id/incBox) field and a given percentage of the that number is automatically placed into another editText (#+id/excBox).
I have implemented a setOnKeyListener for both editText fields, that gets the entered number and does the calculation to update the other field (vice versa).
This code works fine in the emulator everytime a digit is entered the other editText field is updated . However when running the apk on my samsung galaxy s2 the other field is not updated. For the other field to be updated on the phone you have press Enter on the softkeyboard. What am I missing here? I have even removed the event.getAction() == KeyEvent.ACTION_UP "if" clause to ensure no CANCEL or MULTITOUCH events affect the OnKey listener. How do I get to this to work on the phone?
Another problem that I am experiencing is that after entering a value into a field. Moving to the other field and deleting or pressing enter is quite laggy. Sometimes there is a 0.5 second delay when pressing the backspace button to delete a digit in an already populated field. Is this because of the try catch?
Any help would be appreciated.
this is the main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="top"
android:background="#drawable/bground"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="#string/inclusive"
android:textSize="20px"
android:paddingTop="10px"
android:textStyle="bold" />
<EditText
android:id="#+id/incBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="25px"
android:layout_marginRight="25px"
android:singleLine="true"
>
<requestFocus />
</EditText>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20px"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text="#string/exclusive" />
<EditText
android:id="#+id/excBox"
android:layout_width="fill_parent"
android:layout_height="60px"
android:inputType="numberDecimal"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="25px"
android:layout_marginRight="25px"
android:singleLine="true"
>
</EditText>
</LinearLayout>
and here is the activity.java
public class PercentageCalculatorActivity extends Activity
{
private EditText inclusive;
private EditText exclusive;
DecimalFormat cost = new DecimalFormat("0.00");
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set Activity Layout
setContentView(R.layout.main);
// Get the EditText and Button References
inclusive = (EditText)findViewById(R.id.incBox);
exclusive = (EditText)findViewById(R.id.excBox);
//Set KeyListener to ourself
inclusive.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event)
{
try
{
double num = Double.parseDouble( inclusive.getText().toString() );
if ( num > 0)
{
num = num * 0.25;
String exc = cost.format(num).toString();
exclusive.setText(exc);
}
// Close the keyboard on enter press if ( keyCode == 66 ) {
InputMethodManager imm = (InputMethodManager)getSystemService (Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(inclusive.getWindowToken(), 0);
}
return false;
}
catch (Throwable e)
{
// set other field to empty if this field is also blank
exclusive.setText("");
return false;
}
}
});
exclusive.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if(event.getAction()==KeyEvent.ACTION_UP )
{
try
{
double num = Double.parseDouble( exclusive.getText().toString() );
if ( num > 0)
{
num = num * 4;
String exc = cost.format(num).toString();
inclusive.setText(exc);
}
if ( keyCode == 66 )
{
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(exclusive.getWindowToken(), 0);
}
return false;
}
catch (Throwable e)
{
// set other field to empty if this field is also blank
inclusive.setText("");
return false;
}
}
else
{
return false;
}
}
});
It actually depends not on the device but on the keyboard you select. I've run into this before. If you swap out the keyboard for a different one, you'll find that suddenly it starts reacting as you expect. I'm not sure what the cause of this is, but you should give that a try and see if that solves your issue.
I want to display a TextView just above thumb of the SeekBar that will display the current progress of seek bar. As we move the thumb forward and backward the TextView will also move with thumb (the TextView should also be above the thumb).
Please provide any clue, code snippet are always welcome.
Moving the text can even more easily done by setting the padding for the TextView as:
int xPos = ((SeekbarInstance.getRight() - SeekbarInstance.getLeft()) * SeekbarInstance.getProgress()) / SeekbarInstance.getMax();
textViewInstance.setPadding(xPos, 0, 0, 0);
Layout of your activity
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Main context -->
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SeekBar android:id="#+id/skbSample"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:max="35">
</SeekBar>
</LinearLayout>
<!-- For display value -->
<AbsoluteLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text="0"
android:id="#+id/txvSeekBarValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:background="#FF777777"
android:visibility = "invisible">
</TextView>
</AbsoluteLayout>
</FrameLayout>
Initialize your controls on create:
mTxvSeekBarValue = (TextView) this.findViewById(R.id.txvSeekBarValue);
mSkbSample = (SeekBar) this.findViewById(R.id.skbSample);
mSkbSample.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN)
{
ShowSeekValue((int)event.getX(), mTxvSeekBarValue.getTop());
mTxvSeekBarValue.setVisibility(View.VISIBLE);
}
else if(event.getAction() == MotionEvent.ACTION_MOVE)
{
ShowSeekValue((int)event.getX(), mTxvSeekBarValue.getTop());
}
else if(event.getAction() == MotionEvent.ACTION_UP)
{
mTxvSeekBarValue.setVisibility(View.INVISIBLE);
}
return false;
}
});
Function will move your value:
private void ShowSeekValue(int x, int y)
{
if(x > 0 && x < mSkbSample.getWidth())
{
AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, x, y);
mTxvSeekBarValue.setLayoutParams(lp);
}
}
Found a better way. Derived from the sample:
mTxvSeekBarValue = (TextView) this.findViewById(R.id.txvSeekBarValue);
mSkbSample = (SeekBar) this.findViewById(R.id.skbSample);
mSkbSample.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN)
{
int progress = mSkbSample.getProgress();
mTxvSeekBarValue.setText(String.valueOf(progress).toCharArray(), 0, String.valueOf(progress).length());
}
else if(event.getAction() == MotionEvent.ACTION_MOVE)
{
int progress = mSkbSample.getProgress();
mTxvSeekBarValue.setText(String.valueOf(progress).toCharArray(), 0, String.valueOf(progress).length());
}
return false;
}
});
There you don't need any additional method and the ACTION_UP event has no important effect on the result.