foreground

Change TextBlock foreground color based on the background

耗尽温柔 提交于 2019-12-05 15:39:59
I'm looking for a simple way to change the foreground color of a TextBlock based on the color of what is behind it, so that it is more readable. Since an image is more explicit than words, here's what I want: I assume it could be done with a custom shader effect, but I have no idea how to create it... Anyway, perhaps there is a simpler solution. Any idea would be welcome! loxxy Assuming the above is a progressbar, here is a great solution: WPF progress bar with dynamic text & text color update Quick and dirty method: Add both the white and grey textblocks, ensuring the white textblock is "on

How do i remove a foreground notification in Android Lollipop?

故事扮演 提交于 2019-12-05 05:31:06
I'm looking to stop/dismiss a foreground notification for a service for a mediaplayer, much similar to Google's implementation for Google Music. For instance in Google Music, if you are playing music then the the notification cannot be swiped away. However if you pause the music it can. This is completely different to how it is implemented on Android 4.4, where the notification starts only when you leave the app and removes itself when you go back into the app. I can't see how to implement this either considering the requirements for a service to have a notification. Any help would be much

Close foreground thread gracefully on windows service stop

给你一囗甜甜゛ 提交于 2019-12-04 14:10:31
In my windows service I create one "parent" foreground thread that in turn spawns "child" threads using ThreadPool (which means they are background) to execute tasks. What is the best way to close foreground thread gracefully on windows service stop? Here is my current implementation (stripped out of task-specific logic): public partial class TaskScheduler : ServiceBase { private static AutoResetEvent _finishedTaskAutoResetEvent = new AutoResetEvent(false); //This flag is used to increase chances of the Spawning Thread to finish gracefully when service stops. private bool StopRequested { get;

Phonegap 2.3.0 and the ForegroundCamera plugin

两盒软妹~` 提交于 2019-12-04 12:37:57
I'm using Phonegap 2.3.0 and the new ForegroundCamera plugin from Google Code.. I followed the instructions carefully, and in my Eclipse setup I got the following errors when validating the project: Cannot cast from ForegroundCameraLauncher to Plugin ctx cannot be resolved or is not a field (x2) R cannot be resolved to a variable (x4) The method success(PluginResult, String) is undefined for the type ForegroundCameraLauncher Now, I solved the first three of the above errors by updating some deprecated code lines (I hope I got it solved - it doesn't show the errors anymore).. The first error

Communicate with foreground service android

我是研究僧i 提交于 2019-12-04 09:06:52
问题 First question here, but I've been around for a while. What do I have: I'm building an Android app which plays audio streams and online playlists. Everything is working fine now, but I'm having issues in communicating with my service. The music is playing in a Service, started with startForeground, so it doesn't gets killed. I need to communicate from my activity with the service, for getting the track name, image, and a couple of things more. Whats my issue: I think I need to start my

Issue when app coming back to foreground

心不动则不痛 提交于 2019-12-04 08:45:42
my app crashes when it comes back to foreground after some time playing with others applications and I can't find out how to fix it. My app has a splash screen activity where it loads some data from web services and put it in global static variables declared in a class extending Application, as explained in this SO question . Once all data are loaded, this activity launches a Home activity with some menu to navigate in the app. The global vars are used in most activities. At some point, while playing with other apps, it seems that my app is killed, because I can see this in the logcat: I

How to use NotificationCompat.Builder and startForeground?

时光怂恿深爱的人放手 提交于 2019-12-04 01:37:04
Short question: I'm trying to use the NotificationCompat.Builder class in order to create a notification that will be used for the service, but for some reason, i either don't see the notification, or can't cancel it when the service should be destroyed (or stopping from being in the foreground) . my code: @Override public int onStartCommand(final Intent intent, final int flags, final int startId) { final String action = intent == null ? null : intent.getAction(); Log.d("APP", "service action:" + action); if (ACTION_ENABLE_STICKING.equals(action)) { final NotificationCompat.Builder builder =

Change foreground color of textbox when text changes and meets certain criterion

痞子三分冷 提交于 2019-12-03 15:40:20
I require to set text color when text changes inside textbox and meets certain criterion. I can implement this from code behind with textbox_textchanged event and set brushes.color to desired color. But I am not being able to implement this with xaml wpf approach. I am new to wpf, I'm not sure how can I set text color depending upon certain criterion when text changes in textbox. For example: For a given textbox, when text changes, it needs to determine if input text is a number then change foreground color to green else red. Looking forward for the help. Thank you in advance. I am not sure

Hide notification of foreground service while activity is visible

久未见 提交于 2019-12-03 06:04:46
问题 Is their a way to start a service as a foreground service and hide the notification while an activity is visible? Consider a music player, while the app is opened, you don't need the notification (with i.e. the buttons), but whenever the music player is in the background, the notification should be shown. I know, how to do this, if I DON'T run my service in foreground... But when running in foreground, the service itself needs the notification and shows it and I can't manage the notification

How to know if my android app is visible?

白昼怎懂夜的黑 提交于 2019-12-03 05:51:02
问题 I have a timer that start a notification when it ends. But I would like to fire a notification using notificationManager only if the app is not currently visible, and to show an alertDialog if the timer ends while the app is in foreground. I've already tried with this : ActivityManager actMngr = (ActivityManager) ValeoMobileApplication.getContext().getSystemService(Activity.ACTIVITY_SERVICE); List<RunningAppProcessInfo> runningAppProcesses = actMngr.getRunningAppProcesses(); Tools.log(