Dark mode/Splash activity follows the system . Android Studio - java

I'm developing an app. I have implemented dark mode by creating colors-night file , using a switch and appCompatDelegate. I have written some code so that the app doesn't follow the system when phone's dark mode is on . And it works properly. Yet, the Splash screen does not obey and appears dark-colored when phone's dark mode is on(while the app continues light). I know this happens because the system reads the night resources before launching. (I figured it out since disabling dark mode in the onCreate method in SpashActivity or in Application does not work(and did some research) ). Adding "forceDark = false" on xmls doesnt work either. Does anyone know how to fix this?
I know it would be better to leave it this way since it is user's preference but i want on the first use, the user to see my company's colors and logo and then, choose the dark theme. Which, i also cant find how to change. I mean change dynamically splash activity's color depending on the sharedPreferences. (as i said before, doesnt work).
Thank you in advance :slight_smile:

Related

Android 5: Icons turn black after keyboard disappears

We have an Android application which works well on Android 4.1+ till Android 7.
Only in Android 5.0 and 5.1 we experience a difficult problem (on all devices + emulators).
The icons we use in our application turn completely black after hiding the software keyboard (when you are finished typing something in a textbox).
They stay black, even after restarting the application.
But after restarting the device (or closing the application by taskmanager), the icons are back normal (till you hide the keyboard again).
I don't find anything unusual in the code or icons and since it works in Android 4,6,7 it seems related to just Android 5.
Does someone has some idea at what the cause could be?
Disabling hardware-acceleration didn't have any effect.
This problem mainly occurs if you are using some other format of images like jpeg , use only png images also you might want to have a look at this answer

How to? Code Android App to Change user's LOCATION SETTING to OFF?

quick Android Development question on how to Code something!
I've searched for it, but the results are always messy, so I cant seem to find what I need.Any help is greatly appreciated..
Question:
How would I write the Code to: Turn the user's "Location" Setting to "OFF"..?
For example, in the same way that all of the "settings toggle buttons" homescreen widgets would do it, I assume - although i'm implementing it differently than that.I simply just need the raw code that turns LOCATION to OFF.
Also, what permissions would I need to add in my Manifest?
THANKS IN ADVANCE! :)
How would I write the Code to: Turn the user's "Location" Setting to "OFF"..?
You don't, except perhaps on rooted devices or as a system app (i.e., pre-installed by the manufacturer). Ordinary apps have no ability to change the user's location settings directly.
all of the "settings toggle buttons" homescreen widgets would do it
Only on rooted devices, or those that are supplied by the device manufacturer for their device.

Full screen mode in java application

I would like to make an app that have a button that make the app full screen when clicked and then change to normal when the button is clicked second time. The JDK is 1.7 and I know it support application in full screen mode. I tried in many ways but not succeed. Please, is there someone who could help me?
EDIT1: I would like to make my app enter and exit "Video Mode Fullscreen". I cannot enter fullscreen on runtime as changing setUndecorated to true on runtime has no effect on appearance.
One way to do this is to use the setExtendedState and to set it to MAXIMIZED_BOTH as described in this question. It also shows another method to put your Swing Application in real "Video-Mode Fullscreen", if thats what you need.

ActionScript, Android and ANE

Sorry for my bad english.
I want to make a game for Android platform, but every time when i change my device orientation, the activity is restarted and i loss all data. I had read that i can prevent activity from being restarted by overriding onConfigurationChanged function in Android. The problem is that i make my game in Flash, with AS3 and i don't have access to Android API, therefore i must create an ANE which will handle onConfigurationChanged, but this doesn't work and i don't know why...onConfigurationChanged is not triggered when i change my orientation.
Question is - Is this possible to handle onConfigurationChanged from an ANE?
I work in FlashBuilder for Flash, and Eclipse for Java to make ANE, and there is 2 manifest files in which i can put android:configChanges="orientation|screenSize", one in Flash Builder and one in Eclipse, which of it must contain android:configChanges="orientation|screenSize" ?
I'm novice in android and ANE's and my be i do something wrong.
Are you simply trying to handle the orientation changes? You shouldn't need an ANE for this, have a look at the autoOrients and ORIENTATION_CHANGE event:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/StageOrientationEvent.html#ORIENTATION_CHANGE
If your application is restarting it's most likely something slightly amiss in your application descriptor. Just double check that you've got all the defaults in the manifest additions under the android node.

System overlay android 4.0

Before android 4.0 you could create and overlay over any app with TYPE_SYSTEM_OVERLAY and get touches with FLAG_WATCH_OUTSIDE_TOUCH... Now with android 4 you cant receive the touches.
basically the idea follows this app,
http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.taskbar
You can keep your app open, or always on top. it will run over any app.
Ive looked every where for information and even source code for the use on android 4.0 but no luck... Now.. I know for certain there are apps that still do this even on 4.0... there is still a way. Any ideas?
I found a full sample app here that works for Android 4.0
Here is the highlight:
To create an overlay view, when setting up the LayoutParams DON'T
set the type to TYPE_SYSTEM_OVERLAY.
Instead set it to TYPE_PHONE.
Use the following flags:
FLAG_NOT_TOUCH_MODAL
FLAG_WATCH_OUTSIDE_TOUCH
FLAG_NOT_TOUCH_MODAL << This one is quite important. Without it, focus is given to the overlay and soft-key (home, menu,
etc.) presses are not passed to the activity below.
Also make sure you add the SYSTEM_ALERT_WINDOW permission to the
mainifest file.

Categories