updated v1.12.0 -full, fixed #246

This commit is contained in:
Pranshul committed 2024-12-22 21:21:04 +05:30
1 parent 7982007b4d
commit 06eee89022
18 files changed
+3124 -1337

No files matched your search

+2 -2
View File
@@ -10,8 +10,8 @@ android {
applicationId "com.example.weathermaster"
minSdk 22
targetSdk 33
versionCode 95
versionName "1.11.0 (W)"
versionCode 97
versionName "1.12.0 (W)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
+2 -2
View File
@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 95,
"versionName": "1.11.0 (W)",
"versionCode": 97,
"versionName": "1.12.0 (W)",
"outputFile": "app-release.apk"
}
],
+9 -1
View File
@@ -17,7 +17,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Base.Theme.WeatherMaster"
tools:targetApi="33">
android:debuggable="true"
tools:targetApi="33"
tools:ignore="HardcodedDebugMode">
<activity
android:name=".SettingsActivity"
android:screenOrientation="portrait"
@@ -144,6 +146,12 @@
android:exported="true"
android:theme="@style/yelloMainPage"
/>
<activity
android:name=".ArrangeItems"
android:screenOrientation="portrait"
android:exported="true"
android:theme="@style/yelloMainPage"
/>
<activity
android:name=".MainActivity"
android:theme="@style/app_theme"
+393 -15
View File
@@ -93,24 +93,313 @@ function useAutoCurrentLocation() {
if (navigator.onLine) {
if (DefaultLocation) {
if (DefaultLocation.name === "CurrentDeviceLocation") {
useAutoCurrentLocation();
sendThemeToAndroid("ReqLocation");
const offlineData = localStorage.getItem("DefaultLocation");
const parsedOfflineData = JSON.parse(offlineData);
let weatherDataKey;
if (
localStorage.getItem("selectedMainWeatherProvider") === "Met norway"
) {
weatherDataKey = `WeatherDataMetNorwayTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("ApiForAccu") &&
localStorage.getItem("selectedMainWeatherProvider") === "Accuweather"
) {
weatherDataKey = `WeatherDataAccuCurrentTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "meteoFrance"
) {
weatherDataKey = `WeatherDataMeteoFranceTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dwdGermany"
) {
weatherDataKey = `WeatherDataDWDGermanyTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "noaaUS"
) {
weatherDataKey = `WeatherDataNOAAUSTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ecmwf"
) {
weatherDataKey = `WeatherDataECMWFTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ukMetOffice"
) {
weatherDataKey = `WeatherDataukMetOfficeTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "jmaJapan"
) {
weatherDataKey = `WeatherDataJMAJapanTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "gemCanada"
) {
weatherDataKey = `WeatherDatagemCanadaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "bomAustralia"
) {
weatherDataKey = `WeatherDatabomAustraliaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "cmaChina"
) {
weatherDataKey = `WeatherDatacmaChinaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") ===
"knmiNetherlands"
) {
weatherDataKey = `WeatherDataknmiNetherlandsTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dmiDenmark"
) {
weatherDataKey = `WeatherDatadmiDenmarkTimeStamp_${parsedOfflineData.name}`;
} else {
weatherDataKey = `WeatherDataOpenMeteoTimeStamp_${parsedOfflineData.name}`;
}
const weatherData = localStorage.getItem(weatherDataKey);
const providedDate = new Date(weatherData);
const currentDate = new Date();
const timeDifference = currentDate - providedDate;
const timeDifferenceInMinutes = timeDifference / (1000 * 60);
if (timeDifferenceInMinutes < 30) {
setTimeout(() => {
ReturnHomeLocation();
}, 1000);
if (localStorage.getItem("selectedMainWeatherProvider") === "Met norway") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Met Norway (Global)";
} else if (
localStorage.getItem("ApiForAccu") &&
localStorage.getItem("selectedMainWeatherProvider") === "Accuweather"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Accuweather (Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "meteoFrance"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Météo-France (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dwdGermany"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by DWD (Europe, Global)";
} else if (localStorage.getItem("selectedMainWeatherProvider") === "noaaUS") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by NOAA (Americas, Global)";
} else if (localStorage.getItem("selectedMainWeatherProvider") === "ecmwf") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by ECMWF (Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ukMetOffice"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by UK Met Office (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "jmaJapan"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by JMA (Asia, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "gemCanada"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by GEM (Americas, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "bomAustralia"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by BOM (Oceania, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "cmaChina"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by CMA (Asia, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "knmiEurope"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by KNMI (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dmiEurope"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by DMI (Europe, Global)";
} else {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Open-Meteo (Global)";
}
} else{
useAutoCurrentLocation();
sendThemeToAndroid("ReqLocation");
}
document.querySelector(".currentLocationdiv").hidden = false;
document.getElementById("showDeviceLocation").hidden = false;
} else if (DefaultLocation.lat && DefaultLocation.lon) {
DecodeWeather(
DefaultLocation.lat,
DefaultLocation.lon,
DefaultLocation.name
);
const offlineData = localStorage.getItem("DefaultLocation");
const parsedOfflineData = JSON.parse(offlineData);
let weatherDataKey;
if (
localStorage.getItem("selectedMainWeatherProvider") === "Met norway"
) {
weatherDataKey = `WeatherDataMetNorwayTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("ApiForAccu") &&
localStorage.getItem("selectedMainWeatherProvider") === "Accuweather"
) {
weatherDataKey = `WeatherDataAccuCurrentTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "meteoFrance"
) {
weatherDataKey = `WeatherDataMeteoFranceTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dwdGermany"
) {
weatherDataKey = `WeatherDataDWDGermanyTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "noaaUS"
) {
weatherDataKey = `WeatherDataNOAAUSTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ecmwf"
) {
weatherDataKey = `WeatherDataECMWFTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ukMetOffice"
) {
weatherDataKey = `WeatherDataukMetOfficeTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "jmaJapan"
) {
weatherDataKey = `WeatherDataJMAJapanTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "gemCanada"
) {
weatherDataKey = `WeatherDatagemCanadaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "bomAustralia"
) {
weatherDataKey = `WeatherDatabomAustraliaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "cmaChina"
) {
weatherDataKey = `WeatherDatacmaChinaTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") ===
"knmiNetherlands"
) {
weatherDataKey = `WeatherDataknmiNetherlandsTimeStamp_${parsedOfflineData.name}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dmiDenmark"
) {
weatherDataKey = `WeatherDatadmiDenmarkTimeStamp_${parsedOfflineData.name}`;
} else {
weatherDataKey = `WeatherDataOpenMeteoTimeStamp_${parsedOfflineData.name}`;
}
const weatherData = localStorage.getItem(weatherDataKey);
const providedDate = new Date(weatherData);
const currentDate = new Date();
const timeDifference = currentDate - providedDate;
const timeDifferenceInMinutes = timeDifference / (1000 * 60);
if (timeDifferenceInMinutes < 30) {
setTimeout(() => {
ReturnHomeLocation();
}, 1000);
if (localStorage.getItem("selectedMainWeatherProvider") === "Met norway") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Met Norway (Global)";
} else if (
localStorage.getItem("ApiForAccu") &&
localStorage.getItem("selectedMainWeatherProvider") === "Accuweather"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Accuweather (Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "meteoFrance"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Météo-France (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dwdGermany"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by DWD (Europe, Global)";
} else if (localStorage.getItem("selectedMainWeatherProvider") === "noaaUS") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by NOAA (Americas, Global)";
} else if (localStorage.getItem("selectedMainWeatherProvider") === "ecmwf") {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by ECMWF (Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ukMetOffice"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by UK Met Office (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "jmaJapan"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by JMA (Asia, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "gemCanada"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by GEM (Americas, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "bomAustralia"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by BOM (Oceania, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "cmaChina"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by CMA (Asia, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "knmiEurope"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by KNMI (Europe, Global)";
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dmiEurope"
) {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by DMI (Europe, Global)";
} else {
document.querySelector(".data_provider_name_import").innerHTML =
"Data by Open-Meteo (Global)";
}
} else{
DecodeWeather(
DefaultLocation.lat,
DefaultLocation.lon,
DefaultLocation.name
);
document.getElementById("city-name").innerHTML = DefaultLocation.name;
document.getElementById("SelectedLocationText").innerHTML =
DefaultLocation.name;
localStorage.setItem("CurrentLocationName", DefaultLocation.name);
document.getElementById("currentLocationName").textContent =
DefaultLocation.name;
document.getElementById("showDeviceLocation").hidden = true;
}
document.getElementById("city-name").innerHTML = DefaultLocation.name;
document.getElementById("SelectedLocationText").innerHTML =
DefaultLocation.name;
localStorage.setItem("CurrentLocationName", DefaultLocation.name);
document.getElementById("currentLocationName").textContent =
DefaultLocation.name;
document.getElementById("showDeviceLocation").hidden = true;
}
} else {
useAutoCurrentLocation();
@@ -212,6 +501,7 @@ document.addEventListener("DOMContentLoaded", () => {
document.querySelector(".view_device_location").hidden = true;
sendThemeToAndroid("DisableSwipeRefresh");
loadSavedLocations();
initializeDragAndDropLocations();
let savedLocations =
JSON.parse(localStorage.getItem("savedLocations")) || [];
@@ -444,15 +734,18 @@ async function loadSavedLocations() {
const currentTime = new Date().getTime();
savedLocationsHolder.innerHTML = "";
let dataIdCounter = 1;
for (const location of savedLocations) {
const savedLocationItem = document.createElement("savedLocationItem");
savedLocationItem.setAttribute("data-id", dataIdCounter++);
savedLocationItem.setAttribute("lat", location.lat);
savedLocationItem.setAttribute("lon", location.lon);
savedLocationItem.setAttribute("locationLabel", location.locationName);
const savedLocationItemLat = savedLocationItem.getAttribute("lat");
const savedLocationItemLon = savedLocationItem.getAttribute("lon");
let temp = "0";
let icon = "";
let showReloadBtn = "hidden";
@@ -3079,12 +3372,97 @@ function refreshWeather() {
const longSend = localStorage.getItem("currentLong");
const CurrentLocationName = localStorage.getItem("CurrentLocationName");
let weatherDataKey;
if (
localStorage.getItem("selectedMainWeatherProvider") === "Met norway"
) {
weatherDataKey = `WeatherDataMetNorwayTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("ApiForAccu") &&
localStorage.getItem("selectedMainWeatherProvider") === "Accuweather"
) {
weatherDataKey = `WeatherDataAccuCurrentTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "meteoFrance"
) {
weatherDataKey = `WeatherDataMeteoFranceTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dwdGermany"
) {
weatherDataKey = `WeatherDataDWDGermanyTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "noaaUS"
) {
weatherDataKey = `WeatherDataNOAAUSTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ecmwf"
) {
weatherDataKey = `WeatherDataECMWFTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "ukMetOffice"
) {
weatherDataKey = `WeatherDataukMetOfficeTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "jmaJapan"
) {
weatherDataKey = `WeatherDataJMAJapanTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "gemCanada"
) {
weatherDataKey = `WeatherDatagemCanadaTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "bomAustralia"
) {
weatherDataKey = `WeatherDatabomAustraliaTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "cmaChina"
) {
weatherDataKey = `WeatherDatacmaChinaTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") ===
"knmiNetherlands"
) {
weatherDataKey = `WeatherDataknmiNetherlandsTimeStamp_${CurrentLocationName}`;
} else if (
localStorage.getItem("selectedMainWeatherProvider") === "dmiDenmark"
) {
weatherDataKey = `WeatherDatadmiDenmarkTimeStamp_${CurrentLocationName}`;
} else {
weatherDataKey = `WeatherDataOpenMeteoTimeStamp_${CurrentLocationName}`;
}
const weatherData = localStorage.getItem(weatherDataKey);
const providedDate = new Date(weatherData);
const currentDate = new Date();
const timeDifference = currentDate - providedDate;
const timeDifferenceInMinutes = timeDifference / (1000 * 60);
if (timeDifferenceInMinutes < 10) {
setTimeout(() => {
document.querySelector(".no_touch_screen").hidden = true;
ShowSnackMessage.ShowSnack(
"Please wait 10 minutes before refreshing again.",
"long"
);
sendThemeToAndroid("StopRefreshingLoader");
}, 1000);
} else{
DecodeWeather(
latSend,
longSend,
CurrentLocationName,
`Refreshed_${CurrentLocationName}`
);
}
} else {
setTimeout(() => {
document.querySelector(".no_touch_screen").hidden = true;
@@ -3249,7 +3627,7 @@ document.addEventListener("DOMContentLoaded", () => {
});
document.addEventListener("DOMContentLoaded", async function () {
const currentVersion = "v1.11.0";
const currentVersion = "v1.12.0";
const githubRepo = "PranshulGG/WeatherMaster";
const releasesUrl = `https://api.github.com/repos/${githubRepo}/releases/latest`;
@@ -305,14 +305,12 @@ async function displayDailyForecast(forecast, forecastDaily) {
const dateObj = new Date(date + 'T00:00:00');
const isToday = date === todayString;
const weekday = isToday ? 'today' : dateObj.toLocaleDateString('en-US', { weekday: 'short' }).toLowerCase();
const translatedWeekDays = weekDaysCache.map(day => {
return [day][0];
});
const weekdayLang = translatedWeekDays[index % translatedWeekDays.length];
const weekdayLang = isToday
? getTranslationByLang(localStorage.getItem('AppLanguageCode'), ["Today"])[0] // Translate "Today"
: getTranslationByLang(localStorage.getItem('AppLanguageCode'), weekDaysCache).find(
day => day.toLowerCase() === weekday.toLowerCase()
);
const dailyData = forecastDaily[date];
+1 -1
View File
@@ -362,7 +362,7 @@ function DailyWeather(dailyForecast) {
ReportFromdaily(send1stDay);
weekDaysCache.push(getTranslationByLang("en", weekday));
weekDaysCache.push(getTranslationByLang(localStorage.getItem("AppLanguageCode"), weekday));
const rainPercentage = dailyForecast.precipitation_probability_max[index];
const DailyWeatherCode = dailyForecast.weather_code[index];
+122 -21
View File
@@ -84,7 +84,7 @@
<div class="left_current_weather">
<now data-translate="now">Now</now>
<div class="temp_img">
<p id="temp">0°</p>
<p id="temp" style="transition: opacity 0.1s ease-in;">0°</p>
<img id="weather-icon" src="weather-icons/not_available.svg" alt="Weather Icon">
</div>
@@ -141,7 +141,7 @@
<div class="floating_indications" hidden>
<div id="indicatorContainer" class="indicator-container">
<!-- Indicator balls 💀 will be dynamically added here -->
<!-- Indicator's balls 💀 will be dynamically added here -->
</div>
</div>
@@ -189,6 +189,7 @@
<div class="high-all" style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2); z-index: 1; position: relative;">
<div class="high-mini">
@@ -258,8 +259,10 @@
<div class="other-main">
<div class="sortHolder" id="sortHolder" style="display: flex; flex-direction: column;">
<div class="all-24" style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);">
<div data-id="1">
<div class="all-24" style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);" >
<div class="h1">
<p class="today_Text" data-translate="next_24-hr">Next 24-hr</p>
<p class="date_Text_top" id="date_text_top">Mar, 19</p>
@@ -299,8 +302,8 @@
</rainMeterBar>
</rainMeter>
<div class="all-5d" style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);">
</div>
<div class="all-5d" style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);" data-id="2">
<div class="h2">
<p data-translate="daily_forecast"
style="width: calc(100% - 150px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
@@ -322,20 +325,20 @@
</div>
<div class="LiveMapWrap ripple_btn_low" onclick="sendThemeToAndroid('OpenRadar')"
style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);" hidden>
<div class="radar_label"><md-icon icon-outlined>radar</md-icon> <span
data-translate="live_radar">Live radar</span></div>
<div id="livemapPreview">
<img src="icons/prevmap.png" alt="">
</div>
</div>
<!-- <div class="LiveMapWrap ripple_btn_low" onclick="sendThemeToAndroid('OpenRadar')"-->
<!-- style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);" hidden>-->
<!-- <div class="radar_label"><md-icon icon-outlined>radar</md-icon> <span-->
<!-- data-translate="live_radar">Live radar</span></div>-->
<!-- <div id="livemapPreview">-->
<!-- <img src="icons/prevmap.png" alt="">-->
<!-- </div>-->
<!-- </div>-->
<div class="currentConditions" style="margin-top: 10px;" id="sortableContainer">
<div class="currentConditions" style="margin-top: 5px;" id="sortableContainer" data-id="3">
<div class="currentConditionItem sunRISESET ripple_btn_low" data-id="1"
@@ -518,7 +521,7 @@
</div>
<div class="pollen_data " hidden style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);">
<div class="pollen_data " hidden style="box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);" data-id="4">
<div class="pollen_heading">
<md-icon icon-filled>allergy</md-icon>
<p data-translate="pollen">Pollen</p>
@@ -554,7 +557,7 @@
<div class="pollen_circles">
<div class="pollen_icon">
<i icon-outlined>nature</i>
<span data-translate="Tree">Tree</span>
<span data-translate="tree">Tree</span>
</div>
<div class="Pollen_Icon_slot_tree Pollen_Icon_slot">
@@ -605,8 +608,8 @@
<div class="all_air_quality"
style="border-radius: 10px 10px 5px 5px; margin-bottom: 5px; overflow: hidden; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);"
<div class="all_air_quality" data-id="5"
style="border-radius: 10px; margin-bottom: 0px; overflow: hidden; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);"
id="ifPollenIsThere">
<div class="sun_text">
<p data-translate="air_quality">Air Quality</p>
@@ -676,8 +679,8 @@
</div>
<div class="all_air_quality ripple_btn_low"
style="border-radius: 5px 5px 10px 10px; margin-top: 0px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);"
<div class="all_air_quality ripple_btn_low" data-id="6"
style="border-radius: 10px; margin-top: 0px; margin-bottom: 0; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);"
onclick="sendThemeToAndroid('openUVcondition')" id="uvIndexMainDiv">
<div class="sun_text">
<p data-translate="uv_index">UV Index</p>
@@ -698,6 +701,7 @@
</div>
</div>
</div>
@@ -913,7 +917,7 @@ let timeoutID;
timeoutID = setTimeout(() => {
evt.item.classList.remove('noSwipe');
}, 200);
}, 350);
saveOrder();
},
});
@@ -923,6 +927,103 @@ let timeoutID;
initializeDragAndDrop();
// -----------------------------------------------------------------------------------------------------------------------------
async function initializeDragAndDropAllEL() {
const draggableContainer = document.getElementById('sortHolder');
const storageKey = 'dragAndDropStateAllEL';
async function saveOrder() {
const itemsOrder = Array.from(draggableContainer.children).map(element => element.dataset.id);
await customStorage.setItem(storageKey, JSON.stringify(itemsOrder));
}
async function loadOrder() {
const storedState = await customStorage.getItem(storageKey);
if (storedState) {
const itemsOrder = JSON.parse(storedState);
const elements = Array.from(draggableContainer.children);
itemsOrder.forEach(id => {
const element = elements.find(el => el.dataset.id === id);
if (element) {
draggableContainer.appendChild(element);
}
});
}
}
await loadOrder();
}
initializeDragAndDropAllEL()
// ------------------------------------------------------------------------------
let sortableInstanceLocations;
async function initializeDragAndDropLocations() {
const draggableContainer = document.querySelector('savedlocationsholder');
const storageKey = 'dragAndDropStateLocations';
async function saveOrder() {
const itemsOrder = Array.from(draggableContainer.children).map(element => element.dataset.id);
await customStorage.setItem(storageKey, JSON.stringify(itemsOrder));
}
async function loadOrder() {
const storedState = await customStorage.getItem(storageKey);
if (storedState) {
const itemsOrder = JSON.parse(storedState);
const elements = Array.from(draggableContainer.children);
itemsOrder.forEach(id => {
const element = elements.find(el => el.dataset.id === id);
if (element) {
draggableContainer.appendChild(element);
}
});
}
}
let timeoutID;
if (sortableInstanceLocations) {
sortableInstanceLocations.destroy();
}
sortableInstanceLocations = new Sortable(draggableContainer, {
animation: 250,
ghostClass: 'sortable-ghost',
delay: 500,
onStart(evt) {
evt.item.classList.add('noSwipe');
},
onEnd(evt) {
clearTimeout(timeoutID);
timeoutID = setTimeout(() => {
evt.item.classList.remove('noSwipe');
}, 350);
saveOrder();
},
});
await loadOrder();
}
function handleStorageChangeLayoutEvent(event) {
if (event.detail && event.detail.key === 'LoadNewOrder') {
setTimeout(() => {
initializeDragAndDropAllEL()
}, 500);
}
}
window.addEventListener('indexedDBChange', handleStorageChangeLayoutEvent);
function checkFontEventChange() {
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -42,7 +42,6 @@ weatherWrap.addEventListener('scroll', function() {
const Locations = JSON.parse(localStorage.getItem("DefaultLocation"));
if(weatherWrap){
if(await customStorage.getItem('useGestureLocation') && await customStorage.getItem('useGestureLocation') === true){
const savedLocations = [...savedLocationsFromStorage];
if (Locations?.name === "CurrentDeviceLocation") {
savedLocations.unshift({ locationName: "CurrentDeviceLocation", lat: null, lon: null });
@@ -236,7 +235,7 @@ weatherWrap.addEventListener('scroll', function() {
});
}
}
}
+36 -15
View File
@@ -1786,7 +1786,7 @@ function getWeatherLabelInLangNoAnimText(iconCode, isDay, langCode) {
let currentInterval = null; // Track the current interval
function animateTemp(temp_value) {
const SelectedTempUnit = localStorage.getItem('SelectedTempUnit');
@@ -1797,49 +1797,70 @@ function animateTemp(temp_value) {
let currentNum = Math.max(Math.floor(targetNum * 0.75), 0); // Start closer to the target
let baseSpeed = 50;
const tempElement = document.getElementById('temp');
// Set initial opacity to 0
tempElement.style.opacity = 0;
function animateNumber() {
if (useTempAnimation === 'false') {
document.getElementById('temp').innerHTML = temp_value + '°';
tempElement.innerHTML = temp_value + '°';
tempElement.style.opacity = 1; // Ensure opacity is 1 when no animation is used
} else {
let interval = setInterval(() => {
// Clear any existing interval to prevent overlapping animations
if (currentInterval) {
clearInterval(currentInterval);
}
currentInterval = setInterval(() => {
if (currentNum > targetNum) {
currentNum--;
document.getElementById('temp').innerHTML = currentNum + '°';
tempElement.innerHTML = currentNum + '°';
if (currentNum <= targetNum + 5 && currentNum > targetNum) {
clearInterval(interval);
clearInterval(currentInterval);
interval = setInterval(() => {
currentInterval = setInterval(() => {
if (currentNum > targetNum) {
currentNum--;
document.getElementById('temp').innerHTML = currentNum + '°';
tempElement.innerHTML = currentNum + '°';
} else {
clearInterval(interval);
clearInterval(currentInterval);
}
}, baseSpeed * 4);
}
} else if (currentNum < targetNum) {
currentNum++;
document.getElementById('temp').innerHTML = currentNum + '°';
tempElement.innerHTML = currentNum + '°';
if (currentNum >= targetNum - 5 && currentNum < targetNum) {
clearInterval(interval);
clearInterval(currentInterval);
interval = setInterval(() => {
currentInterval = setInterval(() => {
if (currentNum < targetNum) {
currentNum++;
document.getElementById('temp').innerHTML = currentNum + '°';
tempElement.innerHTML = currentNum + '°';
} else {
clearInterval(interval);
clearInterval(currentInterval);
}
}, baseSpeed * 4);
}
} else {
clearInterval(interval);
clearInterval(currentInterval);
}
}, baseSpeed);
}
// Animate opacity to 1
let opacityInterval = setInterval(() => {
let currentOpacity = parseFloat(tempElement.style.opacity);
if (currentOpacity < 1) {
tempElement.style.opacity = currentOpacity + 0.05;
} else {
clearInterval(opacityInterval);
}
}, baseSpeed);
}
animateNumber();
}
}
+3 -3
View File
@@ -93,7 +93,7 @@
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30px;
font-size: 26px;
color: var(--On-Surface);
font-family: var(--google-normal);
padding: 15px;
@@ -149,7 +149,7 @@
<md-icon icon-outlined>info</md-icon>
<div style="position: relative; width: 100%;">
<p data-translate="version">Version</p>
<span>1.11.0 (W)</span>
<span>1.12.0 (W)</span>
<md-icon-button style="position: absolute; right: 5px;" id="checkUpdatesBtn"><md-icon icon-outlined>refresh</md-icon></md-icon-button>
</div>
</div>
@@ -364,7 +364,7 @@ async function CreateMaterialYouTheme(hex) {
document.getElementById('checkUpdatesBtn').addEventListener('click', async function () {
const currentVersion = 'v1.11.0';
const currentVersion = 'v1.12.0';
const githubRepo = 'PranshulGG/WeatherMaster';
const releasesUrl = `https://api.github.com/repos/${githubRepo}/releases/latest`;
+308
View File
@@ -0,0 +1,308 @@
<!DOCTYPE html>
<html lang="en" Theme="clothing" data-theme="dark" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<title>Arrange items Page</title>
<script src="../database/MainDataBase.js"></script>
<script src="../langs/langs.js"></script>
<script src="../modules/Sortable.min.js"></script>
<link rel="stylesheet" href="../ui-files/ui.css">
<link rel="stylesheet" href="../ui-files/font-usage.css">
<link rel="stylesheet" href="../ui-files/variables.css">
<link rel="stylesheet" href="../components/components.css">
<link rel="stylesheet" href="../ripple-files/ripple.css">
<link rel="stylesheet" href="../components/md-buttons.css">
<script src="../modules/lottie.js"></script>
<style>
.padding_about_app{
padding: 15px;
overflow: auto;
height: calc(100vh - 0px - 70px - 90px);
padding-top: 10px;
padding-bottom: 80px !important;
}
.head_area_about_page{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 26px;
color: var(--On-Surface);
font-family: var(--google-normal);
padding: 15px;
position: relative;
background-color: var(--Surface);
}
p{
margin: 0;
}
</style>
</head>
<body class="center_all" style="--md-list-item-label-text-size: 1.15rem; --md-list-item-pressed-state-layer-opacity: 0.15; --md-ref-typeface-plain: var(--google-normal); background-color: var(--Surface); overflow: hidden;">
<div class="head_area_about_page">
<p data-translate="arrange_items">Arrange items</p>
<md-icon-button onclick="sendThemeToAndroid('GoBack')"><md-icon icon-outlined>close</md-icon></md-icon-button>
</div>
<div class="padding_about_app" id="all_el">
<div class="drag_handle" data-id="1">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Hourly forecast</p>
</div>
<div class="drag_handle" data-id="2">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Daily forecast</p>
</div>
<div class="drag_handle" data-id="3">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Current conditions</p>
</div>
<div class="drag_handle" data-id="4">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Pollen data</p>
</div>
<div class="drag_handle" data-id="5">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Air quality index</p>
</div>
<div class="drag_handle" data-id="6">
<md-icon icon-outlined>drag_handle</md-icon>
<p>UV index</p>
</div>
</div>
<div class="save_btn_arranged">
<md-filled-tonal-button onclick="ResetOrder()">Reset</md-filled-tonal-button>
<md-filled-button data-translate="save" onclick="saveOrder()">Save</md-filled-button>
</div>
<script>
// -------------------
let sortableInstance;
async function initializeDragAndDropAllELDrag() {
const draggableContainer = document.getElementById('all_el');
const storageKey = 'dragAndDropStateAllEL';
async function loadOrder() {
const storedState = await customStorage.getItem(storageKey);
if (storedState) {
const itemsOrder = JSON.parse(storedState);
const elements = Array.from(draggableContainer.children);
itemsOrder.forEach(id => {
const element = elements.find(el => el.dataset.id === id);
if (element) {
draggableContainer.appendChild(element);
}
});
}
}
let timeoutID;
if (sortableInstance) {
sortableInstance.destroy();
}
sortableInstance = new Sortable(draggableContainer, {
animation: 250,
// handle: 'drag_handle',
ghostClass: 'sortable-ghost',
delay: 200,
onStart(evt) {
evt.item.classList.add('drag');
},
onEnd(evt) {
clearTimeout(timeoutID);
timeoutID = setTimeout(() => {
evt.item.classList.remove('drag');
}, 200);
},
});
await loadOrder();
}
initializeDragAndDropAllELDrag()
function hexToRgb(hex) {
const bigint = parseInt(hex.slice(1), 16);
return {
r: (bigint >> 16) & 255,
g: (bigint >> 8) & 255,
b: bigint & 255
};
}
function rgbToHsl({ r, g, b }) {
r /= 255;
g /= 255;
b /= 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
let h, s, l = (max + min) / 2;
if (max === min) {
h = s = 0; // Achromatic
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return { h: h * 360, s: s * 100, l: l * 100 };
}
async function CreateMaterialYouTheme(hex) {
const colors = {
orange_material: "#FFA500",
red_material: "#FF0000",
pink_material: "#FFC0CB",
purple_material: "#800080",
blue_material: "#0000FF",
yellow_material: "#FFFF00",
green_material: "#008000"
};
const targetHsl = rgbToHsl(hexToRgb(hex));
let closestColor = null;
let smallestHueDifference = Infinity;
for (const [color, colorHex] of Object.entries(colors)) {
const colorHsl = rgbToHsl(hexToRgb(colorHex));
const hueDifference = Math.abs(targetHsl.h - colorHsl.h);
if (hueDifference < smallestHueDifference) {
smallestHueDifference = hueDifference;
closestColor = color;
}
}
if(localStorage.getItem("useDynamicColors") && localStorage.getItem("useDynamicColors") === "false"){
if (await customStorage.getItem("customTheme")) {
document.documentElement.setAttribute(
"Theme",
await customStorage.getItem("customTheme")
);
sendThemeToAndroid(
`${document.documentElement.getAttribute("Theme")}_ScrollFalse`
);
}
} else{
document.documentElement.setAttribute('Theme', closestColor);
sendThemeToAndroid(`${closestColor}_ScrollFalse`);
}
}
const AppLanguageCodeValue = localStorage.getItem('AppLanguageCode');
if (AppLanguageCodeValue) {
applyTranslations(AppLanguageCodeValue);
}
function sendThemeToAndroid(theme) {
AndroidInterface.updateStatusBarColor(theme);
};
async function saveOrder() {
const draggableContainer = document.getElementById('all_el');
const storageKey = 'dragAndDropStateAllEL';
const itemsOrder = Array.from(draggableContainer.children).map(element => element.dataset.id);
await customStorage.setItem(storageKey, JSON.stringify(itemsOrder));
await customStorage.setItem('LoadNewOrder', new Date().getTime())
setTimeout( async() =>{
sendThemeToAndroid('GoBack')
}, 100);
}
async function ResetOrder() {
const draggableContainer = document.getElementById('all_el');
const storageKey = 'dragAndDropStateAllEL';
const itemsOrder = Array.from(draggableContainer.children).map((_, index) => (index + 1).toString());
await customStorage.setItem(storageKey, JSON.stringify(itemsOrder));
draggableContainer.innerHTML = `
<div class="drag_handle" data-id="1">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Hourly forecast</p>
</div>
<div class="drag_handle" data-id="2">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Daily forecast</p>
</div>
<div class="drag_handle" data-id="3">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Current conditions</p>
</div>
<div class="drag_handle" data-id="4">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Pollen data</p>
</div>
<div class="drag_handle" data-id="5">
<md-icon icon-outlined>drag_handle</md-icon>
<p>Air quality index</p>
</div>
<div class="drag_handle" data-id="6">
<md-icon icon-outlined>drag_handle</md-icon>
<p>UV index</p>
</div>
`
setTimeout(async() =>{
initializeDragAndDropAllELDrag()
await customStorage.setItem('LoadNewOrder', new Date().getTime())
}, 100);
}
</script>
<script src="../app/navigate.js"></script>
<script src="../modules/ripple_acc.js"></script>
<script src="../components-script.js/components.js"></script>
<script src="../ripple-files/icon-ripple.js"></script>
<script src="../modules/scroll.js"></script>
<script src="bundle.js"></script>
<script type="module" src="../index.js"></script>
<script src="../ripple-files/ripples.js"></script>
<script src="../app/apply.js"></script>
</body>
</html>
@@ -31,7 +31,7 @@
<div class="humidity_block_todays">
<p>Today's average</p>
<p data-translate="todays_avg">Today's average</p>
<span id="HumidityMain">---%</span>
<div class="humidityBars">
@@ -41,7 +41,7 @@
</div>
<div class="humidity_block_todays">
<p>Today's high</p>
<p data-translate="todays_high">Today's high</p>
<span id="WindHighMain">33px</span>
<div class="WindBars">
+20 -21
View File
@@ -154,8 +154,8 @@
<md-list class="list_third">
<md-list-item>
<md-icon icon-filled slot="start">palette</md-icon>
<div slot="headline">Dynamic colors</div>
<div slot="supporting-text">Use wallpaper colors</div>
<div slot="headline" data-translate="dynamic_colors">Dynamic colors</div>
<div slot="supporting-text" data-translate="dynamic_colors_sub">Use wallpaper colors</div>
<md-switch slot="end" selected id="useDynamicColors"></md-switch>
</md-list-item>
@@ -197,18 +197,24 @@
<md-list-item onclick="openAppFontSizeDialog()" type="button">
<md-icon icon-filled slot="start">format_size</md-icon>
<div slot="headline">Font size</div>
<div slot="supporting-text">Font size will only affect where it is needed</div>
<div slot="headline"data-translate="font_size">Font size</div>
<div slot="supporting-text" data-translate="font_size_sub">Font size will only affect where it is needed</div>
</md-list-item>
<md-list-item>
<md-icon icon-filled slot="start">swipe_left</md-icon>
<div slot="headline">Swipe between locations</div>
<div slot="supporting-text">Swipe left or right to change location</div>
<div slot="headline" data-translate="swipe_between_locations">Swipe between locations</div>
<div slot="supporting-text" data-translate="swipe_between_locations_sub">Swipe left or right to change location</div>
<md-switch slot="end" id="useGestureLocation"></md-switch>
<md-icon-button slot="end" onclick="openSwipeThresholdDialog()"><md-icon icon-outlined>settings</md-icon></md-icon-button>
</md-list-item>
<md-list-item onclick="sendThemeToAndroid('EditAppLayoutPage')" type="button">
<md-icon icon-filled slot="start">view_agenda</md-icon>
<div slot="headline" data-translate="edit_layout">Edit app layout</div>
<md-icon icon-filled slot="end">chevron_right</md-icon>
</md-list-item>
</md-list>
@@ -246,13 +252,6 @@
<md-switch slot="end" id="HideNewUpdateToastSwitch"></md-switch>
</md-list-item>
<md-list-item>
<md-icon icon-filled slot="start">rounded_corner</md-icon>
<div slot="headline" data-translate="rounded_ui">Rounded UI</div>
<div slot="supporting-text" data-translate="use_the_default_material_corner_radius">Use the default Material corner radius</div>
<md-switch slot="end" id="useRoundedUI"></md-switch>
</md-list-item>
<md-list-item>
<md-icon icon-filled slot="start">bar_chart</md-icon>
<div slot="headline" data-translate="use_bar_chart">Use bar chart</div>
@@ -433,7 +432,7 @@
<md-list-item onclick="sendThemeToAndroid('OpenAboutPage')" type="button">
<md-icon icon-filled slot="start">info</md-icon>
<div slot="headline">About WeatherMaster</div>
<div slot="supporting-text" >Learn about the app</div>
<div slot="supporting-text" data-translate="learn_about_app">Learn about the app</div>
<md-icon icon-outlined slot="end">chevron_right</md-icon>
</md-list-item>
@@ -447,21 +446,21 @@
<md-list-item href="https://discord.gg/sSW2E4nqmn" type="button">
<md-icon icon-filled slot="start">chat</md-icon>
<div slot="headline" >Join the Discord server</div>
<div slot="headline" data-translate="join_discord">Join the Discord server</div>
<md-icon icon-outlined slot="end">open_in_new</md-icon>
</md-list-item>
<md-list-item type="button" id="exportAppData">
<md-icon icon-filled slot="start">upload</md-icon>
<div slot="headline">Export data</div>
<div slot="supporting-text">Export all your settings, locations, and their last fetched weather data—literally everything!</div>
<div slot="headline" data-translate="export_data">Export data</div>
<div slot="supporting-text" data-translate="export_data_sub">Export all your settings, locations, and their last fetched weather data—literally everything!</div>
</md-list-item>
<md-list-item type="button" id="importAppData">
<md-icon icon-filled slot="start">download</md-icon>
<div slot="headline">Import data</div>
<div slot="supporting-text" style="color: var(--Error);">Warning: Importing will erase your current app data</div>
<div slot="headline" data-translate="import_data">Import data</div>
<div slot="supporting-text" style="color: var(--Error);" data-translate="import_data_sub">Warning: Importing will erase your current app data</div>
</md-list-item>
<input type="file" id="ImportFile" style="display:none;" accept="application/json">
@@ -622,14 +621,14 @@
<md-dialog id="chooseSwipeThresholdDialog" style="min-width: 85%;">
<span slot="headline">
<span style="flex: 1;">Swipe Threshold</span>
<span style="flex: 1;" data-translate="swipe_threshold">Swipe Threshold</span>
<div slot="supporting-text" id="ThresholdValueText" style="font-size: 15px; right: 20px; color: var(--On-Surface-Variant); width: 30px; height: 30px; background-color: var(--Primary-Container); display: flex; align-items: center; justify-content: center; border-radius: 50px; padding: 2px; color: var(--On-Primary-Container);">100</div>
</span>
<div slot="content" style="padding-left: 0; padding-right: 0;">
<md-slider style="width: 100%;" ticks min="50" max="350" value="100" step="50" id="ThresholdSlider"></md-slider>
<p style="margin-bottom: 0; margin-left: 15px; margin-right: 15px; margin-top: 0;">The threshold defines the minimum distance a swipe gesture must cover to be recognized. A lower threshold makes swipe gestures easier to trigger, while a higher threshold requires more deliberate swipes.</p>
<p style="margin-bottom: 0; margin-left: 15px; margin-right: 15px; margin-top: 0;" data-translate="swipe_threshold_help_sub">The threshold defines the minimum distance a swipe gesture must cover to be recognized. A lower threshold makes swipe gestures easier to trigger, while a higher threshold requires more deliberate swipes.</p>
</div>
</md-dialog>
+57 -13
View File
@@ -350,8 +350,8 @@ touch_search{
.all-5d {
background-color: var(--Surface);
margin: 10px;
margin-top: 5px;
border-radius: 5px 5px 5px 5px;
margin-top: 0px;
border-radius: 10px 10px 10px 10px;
overflow: hidden;
margin-bottom: 0;
}
@@ -359,11 +359,10 @@ touch_search{
[round-ui="true"] .all-24,
[round-ui="true"] .all-5d{
border-radius: 18px;
margin-top: 8px;
}
.all-24{
border-radius: 5px 5px 0 0 !important;
border-radius: 10px 10px 0 0 !important;
}
[round-ui="true"] .all-24{
@@ -372,7 +371,7 @@ touch_search{
}
.all-5d {
border-radius: 5px 5px 10px 10px;
border-radius: 10px;
}
[round-ui="true"] .all-5d{
@@ -855,7 +854,7 @@ touch_search{
.all_air_quality {
background-color: var(--Surface);
margin: 10px;
margin-bottom: 5px;
margin-bottom: 0px;
margin-top: 0px;
}
@@ -1334,6 +1333,7 @@ sun{
padding-top: 0;
align-content: center;
justify-items: center;
padding-bottom: 5px;
gap: 10px;
}
@@ -1343,7 +1343,7 @@ rainMeter{
margin-top: 0px;
margin-bottom: 0;
background-color: var(--Surface);
border-radius: 0 0 5px 5px;
border-radius: 0 0 10px 10px;
display: block;
padding-bottom: 10px;
}
@@ -2083,7 +2083,7 @@ savelocationtouch md-ripple{
padding: 10px;
padding-top: 0;
padding-bottom: 0;
border-radius: 0 0 5px 5px;
border-radius: 0 0 10px 10px;
}
[round-ui="true"] .insights{
@@ -2485,18 +2485,16 @@ max-width: 80%;
.pollen_data{
margin: 10px;
background-color: var(--Surface);
margin-bottom: 5px;
border-radius: 10px 10px 5px 5px;
margin-bottom: 0px;
border-radius: 10px;
padding-bottom: 20px;
margin-top: 0px;
}
[round-ui="true"] .pollen_data{
border-radius: 18px;
margin-bottom: 8px !important;
}
[round-ui="true"] #ifPollenIsThere{
margin-bottom: 8px !important;
}
.available_pollen{
@@ -2793,7 +2791,6 @@ Tempmeterbaritem span{
}
[round-ui="true"] #uvIndexMainDiv{
margin-bottom: 8px !important;
}
@@ -2964,3 +2961,50 @@ Tempmeterbaritem span{
font-size: 17px !important;
}
.sortHolder{
gap: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
[round-ui="true"] .sortHolder{
gap: 8px;
padding-top: 8px;
padding-bottom: 8px;
}
.drag_handle{
width: calc(100% - 30px);
height: 40px;
background-color: var(--Surface-Container);
color: var(--Inverse-On-Primary);
border-radius: 18px;
display: flex;
align-items: center;
justify-content: flex-start;
padding: 10px 15px;
margin-bottom: 10px;
z-index: 1;
gap: 10px;
font-family: var(--google-mid);
font-size: 18px;
color: var(--On-Surface);
transition: background-color 0.2s ease-out;
}
.drag_handle.drag{
background-color: var(--Secondary-Container);
}
.save_btn_arranged{
position: fixed;
z-index: 99;
bottom: 20px;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
@@ -0,0 +1,440 @@
package com.example.weathermaster;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.google.android.material.snackbar.Snackbar;
public class ArrangeItems extends AppCompatActivity {
private WebView webview;
private boolean isFirstLoad = true;
public void onBackPressed() {
super.onBackPressed();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Webview stuff
webview = findViewById(R.id.webView);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
webSettings.setAllowContentAccess(true);
webview.setVerticalScrollBarEnabled(false);
webview.setHorizontalScrollBarEnabled(false);
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
webview.setWebViewClient(new WebViewClientDemo());
AndroidInterface androidInterface = new AndroidInterface(this);
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
webview.setBackgroundColor(getResources().getColor(R.color.yellowBg));
webview.addJavascriptInterface(new ShowSnackInterface(this), "ShowSnackMessage");
webSettings.setTextZoom(100);
webSettings.setAllowFileAccess(true);
webview.loadUrl("file:///android_asset/pages/ArrangeItems.html");
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivity(intent);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (isFirstLoad) {
isFirstLoad = false;
int primaryColor = new ContextThemeWrapper(ArrangeItems.this, R.style.Base_Theme_WeatherMaster)
.getTheme()
.obtainStyledAttributes(new int[]{com.google.android.material.R.attr.colorPrimary})
.getColor(0, 0);
String hexColor = String.format("#%06X", (0xFFFFFF & primaryColor));
String jsCodePrimaryColor = "CreateMaterialYouTheme('" + hexColor + "');";
webview.evaluateJavascript(jsCodePrimaryColor, null);
}
}
});
}
public class ShowSnackInterface {
private final Context mContext;
public ShowSnackInterface(Context context) {
this.mContext = context;
}
@JavascriptInterface
public void ShowSnack(final String text, final String time) {
int duration = Snackbar.LENGTH_SHORT;
if ("long".equals(time)) {
duration = Snackbar.LENGTH_LONG;
} else if ("short".equals(time)){
duration = Snackbar.LENGTH_SHORT;
}
Snackbar snackbar = Snackbar.make(((Activity) mContext).findViewById(android.R.id.content), text, duration);
View snackbarView = snackbar.getView();
snackbarView.setBackgroundResource(R.drawable.snackbar_background);
snackbar.setTextColor(ContextCompat.getColor(mContext, R.color.snackbar_text));
ViewGroup.LayoutParams params = snackbar.getView().getLayoutParams();
if (params instanceof ViewGroup.MarginLayoutParams) {
ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) params;
marginParams.bottomMargin = 34;
marginParams.leftMargin = 26;
marginParams.rightMargin = 26;
snackbar.getView().setLayoutParams(marginParams);
}
snackbar.show();
}
}
public class AndroidInterface {
private ArrangeItems aActivity;
AndroidInterface(ArrangeItems activity) {
aActivity = activity;
}
@JavascriptInterface
public void updateStatusBarColor(final String color) {
aActivity.runOnUiThread(new Runnable() {
@SuppressLint("ResourceType")
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void run() {
int statusBarColor;
int navigationBarColor;
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
if(color.equals("Scrolled")){
statusBarColor = 0xFF1e2024;
navigationBarColor = 0xFF121317;
systemUiVisibilityFlags = 0;
} else if (color.equals("ScrollFalse")) {
statusBarColor = 0xFF121317;
navigationBarColor = 0xFF121317;
systemUiVisibilityFlags = 0;
} else if(color.equals("orange_material_Scrolled")){
statusBarColor = 0xFF251e17;
navigationBarColor = 0xFF18120c;
systemUiVisibilityFlags = 0;
} else if (color.equals("orange_material_ScrollFalse")) {
statusBarColor = 0xFF18120c;
navigationBarColor = 0xFF18120c;
systemUiVisibilityFlags = 0;
} else if(color.equals("red_material_Scrolled")){
statusBarColor = 0xFF271d1b;
navigationBarColor = 0xFF1a110f;
systemUiVisibilityFlags = 0;
} else if (color.equals("red_material_ScrollFalse")) {
statusBarColor = 0xFF1a110f;
navigationBarColor = 0xFF1a110f;
systemUiVisibilityFlags = 0;
} else if(color.equals("pink_material_Scrolled")){
statusBarColor = 0xFF261d1f;
navigationBarColor = 0xFF191113;
systemUiVisibilityFlags = 0;
} else if (color.equals("pink_material_ScrollFalse")) {
statusBarColor = 0xFF191113;
navigationBarColor = 0xFF191113;
systemUiVisibilityFlags = 0;
} else if(color.equals("purple_material_Scrolled")){
statusBarColor = 0xFF241e22;
navigationBarColor = 0xFF171216;
systemUiVisibilityFlags = 0;
} else if (color.equals("purple_material_ScrollFalse")) {
statusBarColor = 0xFF171216;
navigationBarColor = 0xFF171216;
systemUiVisibilityFlags = 0;
} else if(color.equals("blue_material_Scrolled")){
statusBarColor = 0xFF1d2024;
navigationBarColor = 0xFF111318;
systemUiVisibilityFlags = 0;
} else if (color.equals("blue_material_ScrollFalse")) {
statusBarColor = 0xFF111318;
navigationBarColor = 0xFF111318;
systemUiVisibilityFlags = 0;
} else if(color.equals("yellow_material_Scrolled")){
statusBarColor = 0xFF222017;
navigationBarColor = 0xFF15130b;
systemUiVisibilityFlags = 0;
} else if (color.equals("yellow_material_ScrollFalse")) {
statusBarColor = 0xFF15130b;
navigationBarColor = 0xFF15130b;
systemUiVisibilityFlags = 0;
} else if(color.equals("green_material_Scrolled")){
statusBarColor = 0xFF1e201a;
navigationBarColor = 0xFF12140e;
systemUiVisibilityFlags = 0;
} else if (color.equals("green_material_ScrollFalse")) {
statusBarColor = 0xFF12140e;
navigationBarColor = 0xFF12140e;
systemUiVisibilityFlags = 0;
} else if (color.equals("orange_material_DialogNotScrolled")){
statusBarColor = 0xFF0a0705;
navigationBarColor = 0xFF0a0705;
systemUiVisibilityFlags = 0;
} else if (color.equals("orange_material_DialogScrolled")) {
statusBarColor = 0xFF0f0c09;
navigationBarColor = 0xFF0a0705;
systemUiVisibilityFlags = 0;
} else if(color.equals("red_material_DialogNotScrolled")){
statusBarColor = 0xFF0b0706;
navigationBarColor = 0xFF0b0706;
systemUiVisibilityFlags = 0;
} else if (color.equals("red_material_DialogScrolled")) {
statusBarColor = 0xFF100c0b;
navigationBarColor = 0xFF0b0706;
systemUiVisibilityFlags = 0;
} else if(color.equals("pink_material_DialogNotScrolled")){
statusBarColor = 0xFF090708;
navigationBarColor = 0xFF090708;
systemUiVisibilityFlags = 0;
} else if (color.equals("pink_material_DialogScrolled")) {
statusBarColor = 0xFF0e0d0b;
navigationBarColor = 0xFF090708;
systemUiVisibilityFlags = 0;
} else if(color.equals("purple_material_DialogNotScrolled")){
statusBarColor = 0xFF090709;
navigationBarColor = 0xFF090709;
systemUiVisibilityFlags = 0;
} else if (color.equals("purple_material_DialogScrolled")) {
statusBarColor = 0xFF0e0c0e;
navigationBarColor = 0xFF090709;
systemUiVisibilityFlags = 0;
} else if(color.equals("blue_material_DialogNotScrolled")){
statusBarColor = 0xFF07080a;
navigationBarColor = 0xFF07080a;
systemUiVisibilityFlags = 0;
} else if (color.equals("blue_material_DialogScrolled")) {
statusBarColor = 0xFF0c0d0e;
navigationBarColor = 0xFF07080a;
systemUiVisibilityFlags = 0;
} else if(color.equals("yellow_material_DialogNotScrolled")){
statusBarColor = 0xFF080804;
navigationBarColor = 0xFF080804;
systemUiVisibilityFlags = 0;
} else if (color.equals("yellow_material_DialogScrolled")) {
statusBarColor = 0xFF0e0d09;
navigationBarColor = 0xFF080804;
systemUiVisibilityFlags = 0;
} else if(color.equals("green_material_DialogNotScrolled")){
statusBarColor = 0xFF070806;
navigationBarColor = 0xFF070806;
systemUiVisibilityFlags = 0;
} else if (color.equals("green_material_DialogScrolled")) {
statusBarColor = 0xFF0c0d0a;
navigationBarColor = 0xFF070806;
systemUiVisibilityFlags = 0;
} else if (color.equals("GoBack")){
back();
return;
} else if (color.equals("OpenTermsConditions")){
openTermsConditions();
return;
} else if (color.equals("OpenPrivacyPolicy")){
openPrivacyPolicy();
return;
} else if (color.equals("OpenLicenses")){
openThirdParty();
return;
} else if (color.equals("bluesetDef")) {
return;
} else if (color.equals("keepiton")) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
return;
} else if (color.equals("keepitoff")) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
return;
} else if (color.equals("itsOn")) {
Toast.makeText(aActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
return;
} else if (color.equals("ItsOff")) {
Toast.makeText(aActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
return;
} else {
Toast.makeText(aActivity, "not found", Toast.LENGTH_SHORT).show();
return;
}
int currentStatusBarColor = aActivity.getWindow().getStatusBarColor();
int currentNavigationBarColor = aActivity.getWindow().getNavigationBarColor();
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
aActivity.getWindow(),
"statusBarColor",
new ArgbEvaluator(),
currentStatusBarColor,
statusBarColor
);
statusBarAnimator.setDuration(200);
statusBarAnimator.start();
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
aActivity.getWindow(),
"navigationBarColor",
new ArgbEvaluator(),
currentNavigationBarColor,
navigationBarColor
);
navBarAnimator.setDuration(200);
navBarAnimator.start();
aActivity.getWindow().setNavigationBarColor(navigationBarColor);
View decorView = aActivity.getWindow().getDecorView();
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
}
});
}
public void openTermsConditions() {
Intent intent = new Intent(aActivity, Terms_Conditions.class);
aActivity.startActivity(intent);
}
public void openPrivacyPolicy() {
Intent intent = new Intent(aActivity, PrivacyPolicy.class);
aActivity.startActivity(intent);
}
public void openThirdParty() {
Intent intent = new Intent(aActivity, ThirdParty.class);
aActivity.startActivity(intent);
}
}
public void back() {
onBackPressed();
}
private static class WebViewClientDemo extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (shouldOpenInBrowser(url)) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivity(intent);
return true;
} else {
view.loadUrl(url);
return true;
}
}
private boolean shouldOpenInBrowser(String url) {
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
url.startsWith("https://github.com/");
}
}
}
@@ -558,6 +558,9 @@ public class SettingsActivity extends AppCompatActivity {
} else if (color.equals("openWeatherModels")){
openWeatherModels();
return;
} else if (color.equals("EditAppLayoutPage")){
EditAppLayoutPage();
return;
} else if (color.equals("bluesetDef")) {
return;
} else if (color.equals("keepiton")) {
@@ -637,6 +640,11 @@ public class SettingsActivity extends AppCompatActivity {
sActivity.startActivity(intent);
}
public void EditAppLayoutPage() {
Intent intent = new Intent(sActivity, ArrangeItems.class);
sActivity.startActivity(intent);
}
}