Removed toast and unnecessary code line.

This commit is contained in:
GaidamakUA 2016-01-20 11:00:59 +02:00
parent 6973f16d13
commit 988420842a

View file

@ -5,8 +5,8 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.widget.Toast;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.LocalIndexInfo;
@ -17,6 +17,8 @@ import net.osmand.plus.download.IndexItem;
import net.osmand.plus.resources.IncrementalChangesManager; import net.osmand.plus.resources.IncrementalChangesManager;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,6 +27,8 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFreq
public class PerformLiveUpdateAsyncTask public class PerformLiveUpdateAsyncTask
extends AsyncTask<String, Object, IncrementalChangesManager.IncrementalUpdateList> { extends AsyncTask<String, Object, IncrementalChangesManager.IncrementalUpdateList> {
private final static Log LOG = PlatformUtil.getLog(OsmLiveActivity.class);
private final Context context; private final Context context;
private final LocalIndexInfo localIndexInfo; private final LocalIndexInfo localIndexInfo;
private final boolean forceUpdate; private final boolean forceUpdate;
@ -41,7 +45,6 @@ public class PerformLiveUpdateAsyncTask
if (context instanceof AbstractDownloadActivity) { if (context instanceof AbstractDownloadActivity) {
AbstractDownloadActivity activity = (AbstractDownloadActivity) context; AbstractDownloadActivity activity = (AbstractDownloadActivity) context;
activity.setSupportProgressBarIndeterminateVisibility(true); activity.setSupportProgressBarIndeterminateVisibility(true);
OsmandSettings settings = activity.getMyApplication().getSettings();
} }
final OsmandApplication myApplication = getMyApplication(); final OsmandApplication myApplication = getMyApplication();
OsmandSettings.CommonPreference<Long> lastCheckPreference = OsmandSettings.CommonPreference<Long> lastCheckPreference =
@ -69,7 +72,7 @@ public class PerformLiveUpdateAsyncTask
final OsmandApplication application = getMyApplication(); final OsmandApplication application = getMyApplication();
final OsmandSettings settings = application.getSettings(); final OsmandSettings settings = application.getSettings();
if (result.errorMessage != null) { if (result.errorMessage != null) {
Toast.makeText(context, result.errorMessage, Toast.LENGTH_SHORT).show(); LOG.info(result.errorMessage);
tryRescheduleDownload(context, settings, localIndexInfo); tryRescheduleDownload(context, settings, localIndexInfo);
} else { } else {
settings.LIVE_UPDATES_RETRIES.resetToDefault(); settings.LIVE_UPDATES_RETRIES.resetToDefault();
@ -118,7 +121,7 @@ public class PerformLiveUpdateAsyncTask
} }
public static void tryRescheduleDownload(Context context, OsmandSettings settings, public static void tryRescheduleDownload(Context context, OsmandSettings settings,
LocalIndexInfo localIndexInfo) { LocalIndexInfo localIndexInfo) {
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference = final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
preferenceUpdateFrequency(localIndexInfo, settings); preferenceUpdateFrequency(localIndexInfo, settings);
final Integer frequencyOrdinal = updateFrequencyPreference.get(); final Integer frequencyOrdinal = updateFrequencyPreference.get();