Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-30 14:02:31 +01:00
commit 1dcf9c7b4f
3 changed files with 22 additions and 6 deletions

View file

@ -142,6 +142,7 @@
android:layout_marginLeft="8dp"
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:imeOptions="actionDone"
android:inputType="text"/>

View file

@ -137,6 +137,7 @@
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:text="Name"
android:imeOptions="actionDone"
android:inputType="text"/>

View file

@ -24,6 +24,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
@ -44,6 +45,7 @@ public abstract class PointEditorFragment extends Fragment {
private View view;
private int mainViewHeight;
private EditText nameEdit;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
@ -103,7 +105,7 @@ public abstract class PointEditorFragment extends Fragment {
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
categoryCaption.setText(getCategoryCaption());
EditText nameEdit = (EditText) view.findViewById(R.id.name_edit);
nameEdit = (EditText) view.findViewById(R.id.name_edit);
nameEdit.setText(getNameInitValue());
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
categoryEdit.setText(getCategoryInitValue());
@ -152,6 +154,16 @@ public abstract class PointEditorFragment extends Fragment {
getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
}
@Override
public void onResume() {
super.onResume();
if (getEditor().isNew()) {
nameEdit.selectAll();
nameEdit.requestFocus();
AndroidUtils.softKeyboardDelayed(nameEdit);
}
}
@Override
public void onStop() {
super.onStop();
@ -233,11 +245,13 @@ public abstract class PointEditorFragment extends Fragment {
private void hideKeyboard() {
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
View currentFocus = getActivity().getCurrentFocus();
if (currentFocus != null) {
IBinder windowToken = currentFocus.getWindowToken();
if (windowToken != null) {
inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
if (inputMethodManager != null) {
View currentFocus = getActivity().getCurrentFocus();
if (currentFocus != null) {
IBinder windowToken = currentFocus.getWindowToken();
if (windowToken != null) {
inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
}
}
}
}