Skip to content

Commit

Permalink
55932-elys
Browse files Browse the repository at this point in the history
  • Loading branch information
ELY M committed Jan 10, 2025
1 parent 3fe3dce commit dfb6ec2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
22 changes: 21 additions & 1 deletion app/src/main/java/joshuatee/wx/misc/ImageShowActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ import android.view.Menu
import android.view.MenuItem
import joshuatee.wx.R
import joshuatee.wx.objects.FutureBytes
import joshuatee.wx.objects.FutureVoid
import joshuatee.wx.ui.BaseActivity
import joshuatee.wx.ui.TouchImage
import joshuatee.wx.util.UtilityIO
import joshuatee.wx.util.UtilityImg
import joshuatee.wx.util.UtilityShare
import joshuatee.wx.util.WeatherStory

class ImageShowActivity : BaseActivity() {

Expand All @@ -52,6 +54,7 @@ class ImageShowActivity : BaseActivity() {

private var url = ""
private var urls = listOf<String>()
private var weatherStoryUrl = ""
private var shareTitle = ""
private var needsWhiteBackground = false
private lateinit var touchImage: TouchImage
Expand All @@ -63,7 +66,12 @@ class ImageShowActivity : BaseActivity() {

@SuppressLint("MissingSuperCall")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState, R.layout.activity_image_show, R.menu.image_show_activity, false)
super.onCreate(
savedInstanceState,
R.layout.activity_image_show,
R.menu.image_show_activity,
false
)
val arguments = intent.getStringArrayExtra(URL)!!
url = arguments[0]
shareTitle = arguments[1]
Expand All @@ -84,6 +92,10 @@ class ImageShowActivity : BaseActivity() {
loadRawBitmap()
}

url.contains("WEATHER_STORY:") -> {
loadWeatherStory()
}

else -> getContent()
}
}
Expand All @@ -93,6 +105,14 @@ class ImageShowActivity : BaseActivity() {
touchImage.set(bitmap)
}

private fun loadWeatherStory() {
FutureVoid({ weatherStoryUrl = WeatherStory.getUrl() }, ::loadWeatherStoryUrl)
}

private fun loadWeatherStoryUrl() {
FutureBytes(weatherStoryUrl, ::showImage)
}

override fun onRestart() {
getContent()
super.onRestart()
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/joshuatee/wx/settings/UtilityHomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ internal object UtilityHomeScreen {
classArgs["RAD_2KM"] = arrayOf("")
classId["RAD_2KM"] = RadarMosaicActivity.URL

// classes["WEATHERSTORY"] = ImageShowActivity::class.java
// classArgs["WEATHERSTORY"] = arrayOf(DownloadImage.byProduct(context, "WEATHERSTORY"), "Weather Story")
// classId["WEATHERSTORY"] = ImageShowActivity.URL
classes["WEATHERSTORY"] = ImageShowActivity::class.java
classArgs["WEATHERSTORY"] = arrayOf("WEATHER_STORY::", "Weather Story")
classId["WEATHERSTORY"] = ImageShowActivity.URL

listOf(
"FMAP",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/util/WeatherStory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object WeatherStory {
val html = UtilityIO.getHtml(url)
var scrapeUrl = UtilityString.parse(
html,
"src=.(https://www.weather.gov//images/.../wxstory/Tab.FileL.png). "
"src=.(https://www.weather.gov/?/images/.../wxstory/Tab.FileL.png). "
)
if (scrapeUrl.isNotEmpty()) {
productUrl = scrapeUrl
Expand Down
2 changes: 1 addition & 1 deletion doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 55932 2025_01_10

* [ADD]
* [ADD] On homescreen if "Weather Story" is configured and you tap on it image is opened up in dedicated image viewer allowing you to share the image or zoom in with the full screen.

## 55931 2025_01_10

Expand Down

0 comments on commit dfb6ec2

Please sign in to comment.