[Nook Touch Themes and Apps] nmyshkin:
3-10-24: Updated to version 2.0

Uninstall any previous version.

.

-rewrote time zone/standard/summer time routines

-rewrote forecast panel routine

-thanks to @aykov77 for valuable input and testing

NST Weather Widget is a Tasker-generated app that runs in concert with Minimalistic Text to produce a true home screen widget displaying the current (forecast) weather in your locale as provided by OpenWeatherMap. The code for the weather is based on my NST Weather app with a few tweaks and without the status bar temperature/condition display.

Requirements

0. Root

1. If you previously installed NSTWeather (the status bar app), remove it completely, including the NSTWeather folder on the sdcard.

2. This is a Tasker-generated app. If you already have one of my other Tasker-generated apps, you don't need the two Google maps library files included in the zip and can delete them. If you do need them, copy the two files into the locations shown below:

/system/etc/permissions/com.google.android.maps.xml

/system/framework/com.google.android.maps.jar

Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.

3. Copy the folder "NSTWeather" and its contents from the zip below to the root of your sdcard. This contains all the condition icons for the forecast panel and is where the weather.xml file from OWM will be stored.

4. Copy the folder "MinimalisticTextPreferences" and its contents to your sdcard.

5. Go to https://openweathermap.org/ and find the current weather for your locale. When this is displayed you will also see the "geocoordinates" (i.e., the latitude and longitude). Copy these two values.

Edit: I have three devices and on one of them the coordinates given by OWM always result in a town about a 100 miles up the coast. This is the same data used successfully by the other two devices! What finally worked for me was to go here: https://www.maps.ie/coordinates.html and enter my full home address. The coordinates were quite a bit different but worked perfectly.

6. Go to https://openweathermap.org/api and sign up for a free API (right there in the opening paragraph, click on the words "sign up"). You will eventually receive an email with the API.

7. Install Minimalistic Text (attached below). Installation and setup are tricky on the NST. There seem to be permission issues which are not entirely resolvable. What I ended up doing was installing a copy on a KitKat device and copying out two of the xml preferences files from the /data/data/de.devmil.minimalitext/shared_prefs. But this is not consistent and finally I decided to put together a flashable CWM zip of a working installation. That's what's below. Copy this onto your CWM sdcard, boot up CWM and install the zip. Reboot and your Minimalistic Text is good to go. No CWM card? Head over to here and make a card from either of the two sdcard versions. I have also modded the version of Minimalistic Text in the zip file so that widgets you create are visible in the opening screen of the app (as opposed to a black screen...).

7. Copy the Font folder (and its contents) from the zip below to your sdcard. The customized TrueType font of weather condition icons resides in this folder and you can add additional custom fonts for Minimalistic Text to access in the same folder.

Installation and Use

You MUST have Minimalistic Text installed before installing NST Weather Widget.

Copy the MT_install_CWM.zip file to your CWM card. Power down your NST, insert the CWM card and power up. Choose install from zip file, select zip and then choose the MT_install file. Confirm. When that's done, return to the main menu (top left hardware button) which says "reboot now" at the top. Remove the CWM card, replace it with your usual sdcard and press "n". The device reboots.

Install the app from the zip below either by side-loading or ADB. The initial user interface of the app is a Settings page. Open NST Weather and enter your latitude and longitude, as well as your API. Be especially careful with the API and make sure to include any negative signs with the geocoordinates.

Next, make your selection of the units you want displayed. Finally, to make the app fully functional you need to check both of the boxes in the lower section (you can disable the app temporarily by unchecking these). When you've made all the selections, tap on the bottom box to start a manual data retrieval. The Settings page will close and you should see WiFi come on for a bit. It will then turn off. If a successful connection was made with OWM and if you entered your information correctly, you will eventually receive a notification that the process is complete (first time only). How long will it take? About 3 minutes. There's an awful lot of stuff to be done. That's one reason for having the data update done at 3:30 am when you are hopefully snoozing. OWM finally added a time zone adjustment to their xml data file but I decided to leave my own in place because various municipalities have their own approach to daylight/standard time changes so your time zone will match the local clock setting of your device.

