Fix intent filter and filterCat params
This commit is contained in:
parent
409a4003f5
commit
4a8d2b7b82
8 changed files with 65 additions and 31 deletions
|
@ -141,7 +141,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Not perfect
|
// Not perfect
|
||||||
// searchText.setOnClickListener(new OnClickListener() {
|
// filter.setOnClickListener(new OnClickListener() {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
searchText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
searchText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
|
|
@ -577,7 +577,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
hideDashboard(false);
|
hideDashboard(false);
|
||||||
final Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
final Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
||||||
.getDownloadIndexActivity());
|
.getDownloadIndexActivity());
|
||||||
|
if (f != null && !f.equals("basemap")) {
|
||||||
intent.putExtra(DownloadActivity.FILTER_KEY, f);
|
intent.putExtra(DownloadActivity.FILTER_KEY, f);
|
||||||
|
}
|
||||||
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||||
mapActivity.startActivity(intent);
|
mapActivity.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
|
|
||||||
private BannerAndDownloadFreeVersion visibleBanner;
|
private BannerAndDownloadFreeVersion visibleBanner;
|
||||||
private ViewPager viewPager;
|
private ViewPager viewPager;
|
||||||
|
private String filter;
|
||||||
|
private String filterCat;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -74,7 +76,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
|
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
|
||||||
downloadProgressLayout.setVisibility(View.VISIBLE);
|
downloadProgressLayout.setVisibility(View.VISIBLE);
|
||||||
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
||||||
int currentTab = 0;
|
int currentTab = DOWNLOAD_TAB_NUMBER;
|
||||||
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
if (tab.equals(DOWNLOAD_TAB)) {
|
if (tab.equals(DOWNLOAD_TAB)) {
|
||||||
|
@ -124,10 +126,9 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this);
|
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this);
|
||||||
|
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
// FIXME INITIAL FILTER & INITIAL KEY
|
|
||||||
if (intent != null && intent.getExtras() != null) {
|
if (intent != null && intent.getExtras() != null) {
|
||||||
final String filter = intent.getExtras().getString(FILTER_KEY);
|
filter = intent.getExtras().getString(FILTER_KEY);
|
||||||
final String filterCat = intent.getExtras().getString(FILTER_CAT);
|
filterCat = intent.getExtras().getString(FILTER_CAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,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")
|
@SuppressWarnings("deprecation")
|
||||||
public static void updateDescriptionTextWithSize(DownloadActivity activity, View view) {
|
public static void updateDescriptionTextWithSize(DownloadActivity activity, View view) {
|
||||||
|
|
|
@ -78,6 +78,9 @@ public class DownloadResourceGroup {
|
||||||
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP;
|
|| 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) {
|
public DownloadResourceGroup(DownloadResourceGroup parentGroup, DownloadResourceGroupType type) {
|
||||||
|
|
|
@ -202,10 +202,6 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
|
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
|
||||||
DownloadResourceGroup voiceRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_REC);
|
DownloadResourceGroup voiceRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_REC);
|
||||||
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_TTS);
|
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);
|
DownloadResourceGroup worldMaps = new DownloadResourceGroup(this, DownloadResourceGroupType.WORLD_MAPS);
|
||||||
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
|
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
|
||||||
|
@ -279,7 +275,13 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
if (otherMaps.size() > 0) {
|
if (otherMaps.size() > 0) {
|
||||||
addGroup(otherMapsGroup);
|
addGroup(otherMapsGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
voiceScreenTTS.addGroup(voiceTTS);
|
||||||
|
voiceScreenRec.addGroup(voiceRec);
|
||||||
|
voiceGroup.addGroup(voiceScreenRec);
|
||||||
|
voiceGroup.addGroup(voiceScreenTTS);
|
||||||
addGroup(voiceGroup);
|
addGroup(voiceGroup);
|
||||||
|
|
||||||
createHillshadeSRTMGroups();
|
createHillshadeSRTMGroups();
|
||||||
trimEmptyGroups();
|
trimEmptyGroups();
|
||||||
initAlreadyLoadedFiles();
|
initAlreadyLoadedFiles();
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
package net.osmand.plus.download.ui;
|
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.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -38,6 +19,24 @@ import android.widget.ExpandableListView;
|
||||||
import android.widget.ExpandableListView.OnChildClickListener;
|
import android.widget.ExpandableListView.OnChildClickListener;
|
||||||
import android.widget.TextView;
|
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 class DownloadResourceGroupFragment extends DialogFragment implements DownloadEvents, OnChildClickListener {
|
||||||
public static final int RELOAD_ID = 0;
|
public static final int RELOAD_ID = 0;
|
||||||
public static final int SEARCH_ID = 1;
|
public static final int SEARCH_ID = 1;
|
||||||
|
@ -112,6 +111,19 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
reloadData();
|
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() {
|
private void reloadData() {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import net.osmand.plus.download.DownloadResourceGroup;
|
||||||
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
|
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
|
||||||
import net.osmand.plus.download.DownloadResources;
|
import net.osmand.plus.download.DownloadResources;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -181,6 +182,9 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
search.setIconified(false);
|
search.setIconified(false);
|
||||||
|
if (!Algorithms.isEmpty(searchText)) {
|
||||||
|
search.setQuery(searchText, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSearchText(String searchText) {
|
public void updateSearchText(String searchText) {
|
||||||
|
|
|
@ -60,7 +60,6 @@ public class NauticalMapsPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final Intent intent = new Intent(activity, app.getAppCustomization().getDownloadIndexActivity());
|
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);
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue