Is it possible to change the taskbar color when fullscreen is set to 0 in buildozer.spec file?
I already tried changing Window.clearcolor value but hence taskbar is not part of Window when fullscreen is 0, taskbar color doesn't change.
How does one do that?
I believe this is the answer for Java, therefore (as inclement said) you need to use pyjnius to access the Java functions from Python and then wrap the code mentioned in the linked answer to something usable from Kivy.
Example (not tested):
from jnius import autoclass
WindowManager = autoclass('android.view.WindowManager')
R = autoclass('android.R')
activity = autoclass('<your.app.name>.PythonActivity').mActivity
window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));
I think only these colors are available, but feel free to try other values. I've seen some issues with android.R importing in Java, so you might want to just use the raw values instead of fetching them from android.R module.
Related
Since Android 11 the correct way of displaying a fully immersive fragment is by hiding and showing StatusBar and NavigationBars via the following code which fully supports all devices with a camera notch, at any API level. Note the WindowCompat version replaces the framework version, so you don’t need to check for a particular API level as you did when using the framework version.
Hide
WindowCompat.SetDecorFitsSystemWindows(Activity.Window, false);
WindowInsetsControllerCompat windowInsetsControllerCompat = WindowCompat.GetInsetsController(Activity.Window, Activity.Window.DecorView);
windowInsetsControllerCompat.SystemBarsBehavior = WindowInsetsControllerCompat.BehaviorShowTransientBarsBySwipe;
windowInsetsControllerCompat.Hide(WindowInsetsCompat.Type.StatusBars() | WindowInsetsCompat.Type.NavigationBars());
Show
WindowCompat.SetDecorFitsSystemWindows(Activity.Window, true);
WindowInsetsControllerCompat windowInsetsControllerCompat = WindowCompat.GetInsetsController(Activity.Window, Activity.Window.DecorView);
windowInsetsControllerCompat.Show(WindowInsetsCompat.Type.StatusBars() | WindowInsetsCompat.Type.NavigationBars());
This eliminated the overly complex, very poorly documented and potentially error-prone code like below, which was used prior to Android 11.
Window.DecorView.SystemUiVisibility = (StatusBarVisibility) (SystemUiFlags.Fullscreen |
SystemUiFlags.HideNavigation |
SystemUiFlags.Immersive |
SystemUiFlags.ImmersiveSticky |
SystemUiFlags.LayoutHideNavigation |
SystemUiFlags.LayoutStable |
SystemUiFlags.LowProfile);
I was attempting to provide a choice of either displaying all fragments fully immersive or allowing some fragments to display as “letterboxed” i.e. not allowing the window to render into the DisplayCutout area. So my existing preference choice Devices with Notches/Cutouts allow full screen display would have to change to support multiple choice.
The problem I hit was that code I had used (like the WindowCompat code above since Android 11) was failing to display the fragment fullscreen when first launched. When it opened for the first time the window would attempt to go full screen, but only the NavigationBar would be removed. The StatusBar area was left as a black rectangle. You could see the animation of the time on the left and the icons on the right side of the StatusBar disappearing, (statusBar contents removed) but the window didn’t render into the StatusBar area. Immediately when rotated, the fragment became full screen and when rotated back to Portrait it corrected itself and was full screen again.
So in frustration, I went hunting on StackOverFlow looking for a solution but everything I found suggested that my ImmersiveFragment class was coded correctly. Then because this was my first attempt at using Material 3, I then started to suspect Material3, so I went backwards to my NavigationGraph6 project (Material2) and after much testing, I was able to reproduce the same problem, which eliminated Material3.
More searching on StackOverflow and I came across a Kotlin post that was the same as all the others, except that it had the following line – equivalent to this C# line.
Activity.Window.AddFlags(WindowManagerFlags.LayoutNoLimits)
So I added that line before the WindowCompat.SetDecorFitsSystemWindows(Activity.Window, false) in the HideSystemUi() and then cleared the flags before the WindowCompat.SetDecorFitsSystemWindows(Activity.Window, true) line in the ShowSystemUi with
Activity.Window.ClearFlags(WindowManagerFlags.LayoutNoLimits)
and immediately it worked.
So my question is why is this required and has anyone come across the same problem with immersive fragments?
Definition of LayoutNoLimits – Allow window to extend outside of the screen ???.
Does anyone have a clue what this definition actually means?
To test the code (comment out the new lines in ImmersiveFragment.cs). You can find the project NavigationGraph7 at https://github.com/gmck/NavigationGraph7. The immersiveFragment is the RaceResultsFragment (inherits from ImmersiveFragment) accessed by the BottomNavigationBar on the SlideShowFragment.
I referred to the official doc both Android and Microsoft too. As you said that: "Allow window to extend outside of the screen". There are few official definitions of it...
You can check Can I set FLAG_LAYOUT_NO_LIMITS only for status bar?, it talks about usage of LayoutNoLimit. Wish it could be helpful to you.
When creating a kivy exe on Windows with Pyinstaller, I still have the right click creating red dot.
Why does right-clicking create an orange dot in the center of the circle? proposed to use this to remove this behavior.
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
But when I do, I can't scroll anymore on my page if I stay pressed on a widget.
Isn't there something more precise like deactivate_red_dot rather than deactivated_multitouch which seems to have side effects ? Maybe a method of the Mouse() that we can override ?
venv/Lib/site_packages/kivy/input/providers/mouse.py
Method on_mouse_press
Replace
do_graphics = (not self.disable_multitouch) and (
button != 'left' or 'ctrl' in modifiers)
By
do_graphics = False
I'm not sure if I won't have others sides effects but that seems legit by the behavior I saw on the code.
EDIT:
Actually for my project, the bug with disable multitouchh was on android so I did:
if isWindows():
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,disable_multitouch')
Good side, doesn't change fundamental library. Bad side, disabling multitouch could lead to others sneaky bugs.
I'm using avalonia (version 0.10.3 - but the same happened with 0.10.0 - on Net5.0 project) as the UI for a project and when I create for instance a splash or an about screen, the title bar must be invisible.
On windows this works just fine with these parameters in the window section :
CanResize="False"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="0"
Unfortunately, on Linux (mint - latest version with latest updates), the title bar remains visible (also if I set ExtendClientAreaTitleBarHeightHint="-1").
Is this a known issue or am I doing something wrong ?
I do not have a mac, but is that also the case for mac ?
X11 uses so-called "server decorations". Window frame is drawn by a window manager in a separate process, so it's not really possible to extend into that area.
You can still disable the frame completely and draw your own, but in general it's not really recommended since you will break advanced window interactions in basically every non-GNOME based Linux distro (GNOME doesn't care because it doesn't have any advanced window interactions).
In some future version Avalonia would use a custom-drawn frame for GNOME with a configuration option to ignore your user's preferences in favor of a fancy looking window border for other desktop environments as well, but it's not implemented yet.
I had a similar problem but I "solve it" by defining the window property as:
WindowState = WindowState.FullScreen;
Comparing with Normal or Maximized, with title bar in fullscreen remains hidden.
I am using VS 2019 with a black background editor. The List, Seq etc. methods are black and I cannot see them. Please see the attached image. What is the setting that controls the color of these methods? There is a setting 'Symbol-Static' (under Options -> Fonts and Colors -> Show Settings for: Text Editor) but Item foreground and background are disabled. The extension of the file is fsx.
Thanks
You can set the color under Text Editor | Fonts and Colors: F# Functions / Methods. By the way, the module can also be set under User Types: Modules. So for example:
Is set to purple in:
Looks like a default from a light theme is being picked up.
Here such identifiers are using the Plain Text colour (but then, here, so is the the function name and its parameter identifier).
Do you have any extensions that may be adding extra syntax colouring?
Additional
As noted by s952163 the color setting "F# Functions / Methods" is more specific. But it also sets the method names that are shown differently in your screenshot.
Resharper adds lots of extra settings, one of these could easily be changing static methods (maybe across languages), but I do not use Resharper in part because it was too much effort to change all the defaults I disagreed with!
Is there a way to change the position of the window that pops up when cv::imshow is called?
For me, the window seems to appear partially off-screen, so I have to drag it around before I can see entire image. It's very annoying to have to do this every single time.
I had a look at the reference manual -- it seems you have control over what goes into the title of the window, but I can't see anything relating to window position.
Oh, and the behavior is the same if I use the old C interface (cvShowImage).
Any ideas?
As of OpenCV 2.1 this is possible also in C++ API using the moveWindow function:
cv::moveWindow(std::string winName, int x, int y)
For example:
cv::namedWindow("WindowName");
cv::moveWindow("WindowName", 10, 50);
Using C++ API it is not possible at the moment.
You can use C API instead; it is cvMoveWindow().
UPDATE: Now it is possible in C++ with cv::moveWindow()