refactored scripts and html for easier recognition, renamed all instances of SatsMonitor

This commit is contained in:
0ceanSlim 2023-08-10 08:33:43 -04:00
parent 1b1702443c
commit 4cf86ba755
10 changed files with 12 additions and 11 deletions

View File

@ -12,10 +12,10 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.SatsMonitor" android:theme="@style/Theme.SatWorth"
tools:targetApi="31"> tools:targetApi="31">
<activity <activity
android:name=".MainActivity" android:name="com.example.satworth.MainActivity"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -1,9 +1,10 @@
package com.example.satsmonitor package com.example.satworth
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebSettings import android.webkit.WebSettings
import com.example.satsmonitor.R
import java.io.IOException import java.io.IOException
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
@ -24,10 +25,10 @@ class MainActivity : AppCompatActivity() {
// Clear the WebView cache (optional) // Clear the WebView cache (optional)
webView.clearCache(true) webView.clearCache(true)
// Load the HTML content from the "index.html" file // Load the HTML content from the "app.html" file
val htmlContent = try { val htmlContent = try {
// Load the HTML content from the "index.html" file // Load the HTML content from the "app.html" file
assets.open("index.html").bufferedReader().use { it.readText() } assets.open("app.html").bufferedReader().use { it.readText() }
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
// If loading HTML fails, set some default content // If loading HTML fails, set some default content
@ -35,7 +36,7 @@ class MainActivity : AppCompatActivity() {
} }
val assetManager = assets val assetManager = assets
val scriptFiles = listOf("script.js", "script2.js", "script3.js", "script4.js") val scriptFiles = listOf("viewBitcoinPrice.js", "viewFiatToSats.js", "selectCurrency.js", "calcSatsToFiat.js")
val scriptContents = scriptFiles.map { fileName -> val scriptContents = scriptFiles.map { fileName ->
try { try {

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context="com.example.satworth.MainActivity">
<WebView <WebView
android:id="@+id/webView" android:id="@+id/webView"

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Base.Theme.SatsMonitor" parent="Theme.Material3.DayNight.NoActionBar"> <style name="Base.Theme.SatWorth" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. --> <!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> --> <!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style> </style>

View File

@ -1,9 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Base.Theme.SatsMonitor" parent="Theme.Material3.DayNight.NoActionBar"> <style name="Base.Theme.SatWorth" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. --> <!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> --> <!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style> </style>
<style name="Theme.SatsMonitor" parent="Base.Theme.SatsMonitor" /> <style name="Theme.SatWorth" parent="Base.Theme.SatWorth" />
</resources> </resources>