mirror of
https://github.com/woheller69/solxpect.git
synced 2025-12-16 17:30:13 +01:00
remove unnecessary API calls
This commit is contained in:
parent
f1a79e41e1
commit
a3734b9d36
1 changed files with 0 additions and 12 deletions
|
|
@ -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.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 has item with current cityId go there, otherwise use cityId from current item
|
||||||
if (pagerAdapter.getPosForCityID(cityId)==-1) cityId=pagerAdapter.getCityIDForPos(viewPager2.getCurrentItem());
|
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);
|
if (viewPager2.getCurrentItem()!=pagerAdapter.getPosForCityID(cityId)) viewPager2.setCurrentItem(pagerAdapter.getPosForCityID(cityId),false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue