GitToTheHub commented on PR #1939:
URL: https://github.com/apache/cordova-android/pull/1939#issuecomment-4506716118

   Hi good catch. Since you already noted that `#80000000` resolves to 
`Integer.MIN_VALUE` the change would be to not use `INVALID_COLOR` at all. 
`INVALID_COLOR` in most cases is set, when a string could not parsed by 
`Color.parseColor`, which then throws an `IllegalArgumentException`. So the 
right approach would be to react on the exception directly instead of setting 
`INVALID_COLOR` and use this.
   
   These methods set `INVALID_COLOR`:
   - `parseColorFromString` will return `INVALID_COLOR` if the parameter string 
is empty or `Color.parse` throws `IllegalArgumentException`. 
`parseColorFromString` is called by:
     - `setStatusBarBackgroundColor` which is called from the corresponding 
JavaScript function
     - `getPreferenceStatusBarBackgroundColor` for reading the preference 
`StatusBarBackgroundColor`
   - `getPreferenceBackgroundColor` returns `INVALID_COLOR` if the preference 
`BackgroundColor` could not be parsed as int
   
   The variable `overrideStatusBarBackgroundColor` is an int and can also 
contain `INVALID_COLOR`. It is set by `setStatusBarBackgroundColor` which is 
called by the corresponding JavaScript function. It is only used in 
`updateSystemBars`. Instead of an `int`, this could contain the string given by 
`setStatusBarBackgroundColor` and parse it every time in `updateSystemBars` to 
catch the exception.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to