Merge branch 'master' of https://github.com/osmandapp/Osmand into prepare_importing_finish

This commit is contained in:
veliymolfar 2020-02-27 15:46:38 +02:00
commit 468ebcd894
4 changed files with 39 additions and 38 deletions

View file

@ -866,9 +866,9 @@ public class SearchUICore {
// -1 - means 1st is less than 2nd
return topVisible1 ? -1 : 1;
}
// if (o1.getUnknownPhraseMatchWeight() != o2.getUnknownPhraseMatchWeight()) {
// return -Double.compare(o1.getUnknownPhraseMatchWeight(), o2.getUnknownPhraseMatchWeight());
// }
if (o1.getUnknownPhraseMatchWeight() != o2.getUnknownPhraseMatchWeight()) {
return -Double.compare(o1.getUnknownPhraseMatchWeight(), o2.getUnknownPhraseMatchWeight());
}
if (o1.getFoundWordCount() != o2.getFoundWordCount()) {
return -Algorithms.compare(o1.getFoundWordCount(), o2.getFoundWordCount());
}
@ -879,25 +879,24 @@ public class SearchUICore {
return Double.compare(s1, s2);
}
}
int st1 = o1.localeName == null ? -10000 : Algorithms.extractFirstIntegerNumber(o1.localeName);
int st2 = o2.localeName == null ? -10000 : Algorithms.extractFirstIntegerNumber(o2.localeName);
String localeName1 = o1.localeName == null ? "" : o1.localeName;
String localeName2 = o2.localeName == null ? "" : o2.localeName;
int st1 = Algorithms.extractFirstIntegerNumber(localeName1);
int st2 = Algorithms.extractFirstIntegerNumber(localeName2);
if (st1 != st2) {
return Algorithms.compare(st1, st2);
}
String localeName1 = o1.localeName == null ? "" : o1.localeName;
String localeName2 = o2.localeName == null ? "" : o2.localeName;
double s1 = o1.getSearchDistance(loc, 1);
double s2 = o2.getSearchDistance(loc, 1);
// ????
// if (o1.parentSearchResult != null && o2.parentSearchResult != null) {
// if (o1.parentSearchResult == o2.parentSearchResult) {
// int cmp = collator.compare(localeName1, localeName2);
// if (cmp != 0) {
// return cmp;
// }
// }
// return Double.compare(s1, s2);
// }
if (o1.parentSearchResult != null && o2.parentSearchResult != null) {
if (o1.parentSearchResult == o2.parentSearchResult) {
int cmp = collator.compare(localeName1, localeName2);
if (cmp != 0) {
return cmp;
}
}
return Double.compare(s1, s2);
}
int cmp = collator.compare(localeName1, localeName2);
if (cmp != 0) {
return cmp;
@ -905,7 +904,7 @@ public class SearchUICore {
if (s1 != s2) {
return Double.compare(s1, s2);
}
boolean am1 = o2.object instanceof Amenity;
boolean am1 = o1.object instanceof Amenity;
boolean am2 = o2.object instanceof Amenity;
if (am1 != am2) {
return Boolean.compare(am1, am2);

View file

@ -29,26 +29,26 @@ public class SearchResult {
public boolean firstUnknownWordMatches = true;
public boolean unknownPhraseMatches = false;
public double getUnknownPhraseMatchWeight() {
double res = 0;
boolean isHouse = objectType == ObjectType.HOUSE;
if (unknownPhraseMatches) {
res = ObjectType.getTypeWeight(objectType);
}
if (res == 0 && parentSearchResult != null && parentSearchResult.unknownPhraseMatches) {
if (isHouse && parentSearchResult.objectType == ObjectType.STREET) {
res = ObjectType.getTypeWeight(ObjectType.HOUSE);
} else {
res = ObjectType.getTypeWeight(parentSearchResult.objectType);
}
}
return res;
}
public SearchResult(SearchPhrase sp) {
this.requiredSearchPhrase = sp;
}
public double getUnknownPhraseMatchWeight() {
return getUnknownPhraseMatchWeight(false);
}
private double getUnknownPhraseMatchWeight(boolean isHouse) {
double res = 0;
isHouse = isHouse || objectType == ObjectType.HOUSE;
if (unknownPhraseMatches) {
res = isHouse ? ObjectType.getTypeWeight(ObjectType.HOUSE) : ObjectType.getTypeWeight(objectType);
}
if (res == 0 && parentSearchResult != null) {
return parentSearchResult.getUnknownPhraseMatchWeight(isHouse);
}
return res;
}
public int getFoundWordCount() {
int inc = 0;
if (firstUnknownWordMatches) {

View file

@ -222,8 +222,7 @@ public class SearchCoreUITest {
});
if (files != null) {
for (File f : files) {
// FIXME
// testSearchImpl(f);
testSearchImpl(f);
}
}
}

View file

@ -446,7 +446,7 @@ class TelegramHelper private constructor() {
offsetOrder = last.order
offsetChatId = last.chatId
}
client?.send(TdApi.GetChats(offsetOrder, offsetChatId, CHATS_LIMIT - chatList.size)) { obj ->
client?.send(TdApi.GetChats(TdApi.ChatListMain(), offsetOrder, offsetChatId, CHATS_LIMIT - chatList.size)) { obj ->
when (obj.constructor) {
TdApi.Error.CONSTRUCTOR -> {
val error = obj as TdApi.Error
@ -533,8 +533,9 @@ class TelegramHelper private constructor() {
}
resultArticles.forEach {
shareInfo.lastTextMessageHandled = false
client?.send(TdApi.SendInlineQueryResultMessage(shareInfo.chatId, 0, true,
true, inlineQueryResults.inlineQueryId, it.id, false)) { obj ->
val sendOptions = TdApi.SendMessageOptions(true, true, null)
client?.send(TdApi.SendInlineQueryResultMessage(shareInfo.chatId, 0, sendOptions,
inlineQueryResults.inlineQueryId, it.id, false)) { obj ->
handleTextLocationMessageUpdate(obj, shareInfo, true)
}
}
@ -861,7 +862,8 @@ class TelegramHelper private constructor() {
shareInfo.pendingTdLibText++
shareInfo.lastSendTextMessageTime = (System.currentTimeMillis() / 1000).toInt()
log.error("sendNewTextLocation ${shareInfo.pendingTdLibText}")
client?.send(TdApi.SendMessage(shareInfo.chatId, 0, false, true, null, content)) { obj ->
val sendOptions = TdApi.SendMessageOptions(false, true, null)
client?.send(TdApi.SendMessage(shareInfo.chatId, 0, sendOptions, null, content)) { obj ->
handleTextLocationMessageUpdate(obj, shareInfo, false)
}
}
@ -893,7 +895,8 @@ class TelegramHelper private constructor() {
shareInfo.pendingTdLibMap++
shareInfo.lastSendMapMessageTime = (System.currentTimeMillis() / 1000).toInt()
log.error("sendNewMapLocation ${shareInfo.pendingTdLibMap}")
client?.send(TdApi.SendMessage(shareInfo.chatId, 0, false, true, null, content)) { obj ->
val sendOptions = TdApi.SendMessageOptions(false, true, null)
client?.send(TdApi.SendMessage(shareInfo.chatId, 0, sendOptions, null, content)) { obj ->
handleMapLocationMessageUpdate(obj, shareInfo, false)
}
}
@ -1224,7 +1227,7 @@ class TelegramHelper private constructor() {
val updateUser = obj as TdApi.UpdateUser
val user = updateUser.user
users[updateUser.user.id] = user
if (user.outgoingLink is TdApi.LinkStateIsContact) {
if (user.isContact) {
contacts[user.id] = user
}
if (isOsmAndBot(user.id)) {