commit | 9eca67b4a167ab245d1ee74907da58bf33fb52a4 | [log] [tgz] |
---|---|---|
author | Michael Bestas <mkbestas@lineageos.org> | Sun Nov 07 12:58:06 2021 +0300 |
committer | Ali B <abittin@gmail.com> | Sun Nov 07 12:58:32 2021 +0300 |
tree | d7702d1f24d199ae9df49d4cc7d1bd5d65f1e80a | |
parent | 08a76cf43d30e2d4a7674d25bafc6a987ebd7d4a [diff] |
OmniJaws: Add FLAG_IMMUTABLE flag to PendingIntent Fixes: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. Change-Id: I9d0e9c63e8d2e98c3f46f00be2df72662e4b6105
OmniJaws "Just another weather service" is a minimized service to fetch weather data from OpenWeatherMap or Yahoo.
OpenWeatherMap API http://openweathermap.org/current
IMPORTANT: please request your own API key from OpenWeatherMap at https://openweathermap.org/appid#get and enter it here https://github.com/omnirom/android_packages_services_OmniJaws/blob/android-8.1/res/values/config.xml
Yahoo weather API https://developer.yahoo.com/weather/
Thanks to the original creators and contributors of the LockClock app https://github.com/CyanogenMod/android_packages_apps_LockClock
It provided a lot of insights and knowledge how to do this Some parts of the code like the provider access have been taken from it with minor modificatioons. Please check the file copyright headers for the origins of the files.
If you already include LockClock with your ROM you should consider if you really need this. The provider API is similiar and you dont need two different providers.
The default condition icon pack has also been extracted from LockClock
Here is a client code example using the content provider to access weather data https://github.com/omnirom/android_packages_services_OmniJaws/blob/android-8.1/src/org/omnirom/omnijaws/client/OmniJawsClient.java
There are two ways to register for changes on weather data
Using ContentObserver on URI
content://org.omnirom.omnijaws.provider/weather
Using broadcasts
private static final String ACTION_BROADCAST = "org.omnirom.omnijaws.WEATHER_UPDATE"; private static final String ACTION_ERROR = "org.omnirom.omnijaws.WEATHER_ERROR";
Depending on the value of the metric setting the following units are used to display the weather
Temperature: metric = "C" imperial = "F" Wind speed: metric = "km/h" imperial = "mph"
add activity with action "org.omnirom.WeatherIconPack" the name is used to defined the prefix for the image names default should be .weather.
<activity android:name=".weather_vclouds" android:label="LockClock (vclouds)" > <intent-filter> <action android:name="org.omnirom.WeatherIconPack" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
An example can be found here https://github.com/maxwen/WeatherIconSample
Icons: Outline weather icon set is used with permission from http://emske.com/25-outline-weather-icons/