This commit is contained in:
PavelRatushny 2017-05-22 20:23:57 +03:00
parent a3dc6a1652
commit d3354ffa56
3 changed files with 31 additions and 14 deletions

View file

@ -28,7 +28,6 @@ import net.osmand.CallbackWithObject;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibilityPlugin;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.aidl.OsmandAidlService;
import net.osmand.data.LatLon;
import net.osmand.map.OsmandRegions;
import net.osmand.map.WorldRegion;
@ -73,6 +72,20 @@ import btools.routingapp.BRouterServiceConnection;
import btools.routingapp.IBRouterService;
public class OsmandApplication extends MultiDexApplication {
public static boolean isActivityVisible() {
return activityVisible;
}
public static void activityResumed() {
activityVisible = true;
}
public static void activityPaused() {
activityVisible = false;
}
private static boolean activityVisible;
public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);

View file

@ -685,6 +685,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
}
FirstUsageWelcomeFragment.SHOW = false;
OsmandApplication.activityResumed();
}
@Override
@ -1029,6 +1030,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
getMyApplication().getAppCustomization().pauseActivity(MapActivity.class);
app.getResourceManager().interruptRendering();
OsmandPlugin.onMapActivityPause(this);
OsmandApplication.activityPaused();
}
public void updateApplicationModeSettings() {

View file

@ -1,17 +1,5 @@
package net.osmand.plus.download;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
@ -24,6 +12,18 @@ import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class DownloadFileHelper {
private final static Log log = PlatformUtil.getLog(DownloadFileHelper.class);
@ -224,7 +224,9 @@ public class DownloadFileHelper {
copyVoiceConfig(de);
}
toReIndex.add(de.targetFile);
if (OsmandApplication.isActivityVisible()) {
showWarningCallback.showWarning(ctx.getString(R.string.shared_string_download_successful));
}
return true;
} catch (IOException e) {
log.error("Exception ocurred", e); //$NON-NLS-1$