Main Activity Support Action Bar Buttons - kotlin

I'm in Kotlin using the default Action Bar in the main activity:
setSupportActionBar(binding.toolbar)
I see that there are several elements controlling the color of the Title, it's background, the toolbar background and the buttons on the bar. There must be a way to set the entire toolbar one color and the buttons another color. I'm using styling and XML and code to set a lot of colors elsewhere for day/night modes but I can't change the colors of these buttons. Code takes precedence over all and so I prefer Kotlin code. But it doesn't cover everything like the styling XML code does.
EDIT by author August 18, 2022:
Possibly last comment here because this is not possible. One writer here in SO admitted it was easier to build toolbars in each fragment with independent buttons than use the default main activity toolbar. I've done that with success and in adding the ability to slide between fragments but that is not what I think the compiler designers would have hoped for.
With the main activity toolbar, the buttons come from vector assets with their own XML files. If the fill color is changed in those files with this:
android:tint="?attr/colorControlNormal
and this in for example a night theme:
<item name="android:colorControlNormal">#color/yellow_text</item>
I can't get the colors in a button to change at all.
It's the same as in checkbox properties where the background of the checkbox background is tied to the background of the actual background of the "form" itself showing as a page (the main activity and fragment) on an Android. I can't change the background color of the tick mark in the checkbox either. A default seems to be taking over in the day/night themes.

Related

How to achieve the layering effect of one Composable on top of another when showing a dialog using Jetpack Compose

I'm hoping to understand how I can achieve this behavior using Jetpack Compose in Android when displaying a dialog on top of the current Composable view.
Desired State:
Animation when clicking on the Filter button at the bottom. This is from the app Culture Trip on iOS.
I currently have a dialog like below. If you notice, my content is still visible but I would like to have it appear as if it's a page layer that's in the background.
Notice the red arrow in the desired state picture. I can mimic that behavior by having a row and setting the background color with padding but looking for a more elegant solution or wondering if there is standard behavior that I don't know about.
Actual State:
For displaying your dialog above, you need to use Box and call dialog at the very bottom of this Box.

Fluent UI React Changing the focus outline color to primary inverted color

I'm rendering a CommandButton with only an icon inside a container with a dark background with gradient and I have set the background color of the button to be transparent. (Note that it is transparent because the container's background color has a gradient.)
The problem I have is that since the default focus outline for the button is black and it's not visible against the dark background. How can I change this so that the focus outline becomes the invert color of the primary color?
I can always attach a custom CSS to change the outline color, but I'm looking for the correct way supported by the Fluent UI framework. I noticed that the Button component puts a white background color when the primary=true prop is specified. So, there seems to be a way to change the outline color, but I could not really figure out how. I also looked into the source code, and it takes a theme object and generates a class name, but this still did not tell me the full story.
There are sometimes ::after selectors in play with FluentUI focus behavior. The "Chrome version >= 86" portion of this answer shows how to put Chrome in a state that will yet you inspect your components without losing focus in the page when you navigate in DevTools.
When I encounter focus styling that I want to change in Fluent, I can find out what's applying the styles I wish to alter using this method and then override them.

Yosemite Toolbar Style

How do I get the new toolbar item style of OSX Yosemite?
I created a standard toolbar, but the buttons don't have that button-like look. Do I need to drag actual buttons to the toolbar to get this look?
What I have:
What I want (that round bezel and white background):
There are two types of items in toolbars, image items and view items. It looks like you have an image item. You seem to want a view item where the view is an NSButton configured as a round textured button. So, yes, you should drag actual buttons to the toolbar.
I would not attempt to control the button background. You should use the button as-is to get the default system appearance. Apple recommends using a PDF template image (all black with the alpha channel used to make the image). The button itself would not have a title/label. Rather that would be on the containing toolbar item.
It looks like you may have applied an internal blue "glow" or highlight to your image. Generally, you should not do that. Let the frameworks apply appropriate effects to the template image automatically based on the button state and shows-state-by mode.
Toolbars in the Human Interface Guidelines
Controls which are appropriate to use in the window frame (including the toolbar)
Designing images for toolbar buttons
Works just fine for my Cocoa app under Yosemite -
are you actually setting the template property for your icon images..?
From the NSImage docs:
The 'template' property is metadata that allows clients to be smarter
about image processing. An image should be marked as a template if it
is basic glpyh-like black and white art that is intended to be
processed into derived images for use on screen.

Sub views in HUD Panel

I am working on OSX 10.10
I am facing a strange problem of sub view colors getting inverted for HUD Panel.
For example the button when set to default button looks right in Xib file but when executed the look and feel of button is modified by the HUD panel.
I am having a HUD Panel in my Xib file as follows
But when executed the button looses its default button status. It looks as follows
How do I maintain the look and feel of the button after execution. User is not able to judge which action will be the default action due to this look and feel
Try
_defaultButton.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
Interface Builder follows a set of rules but these rules are not context-dependent. The context I'm talking about is "being displayed in a HUD Panel".
The rule applied in this case is "draw a blueish button in Interface Builder if the button is a default button" even if it's not always what happens (cf. what you're seeing in your second screenshot).
I don't know since which OS X version it's working like that, but now controls in HUD Panels are displayed with a different style (which does not have a special color for default button).
You can confirm this Interface Builder comportment by adding a simple NSTextField in your HUD Panel, it'll draw with a white background in Interface Builder but it will have a black background when running with a gray focus ring.
Interface Builder:
OS X 10.10:
I've never found a way to disable this special styling for controls in HUD Panel but several workarounds (the default button is still working correctly even if not having a special color).
The special styling only occurs when your HUD Panel have a title bar.
self.panel.styleMask = (NSHUDWindowMask | NSTitledWindowMask | NSUtilityWindowMask | NSNonactivatingPanelMask);
If you remove the title bar, it'll display without any special styling:
self.panel.styleMask = (NSHUDWindowMask | NSUtilityWindowMask | NSNonactivatingPanelMask);
At this point, you can implement and draw your own title bar in the panel and mimic the default one. I don't really like this approach because first it's a lot of work for a simple button and the custom styling of controls make them prettier and more easy to read in a HUD Panel.
Another solution was the 'VLC' way. They use HUD Panels but their controls don't have any special styling. They're using BGHUDAppKit which was released when Apple provided HUD Panel without any special controls to go with it. They use it to force the bluish style instead of the greyish one which are now used by default in HUD Panels.
I didn't really like this approach too, I didn't want to add a library for a simple button, library not updated since 2011.
What I end up doing was drawing a custom button (with a simple subclass) for default buttons in a HUD Panel. This solution is quick and allow you to choose the color you want for default button in a HUD Panel (blueish may not be the best for a HUD Panel, your call).

Infragistics State Button Checked doesn't show borders

Here is my question. I have some state button tools in my Toolbars Manager. When I set Checked = True, I don't see that button is checked. Actually I see it, but without borders as usual. Instead of that I can see light-light blue background in my state button tool. Could you please answer why is it happen and how can I change my code to view state button checked state as usual (with borders and usual background) ?
I was able to reproduce your problem setting the BorderAlpha property to Transparent.
Resetting to Default reenables the border around the Tool.
The property is present in every Appearance settings of the button, but the one I have used is the PressedAppearance of the Tool (Large or Small depending on your customization)