Fix - add fav/wpt: select name and open keyboard automatically
This commit is contained in:
parent
41b0baa36e
commit
51234689df
3 changed files with 22 additions and 6 deletions
|
@ -142,6 +142,7 @@
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textColorHint="?android:textColorSecondary"
|
android:textColorHint="?android:textColorSecondary"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
android:inputType="text"/>
|
android:inputType="text"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textColorHint="?android:textColorSecondary"
|
android:textColorHint="?android:textColorSecondary"
|
||||||
android:text="Name"
|
android:text="Name"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
android:inputType="text"/>
|
android:inputType="text"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
@ -44,6 +45,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
private int mainViewHeight;
|
private int mainViewHeight;
|
||||||
|
private EditText nameEdit;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +105,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
|
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
|
||||||
categoryCaption.setText(getCategoryCaption());
|
categoryCaption.setText(getCategoryCaption());
|
||||||
|
|
||||||
EditText nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
||||||
nameEdit.setText(getNameInitValue());
|
nameEdit.setText(getNameInitValue());
|
||||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
||||||
categoryEdit.setText(getCategoryInitValue());
|
categoryEdit.setText(getCategoryInitValue());
|
||||||
|
@ -152,6 +154,16 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
|
getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (getEditor().isNew()) {
|
||||||
|
nameEdit.selectAll();
|
||||||
|
nameEdit.requestFocus();
|
||||||
|
AndroidUtils.softKeyboardDelayed(nameEdit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
@ -233,6 +245,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
|
|
||||||
private void hideKeyboard() {
|
private void hideKeyboard() {
|
||||||
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
|
if (inputMethodManager != null) {
|
||||||
View currentFocus = getActivity().getCurrentFocus();
|
View currentFocus = getActivity().getCurrentFocus();
|
||||||
if (currentFocus != null) {
|
if (currentFocus != null) {
|
||||||
IBinder windowToken = currentFocus.getWindowToken();
|
IBinder windowToken = currentFocus.getWindowToken();
|
||||||
|
@ -241,6 +254,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void savePressed() {
|
protected void savePressed() {
|
||||||
save(true);
|
save(true);
|
||||||
|
|
Loading…
Reference in a new issue