you-apps / TranslateYou

Privacy focused translator app built with MD3
https://you-apps.net
GNU General Public License v3.0
986 stars 45 forks source link

'Paste' button disappears in starting screen after pushing the 'forget' button #435

Closed serrq closed 4 months ago

serrq commented 5 months ago

Describe your suggested feature

When the clipboard is filled I want paste the clipboard content into the text field in TY without have to evoke the system copy/paste.

If the clipboard is empty, then show a toastbar message like "clipboard is empty" and do nothing.

Other details

1000113568

Acknowledgements

serrq commented 5 months ago

Problem:

This happens when you comeback to starting screen from a previous translation and you push the 'forget' button. Then 'paste' button doesn't appear.

What I want:

In short when the user pushes 'forget' then 'paste' button remains in place or it is moved elsewhere. But not disappear.

1000113571

drogga commented 5 months ago

My Paste and Forget buttons are inline, below the input field and this happens because the "Forget" button actually modifies the Clipboard data to delete the text, which I don't personally agree with, but it still stays in the clipboard manager, like the one of your KB (if it has one) or the Samsung's global system one, it just deletes the last quick paste entry data.

Edit: If I copy something new, the 2 reappear for me. Just don't use the "Forget" one I guess, because it seems like it kind of does what it's intended for...

serrq commented 5 months ago

But if you fill again the clipboard, 'paste' button doesn't appear. The point is this. So, why it disappear? Cannot it staying there?

Bnyro commented 4 months ago

But if you fill again the clipboard, 'paste' button doesn't appear. The point is this. So, why it disappear? Cannot it staying there?

We can only listen for clipboard changes while the app is focused, so if you're copying something in an other app while Translate You is in the background, Translate You won't notice it.

If it'd stay there all the time, I'd consider that user unfriendly and annoying because it probably won't be useful most times as the clipboard is empty.

drogga commented 4 months ago

@Bnyro On A.8.1 x86 the "Forget" button produces the following crash with v.10.0, no such problem in v.9.0, I suspect it's whatever you did in this commit dbcff4d946350b0a8010e224bc157ce052629eda:

FATAL EXCEPTION: main Process: com.bnyro.translate, PID: 16702 java.lang.NullPointerException: Attempt to read from field 'android.content.ClipDescription android.content.ClipData.mClipDescription' on a null object reference at android.content.ClipData.(ClipData.java:728) at w.q.a(SourceFile:3) at w.q.c(SourceFile:25) at o.x.l(SourceFile:403) at t.s2.invokeSuspend(SourceFile:134) at i6.a.resumeWith(Unknown Source:8) at d6.n.k2(Unknown Source:80) at y6.h.p(SourceFile:138) at y6.h.B(SourceFile:45) at y6.h.resumeWith(SourceFile:17) at m1.j0.y0(SourceFile:51) at m1.j0.k0(SourceFile:31) at s.f.k0(Unknown Source:4) at s.d.k0(Unknown Source:4) at m1.j.f(SourceFile:167) at m1.j.f(SourceFile:146) at m1.j.f(SourceFile:146) at m1.j.f(SourceFile:146) at m1.j.f(SourceFile:146) at m1.j.f(SourceFile:146) at m1.f.b(SourceFile:30) at m1.x.a(SourceFile:122) at s1.v.D(SourceFile:79) at s1.v.l(SourceFile:224) at s1.v.dispatchTouchEvent(SourceFile:83) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:448) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1829) at android.app.Activity.dispatchTouchEvent(Activity.java:3317) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:410) at android.view.View.dispatchPointerEvent(View.java:12015) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4795) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4609) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6661) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6635) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6596) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6764) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:325) at android.os.Looper.loop(Looper.java:142) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:463) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)