commit
896ae0a59d
3 changed files with 20 additions and 24 deletions
|
@ -22,6 +22,7 @@ import android.view.Window;
|
|||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
|
||||
|
||||
public class WikivoyageBaseDialogFragment extends BaseOsmAndDialogFragment {
|
||||
|
||||
|
@ -89,7 +90,7 @@ public class WikivoyageBaseDialogFragment extends BaseOsmAndDialogFragment {
|
|||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
getFragmentManager().popBackStackImmediate(WikivoyageExploreDialogFragment.TAG, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -147,13 +147,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr
|
|||
}
|
||||
|
||||
private void sendResults(long cityId) {
|
||||
Fragment fragment = getTargetFragment();
|
||||
if (fragment != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(CITY_ID_KEY, cityId);
|
||||
intent.putExtra(SELECTED_LANG_KEY, selectedLang);
|
||||
fragment.onActivityResult(getTargetRequestCode(), OPEN_ARTICLE_REQUEST_CODE, intent);
|
||||
}
|
||||
WikivoyageArticleDialogFragment.showInstance(getMyApplication(), getFragmentManager(), cityId, selectedLang);
|
||||
}
|
||||
|
||||
public static boolean showInstance(@NonNull FragmentManager fm,
|
||||
|
|
|
@ -362,22 +362,23 @@ public class TravelDbHelper {
|
|||
cursor.close();
|
||||
}
|
||||
LinkedHashMap<WikivoyageSearchResult, List<WikivoyageSearchResult>> res = new LinkedHashMap<>();
|
||||
parts = parts == null ? new String[]{} : parts;
|
||||
for (String header : parts) {
|
||||
WikivoyageSearchResult searchResult = headerObjs.get(header);
|
||||
List<WikivoyageSearchResult> results = navMap.get(header);
|
||||
if (results != null) {
|
||||
Collections.sort(results, new Comparator<WikivoyageSearchResult>() {
|
||||
@Override
|
||||
public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) {
|
||||
return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0));
|
||||
}
|
||||
});
|
||||
WikivoyageSearchResult emptyResult = new WikivoyageSearchResult();
|
||||
emptyResult.articleTitles.add(header);
|
||||
emptyResult.cityId = -1;
|
||||
searchResult = searchResult != null ? searchResult : emptyResult;
|
||||
res.put(searchResult, results);
|
||||
if (parts != null) {
|
||||
for (String header : parts) {
|
||||
WikivoyageSearchResult searchResult = headerObjs.get(header);
|
||||
List<WikivoyageSearchResult> results = navMap.get(header);
|
||||
if (results != null) {
|
||||
Collections.sort(results, new Comparator<WikivoyageSearchResult>() {
|
||||
@Override
|
||||
public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) {
|
||||
return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0));
|
||||
}
|
||||
});
|
||||
WikivoyageSearchResult emptyResult = new WikivoyageSearchResult();
|
||||
emptyResult.articleTitles.add(header);
|
||||
emptyResult.cityId = -1;
|
||||
searchResult = searchResult != null ? searchResult : emptyResult;
|
||||
res.put(searchResult, results);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue