sspanak / tt9

A T9 keyboard for Android devices with a hardware keypad.
Apache License 2.0
253 stars 43 forks source link

Swipe left to delete last word #333

Open maverick74 opened 1 year ago

maverick74 commented 1 year ago

On the on-screen keyboard, it would be nice if we could swipe left on the delete button to delete the last word!

Its not an essential feature, just a nice one!

sspanak commented 1 year ago

This may be a bit tricky, but I think it is possible by handling MotionEvent.ACTION_MOVE in SoftKey.onTouch() then and using it in SoftBackspaceKey, possibly with a handleSwipe() function.

maverick74 commented 8 months ago

I've been thinking about this...

Instead of swipe maybe a Tap+LongTap (as in "holding the delete") could be easier...

And if you keep holding it, it would keep on deleting one word at a time...

sspanak commented 8 months ago

Swipe to delete sounds good to me, there is no need to make it more complicated. I haven't researched how to do it, though.

One more thing, deleting more than one character at a time will become easier after #170, when it will become possible to select text and cut/copy/paste/delete with a single click. The selection method itself is described in a kind of complicated way, but I think I have ideas how to make it simpler.

However, as of now, I am focused on other features. This will not be released anytime soon.

maverick74 commented 8 months ago

No pressure!

My intention is not to speed this up or something, it's just to share "way outs" (It's also not that "you don't know what you're doing" or something like that. It's just that there are various ways to accomplish one effect and sometimes we don't remember every single one... It's my way to try to help...)

sspanak commented 7 months ago

No worries, I'm from the Balkans, I don't get offended for nothing. :slightly_smiling_face:

I'm also sharing my opinion. I've seen the swipe-to-delete function in other keyboards, so I think it is intuitive and relatively easy to do. For this reason, I like it better.

sspanak commented 3 months ago

408 makes this obsolete. Deleting entire words will be possible by holding backspace instead of swiping. Holding is easier to implement and allows for consistency with hardware keypads.

maverick74 commented 3 months ago

But won't accelerating it cause loss of control of exactly what we want to delete?

Swiping left would allow deletion of "just" the last word! And, if holding it, it would delete one word at a time...

this would, probably, give users more control of the deletion process...

(but, then again, I have no idea of how you're doing it so it may work...)

sspanak commented 3 months ago

There will be a slight delay, so you will be able to stop at the right time. See the attached video.

https://github.com/user-attachments/assets/63ed4c9b-59bd-4cb3-9507-0b32db1ccd2d

maverick74 commented 2 months ago

There will be a slight delay, so you will be able to stop at the right time.

Hum, I see!!! It might work.... I still have some doubts about deleting a single word but I'll say more after I put my fingers on it 😀! You got me half convinced with the video 🤣

sspanak commented 2 months ago

Never mind, I was able to add swiping to all buttons. To be honest, the effort was really worth it. The code looks much nicer and cleaner, and on top of that, I was able to use it for resizing too.

maverick74 commented 1 month ago

I'm not exactly sure if i should open a new bug report or not because i'm not sure i can say it's a bug:

still, sometimes, swiping left deletes more than one word (sometimes, it apparently stops in the middle of another word).

the thing is: i can only seldom replicate it... maybe i'm doing something wrong... if you @sspanak think it's worth it, i'll submit a bug report... but it's a tricky thing............

sspanak commented 1 month ago

v39.0 will probably fix that. I've noticed there is a bug which sometimes causes accidental double click or click and swipe, or hold and swipe within a couple of milliseconds, which would cause Backspace to delete more characters than expected.

If the problem persists even after updating to v39.0, please create a new bug.

maverick74 commented 1 month ago

It REALLY is a lot better!!!

But, sometimes, it still happens some weird deletions!

Do you think

https://github.com/sspanak/tt9/commit/d47528f5502757863b75faaa962c32edab23d63e

may help or will we need to try to track it?

sspanak commented 1 month ago

It still happens sometimes. I'll have to revisit that part of the code. I don't like it anyway, it is overcomplicated.

Edit: I made it even more complicated but I hope it finally works! I'll test it in the following days and if everything is fine, I'll push the new release.

maverick74 commented 2 weeks ago

Almost perfect!!!!!

It indeed improved a LOT!!!!

BUT... it occasionally when I "simple" tap delete, instead of deleting a single letter it deletes the whole word!!!

maverick74 commented 2 weeks ago

I've been trying to replicate it but I don't really seem to be able to find the way!!!

It happened to me 3 or 4 times in this same message with "been" but I don't seem to find the path... maybe it's my fault... maybe I slide on delete and don't notice it or something...

sspanak commented 2 weeks ago

There are three possible reasons for this.

First, there still may be some flaw in the logic, that fails because of a specific sequence of letters and special characters. I believe I solved all such problems, but just in case, could you please share the entire message with the surrounding spaces and new lines, if any? Provided that it does not contain any personal information, of course.

Second, if the device lags a little, it becomes very difficult to distinguish between a click and a swipe. I am talking about lagging for very short time intervals, less than 60 ms. In this case, I can provide an alternative key operation. Backspace could delete one character when released, instead of when pressed. This should solve the problem completely, but it may feel Backspace is lagging, if you lift up your finger slowly. And that's the reason I haven't implemented it until now.

Third reason, due to lagging or due to too much customization by your device manufacturer, pressing the virtual keys may produce an ACTION_MOVE event without first producing an ACTION_DOWN event. If I remember correctly, there was some problem with registering the exact moment the finger touches the screen on my Energizer H620S. I can attempt to fix this, too.

So here is what we can do (I'll need your help again). I will prepare a new APK, based on v40.0, with two settings to toggle fixes 2 and 3. You will have to install it and try each fix for a couple of days, then let me know if any of them worked.

maverick74 commented 1 week ago

Yeah, probably lagging may have something to do with it!

We can try the options you mentioned!

But, if it's just me I don't know if it's worth the work...

maverick74 commented 1 week ago

Oh and i forgot to reply to this:

could you please share the entire message with the surrounding spaces and new lines, if any?

that was my previous message: https://github.com/sspanak/tt9/issues/333#issuecomment-2466490858

I was typing the word "been" on that massage when it happened. I typed "ben" (instead of "been") and since there was an "e" missing i was trying to delete the "n" to type the second "e" and it just deleted the whole word instead.

When it happened i tried to figure out how it happened. i must have tried some ~15 times. On the first ones (lets say 6 or 7 times) it deleted the whole word in some 3 times...

however in the last 7 times it always went well.

sspanak commented 1 week ago

I don't think it is only you. I am experiencing the same problem when changing the language, but never with Backspace. Go figure! I'll see what I can do about it.

maverick74 commented 1 week ago

when changing the language

now that you mentioned it... i was previously in portuguese and changed language to english just before typing here the above message we talked about!

however, here, it is indeed in the backspace key afaict

sspanak commented 1 week ago

Just a slight change in the plan, I will probably not do it in this release, because I want to stay focused on adding support for East Asian languages. It really takes a lot of effort!

Meanwhile, I would like to confirm if it is a performance problem or a logic problem. Could you please remind me what your phone is? If I remember correctly it was a Redmi something...

The specs are one thing but it would be great if I can get a better idea of how fast your phone is. Are you using the "full" or the "lite" version? If you are using the "lite" version, do you mind installing the "full" one over it? You will not lose any data or settings, it will just take more storage space. After you are done testing, you can re-install "lite" over "full" to claim back that storage space.

If you are running the "full" version, I will need to know how long does a middle-sized language, for example Greek, take to load, provided that the screen does not go off while loading. To load only Greek:

  1. Go to Settings -> Languages -> Languages
  2. Disable all (you will not lose the words this way, no worries)
  3. Enable Greek
  4. Go back to Settings -> Languages
  5. "Load Selected"
  6. Note the loading time in the notifications.
  7. Go to Settings -> Languages -> Languages again
  8. Disable Greek and re-enable Portuguese, English and any others from before.
  9. Go back
  10. "Delete Unselected" to delete the Greek words.

If you were using the "lite" version re-install it to save some more storage space.

maverick74 commented 1 week ago

It really takes a lot of effort!

No worries. It's all good :)

Could you please remind me what your phone is?

Xiaomi Redmi 5

Are you using the "full" or the "lite" version?

I use the lite version

how long does a middle-sized language, for example Greek, take to load

49,7s