[Quick search] Custom filters in progress
This commit is contained in:
parent
180270ab15
commit
a2cab336c4
17 changed files with 1258 additions and 182 deletions
|
@ -11,10 +11,12 @@ public abstract class AbstractPoiType {
|
|||
protected final String keyName;
|
||||
protected final MapPoiTypes registry;
|
||||
private List<PoiType> poiAdditionals = null;
|
||||
private List<PoiType> poiAdditionalsCategorized = null;
|
||||
private boolean topVisible;
|
||||
private String lang;
|
||||
private AbstractPoiType baseLangType;
|
||||
private boolean notEditableOsm;
|
||||
private String poiAdditionalCategory;
|
||||
|
||||
public AbstractPoiType(String keyName, MapPoiTypes registry) {
|
||||
this.keyName = keyName;
|
||||
|
@ -58,7 +60,7 @@ public abstract class AbstractPoiType {
|
|||
}
|
||||
|
||||
public boolean isAdditional() {
|
||||
return this instanceof PoiType && ((PoiType) this).isAdditional();
|
||||
return this instanceof PoiType && this.isAdditional();
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,20 +68,41 @@ public abstract class AbstractPoiType {
|
|||
return registry.getTranslation(this);
|
||||
}
|
||||
|
||||
public String getPoiAdditionalCategoryTranslation() {
|
||||
if (poiAdditionalCategory != null) {
|
||||
return registry.getPoiTranslation(poiAdditionalCategory);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addPoiAdditional(PoiType tp) {
|
||||
if(poiAdditionals == null) {
|
||||
poiAdditionals = new ArrayList<PoiType>();
|
||||
if (poiAdditionals == null) {
|
||||
poiAdditionals = new ArrayList<>();
|
||||
}
|
||||
poiAdditionals.add(tp);
|
||||
if (tp.getPoiAdditionalCategory() != null) {
|
||||
if (poiAdditionalsCategorized == null) {
|
||||
poiAdditionalsCategorized = new ArrayList<>();
|
||||
}
|
||||
poiAdditionalsCategorized.add(tp);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PoiType> getPoiAdditionals() {
|
||||
if(poiAdditionals == null) {
|
||||
if (poiAdditionals == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return poiAdditionals;
|
||||
}
|
||||
|
||||
public List<PoiType> getPoiAdditionalsCategorized() {
|
||||
if (poiAdditionalsCategorized == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return poiAdditionalsCategorized;
|
||||
}
|
||||
|
||||
public boolean isNotEditableOsm() {
|
||||
return notEditableOsm;
|
||||
}
|
||||
|
@ -88,6 +111,14 @@ public abstract class AbstractPoiType {
|
|||
this.notEditableOsm = notEditableOsm;
|
||||
}
|
||||
|
||||
public String getPoiAdditionalCategory() {
|
||||
return poiAdditionalCategory;
|
||||
}
|
||||
|
||||
public void setPoiAdditionalCategory(String poiAdditionalCategory) {
|
||||
this.poiAdditionalCategory = poiAdditionalCategory;
|
||||
}
|
||||
|
||||
public abstract Map<PoiCategory, LinkedHashSet<String>> putTypes(Map<PoiCategory, LinkedHashSet<String>> acceptedTypes);
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,8 @@ public class MapPoiTypes {
|
|||
|
||||
public interface PoiTranslator {
|
||||
|
||||
public String getTranslation(AbstractPoiType type);
|
||||
String getTranslation(AbstractPoiType type);
|
||||
String getTranslation(String keyName);
|
||||
|
||||
}
|
||||
|
||||
|
@ -276,6 +277,7 @@ public class MapPoiTypes {
|
|||
PoiCategory lastCategory = null;
|
||||
PoiFilter lastFilter = null;
|
||||
PoiType lastType = null;
|
||||
String lastPoiAdditionalCategory = null;
|
||||
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
||||
if (tok == XmlPullParser.START_TAG) {
|
||||
String name = parser.getName();
|
||||
|
@ -302,12 +304,17 @@ public class MapPoiTypes {
|
|||
if (lastCategory == null) {
|
||||
lastCategory = getOtherMapCategory();
|
||||
}
|
||||
PoiType baseType = parsePoiAdditional(parser, lastCategory, lastFilter, lastType, null, null);
|
||||
PoiType baseType = parsePoiAdditional(parser, lastCategory, lastFilter, lastType, null, null, lastPoiAdditionalCategory);
|
||||
if ("true".equals(parser.getAttributeValue("", "lang"))) {
|
||||
for (String lng : MapRenderingTypes.langs) {
|
||||
parsePoiAdditional(parser, lastCategory, lastFilter, lastType, lng, baseType);
|
||||
parsePoiAdditional(parser, lastCategory, lastFilter, lastType, lng, baseType, lastPoiAdditionalCategory);
|
||||
}
|
||||
parsePoiAdditional(parser, lastCategory, lastFilter, lastType, "en", baseType);
|
||||
parsePoiAdditional(parser, lastCategory, lastFilter, lastType, "en", baseType, lastPoiAdditionalCategory);
|
||||
}
|
||||
|
||||
} else if (name.equals("poi_additional_category")) {
|
||||
if (lastPoiAdditionalCategory == null) {
|
||||
lastPoiAdditionalCategory = parser.getAttributeValue("", "name");
|
||||
}
|
||||
|
||||
} else if (name.equals("poi_type")) {
|
||||
|
@ -336,6 +343,8 @@ public class MapPoiTypes {
|
|||
lastType = null;
|
||||
} else if (name.equals("poi_category")) {
|
||||
lastCategory = null;
|
||||
} else if (name.equals("poi_additional_category")) {
|
||||
lastPoiAdditionalCategory = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +377,7 @@ public class MapPoiTypes {
|
|||
|
||||
|
||||
private PoiType parsePoiAdditional(XmlPullParser parser, PoiCategory lastCategory, PoiFilter lastFilter,
|
||||
PoiType lastType, String lang, PoiType langBaseType) {
|
||||
PoiType lastType, String lang, PoiType langBaseType, String poiAdditionalCategory) {
|
||||
String oname = parser.getAttributeValue("", "name");
|
||||
if (lang != null) {
|
||||
oname += ":" + lang;
|
||||
|
@ -393,6 +402,7 @@ public class MapPoiTypes {
|
|||
tp.setOsmValue(parser.getAttributeValue("", "value"));
|
||||
tp.setOsmTag2(parser.getAttributeValue("", "tag2"));
|
||||
tp.setOsmValue2(parser.getAttributeValue("", "value2"));
|
||||
tp.setPoiAdditionalCategory(poiAdditionalCategory);
|
||||
if (lastType != null) {
|
||||
lastType.addPoiAdditional(tp);
|
||||
} else if (lastFilter != null) {
|
||||
|
@ -548,6 +558,17 @@ public class MapPoiTypes {
|
|||
return Algorithms.capitalizeFirstLetterAndLowercase(name);
|
||||
}
|
||||
|
||||
public String getPoiTranslation(String keyName) {
|
||||
if (poiTranslator != null) {
|
||||
String translation = poiTranslator.getTranslation(keyName);
|
||||
if (!Algorithms.isEmpty(translation)) {
|
||||
return translation;
|
||||
}
|
||||
}
|
||||
String name = keyName;
|
||||
name = name.replace('_', ' ');
|
||||
return Algorithms.capitalizeFirstLetterAndLowercase(name);
|
||||
}
|
||||
|
||||
public boolean isRegisteredType(PoiCategory t) {
|
||||
return getPoiCategoryByName(t.getKeyName()) != otherCategory;
|
||||
|
|
|
@ -258,6 +258,14 @@ public class SearchUICore {
|
|||
apis.add(new SearchCoreFactory.SearchAddressByNameAPI(streetsApi, cityApi));
|
||||
}
|
||||
|
||||
public void clearCustomSearchPoiFilters() {
|
||||
for(SearchCoreAPI capi : apis) {
|
||||
if(capi instanceof SearchAmenityTypesAPI) {
|
||||
((SearchAmenityTypesAPI) capi).clearCustomFilters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addCustomSearchPoiFilter(CustomSearchPoiFilter poiFilter, int priority) {
|
||||
for(SearchCoreAPI capi : apis) {
|
||||
if(capi instanceof SearchAmenityTypesAPI) {
|
||||
|
|
|
@ -496,6 +496,11 @@ public class SearchCoreFactory {
|
|||
this.types = types;
|
||||
}
|
||||
|
||||
public void clearCustomFilters() {
|
||||
this.customPoiFilters.clear();
|
||||
this.customPoiFiltersPriorites.clear();
|
||||
}
|
||||
|
||||
public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) {
|
||||
this.customPoiFilters.add(poiFilter);
|
||||
this.customPoiFiltersPriorites.add(priority);
|
||||
|
|
27
OsmAnd/res/layout/list_item_button.xml
Normal file
27
OsmAnd/res/layout/list_item_button.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/blue_button_drawable"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/color_white"
|
||||
tools:text="APPLY FILTERS"/>
|
||||
|
||||
</LinearLayout>
|
15
OsmAnd/res/layout/list_item_divider.xml
Normal file
15
OsmAnd/res/layout/list_item_divider.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"/>
|
||||
|
||||
<include layout="@layout/card_top_divider"/>
|
||||
|
||||
</LinearLayout>
|
107
OsmAnd/res/layout/poi_filter_list_item.xml
Normal file
107
OsmAnd/res/layout/poi_filter_list_item.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:clickable="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bg_color"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_search_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/filter_poi_hint"
|
||||
android:textColor="?attr/searchbar_text"
|
||||
android:textColorHint="?attr/searchbar_text_hint"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/titleRegular"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
style="@style/TextAppearance.ListItemTitle"
|
||||
android:visibility="gone"
|
||||
tools:text="Live updates"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/titleBold"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
style="@style/TextAppearance.ListItemCategoryTitle"
|
||||
android:visibility="gone"
|
||||
tools:text="Live updates"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/titleButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
style="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:visibility="visible"
|
||||
tools:text="SHOW ALL"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/switchItem"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkboxItem"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/expandItem"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_action_arrow_drop_up"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="54dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -179,6 +179,15 @@
|
|||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/filterButton"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/poi_filter_custom_filter"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_action_filter_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
83
OsmAnd/res/layout/search_poi_filter.xml
Normal file
83
OsmAnd/res/layout/search_poi_filter.xml
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/osmand_orange"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:theme="?attr/toolbar_theme"
|
||||
app:contentInsetLeft="54dp"
|
||||
app:contentInsetStart="54dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_filters"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_list_text_size_large"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@null"
|
||||
android:text="Filling station"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/moreButton"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:contentDescription="@string/shared_string_more_actions"
|
||||
android:src="@drawable/ic_overflow_menu_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:drawSelectorOnTop="true"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="poi_fuel_type">Fuel type</string>
|
||||
<string name="poi_payment_type">Payment type</string>
|
||||
<string name="poi_additional_type">Additional</string>
|
||||
<!-- categories -->
|
||||
<string name="poi_shop">Store</string>
|
||||
<string name="poi_shop_food">Food store</string>
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="shared_string_filters">Filters</string>
|
||||
<string name="apply_filters">Apply filters</string>
|
||||
<string name="save_filter">Save filter</string>
|
||||
<string name="delete_filter">Delete filter</string>
|
||||
<string name="new_filter">New filter</string>
|
||||
<string name="new_filter_desc">Please enter name for the new filter. You will find it in the list of Categories.</string>
|
||||
<string name="osm_live_payment_desc">Subscription fee will be charged each month. You can cancel your subscription on Google Play at any time.</string>
|
||||
<string name="donation_to_osm">Donation to OpenStreetMap community</string>
|
||||
<string name="donation_to_osm_desc">Part of your donation will be sent to OSM users who submit changes to OpenStreetMap. The cost of the subscription remains the same.</string>
|
||||
|
|
|
@ -317,14 +317,19 @@ public class AppInitializer implements IProgress {
|
|||
if(type.getBaseLangType() != null) {
|
||||
return getTranslation(type.getBaseLangType()) + " (" + app.getLangTranslation(type.getLang()).toLowerCase() +")";
|
||||
}
|
||||
return getTranslation(type.getIconKeyName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslation(String keyName) {
|
||||
try {
|
||||
Field f = R.string.class.getField("poi_" + type.getIconKeyName());
|
||||
Field f = R.string.class.getField("poi_" + keyName);
|
||||
if (f != null) {
|
||||
Integer in = (Integer) f.get(null);
|
||||
return app.getString(in);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("No translation for "+ type.getIconKeyName() + " " + e.getMessage());
|
||||
System.err.println("No translation for "+ keyName + " " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -44,9 +44,8 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
public final static String CUSTOM_FILTER_ID = USER_PREFIX + "custom_id"; //$NON-NLS-1$
|
||||
public final static String BY_NAME_FILTER_ID = USER_PREFIX + "by_name"; //$NON-NLS-1$
|
||||
|
||||
private Map<PoiCategory, LinkedHashSet<String>> acceptedTypes = new LinkedHashMap<PoiCategory,
|
||||
LinkedHashSet<String>>();
|
||||
private Map<String, PoiType> poiAdditionals = new HashMap<String, PoiType>();
|
||||
private Map<PoiCategory, LinkedHashSet<String>> acceptedTypes = new LinkedHashMap<>();
|
||||
private Map<String, PoiType> poiAdditionals = new HashMap<>();
|
||||
|
||||
protected String filterId;
|
||||
protected String standardIconId = "";
|
||||
|
@ -455,7 +454,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
|
||||
public void clearFilter() {
|
||||
acceptedTypes = new LinkedHashMap<PoiCategory, LinkedHashSet<String>>();
|
||||
acceptedTypes = new LinkedHashMap<>();
|
||||
poiAdditionals.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControll
|
|||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||
import net.osmand.search.SearchUICore;
|
||||
import net.osmand.search.SearchUICore.SearchResultCollection;
|
||||
import net.osmand.search.core.ObjectType;
|
||||
import net.osmand.search.core.SearchCoreAPI;
|
||||
import net.osmand.search.core.SearchCoreFactory.SearchAmenityTypesAPI;
|
||||
import net.osmand.search.core.SearchPhrase;
|
||||
|
@ -77,6 +76,8 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.search.core.ObjectType.POI_TYPE;
|
||||
|
||||
public class QuickSearchDialogFragment extends DialogFragment implements OsmAndCompassListener, OsmAndLocationListener {
|
||||
|
||||
public static final String TAG = "QuickSearchDialogFragment";
|
||||
|
@ -98,6 +99,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
private View searchView;
|
||||
private View buttonToolbarView;
|
||||
private ImageView buttonToolbarImage;
|
||||
private ImageButton buttonToolbarFilter;
|
||||
private TextView buttonToolbarText;
|
||||
private QuickSearchMainListFragment mainSearchFragment;
|
||||
private QuickSearchHistoryListFragment historySearchFragment;
|
||||
|
@ -146,7 +148,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("PrivateResource")
|
||||
@SuppressLint("PrivateResource, ValidFragment")
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
|
@ -209,14 +211,49 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
buttonToolbarView = view.findViewById(R.id.button_toolbar_layout);
|
||||
buttonToolbarImage = (ImageView) view.findViewById(R.id.buttonToolbarImage);
|
||||
buttonToolbarImage.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_marker_dark));
|
||||
buttonToolbarFilter = (ImageButton) view.findViewById(R.id.filterButton);
|
||||
buttonToolbarFilter.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_filter_dark));
|
||||
buttonToolbarFilter.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SearchPhrase searchPhrase = searchUICore.getPhrase();
|
||||
if (searchPhrase.isLastWord(POI_TYPE)) {
|
||||
String filterId = null;
|
||||
String filterByName = searchPhrase.getUnknownSearchPhrase();
|
||||
Object object = searchPhrase.getLastSelectedWord().getResult().object;
|
||||
if (object instanceof PoiUIFilter) {
|
||||
PoiUIFilter model = (PoiUIFilter) object;
|
||||
if (!Algorithms.isEmpty(model.getSavedFilterByName())) {
|
||||
model.setFilterByName(model.getSavedFilterByName());
|
||||
}
|
||||
filterId = model.getFilterId();
|
||||
} else if (object instanceof AbstractPoiType) {
|
||||
AbstractPoiType abstractPoiType = (AbstractPoiType) object;
|
||||
PoiUIFilter custom = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + abstractPoiType.getKeyName());
|
||||
if (custom != null) {
|
||||
custom.setFilterByName(null);
|
||||
custom.clearFilter();
|
||||
custom.updateTypesToAccept(abstractPoiType);
|
||||
filterId = custom.getFilterId();
|
||||
}
|
||||
}
|
||||
if (filterId != null) {
|
||||
QuickSearchPoiFilterFragment.showDialog(
|
||||
QuickSearchDialogFragment.this, filterByName, filterId);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttonToolbarText = (TextView) view.findViewById(R.id.buttonToolbarTitle);
|
||||
view.findViewById(R.id.buttonToolbar).setOnClickListener(new OnClickListener() {
|
||||
view.findViewById(R.id.buttonToolbar).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SearchPhrase searchPhrase = searchUICore.getPhrase();
|
||||
if (foundPartialLocation) {
|
||||
QuickSearchCoordinatesFragment.showDialog(QuickSearchDialogFragment.this, searchPhrase.getUnknownSearchWord());
|
||||
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(ObjectType.POI_TYPE)) {
|
||||
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(POI_TYPE)) {
|
||||
PoiUIFilter filter;
|
||||
if (searchPhrase.isNoSelectedType()) {
|
||||
filter = app.getPoiFilters().getSearchByNamePOIFilter();
|
||||
|
@ -263,30 +300,37 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(app.getIconsCache().getThemedIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new OnClickListener() {
|
||||
toolbar.setNavigationOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
toolbarEdit = (Toolbar) view.findViewById(R.id.toolbar_edit);
|
||||
toolbarEdit.setNavigationIcon(app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark));
|
||||
toolbarEdit.setNavigationContentDescription(R.string.shared_string_cancel);
|
||||
toolbarEdit.setNavigationOnClickListener(new OnClickListener() {
|
||||
toolbarEdit.setNavigationOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
enableSelectionMode(false, -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
titleEdit = (TextView) view.findViewById(R.id.titleEdit);
|
||||
view.findViewById(R.id.shareButton).setOnClickListener(new OnClickListener() {
|
||||
view.findViewById(R.id.shareButton).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
List<HistoryEntry> historyEntries = new ArrayList<HistoryEntry>();
|
||||
|
@ -300,8 +344,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
enableSelectionMode(false, -1);
|
||||
}
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.deleteButton).setOnClickListener(new OnClickListener() {
|
||||
}
|
||||
);
|
||||
view.findViewById(R.id.deleteButton).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
|
@ -329,7 +375,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
}.show(getChildFragmentManager(), "DeleteHistoryConfirmationFragment");
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
viewPager = (LockableViewPager) view.findViewById(R.id.pager);
|
||||
pagerAdapter = new SearchFragmentPagerAdapter(getChildFragmentManager(), getResources());
|
||||
|
@ -340,9 +387,11 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
|
||||
tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
viewPager.addOnPageChangeListener(
|
||||
new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -353,10 +402,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
searchEditText = (EditText) view.findViewById(R.id.searchEditText);
|
||||
searchEditText.addTextChangedListener(new TextWatcher() {
|
||||
searchEditText.addTextChangedListener(
|
||||
new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
@ -380,12 +431,14 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar);
|
||||
clearButton = (ImageButton) view.findViewById(R.id.clearButton);
|
||||
clearButton.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
clearButton.setOnClickListener(new OnClickListener() {
|
||||
clearButton.setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (searchEditText.getText().length() > 0) {
|
||||
|
@ -406,7 +459,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
updateToolbarButton();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
setupSearch(mapActivity);
|
||||
|
||||
|
@ -515,10 +569,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
|
||||
private void updateToolbarButton() {
|
||||
SearchWord word = searchUICore.getPhrase().getLastSelectedWord();
|
||||
if (foundPartialLocation) {
|
||||
buttonToolbarText.setText(app.getString(R.string.advanced_coords_search).toUpperCase());
|
||||
} else if (searchEditText.getText().length() > 0) {
|
||||
SearchWord word = searchUICore.getPhrase().getLastSelectedWord();
|
||||
if (word != null && word.getResult() != null) {
|
||||
buttonToolbarText.setText(app.getString(R.string.show_something_on_map, word.getResult().localeName).toUpperCase());
|
||||
} else {
|
||||
|
@ -527,6 +581,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
} else {
|
||||
buttonToolbarText.setText(app.getString(R.string.shared_string_show_on_map).toUpperCase());
|
||||
}
|
||||
buttonToolbarFilter.setVisibility(word != null && word.getType() != null && word.getType().equals(POI_TYPE) ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void setupSearch(final MapActivity mapActivity) {
|
||||
|
@ -993,6 +1048,16 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
runCoreSearch(txt, false, false);
|
||||
}
|
||||
|
||||
public void replaceQueryWithUiFilter(PoiUIFilter filter) {
|
||||
SearchPhrase searchPhrase = searchUICore.getPhrase();
|
||||
if (searchPhrase.isLastWord(POI_TYPE)) {
|
||||
SearchResult sr = searchPhrase.getLastSelectedWord().getResult();
|
||||
sr.object = filter;
|
||||
String txt = searchUICore.getPhrase().getText(true);
|
||||
runCoreSearch(txt, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void addMoreButton() {
|
||||
QuickSearchMoreListItem moreListItem =
|
||||
new QuickSearchMoreListItem(app, app.getString(R.string.search_POI_level_btn).toUpperCase(), new OnClickListener() {
|
||||
|
|
|
@ -136,12 +136,19 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
core.registerAPI(new SearchWptAPI(app));
|
||||
core.registerAPI(new SearchHistoryAPI(app));
|
||||
|
||||
refreshCustomPoiFilters();
|
||||
|
||||
PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
core.addCustomSearchPoiFilter(poiFilters.getLocalWikiPOIFilter(), 1);
|
||||
core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1);
|
||||
}
|
||||
|
||||
public void refreshCustomPoiFilters() {
|
||||
core.clearCustomSearchPoiFilters();
|
||||
PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
for(CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) {
|
||||
core.addCustomSearchPoiFilter(udf, 0);
|
||||
}
|
||||
core.addCustomSearchPoiFilter(poiFilters.getLocalWikiPOIFilter(), 1);
|
||||
core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1);
|
||||
}
|
||||
|
||||
public void setRepositoriesForSearchUICore(final OsmandApplication app) {
|
||||
|
|
|
@ -0,0 +1,680 @@
|
|||
package net.osmand.plus.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class QuickSearchPoiFilterFragment extends DialogFragment {
|
||||
public static final String TAG = "QuickSearchPoiFilterFragment";
|
||||
|
||||
private static final String QUICK_SEARCH_POI_FILTER_ID_KEY = "quick_search_poi_filter_id_key";
|
||||
private static final String QUICK_SEARCH_POI_FILTER_BY_NAME_KEY = "quick_search_poi_filter_by_name_key";
|
||||
private static final String QUICK_SEARCH_POI_FILTER_SELECTED_ADDITIONALS = "quick_search_poi_filter_selected_additionals";
|
||||
private static final String QUICK_SEARCH_POI_FILTER_COLLAPSED_CATEGORIES = "quick_search_poi_filter_collapsed_categories";
|
||||
private static final String QUICK_SEARCH_POI_FILTER_SHOW_ALL_CATEGORIES = "quick_search_poi_filter_show_all_categories";
|
||||
|
||||
private View view;
|
||||
private ListView listView;
|
||||
private PoiFilterListAdapter adapter;
|
||||
private PoiUIFilter filter;
|
||||
private String filterId;
|
||||
private String nameFilterText = "";
|
||||
private EditText editText;
|
||||
private Set<String> selectedPoiAdditionals = new TreeSet<>();
|
||||
private ArrayList<String> collapsedCategories = new ArrayList<>();
|
||||
private ArrayList<String> showAllCategories = new ArrayList<>();
|
||||
|
||||
public QuickSearchPoiFilterFragment() {
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
boolean isLightTheme = getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
setStyle(STYLE_NO_FRAME, themeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
|
||||
if (getArguments() != null) {
|
||||
filterId = getArguments().getString(QUICK_SEARCH_POI_FILTER_ID_KEY);
|
||||
nameFilterText = getArguments().getString(QUICK_SEARCH_POI_FILTER_BY_NAME_KEY);
|
||||
} else if (savedInstanceState != null) {
|
||||
filterId = savedInstanceState.getString(QUICK_SEARCH_POI_FILTER_ID_KEY);
|
||||
nameFilterText = savedInstanceState.getString(QUICK_SEARCH_POI_FILTER_BY_NAME_KEY);
|
||||
ArrayList<String> selectedList = savedInstanceState.getStringArrayList(QUICK_SEARCH_POI_FILTER_SELECTED_ADDITIONALS);
|
||||
if (selectedList != null) {
|
||||
selectedPoiAdditionals.addAll(selectedList);
|
||||
}
|
||||
ArrayList<String> collapsedList = savedInstanceState.getStringArrayList(QUICK_SEARCH_POI_FILTER_COLLAPSED_CATEGORIES);
|
||||
if (collapsedList != null) {
|
||||
collapsedCategories.addAll(collapsedList);
|
||||
}
|
||||
ArrayList<String> showAllList = savedInstanceState.getStringArrayList(QUICK_SEARCH_POI_FILTER_SHOW_ALL_CATEGORIES);
|
||||
if (showAllList != null) {
|
||||
showAllCategories.addAll(showAllList);
|
||||
}
|
||||
}
|
||||
|
||||
if (filterId != null) {
|
||||
filter = app.getPoiFilters().getFilterById(filterId);
|
||||
}
|
||||
if (filter == null) {
|
||||
filter = app.getPoiFilters().getCustomPOIFilter();
|
||||
filter.clearFilter();
|
||||
}
|
||||
if (selectedPoiAdditionals.size() == 0) {
|
||||
processFilterFields();
|
||||
}
|
||||
|
||||
view = inflater.inflate(R.layout.search_poi_filter, container, false);
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark));
|
||||
toolbar.setNavigationContentDescription(R.string.shared_string_close);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
ImageButton moreButton = (ImageButton) view.findViewById(R.id.moreButton);
|
||||
moreButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getContext(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
MenuItem item;
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.save_filter).setIcon(
|
||||
iconsCache.getThemedIcon(R.drawable.ic_action_save));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
saveFilter();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!filter.isStandardFilter()) {
|
||||
item = optionsMenu.getMenu().add(R.string.delete_filter)
|
||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_delete_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
deleteFilter();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
optionsMenu.show();
|
||||
}
|
||||
});
|
||||
|
||||
listView = (ListView) view.findViewById(android.R.id.list);
|
||||
listView.setBackgroundColor(getResources().getColor(
|
||||
app.getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light
|
||||
: R.color.ctx_menu_info_view_bg_dark));
|
||||
|
||||
View editTextView = inflater.inflate(R.layout.poi_filter_list_item, listView, false);
|
||||
editText = (EditText) editTextView.findViewById(R.id.editText);
|
||||
editText.setText(nameFilterText);
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
nameFilterText = s.toString();
|
||||
}
|
||||
});
|
||||
|
||||
editText.setVisibility(View.VISIBLE);
|
||||
final ImageView textEditIcon = (ImageView) editTextView.findViewById(R.id.icon);
|
||||
textEditIcon.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_search_dark));
|
||||
textEditIcon.setVisibility(View.VISIBLE);
|
||||
editTextView.findViewById(R.id.titleBold).setVisibility(View.GONE);
|
||||
editTextView.findViewById(R.id.titleButton).setVisibility(View.GONE);
|
||||
editTextView.findViewById(R.id.expandItem).setVisibility(View.GONE);
|
||||
editTextView.findViewById(R.id.titleRegular).setVisibility(View.GONE);
|
||||
editTextView.findViewById(R.id.switchItem).setVisibility(View.GONE);
|
||||
editTextView.findViewById(R.id.checkboxItem).setVisibility(View.GONE);
|
||||
listView.addHeaderView(editTextView);
|
||||
|
||||
View bottomShadowView = inflater.inflate(R.layout.card_bottom_divider, listView, false);
|
||||
listView.addFooterView(bottomShadowView);
|
||||
View applyFilterButtonView = inflater.inflate(R.layout.list_item_button, listView, false);
|
||||
AppCompatButton applyFilterButton = (AppCompatButton) applyFilterButtonView.findViewById(R.id.button);
|
||||
applyFilterButton.setText(app.getString(R.string.apply_filters));
|
||||
applyFilterButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
applyFilterFields();
|
||||
((QuickSearchDialogFragment) getParentFragment()).replaceQueryWithUiFilter(filter);
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
listView.addFooterView(applyFilterButtonView);
|
||||
|
||||
adapter = new PoiFilterListAdapter(getMyApplication(), getListItems());
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
PoiFilterListItem item = adapter.getItem(position - listView.getHeaderViewsCount());
|
||||
if (item != null) {
|
||||
switch (item.type) {
|
||||
case GROUP_HEADER:
|
||||
if (item.category != null) {
|
||||
if (collapsedCategories.contains(item.category)) {
|
||||
collapsedCategories.remove(item.category);
|
||||
} else {
|
||||
collapsedCategories.add(item.category);
|
||||
}
|
||||
updateListView();
|
||||
}
|
||||
break;
|
||||
case CHECKBOX_ITEM:
|
||||
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkboxItem);
|
||||
adapter.toggleCheckbox(item, checkBox, !checkBox.isChecked());
|
||||
break;
|
||||
case BUTTON_ITEM:
|
||||
if (item.category != null) {
|
||||
showAllCategories.add(item.category);
|
||||
updateListView();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void deleteFilter() {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setMessage(R.string.edit_filter_delete_dialog_title);
|
||||
builder.setNegativeButton(R.string.shared_string_no, null);
|
||||
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
if (app.getPoiFilters().removePoiFilter(filter)) {
|
||||
Toast.makeText(getContext(), MessageFormat.format(getContext().getText(R.string.edit_filter_delete_message).toString(),
|
||||
filter.getName()), Toast.LENGTH_SHORT).show();
|
||||
app.getSearchUICore().refreshCustomPoiFilters();
|
||||
QuickSearchPoiFilterFragment.this.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private void saveFilter() {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(R.string.access_hint_enter_name);
|
||||
final EditText editText = new EditText(getContext());
|
||||
editText.setHint(R.string.new_filter);
|
||||
editText.setText(filter.getName());
|
||||
final TextView textView = new TextView(getContext());
|
||||
textView.setText(app.getString(R.string.new_filter_desc));
|
||||
textView.setTextAppearance(getContext(), R.style.TextAppearance_ContextMenuSubtitle);
|
||||
LinearLayout ll = new LinearLayout(getContext());
|
||||
ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
ll.setOrientation(LinearLayout.VERTICAL);
|
||||
ll.setPadding(AndroidUtils.dpToPx(getContext(), 20f), AndroidUtils.dpToPx(getContext(), 12f), AndroidUtils.dpToPx(getContext(), 20f), AndroidUtils.dpToPx(getContext(), 12f));
|
||||
ll.addView(editText, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
textView.setPadding(AndroidUtils.dpToPx(getContext(), 4f), AndroidUtils.dpToPx(getContext(), 6f), AndroidUtils.dpToPx(getContext(), 4f), AndroidUtils.dpToPx(getContext(), 4f));
|
||||
ll.addView(textView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
builder.setView(ll);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
builder.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), app);
|
||||
applyFilterFields();
|
||||
if (!Algorithms.isEmpty(filter.getFilterByName())) {
|
||||
nFilter.setSavedFilterByName(filter.getFilterByName());
|
||||
}
|
||||
if (app.getPoiFilters().createPoiFilter(nFilter)) {
|
||||
Toast.makeText(getContext(), MessageFormat.format(getContext().getText(R.string.edit_filter_create_message).toString(),
|
||||
editText.getText().toString()), Toast.LENGTH_SHORT).show();
|
||||
((QuickSearchDialogFragment) getParentFragment()).replaceQueryWithUiFilter(filter);
|
||||
app.getSearchUICore().refreshCustomPoiFilters();
|
||||
QuickSearchPoiFilterFragment.this.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(QUICK_SEARCH_POI_FILTER_ID_KEY, filterId);
|
||||
outState.putString(QUICK_SEARCH_POI_FILTER_BY_NAME_KEY, nameFilterText);
|
||||
outState.putStringArrayList(QUICK_SEARCH_POI_FILTER_SELECTED_ADDITIONALS, new ArrayList<>(selectedPoiAdditionals));
|
||||
outState.putStringArrayList(QUICK_SEARCH_POI_FILTER_COLLAPSED_CATEGORIES, collapsedCategories);
|
||||
outState.putStringArrayList(QUICK_SEARCH_POI_FILTER_SHOW_ALL_CATEGORIES, showAllCategories);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
hideKeyboard();
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
if (editText.hasFocus()) {
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), editText);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateListView() {
|
||||
adapter.setListItems(getListItems());
|
||||
}
|
||||
|
||||
private void applyFilterFields() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!Algorithms.isEmpty(nameFilterText)) {
|
||||
sb.append(nameFilterText);
|
||||
}
|
||||
for (String param : selectedPoiAdditionals) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(param);
|
||||
}
|
||||
filter.setFilterByName(sb.toString());
|
||||
}
|
||||
|
||||
private void processFilterFields() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
String filterByName = filter.getFilterByName();
|
||||
if (!Algorithms.isEmpty(filterByName)) {
|
||||
String keyNameOpen = app.getString(R.string.shared_string_is_open).replace(' ', '_').toLowerCase();
|
||||
String keyNameOpen24 = app.getString(R.string.shared_string_is_open_24_7).replace(' ', '_').toLowerCase();
|
||||
int index = filterByName.indexOf(keyNameOpen);
|
||||
if (index != -1) {
|
||||
selectedPoiAdditionals.add(keyNameOpen);
|
||||
filterByName = filterByName.replaceAll(keyNameOpen, "");
|
||||
}
|
||||
index = filterByName.indexOf(keyNameOpen24);
|
||||
if (index != -1) {
|
||||
selectedPoiAdditionals.add(keyNameOpen24);
|
||||
filterByName = filterByName.replaceAll(keyNameOpen24, "");
|
||||
}
|
||||
|
||||
Map<String, PoiType> poiAdditionals = filter.getPoiAdditionals();
|
||||
List<PoiType> otherAdditionalCategories = app.getPoiTypes().getOtherMapCategory().getPoiAdditionalsCategorized();
|
||||
if (poiAdditionals != null) {
|
||||
Map<String, Set<String>> additionalsMap = new TreeMap<>();
|
||||
extractPoiAdditionals(poiAdditionals.values(), additionalsMap, true);
|
||||
extractPoiAdditionals(otherAdditionalCategories, additionalsMap, true);
|
||||
|
||||
if (additionalsMap.size() > 0) {
|
||||
for (Entry<String, Set<String>> entry : additionalsMap.entrySet()) {
|
||||
for (String poiTypeName : entry.getValue()) {
|
||||
String keyName = poiTypeName.replace(' ', ':').toLowerCase();
|
||||
index = filterByName.indexOf(keyName);
|
||||
if (index != -1) {
|
||||
selectedPoiAdditionals.add(keyName);
|
||||
filterByName = filterByName.replaceAll(keyName, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filterByName.trim().length() > 0 && Algorithms.isEmpty(nameFilterText)) {
|
||||
nameFilterText = filterByName.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<PoiFilterListItem> getListItems() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
int groupId = 0;
|
||||
List<PoiFilterListItem> items = new ArrayList<>();
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.DIVIDER, 0, null, -1, false, false, false, null, null));
|
||||
String keyNameOpen = app.getString(R.string.shared_string_is_open).replace(' ', '_').toLowerCase();
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.SWITCH_ITEM,
|
||||
R.drawable.ic_action_time, app.getString(R.string.shared_string_is_open), ++groupId,
|
||||
false, false, selectedPoiAdditionals.contains(keyNameOpen), null, keyNameOpen));
|
||||
String keyNameOpen24 = app.getString(R.string.shared_string_is_open_24_7).replace(' ', '_').toLowerCase();
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.SWITCH_ITEM,
|
||||
0, app.getString(R.string.shared_string_is_open_24_7), groupId, false, false,
|
||||
selectedPoiAdditionals.contains(keyNameOpen24), null, keyNameOpen24));
|
||||
|
||||
Map<String, PoiType> poiAdditionals = filter.getPoiAdditionals();
|
||||
List<PoiType> otherAdditionalCategories = app.getPoiTypes().getOtherMapCategory().getPoiAdditionalsCategorized();
|
||||
if (poiAdditionals != null) {
|
||||
Map<String, Set<String>> additionalsMap = new TreeMap<>();
|
||||
extractPoiAdditionals(poiAdditionals.values(), additionalsMap, false);
|
||||
extractPoiAdditionals(otherAdditionalCategories, additionalsMap, false);
|
||||
|
||||
if (additionalsMap.size() > 0) {
|
||||
for (Entry<String, Set<String>> entry : additionalsMap.entrySet()) {
|
||||
String category = entry.getKey();
|
||||
boolean expanded = !collapsedCategories.contains(category);
|
||||
boolean showAll = showAllCategories.contains(category);
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.DIVIDER, 0, null, -1, false, false, false, null, null));
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.GROUP_HEADER,
|
||||
R.drawable.ic_action_folder_stroke, category, ++groupId, true, expanded, false, category, null));
|
||||
List<String> poiTypeNames = new ArrayList<>(entry.getValue());
|
||||
Collections.sort(poiTypeNames);
|
||||
for (String poiTypeName : poiTypeNames) {
|
||||
String keyName = poiTypeName.replace(' ', ':').toLowerCase();
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.CHECKBOX_ITEM,
|
||||
0, poiTypeName, groupId, false, false, selectedPoiAdditionals.contains(keyName), category, keyName));
|
||||
}
|
||||
if (!showAll && poiTypeNames.size() > 0) {
|
||||
items.add(new PoiFilterListItem(PoiFilterListItemType.BUTTON_ITEM,
|
||||
0, app.getString(R.string.shared_string_show_all).toUpperCase(), groupId, false, false, false, category, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private void extractPoiAdditionals(Collection<PoiType> poiAdditionals, Map<String, Set<String>> additionalsMap, boolean extractAll) {
|
||||
for (PoiType poiType : poiAdditionals) {
|
||||
String category = poiType.getPoiAdditionalCategoryTranslation();
|
||||
if (category == null) {
|
||||
category = "";
|
||||
}
|
||||
if (collapsedCategories.contains(category) && !extractAll) {
|
||||
if (!additionalsMap.containsKey(category)) {
|
||||
additionalsMap.put(category, new TreeSet<String>());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
boolean showAll = showAllCategories.contains(category) || extractAll;
|
||||
String name = poiType.getTranslation();
|
||||
String keyName = name.replace(' ', ':').toLowerCase();
|
||||
if (showAll || poiType.isTopVisible() || selectedPoiAdditionals.contains(keyName)) {
|
||||
Set<String> adds = additionalsMap.get(category);
|
||||
if (adds == null) {
|
||||
adds = new TreeSet<>();
|
||||
additionalsMap.put(category, adds);
|
||||
}
|
||||
adds.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void showDialog(DialogFragment parentFragment, String filterByName, String filterId) {
|
||||
Bundle bundle = new Bundle();
|
||||
if (filterByName != null) {
|
||||
bundle.putString(QUICK_SEARCH_POI_FILTER_BY_NAME_KEY, filterByName);
|
||||
}
|
||||
if (filterId != null) {
|
||||
bundle.putString(QUICK_SEARCH_POI_FILTER_ID_KEY, filterId);
|
||||
}
|
||||
QuickSearchPoiFilterFragment fragment = new QuickSearchPoiFilterFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(parentFragment.getChildFragmentManager(), TAG);
|
||||
}
|
||||
|
||||
private class PoiFilterListAdapter extends ArrayAdapter<PoiFilterListItem> {
|
||||
private OsmandApplication app;
|
||||
|
||||
PoiFilterListAdapter(OsmandApplication app, List<PoiFilterListItem> items) {
|
||||
super(app, R.layout.poi_filter_list_item, items);
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public void setListItems(List<PoiFilterListItem> items) {
|
||||
setNotifyOnChange(false);
|
||||
clear();
|
||||
for (PoiFilterListItem item : items) {
|
||||
add(item);
|
||||
}
|
||||
setNotifyOnChange(true);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
PoiFilterListItem item = getItem(position);
|
||||
return item != null && item.type == PoiFilterListItemType.DIVIDER ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void toggleSwitch(PoiFilterListItem item, boolean isChecked) {
|
||||
item.checked = isChecked;
|
||||
if (item.checked) {
|
||||
selectedPoiAdditionals.add(item.keyName);
|
||||
} else {
|
||||
selectedPoiAdditionals.remove(item.keyName);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleCheckbox(PoiFilterListItem item, CheckBox checkBox, boolean isChecked) {
|
||||
if (checkBox != null) {
|
||||
checkBox.setChecked(isChecked);
|
||||
}
|
||||
item.checked = isChecked;
|
||||
if (item.checked) {
|
||||
selectedPoiAdditionals.add(item.keyName);
|
||||
} else {
|
||||
selectedPoiAdditionals.remove(item.keyName);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
final PoiFilterListItem item = getItem(position);
|
||||
final PoiFilterListItem nextItem = position < getCount() - 1 ? getItem(position + 1) : null;
|
||||
|
||||
int viewType = getItemViewType(position);
|
||||
|
||||
View view;
|
||||
if (convertView == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
if (viewType == 0) {
|
||||
view = inflater.inflate(R.layout.poi_filter_list_item, null);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.list_item_divider, null);
|
||||
view.setOnClickListener(null);
|
||||
}
|
||||
} else {
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
if (viewType == 1) {
|
||||
return view;
|
||||
}
|
||||
|
||||
final ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||
final TextViewEx titleRegular = (TextViewEx) view.findViewById(R.id.titleRegular);
|
||||
final TextViewEx titleBold = (TextViewEx) view.findViewById(R.id.titleBold);
|
||||
final TextViewEx titleButton = (TextViewEx) view.findViewById(R.id.titleButton);
|
||||
final SwitchCompat switchItem = (SwitchCompat) view.findViewById(R.id.switchItem);
|
||||
final CheckBox checkBoxItem = (CheckBox) view.findViewById(R.id.checkboxItem);
|
||||
final ImageView expandItem = (ImageView) view.findViewById(R.id.expandItem);
|
||||
final View divider = view.findViewById(R.id.divider);
|
||||
|
||||
if (item != null) {
|
||||
if (nextItem != null && nextItem.groupIndex == item.groupIndex) {
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
divider.setVisibility(View.GONE);
|
||||
}
|
||||
if (item.iconId != 0) {
|
||||
icon.setImageDrawable(app.getIconsCache().getThemedIcon(item.iconId));
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
icon.setVisibility(View.GONE);
|
||||
}
|
||||
switchItem.setOnCheckedChangeListener(null);
|
||||
checkBoxItem.setOnCheckedChangeListener(null);
|
||||
switch (item.type) {
|
||||
case GROUP_HEADER:
|
||||
titleBold.setText(item.text);
|
||||
if (item.expandable) {
|
||||
expandItem.setImageDrawable(item.expanded ?
|
||||
app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_up) : app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_down));
|
||||
expandItem.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
expandItem.setVisibility(View.GONE);
|
||||
}
|
||||
titleBold.setVisibility(View.VISIBLE);
|
||||
titleButton.setVisibility(View.GONE);
|
||||
titleRegular.setVisibility(View.GONE);
|
||||
switchItem.setVisibility(View.GONE);
|
||||
checkBoxItem.setVisibility(View.GONE);
|
||||
break;
|
||||
case SWITCH_ITEM:
|
||||
titleRegular.setText(item.text);
|
||||
titleRegular.setVisibility(View.VISIBLE);
|
||||
switchItem.setVisibility(View.VISIBLE);
|
||||
switchItem.setChecked(item.checked);
|
||||
switchItem.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
toggleSwitch(item, isChecked);
|
||||
}
|
||||
});
|
||||
titleBold.setVisibility(View.GONE);
|
||||
titleButton.setVisibility(View.GONE);
|
||||
expandItem.setVisibility(View.GONE);
|
||||
checkBoxItem.setVisibility(View.GONE);
|
||||
break;
|
||||
case CHECKBOX_ITEM:
|
||||
titleRegular.setText(item.text);
|
||||
titleRegular.setVisibility(View.VISIBLE);
|
||||
checkBoxItem.setVisibility(View.VISIBLE);
|
||||
checkBoxItem.setChecked(item.checked);
|
||||
checkBoxItem.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
toggleCheckbox(item, checkBoxItem, isChecked);
|
||||
}
|
||||
});
|
||||
switchItem.setVisibility(View.GONE);
|
||||
titleBold.setVisibility(View.GONE);
|
||||
titleButton.setVisibility(View.GONE);
|
||||
expandItem.setVisibility(View.GONE);
|
||||
break;
|
||||
case BUTTON_ITEM:
|
||||
titleButton.setText(item.text);
|
||||
titleButton.setVisibility(View.VISIBLE);
|
||||
checkBoxItem.setVisibility(View.GONE);
|
||||
switchItem.setVisibility(View.GONE);
|
||||
titleBold.setVisibility(View.GONE);
|
||||
titleRegular.setVisibility(View.GONE);
|
||||
expandItem.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
public enum PoiFilterListItemType {
|
||||
DIVIDER,
|
||||
GROUP_HEADER,
|
||||
SWITCH_ITEM,
|
||||
CHECKBOX_ITEM,
|
||||
BUTTON_ITEM
|
||||
}
|
||||
|
||||
public static class PoiFilterListItem {
|
||||
private PoiFilterListItemType type;
|
||||
private int iconId;
|
||||
private String text;
|
||||
private int groupIndex;
|
||||
private boolean expandable;
|
||||
private boolean expanded;
|
||||
private boolean checked;
|
||||
private String category;
|
||||
private String keyName;
|
||||
|
||||
public PoiFilterListItem(PoiFilterListItemType type, int iconId, String text, int groupIndex,
|
||||
boolean expandable, boolean expanded, boolean checked, String category,
|
||||
String keyName) {
|
||||
this.type = type;
|
||||
this.iconId = iconId;
|
||||
this.text = text;
|
||||
this.groupIndex = groupIndex;
|
||||
this.expandable = expandable;
|
||||
this.expanded = expanded;
|
||||
this.checked = checked;
|
||||
this.category = category;
|
||||
this.keyName = keyName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,6 +78,11 @@ public class SampleApplication extends Application {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslation(String keyName) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue