Merge remote-tracking branch 'remotes/origin/webview'

This commit is contained in:
0ceanSlim 2023-08-07 08:43:52 -04:00
commit 234b6e24f6
80 changed files with 367 additions and 89 deletions

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<div class="bitcointodollars">
<h1>Bitcoin Price Tracker</h1>
<div id="bitcoin-price"></div>
</div>
<script>
// Fetch the Bitcoin price from the CoinGecko API
fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd')
.then(response => response.json())
.then(data => {
const bitcoinPrice = data['bitcoin']['usd'];
const bitcoinPriceDivided = bitcoinPrice; // Divide the Bitcoin price by 100 million
// Update the Bitcoin price on the website
const bitcoinPriceElement = document.getElementById('bitcoin-price');
bitcoinPriceElement.textContent = `1 Bitcoin = $${bitcoinPriceDivided.toFixed(2)}`; // Display the Bitcoin price
})
.catch(error => console.error(error));
</script>

View File

@ -0,0 +1,161 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Lorem ipsum</title>
<style type="text/css">
body {
text-rendering: optimizeLegibility;
font-feature-settings: "kern";
-moz-font-feature-settings: "kern=1";
-ms-font-feature-settings: "kern";
-webkit-font-feature-settings: "kern";
-o-font-feature-settings: "kern";
margin: 0 0 0 0;
padding: 0 0 0 0;
}
@font-face {
font-family: "Satoshi SymbolSVG";
src: url("Satoshi Symbol.svg#Satoshi Symbol") format('svg');
}
@font-face {
font-family: "Satoshi SymbolOTF";
src: url("Satoshi Symbol.otf") format('opentype');
}
@font-face {
font-family: "Satoshi SymbolTTF";
src: url("Satoshi Symbol.ttf") format('truetype');
}
@font-face {
font-family: "Satoshi SymbolEOT"
src: url("Satoshi Symbol.eot");
}
h1 {
font-weight:normal;
margin: 10px 0 5px 0;
color: #afafaf;
}
h2 {
font-weight:normal;
margin: 0 0 5px 0;
color: #afafaf;
}
h3 {
font-weight:normal;
margin: 0 0 5px 0;
color: #afafaf;
}
h4 {
font-weight:normal;
margin: 0 0 5px 0;
color: #afafaf;
}
p {
margin: 0 0 5px 0;
color: #000000;
}
div {
font-family: "Satoshi SymbolEOT", "Satoshi SymbolOTF", "Satoshi SymbolTTF", "Satoshi SymbolSVG";
margin: 0 0 30px 0;
}
section {
padding-left: 25px;
}
h1.bigger {
font-size: 58pt;
}
h2.big {
font-size: 40pt;
}
h3.small {
font-size: 32pt;
}
h4.smaller {
font-size: 18pt;
}
p.bigger {
font-size: 32pt;
}
p.big {
font-size: 24pt;
}
p.small {
font-size: 18pt;
}
p.smaller {
font-size: 12pt;
}
span.swashes {
font-feature-settings: "swsh";
}
span.alternates {
font-feature-settings: "salt" 1;
}
span.smallcaps {
font-variant-caps: small-caps;
font-feature-settings: "smcp";
}
span.capstosmallcaps {
font-variant-caps: all-small-caps;
font-feature-settings: "c2sc", "smcp";
}
span.stylisticset01 {
font-feature-settings: "ss01";
}
</style>
</head>
<body>
<section>
<div>
<h1 class="bigger">Lorem ipsum</h1>
<p class="bigger">Dolor sit amet!</p>
</div>
<div>
<h2 class="big">Hamburgerfonstiv</h2>
<p class="big">Satoshi Symbol</p>
</div>
<div>
<h4 class="smaller">Headline 16pt</h4>
<p class="smaller">The quick brown fox jumps over the lazy dog</p>
</div>
<div>
<h4 class="smaller">Alphabet</h4>
<p class="smaller">a b c d e f g h i j k l m n o p q r s t u v w x y z</p>
<p class="smaller">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</p>
<p class="smaller">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</p>
<p class="smaller">0 1 2 3 4 5 6 7 8 9</p>
</div>
</section>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360"><rect x="166.06" y="2.83" width="27.89" height="47.65"/><rect x="166.06" y="310.35" width="27.89" height="47.65"/><rect x="166.06" y="6.84" width="27.89" height="198.86" transform="translate(286.28 -73.74) rotate(90)"/><rect x="166.06" y="80.5" width="27.89" height="198.86" transform="translate(359.94 -0.08) rotate(90)"/><rect x="166.06" y="152.08" width="27.89" height="198.86" transform="translate(431.52 71.5) rotate(90)"/></svg>

After

Width:  |  Height:  |  Size: 529 B

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360"><defs><style>.cls-1{fill:#848484;}.cls-2{fill:#fff;}</style></defs><circle class="cls-1" cx="180" cy="180" r="179"/><rect class="cls-2" x="201.48" y="37.16" width="23.49" height="40.14" transform="translate(21.82 -52.79) rotate(14.87)"/><rect class="cls-2" x="135.03" y="287.5" width="23.49" height="40.14" transform="translate(83.82 -27.36) rotate(14.87)"/><rect class="cls-2" x="184.27" y="38.29" width="23.49" height="167.49" transform="translate(364.26 -36.11) rotate(104.87)"/><rect class="cls-2" x="168.36" y="98.26" width="23.49" height="167.49" transform="translate(402.22 54.61) rotate(104.87)"/><rect class="cls-2" x="152.89" y="156.52" width="23.49" height="167.49" transform="translate(439.1 142.78) rotate(104.87)"/></svg>

After

Width:  |  Height:  |  Size: 830 B

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360"><defs><style>.cls-1{fill:#fff;}</style></defs><circle cx="180" cy="180" r="179"/><rect class="cls-1" x="201.48" y="37.16" width="23.49" height="40.14" transform="translate(21.82 -52.79) rotate(14.87)"/><rect class="cls-1" x="135.03" y="287.5" width="23.49" height="40.14" transform="translate(83.82 -27.36) rotate(14.87)"/><rect class="cls-1" x="184.27" y="38.29" width="23.49" height="167.49" transform="translate(364.26 -36.11) rotate(104.87)"/><rect class="cls-1" x="168.36" y="98.26" width="23.49" height="167.49" transform="translate(402.22 54.61) rotate(104.87)"/><rect class="cls-1" x="152.89" y="156.52" width="23.49" height="167.49" transform="translate(439.1 142.78) rotate(104.87)"/></svg>

After

Width:  |  Height:  |  Size: 795 B

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360"><defs><style>.cls-1{fill:#f8991d;}.cls-2{fill:#fff;}</style></defs><circle class="cls-1" cx="180" cy="180" r="179"/><rect class="cls-2" x="201.48" y="37.16" width="23.49" height="40.14" transform="translate(21.82 -52.79) rotate(14.87)"/><rect class="cls-2" x="135.03" y="287.5" width="23.49" height="40.14" transform="translate(83.82 -27.36) rotate(14.87)"/><rect class="cls-2" x="184.27" y="38.29" width="23.49" height="167.49" transform="translate(364.26 -36.11) rotate(104.87)"/><rect class="cls-2" x="168.36" y="98.26" width="23.49" height="167.49" transform="translate(402.22 54.61) rotate(104.87)"/><rect class="cls-2" x="152.89" y="156.52" width="23.49" height="167.49" transform="translate(439.1 142.78) rotate(104.87)"/></svg>

After

