sspanak / tt9

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

Random white bar on TCL Flip 2 #249

Open Pbeight opened 1 year ago

Pbeight commented 1 year ago

There's a white bar on top of the word bar which takes up much precious screen space (i have it set on "Don't show on screen keys"). Would it be possible to remove it. Thank you so much! Love the app!

sspanak commented 1 year ago

This is not intentional and it doesn't happen on the testing devices.

Could you please post a screenshot? Also what is your phone make and model?

Pbeight commented 1 year ago

Screenshot_20230504-091450 Screenshot_20230504-144154 Screenshot_20230504-091315 The Phone is the TCL Flip 2

sspanak commented 1 year ago

Really, I have no idea what is this... :slightly_frowning_face:

Does the white bar appear always in the same applications? The apps on the screenshots look like native applications of the Flip 2, is it possible to install some popular application, for example: Viber, Messenger, Firefox, etc... and test there? Does the bar's position change when you open and close the same application?

Have you tried the new v21.0? I brings significant layout changes that may or may not fix the problem. Also, try enabling the full on-screen keyboard and see if the bar is still there.

Pbeight commented 1 year ago

Really, I have no idea what is this... 🙁

Does the white bar appear always in the same applications? The apps on the screenshots look like native applications of the Flip 2, is it possible to install some popular application, for example: Viber, Messenger, Firefox, etc... and test there? Does the bar's position change when you open and close the same application?

Have you tried the new v21.0? I brings significant layout changes that may or may not fix the problem. Also, try enabling the full on-screen keyboard and see if the bar is still there.

Thank you for looking into this. I installed the latest version and the issue wasn't fixed. I tried it on non native apps, such as Google Messages and ColorNote and they also had the issue

An interesting point to note is, on the first version that I installed, I believe it wa v16.5, it did not have this issue. I think this issue may have come about when the fix for; not being able to click "ok" or "send", was implemented.

Thank you for all your work!

sspanak commented 1 year ago

Thank you for looking into this. I installed the latest version and the issue wasn't fixed. I tried it on non native apps, such as Google Messages and ColorNote and they also had the issue

Still, I need to know whether the bar remains there when you toggle the on-screen keys and numpad options. And, does it turn dark, when you change the theme to dark?

Thank you for all your work!

Thank you for the feedback. Hopefully, it will make the app better.

Pbeight commented 1 year ago

Thank you for looking into this. I installed the latest version and the issue wasn't fixed. I tried it on non native apps, such as Google Messages and ColorNote and they also had the issue

Still, I need to know whether the bar remains there when you toggle the on-screen keys and numpad options. And, does it turn dark, when you change the theme to dark?

Thank you for all your work!

Thank you for the feedback. Hopefully, it will make the app better.

Toggling dark mode works. Screenshot_20230521-125640 Screenshot_20230521-125700

Additionally, when I tried the on screen keyboard mode, I noticed that the bar is really just the keyboard being higher, as evidenced by the photos.

sspanak commented 1 year ago

Additionally, when I tried the on screen keyboard mode, I noticed that the bar is really just the keyboard being higher, as evidenced by the photos.

This may be related to the StatusBar and the SuggestionBar being stacked inside a <FrameLayout>. It is possible that on your phone they appear one on top of the other, instead of one behind the other, as intended.

I could try replacing it with a <RelativeLayout> or maybe hiding one of the bars, instead of changing its background, but since this is a device-specific problem, I will treat it with low priority.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 100 days with no activity.

sspanak commented 5 months ago

@Pbeight, if I remember correctly, you are using a Qin F21 Pro now, but if you still have the TCL Flip 2, you can update to v31.0. After installing, go to Settings -> Appearance and scroll down to the Compatibility section. In there, enable the Always on Top option. It fixes a similar problem on Sonim phones, and it may fix it on the Flip 2.

sspanak commented 2 months ago

According to the latest comments in #555, the problem still persists. Unfortunately, I still have no idea what is causing it and how to fix it.

omn0mn0m commented 1 month ago

Not sure if this is helpful at all, but I was looking at the decompiled launcher code for the TCL Flip 2, and it imports a package called android.widget.MenuBar. I can't find any documentation for it though under android.widget, so I am not sure if it is even part of the Android SDK. However, I believe this is the mysterious white bar.

There are these lines of code that I am assuming hides the menu bar:

MenuBar menuBar = this.mMenuBar;
if (menuBar != null) {
    menuBar.dismissOptionMenu();
}

However, I have been unable to compile any test apps to include the android.widget.MenuBar package to test.

EDIT: I pulled framework.jar from my phone and decompiled it to find MenuBar.java. It has a function hideMenuBar():

public void hideMenuBar() {
    setVisibility(8);
}

It has been a while since I did anything with Java, so I am not sure how to proceed knowing this class exists in the modified Android SDK the TCL Flip 2 uses. I also am not sure whether this even fits into the scope of this project anymore.

sspanak commented 1 month ago

Every phone manufacturer modifies the SDK. It is entirely possible that there is a special android.widget.MenuBar on TCL phones. I may be able to hack it but I don't have a TCL Flip 2 to test on.

I also am not sure whether this even fits into the scope of this project anymore.

I have created an AppHacks class for these things. If the solution is not overly complex, we can put it there.

Where is MenuBar menuBar = this.mMenuBar; and what is this? Is that code in an InputMethodService object (or a descendant)? If so, you can try calling it magically in TraditionalT9.onStart() like this:

getClass().getDeclaredField("mMenuBar").getClass().getDeclaredMethod("dismissOptionMenu").invoke(this);

Of course, you need to handle all possible exceptions and NULL values to avoid crashing. If it works I can potentially put it in the right place and, ultimately, include the fix in the next version.

omn0mn0m commented 1 week ago

I was able to hide the bar in a test app using

int decorMenuBarId = getResources().getIdentifier("decor_menu_bar", "id", "android");
View decorMenuBar = findViewById(decorMenuBarId);
if (decorMenuBar != null) {
    decorMenuBar.setVisibility(View.GONE);
}

This is the device check that I put in DeviceInfo:

public static boolean isTclFlip2() {
    return Build.MANUFACTURER.equals("TCL") && Build.MODEL.contains("T408DL");
}

However, I can't call findViewById in TraditionalT9 since it is not an Activity. I am trying to find a workaround, but if you already know how, would love to hear it.

sspanak commented 1 week ago

When you do that, does the Menu bar disappear permanently or only while the current application is active and visible? If the effect is permanent, you can call findViewById() somewhere in the TT9 Settings, because they are an Activity. For example, find this file: .../preferences/screens/appearance/AppearanceScreen.java, and in onCreate() call activity.findViewById(...). To run the code, just go to Settings -> Appearance, then go back to some problematic app.

If the effect is not permanent, there are two ways of calling findViewById() every time TT9 wakes up.

  1. You can use the MainView. Find app/src/main/java/io/github/sspanak/tt9/ime/TraditionalT9.java and at the end of onStart() do mainView.getView().findViewById(...). This will probably not work, because findViewById() will try to search for the DecorMenuBar as a child of TT9's view. But the way you construct the ID, it looks like it may work.
  2. You can start a transparent activity, run your stuff, then close it. See app/src/main/java/io/github/sspanak/tt9/ui/dialogs/AutoUpdateMonologue.java. Create a similar class and put your code in render(). Then, at the end of TraditionalT9.onStart() do:
    Intent intent = YourPopup.generateShowIntent(this);
    startActivity(intent).

All this is a bit messy, of course, but it is easy to do and test. If you manage to fix the problem somehow, I'll tidy up the code. It is not a problem.