Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix clear button not working on Entry #7992

Merged
merged 3 commits into from
Jul 22, 2022
Merged

[Android] Fix clear button not working on Entry #7992

merged 3 commits into from
Jul 22, 2022

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Fix clear button not working on Entry. The FlowDirection used when checking if the tapped point is inside the Clear button Rect was not correct. This PR adds changes to correct the issue.

fix-7963

Can use the .NET MAUI Gallery and the Entry samples to verify the changes.

Issues Fixed

Fixes #7963

@jsuarezruiz jsuarezruiz added this to the 6.0-sr2 milestone Jun 13, 2022
@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jun 13, 2022
@hartez hartez requested a review from rachelkang June 13, 2022 17:21
Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it still appears to not be working for me

I added the following to Sandbox and the clear button still appears to not be functional:

    <VerticalStackLayout>

            <Entry
                HorizontalOptions="Center"
                WidthRequest="300"
                ClearButtonVisibility="WhileEditing"
                BackgroundColor="LightGray"
                Text="ClearButtonVisibility" />
            
    </VerticalStackLayout>

Am I missing something?

@hartez hartez modified the milestones: 6.0-sr2, 6.0-sr3 Jun 14, 2022
@jsuarezruiz
Copy link
Contributor Author

Hmm it still appears to not be working for me

I added the following to Sandbox and the clear button still appears to not be functional:

    <VerticalStackLayout>

            <Entry
                HorizontalOptions="Center"
                WidthRequest="300"
                ClearButtonVisibility="WhileEditing"
                BackgroundColor="LightGray"
                Text="ClearButtonVisibility" />
            
    </VerticalStackLayout>

Am I missing something?

Could you try it again?

<VerticalStackLayout>
      <Entry
          HorizontalOptions="Center"
          WidthRequest="300"
          ClearButtonVisibility="WhileEditing"
          BackgroundColor="LightGray"
          Text="ClearButtonVisibility" />
      <Entry
          HorizontalOptions="Center"
          WidthRequest="300"
          FlowDirection="RightToLeft"
          ClearButtonVisibility="WhileEditing"
          BackgroundColor="LightGray"
          Text="ClearButtonVisibility" />
      <Entry
          HorizontalOptions="Center"
          ClearButtonVisibility="WhileEditing"
          BackgroundColor="LightGray"
          Text="ClearButtonVisibility" />
      <Entry
          HorizontalOptions="Center"
          ClearButtonVisibility="WhileEditing" 
          FlowDirection="RightToLeft"
          BackgroundColor="LightGray"
          Text="ClearButtonVisibility" />
  </VerticalStackLayout>

@xlawswants
Copy link

you can set the Text for "" or empty value ,You will see the phenomenon of the bug, the delete button will not show

@hartez hartez self-assigned this Jul 18, 2022
@hartez
Copy link
Contributor

hartez commented Jul 19, 2022

The button does not disappear when the text length goes to zero during editing, and the button does not appear if the text length was zero when the Entry gained focus.

@jsuarezruiz jsuarezruiz requested a review from a team as a code owner July 19, 2022 17:10
@hartez hartez changed the base branch from main to net6.0 July 19, 2022 17:10
@hartez
Copy link
Contributor

hartez commented Jul 19, 2022

Okay, fixed it so the clear button status updates when the text changes. The button now appears when you add text to a blank entry, and disappears when the entry no longer has text.

@Eilon Eilon removed the request for review from a team July 19, 2022 17:58
@hartez hartez assigned rachelkang and unassigned hartez Jul 20, 2022
@@ -372,7 +360,7 @@ internal static bool HandleClearButtonTouched(this EditText? platformView, FlowD
if (motionEvent.Action != MotionEventActions.Up)
return false;

var x = motionEvent.GetX();
var x = motionEvent.RawX;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hartez what is RawX vs GetX?

Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Working now, yay :)

@rachelkang rachelkang merged commit 8ed80a2 into net6.0 Jul 22, 2022
@rachelkang rachelkang deleted the fix-7963 branch July 22, 2022 19:22
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClearButtonVisibility="WhileEditing" does not work in Android
5 participants