Width:  |  Height:  |  Size: 830 B

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360"><defs><style>.cls-1{fill:#fff;}</style></defs><rect width="360" height="360"/><rect class="cls-1" x="166.06" y="2.83" width="27.89" height="47.65"/><rect class="cls-1" x="166.06" y="310.35" width="27.89" height="47.65"/><rect class="cls-1" x="166.06" y="6.84" width="27.89" height="198.86" transform="translate(286.28 -73.74) rotate(90)"/><rect class="cls-1" x="166.06" y="80.5" width="27.89" height="198.86" transform="translate(359.94 -0.08) rotate(90)"/><rect class="cls-1" x="166.06" y="152.08" width="27.89" height="198.86" transform="translate(431.52 71.5) rotate(90)"/></svg>

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="price-display">
<div class="bitcoin-logo">
<img src='file:///android_asset/images/logo.png' alt='BTC' />
</div>
<div id="bitcoin-price"></div>
</div>
<div id="dollars-to-sats"></div>
<div class="currency-dropdown">
<label for="currency-select">Select Currency: </label>
<select id="currency-select">
<option value="usd">Dollars</option>
<option value="ars">Argentine Peso</option>
<option value="brl">Brazilian Real</option>
<option value="cny">Chinese Yuan</option>
<option value="eur">Euros</option>
<option value="inr">Indian Rupee</option>
<option value="jpy">Yen</option>
<option value="ngn">Nigerian Naira</option>
<option value="pkr">Pakistani Rupee</option>
<option value="php">Philippine Peso</option>
<option value="rub">Russian Ruble</option>
<option value="thb">Thai Baht</option>
<option value="try">Turkish Lira</option>
<option value="uah">Ukrainian Hryvnia</option>
<option value="vnd">Dong</option>
</select>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
// Function to fetch and update the Bitcoin price
function updateBitcoinPrice() {
const currencySelect = document.getElementById('currency-select');
const selectedCurrency = currencySelect.value;
fetch(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=${selectedCurrency}`)
.then(response => response.json())
.then(data => {
const bitcoinPrice = data['bitcoin'][selectedCurrency];
// Update the Bitcoin price on the website
const bitcoinPriceElement = document.getElementById('bitcoin-price');
// Format the Bitcoin price with a comma after every three digits and no decimals
const formattedPrice = `${selectedCurrency.toUpperCase()} ` + bitcoinPrice.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 });
bitcoinPriceElement.textContent = formattedPrice; // Display the formatted Bitcoin price
// Calculate currency to sats
const currencyToSatsElement = document.getElementById('dollars-to-sats');
const satsConversionFactor = 100000000; // 1 bitcoin = 100 million sats
// Calculate how many sats you can get for 1 unit of the selected currency based on the fetched Bitcoin price
const currencyValue = 1;
const sats = (currencyValue / bitcoinPrice) * satsConversionFactor;
currencyToSatsElement.textContent = `1 ${selectedCurrency.toUpperCase()} = ${sats.toFixed(0)} sats`; // Display the result
})
.catch(error => console.error(error));
}
// Function to refresh the Bitcoin price every 30 seconds
function refreshBitcoinPrice() {
updateBitcoinPrice(); // Call the function immediately to display the price on page load
setInterval(updateBitcoinPrice, 1000); // Call the function every 1 second (1,000 milliseconds)
}
// Call the function to refresh the Bitcoin price
refreshBitcoinPrice();

View File

@ -0,0 +1,66 @@
/* CSS styles for the Bitcoin Price Tracker */
body {
margin: 0;
padding: 0;
background: #202020;
color: #ffffff;
font-family: monospace, Arial;
font-size: 12px;
font-feature-settings: normal;
overflow-x: hidden;
text-align: center;
}
.container {
width: auto;
margin-left: 20px;
margin-right: 20px;
margin-top: 20px;
background-color: #282828;
border: 3px solid #ccc;
border-radius: 8px;
padding: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
align-items: center; /* Center items vertically within the container */
justify-content: center; /* Center items horizontally within the container */
}
.price-display {
width: auto;
margin-right: 10px;
padding: 10px;
display: flex; /* Add this to create a flexbox layout */
align-items: center; /* Center items vertically within the container */
justify-content: center; /* Center items horizontally within the container */
}
h1 {
color: #ff7500;
}
#bitcoin-price {
font-size: 26px;
font-weight: bold;
text-align: center;
}
.bitcoin-logo {
height: 50px;
/* Adjust this to match the font size of the Bitcoin price */
width: 50px;
margin-right: 10px;
/* Add some space between the logo and the price */
}
.bitcoin-logo img {
height: 50px;
/* Adjust this to match the font size of the Bitcoin price */
width: 50px;
/* Add some space between the logo and the price */
}
#dollars-to-sats {
font-size: 24px;
font-weight: semi-bold;
text-align: center;
margin: 10px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
import android.webkit.WebSettings
import java.io.IOException
class MainActivity : AppCompatActivity() {
@ -23,67 +24,50 @@ class MainActivity : AppCompatActivity() {
// Clear the WebView cache (optional)
webView.clearCache(true)
// Load the HTML content with the embedded script and CSS
val htmlContent = """<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
/* CSS styles for the Bitcoin Price Tracker */
body {
margin: 0;
padding: 0;
background: #252525;
color: #ffffff;
font-family: monospace, Arial;
font-size: 12px;
font-feature-settings: normal;
overflow-x: hidden;
text-align: center;
}
.bitcointodollars {
width: auto;
margin-left: 20px;
margin-right: 20px;
margin-top: 20px;
background-color: #252525;
border: 1px solid #ccc;
border-radius: 8px;
padding: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #ff7500;
}
#bitcoin-price {
font-size: 24px;
font-weight: bold;
text-align: center;
margin: 10px;
}
</style>
</head>
<body>
<div class="bitcointodollars">
<h1>Bitcoin Price Tracker</h1>
<div id="bitcoin-price"></div>
<script>
// Fetch the Bitcoin price from the CoinGecko API
fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd')
.then(response => response.json())
.then(data => {
const bitcoinPrice = data['bitcoin']['usd'];
// Update the Bitcoin price on the website
const bitcoinPriceElement = document.getElementById('bitcoin-price');
bitcoinPriceElement.textContent = '1 BTC = $' + bitcoinPrice.toFixed(2); // Display the Bitcoin price
})
.catch(error => console.error(error));
</script>
</div>
</body>
</html>"""
// Load the HTML content from the "index.html" file
val htmlContent = try {
// Load the HTML content from the "index.html" file
assets.open("index.html").bufferedReader().use { it.readText() }
} catch (e: IOException) {
e.printStackTrace()
// If loading HTML fails, set some default content
"<html><body><h1>Error loading HTML</h1></body></html>"
}
webView.loadDataWithBaseURL(null, htmlContent, "text/html", "UTF-8", null)
// Load the JavaScript code from the "script.js" file
val javaScriptCode = try {
assets.open("script.js").bufferedReader().use { it.readText() }
} catch (e: IOException) {
e.printStackTrace()
// If loading JavaScript fails, set an empty script
""
}
// Load the CSS code from the "style.css" file
val cssCode = try {
assets.open("style.css").bufferedReader().use { it.readText() }
} catch (e: IOException) {
e.printStackTrace()
// If loading CSS fails, set an empty style
""
}
// Combine the HTML, CSS, and JavaScript code
val finalHtmlContent = """
<html>
<head>
<style type="text/css">$cssCode</style>
</head>
<body>
$htmlContent
<script>$javaScriptCode</script>
</body>
</html>
""".trimIndent()
// Define the base URL for resolving relative paths (e.g., image source)
val baseUrl = "file:///android_asset/"
webView.loadDataWithBaseURL(null, finalHtmlContent, "text/html", "UTF-8", null)
}
}
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F6981D</color>
</resources>