Merge branch 'master' of github.com:osmandapp/Osmand
This commit is contained in:
commit
3983371f9d
1 changed files with 49 additions and 55 deletions
|
@ -1,24 +1,5 @@
|
||||||
package net.osmand.plus.osmedit;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
|
||||||
import net.osmand.StringMatcher;
|
|
||||||
import net.osmand.osm.AbstractPoiType;
|
|
||||||
import net.osmand.osm.MapPoiTypes;
|
|
||||||
import net.osmand.osm.PoiCategory;
|
|
||||||
import net.osmand.osm.PoiFilter;
|
|
||||||
import net.osmand.osm.PoiType;
|
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
@ -41,6 +22,25 @@ import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.StringMatcher;
|
||||||
|
import net.osmand.osm.AbstractPoiType;
|
||||||
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.osm.PoiFilter;
|
||||||
|
import net.osmand.osm.PoiType;
|
||||||
|
import net.osmand.osm.edit.OSMSettings;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class AdvancedEditPoiFragment extends Fragment
|
public class AdvancedEditPoiFragment extends Fragment
|
||||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||||
private static final String TAG = "AdvancedEditPoiFragment";
|
private static final String TAG = "AdvancedEditPoiFragment";
|
||||||
|
@ -217,25 +217,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
initAutocompleteTextView(tagEditText, tagAdapter);
|
||||||
tagEditText.setAdapter(tagAdapter);
|
|
||||||
tagEditText.setThreshold(1);
|
|
||||||
tagEditText.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
||||||
builder.setAdapter(tagAdapter, new Dialog.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
tagAdapter.getItem(which);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
builder.create();
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
valueEditText.setText(vl);
|
valueEditText.setText(vl);
|
||||||
valueEditText.addTextChangedListener(new TextWatcher() {
|
valueEditText.addTextChangedListener(new TextWatcher() {
|
||||||
|
@ -255,23 +237,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
valueEditText.setAdapter(valueAdapter);
|
initAutocompleteTextView(valueEditText, valueAdapter);
|
||||||
valueEditText.setThreshold(1);
|
|
||||||
valueEditText.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
||||||
builder.setAdapter(valueAdapter, new Dialog.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
valueAdapter.getItem(which);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
builder.create();
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
linearLayout.addView(convertView);
|
linearLayout.addView(convertView);
|
||||||
tagEditText.requestFocus();
|
tagEditText.requestFocus();
|
||||||
|
@ -292,6 +258,34 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void initAutocompleteTextView(final AutoCompleteTextView textView,
|
||||||
|
final ArrayAdapter<String> adapter) {
|
||||||
|
textView.setAdapter(adapter);
|
||||||
|
textView.setThreshold(1);
|
||||||
|
textView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
|
||||||
|
builder.setAdapter(adapter, new Dialog.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
textView.setText(adapter.getItem(which));
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
textView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if (hasFocus) {
|
||||||
|
adapter.getFilter().filter(textView.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static void addPoiToStringSet(AbstractPoiType abstractPoiType, Set<String> stringSet,
|
private static void addPoiToStringSet(AbstractPoiType abstractPoiType, Set<String> stringSet,
|
||||||
Set<String> values) {
|
Set<String> values) {
|
||||||
if (abstractPoiType instanceof PoiType) {
|
if (abstractPoiType instanceof PoiType) {
|
||||||
|
|
Loading…
Reference in a new issue