Skip to content

Commit

Permalink
Removing unused code. Reorganizing packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
vbresan committed Jun 3, 2024
1 parent 1afd653 commit ee42a69
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 57 deletions.
24 changes: 12 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
apply plugin: 'com.android.application'
apply plugin: "com.android.application"

android {
compileSdkVersion 32
buildToolsVersion "31.0.0"
namespace "biz.binarysolutions.weatherusa"
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

defaultConfig {
applicationId "biz.binarysolutions.weatherusa"
minSdkVersion 21
targetSdkVersion 32
versionCode 25
versionName "4.0"
targetSdk 34
versionCode 26
versionName "4.0.1"

setProperty("archivesBaseName", "$applicationId-$versionName")
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-project.txt"
}
}

flavorDimensions "distribution"
flavorDimensions = ["distribution"]
productFlavors {
gplay {
dimension "distribution"
Expand All @@ -38,6 +38,6 @@ android {
}

dependencies {
implementation 'com.github.bumptech.glide:glide:4.15.1'
gplayImplementation 'com.google.android.gms:play-services-ads:22.1.0'
implementation "com.github.bumptech.glide:glide:4.15.1"
gplayImplementation "com.google.android.gms:play-services-ads:23.1.0"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package biz.binarysolutions.weatherusa.forecast;

import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -403,6 +404,19 @@ private GlideUrl getGlideUrl(String url) {
);
}

/**
*
*/
private void loadIcon(int index) {

if (TextUtils.isEmpty(iconURL[index])) {
return;
}

GlideUrl glideUrl = getGlideUrl(iconURL[index]);
Glide.with(icon[index]).load(glideUrl).into(icon[index]);
}

/**
*
* @param activity
Expand Down Expand Up @@ -474,11 +488,8 @@ public void onWeatherAvailable(TimelinedData weatherSequence) {
String event = weatherSequence.dataAt(index);
weather[i].setText(formatWeather(event));

String url = weatherSequence.iconAt(index);
iconURL[i] = url;

GlideUrl glideUrl = getGlideUrl(iconURL[i]);
Glide.with(icon[i]).load(glideUrl).into(icon[i]);
iconURL[i] = weatherSequence.iconAt(index);
loadIcon(i);
}

date = DateUtil.addDays(midDay, i + 1);
Expand Down Expand Up @@ -562,13 +573,8 @@ public void onIconsAvailable(Vector<String> icons) {

for (int i = 0, length = icons.size(); i < length; i++) {

String url = icons.elementAt(i);
if (url.length() > 0) {

iconURL[i] = url;
GlideUrl glideUrl = getGlideUrl(iconURL[i]);
Glide.with(icon[i]).load(glideUrl).into(icon[i]);
}
iconURL[i] = icons.elementAt(i);
loadIcon(i);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import android.text.TextUtils;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

/**
*
*/
Expand All @@ -22,11 +23,11 @@ public class InternetUtil {
*/
public static String getGetResponse(String url, String userAgent) {

String response = "";
HttpURLConnection connection = null;
String response = "";
HttpsURLConnection connection = null;

try {
connection = (HttpURLConnection) new URL(url).openConnection();
connection = (HttpsURLConnection) new URL(url).openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(TIMEOUT);
connection.setConnectTimeout(TIMEOUT);
Expand All @@ -36,7 +37,7 @@ public static String getGetResponse(String url, String userAgent) {
}

int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
if (responseCode == HttpsURLConnection.HTTP_OK) {
response = StringUtil.getString(connection.getInputStream());
}
} catch (IOException e) {
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "com.android.tools.build:gradle:8.2.2"
}
}

allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat Apr 03 10:47:30 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
25 changes: 0 additions & 25 deletions metadata/biz.binarysolutions.weatherusa.yml

This file was deleted.

6 changes: 6 additions & 0 deletions metadata/en-US/changelogs/26.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4.0.1 (2024.06.03)

* targeting Android SDK 34
* bug fix: crash when weather icons missing
* bug fix: replacing HttpURLConnection with HttpsURLConnection
* updating AdMob library (Play Store distribution only)

0 comments on commit ee42a69

Please sign in to comment.