Fix #3783
This commit is contained in:
parent
5633a26418
commit
bfcecbe227
3 changed files with 31 additions and 14 deletions
|
@ -28,7 +28,6 @@ import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.AccessibilityPlugin;
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
import net.osmand.aidl.OsmandAidlApi;
|
import net.osmand.aidl.OsmandAidlApi;
|
||||||
import net.osmand.aidl.OsmandAidlService;
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.map.WorldRegion;
|
import net.osmand.map.WorldRegion;
|
||||||
|
@ -73,6 +72,20 @@ import btools.routingapp.BRouterServiceConnection;
|
||||||
import btools.routingapp.IBRouterService;
|
import btools.routingapp.IBRouterService;
|
||||||
|
|
||||||
public class OsmandApplication extends MultiDexApplication {
|
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$
|
public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$
|
||||||
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
|
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
|
||||||
|
|
||||||
|
|
|
@ -685,6 +685,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
|
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
FirstUsageWelcomeFragment.SHOW = false;
|
FirstUsageWelcomeFragment.SHOW = false;
|
||||||
|
OsmandApplication.activityResumed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1029,6 +1030,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
getMyApplication().getAppCustomization().pauseActivity(MapActivity.class);
|
getMyApplication().getAppCustomization().pauseActivity(MapActivity.class);
|
||||||
app.getResourceManager().interruptRendering();
|
app.getResourceManager().interruptRendering();
|
||||||
OsmandPlugin.onMapActivityPause(this);
|
OsmandPlugin.onMapActivityPause(this);
|
||||||
|
OsmandApplication.activityPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateApplicationModeSettings() {
|
public void updateApplicationModeSettings() {
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
package net.osmand.plus.download;
|
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.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -24,6 +12,18 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
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 {
|
public class DownloadFileHelper {
|
||||||
|
|
||||||
private final static Log log = PlatformUtil.getLog(DownloadFileHelper.class);
|
private final static Log log = PlatformUtil.getLog(DownloadFileHelper.class);
|
||||||
|
@ -224,7 +224,9 @@ public class DownloadFileHelper {
|
||||||
copyVoiceConfig(de);
|
copyVoiceConfig(de);
|
||||||
}
|
}
|
||||||
toReIndex.add(de.targetFile);
|
toReIndex.add(de.targetFile);
|
||||||
|
if (OsmandApplication.isActivityVisible()) {
|
||||||
showWarningCallback.showWarning(ctx.getString(R.string.shared_string_download_successful));
|
showWarningCallback.showWarning(ctx.getString(R.string.shared_string_download_successful));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Exception ocurred", e); //$NON-NLS-1$
|
log.error("Exception ocurred", e); //$NON-NLS-1$
|
||||||
|
|
Loading…
Reference in a new issue