From a3734b9d36af0bc621db4c2c3a5bb88286417e54 Mon Sep 17 00:00:00 2001 From: woheller69 Date: Sun, 16 Apr 2023 20:04:35 +0200 Subject: [PATCH] remove unnecessary API calls --- .../weather/activities/ForecastCityActivity.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java b/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java index 6ac27bb..5b3ea20 100644 --- a/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java +++ b/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java @@ -83,18 +83,6 @@ public class ForecastCityActivity extends NavigationActivity implements IUpdatea if (pagerAdapter.getItemCount()>0) { //only if at least one city is watched //if pagerAdapter has item with current cityId go there, otherwise use cityId from current item if (pagerAdapter.getPosForCityID(cityId)==-1) cityId=pagerAdapter.getCityIDForPos(viewPager2.getCurrentItem()); - GeneralData generalData = db.getGeneralDataByCityId(cityId); - - long timestamp = generalData.getTimestamp(); - long systemTime = System.currentTimeMillis() / 1000; - SharedPreferences prefManager = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - long updateInterval = (long) (Float.parseFloat(prefManager.getString("pref_updateInterval", "2")) * 60 * 60); - - if (timestamp + updateInterval - systemTime <= 0) { - WeatherPagerAdapter.refreshSingleData(getApplicationContext(), true, cityId); //only update current tab at start - ForecastCityActivity.startRefreshAnimation(); - - } if (viewPager2.getCurrentItem()!=pagerAdapter.getPosForCityID(cityId)) viewPager2.setCurrentItem(pagerAdapter.getPosForCityID(cityId),false); } }