Skip to content

Commit

Permalink
Fixed la maison not loading, fixed webcam message showing "body", upd…
Browse files Browse the repository at this point in the history
…ated gradle
  • Loading branch information
hej2010 committed May 30, 2024
1 parent d644a90 commit 9dd0c5d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 34
compileSdk 34
defaultConfig {
applicationId "se.swecookie.valthorens"
minSdkVersion 16
Expand Down Expand Up @@ -33,7 +33,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.jsoup:jsoup:1.14.3'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
}
25 changes: 16 additions & 9 deletions app/src/main/java/se/swecookie/valthorens/ImageDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import androidx.appcompat.app.AppCompatActivity;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
Expand Down Expand Up @@ -85,7 +88,7 @@ protected Void doInBackground(Void... voids) {
}
checkDate(i, imageLinks);
break;
} else if (s.startsWith(" \"//data.skaping.com/") || s.startsWith(" \"//storage.gra.cloud.ovh.net/")) {
} else if (s.startsWith(" \"//data2.skaping.com/") || s.startsWith(" \"//data.skaping.com/") || s.startsWith(" \"//storage.gra.cloud.ovh.net/")) {
imageDownloader.currentURL = "http:" + s.replace("\"", "").trim();
checkDate(i, imageLinks);
break;
Expand All @@ -97,14 +100,18 @@ protected Void doInBackground(Void... voids) {
String[] m = script.split("\"messages\":");
Log.e(TAG, "doInBackground: m is " + m.length);
if (m.length > 1) {
String[] m2 = m[1].split("\\}\\]");
if (m2.length > 1) {
// now we should have: [{"title":"Webcam Hors Service","body":"Cette webcam est d\u00e9sactiv\u00e9e en raison du risque de foudre.\r\nRetour en novembre !","link":null,"delay":null
String[] m3 = m2[0].split("\"");
Log.e(TAG, "doInBackground: " + m2[0]);
if (m3.length > 7) {
title = fixDateString(m3[3]);
body = fixDateString(m3[7]);
String s = m[1].split("\\}\\]")[0] + "}]";
JSONArray arr = new JSONArray(s);
for (int i = 0; i < arr.length(); i++) {
try {
JSONObject o = arr.getJSONObject(i);
if (o.has("title")) {
title = fixDateString(o.getString("title"));
}
if (o.has("body")) {
body = fixDateString(o.getString("body"));
}
} catch (JSONException ignored) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void onImageInfoFound(String currentURL, int height, String imageDate, St

if (showMessages) {
boolean showTitle = false, showBody = false;
if (!title.isEmpty()) {
if (!title.isEmpty() && !title.equals("null")) {
txtTitle.setText(title);
showTitle = true;
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'com.android.tools.build:gradle:8.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 9dd0c5d

Please sign in to comment.