If for some reason the device fails to contact OWM the first time it will try a second time. If the second time fails, you will get a notification telling you that download failed, assuming there is nothing wrong with the values you entered. Go back to the Settings page and carefully check your API. That's where the most likely error will occur. Of course you should check your geocoordinates, too, just to be sure.

Once an initial weather forecast has been successfully retrieved (and the data is processed), tapping the app icon will display the 5-day forecast panel rather than the Settings page. However, you can access the Settings page from the little cog-wheel icon on the forecast panel.

If you have made a successful connection with OWM before and one day there is a notification saying download failed, you can just ignore it and hope for better luck the next day unless you absolutely must have an updated forecast. In that case, you can use the manual retrieval option from the Settings page. There is no need to re-enter the latitude, longitude and API each time you open the Settings page once they have been entered correctly. Also, if you decide to change the locale, you only need to enter the new latitude and longitude, not the API.

The 5-day forecast panel is updated daily even if a download fails (data is just shifted to the left and the names of the days are changed). You access the panel by tapping on the app icon or--better--by assigning the app to your widget (see below). If you run through the data entirely without any WiFi contact OR if the device has been off for awhile and the data is no longer current when it is turned back on, you will receive a notification that there is no more forecast data. A tap on the widget will initiate a manual data update.

The Widget

The app shares five variables with Minimalistic Text every three hours as well as updating one of the variables at both sunrise and sunset (within the nearest quarter hour). The variables are:

LOCATION (where OWM says you are)

CURRTEMP (the current forecast temperature)

CURRCOND (the current forecast

general

condition--as icon)

TCURRCOND (the current forecast

specific

condition--as text)

TUNITS (either C or F depending on the units you chose)

You can use as many or as few of these as you like, as well as static text, in any arrangement, to construct your widget OR, to keep things simple, you can just read in the widget profile I have provided, see how that works for you and if you want changes, either experiment yourself or ask me for help.

1. Find a spot on your home screen and long press there to add a widget (or do whatever you do for the launcher you are using to add a widget)

2. Choose a Minimalistic Text option. The sample weather widget shown below is a horizontal 4x2.

3. Minimalistic Text now opens to a Settings page. Give your widget a Name (Weather).

4. Scroll down to the very last setting option, Backup or Restore. Tap on Restore and tap on "Weather". Confirm. You'll see a message that the data has been loaded.

5. Tap on the status bar menu "button". A small menu slides up from the bottom. You want to tap on "OK". Exit the app if needed, but you may just be returned to the home screen where you will see the widget somewhere on the screen. Drag it where you want and....you're done!

Icons credit and information

I could not have done any of this without the weather icon font from Erik Flowers: https://erikflowers.github.io/weather-icons/. I did locate one other font but it had far fewer choices of glyphs. In the end I only actually used 13 of the glyphs for the weather condition icons. OWM has 18 general conditions (actually just nine doubled for day and night). After looking at the many choices offered in the font and the more detailed descriptions of the conditions from OWM, I decided to use day-neutral icons for situations in which the sky would be largely obscured. That means that the inaptly named "broken clouds" (51-84% cover), "shower rain", "rain", "thunderstorm" and "snow" show neither sun nor moon (and in fact are identical for day and night). There just seemed something odd about looking at driving rain and the sun peeking over clouds. Even in Coastal California we occasionally have such conditions as a storm is on the wane, but there just isn't enough fine gradation in the OWM condition icons so I had to make judgment calls. The specific text conditions, on the other hand, cover 54 situations and give some nuance to the general forecast.

In order to make the glyphs accessible to MT, I needed to partially remap the font, "moving" the 13 glyphs to standard keyboard characters rather than the glyph section which there is no way to access with the NST. I used the free version of Type Light 3.2 (https://www.cr8software.net/typelight.html) to do this.

The icons in the forecast panel are just images I created with a graphics program on my PC, using the remapped font.

So...if you don't like the condition icons you can, of course, not include them in your widget. If you want to change the icons in the forecast panel, you can replace the images in the NSTWeather folder. Just keep the size the same and make a transparent png. But if you want to replace the condition icons used in the widget, you will have to find another font somewhere and treat it as I did. You could also remap the font supplied if you prefer other choices of glyphs. That's quite a project and best left to individual questions.