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

This commit is contained in:
Victor Shcherb 2015-10-21 18:12:07 +02:00
commit dbb1265503
9 changed files with 76 additions and 41 deletions

View file

@ -1998,4 +1998,10 @@
<string name="poi_note">注釋</string>
<string name="poi_watering_place">有水的地方</string>
<string name="poi_animal_boarding">動物寄宿</string>
<string name="poi_animal_boarding_dog">寄宿類型:狗</string>
<string name="poi_animal_boarding_cat">寄宿類型:貓</string>
<string name="poi_animal_boarding_dog_cat">寄宿類型:狗、貓</string>
<string name="poi_animal_boarding_horse">寄宿類型:馬</string>
</resources>

View file

@ -141,7 +141,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
}
});
// Not perfect
// searchText.setOnClickListener(new OnClickListener() {
// filter.setOnClickListener(new OnClickListener() {
// }
// });
searchText.setImeOptions(EditorInfo.IME_ACTION_DONE);

View file

@ -577,7 +577,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
hideDashboard(false);
final Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadIndexActivity());
intent.putExtra(DownloadActivity.FILTER_KEY, f);
if (f != null && !f.equals("basemap")) {
intent.putExtra(DownloadActivity.FILTER_KEY, f);
}
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
mapActivity.startActivity(intent);
}

View file

@ -60,6 +60,8 @@ public class DownloadActivity extends BaseDownloadActivity {
private BannerAndDownloadFreeVersion visibleBanner;
private ViewPager viewPager;
private String filter;
private String filterCat;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -76,18 +78,13 @@ public class DownloadActivity extends BaseDownloadActivity {
updateDescriptionTextWithSize(this, downloadProgressLayout);
int currentTab = DOWNLOAD_TAB_NUMBER;
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
if (tab != null) {
switch (tab) {
case DOWNLOAD_TAB:
currentTab = DOWNLOAD_TAB_NUMBER;
break;
case LOCAL_TAB:
currentTab = LOCAL_TAB_NUMBER;
break;
case UPDATES_TAB:
currentTab = UPDATES_TAB_NUMBER;
break;
if (tab.equals(DOWNLOAD_TAB)) {
currentTab = DOWNLOAD_TAB_NUMBER;
} else if (tab.equals(LOCAL_TAB)) {
currentTab = LOCAL_TAB_NUMBER;
} else if (tab.equals(UPDATES_TAB)) {
currentTab = UPDATES_TAB_NUMBER;
}
}
@ -129,10 +126,9 @@ public class DownloadActivity extends BaseDownloadActivity {
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this);
final Intent intent = getIntent();
// FIXME INITIAL FILTER & INITIAL KEY
if (intent != null && intent.getExtras() != null) {
final String filter = intent.getExtras().getString(FILTER_KEY);
final String filterCat = intent.getExtras().getString(FILTER_CAT);
filter = intent.getExtras().getString(FILTER_KEY);
filterCat = intent.getExtras().getString(FILTER_CAT);
}
}
@ -448,6 +444,17 @@ public class DownloadActivity extends BaseDownloadActivity {
}
public String getFilterAndClear() {
String res = filter;
filter = null;
return res;
}
public String getFilterCatAndClear() {
String res = filterCat;
filterCat = null;
return res;
}
@SuppressWarnings("deprecation")
public static void updateDescriptionTextWithSize(DownloadActivity activity, View view) {

View file

@ -78,6 +78,9 @@ public class DownloadResourceGroup {
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP;
}
public static String getVoiceTTSId() {
return "#" + VOICE_GROUP.name().toLowerCase() + "#" + VOICE_TTS.name().toLowerCase();
}
}
public DownloadResourceGroup(DownloadResourceGroup parentGroup, DownloadResourceGroupType type) {

View file

@ -206,11 +206,7 @@ public class DownloadResources extends DownloadResourceGroup {
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
DownloadResourceGroup voiceRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_REC);
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_TTS);
voiceScreenTTS.addGroup(voiceTTS);
voiceScreenRec.addGroup(voiceRec);
voiceGroup.addGroup(voiceScreenRec);
voiceGroup.addGroup(voiceScreenTTS);
DownloadResourceGroup worldMaps = new DownloadResourceGroup(this, DownloadResourceGroupType.WORLD_MAPS);
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
@ -283,7 +279,13 @@ public class DownloadResources extends DownloadResourceGroup {
if (otherMaps.size() > 0) {
addGroup(otherMapsGroup);
}
voiceScreenTTS.addGroup(voiceTTS);
voiceScreenRec.addGroup(voiceRec);
voiceGroup.addGroup(voiceScreenRec);
voiceGroup.addGroup(voiceScreenTTS);
addGroup(voiceGroup);
createHillshadeSRTMGroups();
trimEmptyGroups();
updateLoadedFiles();

View file

@ -1,24 +1,5 @@
package net.osmand.plus.download.ui;
import java.util.ArrayList;
import java.util.List;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem;
import net.osmand.util.Algorithms;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
@ -38,6 +19,24 @@ import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.TextView;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.List;
public class DownloadResourceGroupFragment extends DialogFragment implements DownloadEvents, OnChildClickListener {
public static final int RELOAD_ID = 0;
public static final int SEARCH_ID = 1;
@ -112,6 +111,19 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
public void onResume() {
super.onResume();
reloadData();
String filter = getDownloadActivity().getFilterAndClear();
String filterCat = getDownloadActivity().getFilterCatAndClear();
if (filter != null) {
getDownloadActivity().showDialog(getActivity(),
SearchDialogFragment.createInstance(filter));
} else if (filterCat != null) {
if (filterCat.equals(DownloadActivityType.VOICE_FILE.getTag())) {
String uniqueId = DownloadResourceGroup.DownloadResourceGroupType.getVoiceTTSId();
final DownloadResourceGroupFragment regionDialogFragment = DownloadResourceGroupFragment
.createInstance(uniqueId);
((DownloadActivity) getActivity()).showDialog(getActivity(), regionDialogFragment);
}
}
}
private void reloadData() {

View file

@ -33,6 +33,7 @@ import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.Collections;
@ -181,6 +182,9 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
public void onResume() {
super.onResume();
search.setIconified(false);
if (!Algorithms.isEmpty(searchText)) {
search.setQuery(searchText, true);
}
}
public void updateSearchText(String searchText) {

View file

@ -60,7 +60,6 @@ public class NauticalMapsPlugin extends OsmandPlugin {
@Override
public void onClick(DialogInterface dialog, int which) {
final Intent intent = new Intent(activity, app.getAppCustomization().getDownloadIndexActivity());
intent.putExtra(DownloadActivity.FILTER_KEY, app.getString(net.osmand.plus.R.string.index_item_world_seamarks));
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
activity.startActivity(intent);
}