Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
63151416a7
4 changed files with 25 additions and 17 deletions
|
@ -9,8 +9,8 @@ import java.util.Arrays;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ClientContext;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -39,6 +39,7 @@ import android.os.AsyncTask.Status;
|
|||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
|
@ -458,11 +459,13 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
public static Map<String, String> listWithAlternatives(final Context ctx, File file, final String ext,
|
||||
final Map<String, String> files) {
|
||||
if (file.isDirectory()) {
|
||||
final java.text.DateFormat format = DateFormat.getDateFormat(ctx);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+01:00"));
|
||||
file.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String filename) {
|
||||
if (filename.endsWith(ext)) {
|
||||
String date = AndroidUtils.formatDate(ctx, new File(dir, filename).lastModified());
|
||||
String date = format.format(new File(dir, filename).lastModified());
|
||||
files.put(filename, date);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -11,6 +13,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
|
@ -41,32 +44,28 @@ import net.osmand.util.MapUtils;
|
|||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import com.ibm.icu.text.DateFormat;
|
||||
|
||||
public class LocalIndexHelper {
|
||||
|
||||
private final OsmandApplication app;
|
||||
|
||||
|
||||
private DateFormat dateFormat;
|
||||
|
||||
public LocalIndexHelper(OsmandApplication app){
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String formatDate(long t) {
|
||||
if(dateFormat == null) {
|
||||
dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
}
|
||||
return dateFormat.format(new Date(t));
|
||||
}
|
||||
|
||||
public String getInstalledDate(File f){
|
||||
return getInstalledDate(f.lastModified());
|
||||
return getInstalledDate(f.lastModified(), null);
|
||||
}
|
||||
|
||||
public String getInstalledDate(long t){
|
||||
return app.getString(R.string.local_index_installed) + " : " + formatDate(t);
|
||||
public String getInstalledDate(long t, TimeZone timeZone){
|
||||
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
if(timeZone != null) {
|
||||
dateFormat.setTimeZone(timeZone);
|
||||
}
|
||||
return app.getString(R.string.local_index_installed) + " : " + dateFormat.format(new Date(t));
|
||||
}
|
||||
|
||||
public void updateDescription(LocalIndexInfo info){
|
||||
|
@ -441,7 +440,7 @@ public class LocalIndexHelper {
|
|||
append(mi.getName()).append("\n");
|
||||
}
|
||||
}
|
||||
builder.append(getInstalledDate(reader.getDateCreated()));
|
||||
builder.append(getInstalledDate(reader.getDateCreated(), null));
|
||||
info.setDescription(builder.toString());
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Collections;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -66,6 +67,7 @@ import android.database.sqlite.SQLiteException;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.HandlerThread;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
||||
|
@ -433,6 +435,8 @@ public class ResourceManager {
|
|||
file.mkdirs();
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
if (file.exists() && file.canRead()) {
|
||||
final java.text.DateFormat format = DateFormat.getDateFormat(context);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+01:00"));
|
||||
File[] lf = file.listFiles();
|
||||
if (lf != null) {
|
||||
for (File f : lf) {
|
||||
|
@ -442,7 +446,7 @@ public class ResourceManager {
|
|||
conf = new File(f, "_ttsconfig.p");
|
||||
}
|
||||
if (conf.exists()) {
|
||||
indexFileNames.put(f.getName(), AndroidUtils.formatDate(context, conf.lastModified())); //$NON-NLS-1$
|
||||
indexFileNames.put(f.getName(), format.format(conf.lastModified())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -610,6 +614,8 @@ public class ResourceManager {
|
|||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
final java.text.DateFormat format = DateFormat.getDateFormat(context);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+01:00"));
|
||||
for (File f : files) {
|
||||
progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$
|
||||
try {
|
||||
|
@ -635,7 +641,7 @@ public class ResourceManager {
|
|||
if (dateCreated == 0) {
|
||||
dateCreated = f.lastModified();
|
||||
}
|
||||
indexFileNames.put(f.getName(), AndroidUtils.formatDate(context, dateCreated)); //$NON-NLS-1$
|
||||
indexFileNames.put(f.getName(), format.format(dateCreated)); //$NON-NLS-1$
|
||||
for (String rName : index.getRegionNames()) {
|
||||
// skip duplicate names (don't make collision between getName() and name in the map)
|
||||
// it can be dangerous to use one file to different indexes if it is multithreaded
|
||||
|
|
|
@ -405,7 +405,7 @@ public class RouteProvider {
|
|||
RoutingParameter pr = e.getValue();
|
||||
String vl;
|
||||
if(key.equals(GeneralRouter.USE_SHORTEST_WAY)) {
|
||||
Boolean bool = settings.FAST_ROUTE_MODE.getModeValue(params.mode);
|
||||
Boolean bool = !settings.FAST_ROUTE_MODE.getModeValue(params.mode);
|
||||
vl = bool ? "true" : null;
|
||||
} else if(pr.getType() == RoutingParameterType.BOOLEAN) {
|
||||
CommonPreference<Boolean> pref = settings.getCustomRoutingBooleanProperty(key);
|
||||
|
|
Loading…
Reference in a new issue