android images in custom notification views inverse in dark mode (android 10.0) - android-notifications

when i use systemPic style,use system xml,it works well.
builder.setContentTitle(StringUtil.f(title));
builder.setContentText(StringUtil.f(desc));
if (poster != null) {
builder.setLargeIcon(poster);
}
Notification notification = builder.build();
but when i use custom layout, the image in notification like a negative image:
original image vs Invert image

Related

How to hide "VR" button unless VR headset is present on A-Frame scene

By default an A-Frame scene shows a "VR" icon to enter immersive VR mode in all cases, even if a headset is not present. Is there a simple way to only show this icon when a user is using a headset with WebXR available?
Yes, there is a built in A-Frame function checkHeadsetConnected() for this purpose. You can use this in a component attached to the a-scene entity to disable vr-mode-ui when a headset is not present. Here is example code for this:
// only show VR button if headset connected
AFRAME.registerComponent('vr-mode-ui-if-headset', {
dependencies: ['vr-mode-ui'],
init: function () {
if (!AFRAME.utils.device.checkHeadsetConnected()) {
this.el.setAttribute('vr-mode-ui', 'enabled', false);
}
}
})
Here is a glitch A-Frame scene showing this component in use:
Code: https://glitch.com/edit/#!/lapis-wide-cartoon?path=index.html
Live project: https://lapis-wide-cartoon.glitch.me/

Xamarin Forms app not changing orientation on iOS

I have a Xam.Forms app which is working fine on iOS and Android with one exception. All screens except one are portrait. When this one screen shows, it show rotate to landscape. It works fine on android.
On iOS, it fails to change. The info.plist file has all orientations enabled. As I want only this one screen to be portrait, I have in the AppDelegate class an override that ensures everytrhing is portrait except one.
The override is this
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
var mainPage = Shell.Current?.CurrentPage;
if (mainPage != null)
{
if (mainPage is IDCardPage)
{
return UIInterfaceOrientationMask.Landscape;
}
}
return UIInterfaceOrientationMask.Portrait;
}
A break point for the landscape is hit, but there is no rotation. According to the Apple docs, this is all I should need to do to rotate a view

Swift iOS 13 - scopeBar in searchBar not displayed in TitleView

Prior to iOS 13, when the search bar became the first responder, the below code displayed the scope bar with two scope bar buttons, which is the intended behavior.
With iOS 13, the search bar still functions correctly, however the scope bar is no longer being displayed. Apple's documentation for the UISearchBarDelegate seems to suggest using .setShowsScope(show:(bool), animated:(bool)) and .sizeToFit() for iOS 13. However, these function calls seemed not to have any effect. Looking for ideas to have the scope bar displayed as it did with iOS 12 and earlier.
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
//eventSearchBar is name of UISearchBar
//eventSearchBar.delegate has already been called out as self
//eventSearchBar is not owned by a UISearchController
self.navigationController?.setNavigationBarHidden(true, animated: true)
eventSearchBar.setShowsCancelButton(true, animated: true)
eventSearchBar.frame.size.height = 68
TitleView.frame.size.height = 132
eventSearchBar.scopeButtonTitles = ["Category", "Project"]
eventSearchBar.showsScopeBar = true
if eventSearchBar.text! == "" {
self.tableView.reloadData()
} else {
if eventSearchBar.selectedScopeButtonIndex == 0 {
self.loadSearchElements(self.refreshControl)
} else {
self.loadProjectSearchElements(self.refreshControl)
}
}
}
Problem solved. Issue is that the storyboard searchBar object has been updated for iOS 13. Solution was to remove the searchBar from the viewController in the storyboard and replace it with a new searchBar, dragged from the objects list. The old and new searchBar look identical, but the connection to their delegate properties is evidently different.

hide navigation bar programmatically while application running

I am developing an android game with webview layout. I would like to hide the navigation bar while the user is playing the game. I have found some solutions but when I touch the screen the navigation bar shows up.
What am I doing wrong? Here is my non-working solution:
int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
you need to make use of following piece of code to reset the flags again :
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener
(new View.OnSystemUiVisibilityChangeListener() {
#Override
public void onSystemUiVisibilityChange(int visibility) {
// Note that system bars will only be "visible" if none of the
// LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(mUIFlag);
} else {
// TODO: The system bars are NOT visible. Make any desired
// adjustments to your UI, such as hiding the action bar or
// other navigational controls.
}
}
});
also, read through this page to know how to handle your scenario

Replace default play button on Brightcove's Smart Player on mobile devices

Quite likely I just need the right terms to find the answer; however, I imagine someone else has already encountered this problem and knows right away how to solve it.
I'm using Brightcove's services and their Smart Player. I've configured a Chromeless player and tried to eliminate ALL controls because my page's controls will use their API to play, pause, etc. On desktop, this works just ok. On mobile devices (iOS7 Safari) there is a play button overlay on the video player that I'd like to replace with my own graphic.
I'd like to turn this:
into this:
Anyone know how to do this? I can't just reach into the player with JavaScript because it's in an iframe filled by Brightcove services.
You can do this with a javascript player plugin, which runs inside the player iframe. Use the overlay API to create your custom play button and playOverlayCallbacks() to prevent the default play overlay from being displayed.
Something like this would work in a plugin:
(function() {
function addPlayOverlay() {
var overlay = videoPlayer.overlay();
$(overlay).css('background', 'transparent url("http://example.com/playbutton.png") no-repeat center center')
.width($(document).width())
.height($(document).height())
.css("-webkit-box-shadow","inset 0 0 150px rgba(0,0,0,0.9)")
;
$(overlay).click(function(){
// Play when custom overlay is clicked
videoPlayer.play();
});
videoPlayer.playOverlayCallbacks({
show: function() {
// Show custom overlay
$(overlay).fadeIn();
// Prevent standard play overlay
return false;
},
hide: function() {
// Hide play overlay
$(overlay).fadeOut();
return false;
}
});
}
var
bcplayer = brightcove.api.getExperience(),
videoPlayer = bcplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER),
experience = bcplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE);;
if (experience.getReady()) {
addPlayOverlay();
} else {
experience.addEventListener(brightcove.player.events.ExperienceEvent.TEMPLATE_READY, addPlayOverlay);
}
}());

Resources