This commit is contained in:
Alexey Kulish 2015-10-22 11:50:12 +03:00
commit 741ae36bbd
9 changed files with 123 additions and 58 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>
<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

@ -448,8 +448,7 @@ POIの更新は利用できません</string>
<string name="shared_string_close">閉じる</string>
<string name="loading_data">データをロード中…</string>
<string name="reading_indexes">索引を読み込み中…</string>
<string name="previous_run_crashed">前回のアプリケーション実行はクラッシュしました。
ログファイルは{0}にあります。ログファイルを添付して問題を報告してください。</string>
<string name="previous_run_crashed">前回アプリケーション実行中にクラッシュしました。 詳細は{0}に記録されています。報告する場合はログファイルの添付をお願いします。</string>
<string name="saving_gpx_tracks">GPX経路をSDに保存中…</string>
<string name="finished_task">終了</string>
@ -1161,10 +1160,10 @@ POIの更新は利用できません</string>
<string name="index_name_europe">ヨーロッパ</string>
<string name="index_name_france">ヨーロッパ - フランス</string>
<string name="index_name_germany">ヨーロッパ - ドイツ</string>
<string name="index_name_russia">ヨーロッパ/アジア - ロシア</string>
<string name="index_name_russia">ロシア</string>
<string name="index_name_africa">アフリカ</string>
<string name="index_name_asia">アジア</string>
<string name="index_name_oceania">オセアニア</string>
<string name="index_name_oceania">ーストラリアとオセアニア</string>
<string name="index_name_other">ワールドワイドとトピックマップ</string>
<string name="index_name_wiki">ワールドワイドウィキペディアPOI</string>
<string name="index_name_voice">音声指示(記録音声、機能限定)</string>
@ -1816,7 +1815,7 @@ POIの更新は利用できません</string>
<string name="traffic_warning_stop">一時停止標識</string>
<string name="traffic_warning_calming">速度抑制</string>
<string name="traffic_warning_speed_camera">スピードカメラ</string>
<string name="traffic_warning">通警告</string>
<string name="traffic_warning">行に関する警告</string>
<string name="local_index_description">選択解除または削除するには長押し、詳細を見るにはタップして下さい。現在のデバイス上のデータ(空き容量 %1$s):</string>
<string name="speed_limit_exceed">制限速度の許容範囲</string>
<string name="speed_limit_exceed_message">制限速度超過による警告音声の許容値を選択します</string>
@ -2112,7 +2111,7 @@ POIの更新は利用できません</string>
<string name="rendering_value_boldOutline_name">太線</string>
<string name="no_updates_available">更新はありません</string>
<string name="download_live_updates">ライブ更新</string>
<string name="we_really_care_about_your_opinion">私達は常にユーザーを気に掛け、個々の意見を参考にすることを重要視しています。</string>
<string name="we_really_care_about_your_opinion">我々はあなた方の意見やフィードバックを大切にし、それらを開発に生かせるよう努めています。</string>
<string name="failed_to_upload">アップロードに失敗しました</string>
<string name="delete_change">変更を削除します</string>
<string name="successfully_uploaded_pattern">正常にアップロードされました {0}/{1}</string>
@ -2152,7 +2151,7 @@ POIの更新は利用できません</string>
<string name="tab_title_basic">基本</string>
<string name="tab_title_advanced">拡張</string>
<string name="show_on_start">起動時に表示</string>
<string name="count_of_lines">表示する数の指定</string>
<string name="count_of_lines">表示数の選択</string>
<string name="address_unknown">住所はまだ登録されていません</string>
<string name="favorite_category_dublicate_message">指定したカテゴリ名は既に使用されています。別の名前を付けてください。</string>
<string name="favorite_category_name">カテゴリ名</string>

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,9 +56,8 @@ import btools.routingapp.BRouterServiceConnection;
public class AppInitializer implements IProgress {
public static final boolean TIPS_AND_TRICKS = false;
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$
private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
public static final String LATEST_CHANGES_URL = "changes-2.1.html";
@ -111,15 +110,19 @@ public class AppInitializer implements IProgress {
if(initSettings) {
return;
}
SharedPreferences pref = activity.getPreferences(Context.MODE_WORLD_WRITEABLE);
if (!pref.contains(FIRST_TIME_APP_RUN)) {
firstTime = true;
pref.edit().putBoolean(FIRST_TIME_APP_RUN, true).commit();
pref.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
} else if (!Version.getFullVersion(app).equals(pref.getString(VERSION_INSTALLED, ""))) {
pref.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
OsmandSettings settings = getSettings(activity);
firstTime = settings.FIRST_TIME_APP_RUN.get();
if (firstTime) {
settings.FIRST_TIME_APP_RUN.set(false);
settings.VERSION_INSTALLED.set(Version.getFullVersion(app));
} else if (!Version.getFullVersion(app).equals(settings.VERSION_INSTALLED.get())) {
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;
}
@ -132,6 +135,16 @@ public class AppInitializer implements IProgress {
this.firstTime = firstTime;
}
public void writeFirstTime(boolean firstTime, Activity activity) {
setFirstTime(firstTime);
OsmandSettings settings = getSettings(activity);
settings.FIRST_TIME_APP_RUN.set(firstTime);
}
private OsmandSettings getSettings(Activity activity) {
return ((OsmandApplication) activity.getApplication()).getSettings();
}
public boolean checkAppVersionChanged(Activity activity) {
initUiVars(activity);
boolean showRecentChangesDialog = !firstTime && appVersionChanged;

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 {
@ -1875,7 +1874,7 @@ 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();
@ -1891,6 +1890,10 @@ public class OsmandSettings {
DashRateUsFragment.RateUsState.INITIAL_STATE, DashRateUsFragment.RateUsState.values())
.makeGlobal()
.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 {

View file

@ -182,6 +182,21 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.SHOULD_SHOW_FREE_VERSION_BANNER,
R.string.show_free_version_banner,
R.string.show_free_version_banner_description));
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle("Reset first run");
firstRunPreference.setSummary("After reset app wold act like it is it's firs run");
firstRunPreference.setSelectable(true);
firstRunPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final SettingsDevelopmentActivity activity = SettingsDevelopmentActivity.this;
activity.getMyApplication().getAppInitializer()
.writeFirstTime(true, activity);
firstRunPreference.setSummary("First run flag has been reset");
return true;
}
});
cat.addPreference(firstRunPreference);
}
protected void availableProfileDialog() {

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);