Merge pull request #5299 from osmandapp/PaulsBranch

Fixed unused array
This commit is contained in:
vshcherb 2018-04-28 16:00:55 +03:00 committed by GitHub
commit 896ae0a59d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 24 deletions

View file

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

View file

@ -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,

View file

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