This commit is contained in:
GaidamakUA 2015-10-22 11:28:56 +03:00
commit 117e3af36c
7 changed files with 80 additions and 41 deletions

View file

@ -956,10 +956,10 @@
<string name="poi_fax">Fax</string>
<string name="poi_facebook">Facebook</string>
<string name="poi_mobile">Mòbil</string>
<string name="poi_animal_shelter_dog">Refugi per a gossos</string>
<string name="poi_animal_shelter_cat">Refugi per a gats</string>
<string name="poi_animal_shelter_dog_cat">Refugi per a gossos i gats</string>
<string name="poi_animal_shelter_bird">Refugi per a ocells</string>
<string name="poi_animal_shelter_dog">Tipus de refugi: per gossos</string>
<string name="poi_animal_shelter_cat">Tipus de refugi: per gats</string>
<string name="poi_animal_shelter_dog_cat">Tipus de refugi: per gossos i gats</string>
<string name="poi_animal_shelter_bird">Tipus de refugi: per ocells</string>
<string name="poi_recycling_centre">Tipus: deixalleria</string>
<string name="poi_recycling_container">Tipus: contenidor</string>
@ -1392,4 +1392,21 @@
<string name="poi_step_condition_uneven">Condició dels graons: desigual</string>
<string name="poi_step_condition_rough">Condició dels graons: ruda</string>
</resources>
<string name="poi_tomb_columbarium">Tipus: columbari</string>
<string name="poi_tomb_mausoleum">Tipus: mausoleu</string>
<string name="poi_tomb_sarcophagus">Tipus: sarcòfag</string>
<string name="poi_tomb_crypt">Tipus: cripta</string>
<string name="poi_tomb_pyramid">Tipus: piràmide</string>
<string name="poi_cairn">Pila de pedres</string>
<string name="poi_memorial_fassade_decoration">Memorial per decoració de façana</string>
<string name="poi_defibrillator">Desfibril·lador</string>
<string name="poi_defibrillator_yes">Desfibril·lador: sí</string>
<string name="poi_tomb_war_grave">Tipus: fosa de guerra</string>
<string name="poi_tomb_tumulus">Tipus: túmul</string>
<string name="poi_tomb_rock_cut">Tipus: excavació a la roca</string>
<string name="poi_tomb_hypogeum">Tipus: subterrani</string>
<string name="poi_tomb_vault">Tipus: volta</string>
</resources>

View file

@ -2004,4 +2004,14 @@
<string name="poi_animal_boarding_dog_cat">寄宿類型:狗、貓</string>
<string name="poi_animal_boarding_horse">寄宿類型:馬</string>
<string name="poi_historic_aircraft">退役飛機</string>
<string name="poi_honey">蜂蜜專賣店</string>
<string name="poi_elevator_yes">有電梯</string>
<string name="poi_elevator_no">無電梯</string>
<string name="poi_technical_monument">工藝不朽的遺迹</string>
<string name="poi_office_camping">露營服務處</string>
</resources>

View file

@ -56,6 +56,7 @@ import btools.routingapp.BRouterServiceConnection;
public class AppInitializer implements IProgress {
public static final boolean TIPS_AND_TRICKS = false;
private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
@ -118,6 +119,10 @@ public class AppInitializer implements IProgress {
settings.VERSION_INSTALLED.set(Version.getFullVersion(app));
appVersionChanged = true;
}
settings.NUMBER_OF_APPLICATION_STARTS.set(settings.NUMBER_OF_APPLICATION_STARTS.get() + 1);
if (settings.FIRST_INSTALLED_DATE.get() == -1) {
settings.FIRST_INSTALLED_DATE.set(System.currentTimeMillis());
}
initSettings = true;
}

View file

@ -30,7 +30,6 @@ import gnu.trove.list.array.TIntArrayList;
public class ContextMenuAdapter {
private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class);
// Log log =
public interface OnContextMenuClick {
//boolean return type needed to desribe if drawer needed to be close or not
@ -296,7 +295,6 @@ public class ContextMenuAdapter {
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
// XXX layoutId does not effect layout inflated.
final int layoutId = defaultLayoutId;
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
ArrayAdapter<String> listAdapter = new ContextMenuArrayAdapter(activity, layoutId, R.id.title,

View file

@ -137,10 +137,6 @@ public class OsmandApplication extends Application {
timeToStart = System.currentTimeMillis();
OsmandPlugin.initPlugins(this);
System.out.println("Time to init plugins " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
osmandSettings.NUMBER_OF_APPLICATION_STARTS.set(
osmandSettings.NUMBER_OF_APPLICATION_STARTS.get() + 1);
}
public AppInitializer getAppInitializer() {

View file

@ -1,15 +1,21 @@
package net.osmand.plus;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import net.osmand.IndexConstants;
import net.osmand.StateChangedListener;
@ -28,22 +34,15 @@ import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.routing.RouteProvider.RouteService;
import net.osmand.render.RenderingRulesStorage;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
public class OsmandSettings {
@ -1874,8 +1873,8 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_RULER =
new BooleanPreference("show_ruler", true).makeProfile().cache();
public final OsmandPreference<Long> FIRST_INSTALLED_DATE = new LongPreference("first_installed_date", -1).makeGlobal();
// public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal();
@ -1890,13 +1889,13 @@ public class OsmandSettings {
new EnumIntPreference<>("rate_us_state",
DashRateUsFragment.RateUsState.INITIAL_STATE, DashRateUsFragment.RateUsState.values())
.makeGlobal()
.cache();
.cache();
public final OsmandPreference<Boolean> FIRST_TIME_APP_RUN =
new BooleanPreference("first_time_app_run", true).makeGlobal().cache();
public final OsmandPreference<String> VERSION_INSTALLED =
new StringPreference("version_installed", null).makeGlobal().cache();
public enum DayNightMode {
AUTO(R.string.daynight_mode_auto),
DAY(R.string.daynight_mode_day),

View file

@ -12,22 +12,26 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetManager;
import android.provider.Settings.Secure;
public class DownloadOsmandIndexesHelper {
private final static Log log = PlatformUtil.getLog(DownloadOsmandIndexesHelper.class);
@ -178,7 +182,17 @@ public class DownloadOsmandIndexesHelper {
log.debug("Start loading list of index files"); //$NON-NLS-1$
try {
String strUrl = ctx.getAppCustomization().getIndexesUrl();
OsmandSettings settings = ctx.getSettings();
Long nd = settings.FIRST_INSTALLED_DATE.get();
if(nd > 0) {
strUrl += "&nd=" + ((System.currentTimeMillis() - nd) / (1000l * 24l * 60l * 60l));
}
strUrl += "&ns=" + settings.NUMBER_OF_APPLICATION_STARTS.get();
try {
strUrl += "&aid=" + Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);
} catch (Exception e) {
e.printStackTrace();
}
log.info(strUrl);
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
URLConnection connection = NetworkUtils.getHttpURLConnection(strUrl);