Fix: ask to unlock device if it requires keyboard interaction while in FLAG_SHOW_WHEN_LOCKED mode.
This commit is contained in:
parent
eb2d577c2e
commit
90ec2ddd79
13 changed files with 23 additions and 19 deletions
|
@ -96,20 +96,24 @@ public class AndroidUtils {
|
|||
return context.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
|
||||
}
|
||||
|
||||
public static void softKeyboardDelayed(final View view) {
|
||||
public static void softKeyboardDelayed(final Activity activity, final View view) {
|
||||
view.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!isHardwareKeyboardAvailable(view.getContext())) {
|
||||
showSoftKeyboard(view);
|
||||
showSoftKeyboard(activity,view);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void showSoftKeyboard(final View view) {
|
||||
public static void showSoftKeyboard(final Activity activity, final View view) {
|
||||
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
KeyguardManager keyguardManager = (KeyguardManager) view.getContext().getSystemService(Context.KEYGUARD_SERVICE);
|
||||
keyguardManager.requestDismissKeyguard(activity,null);
|
||||
}
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class FavoritesSearchFragment extends DialogFragment {
|
|||
|
||||
private void openKeyboard() {
|
||||
searchEditText.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(searchEditText);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), searchEditText);
|
||||
}
|
||||
|
||||
public void hideKeyboard() {
|
||||
|
|
|
@ -113,7 +113,7 @@ public class FavoriteDialogs {
|
|||
editText.requestFocus();
|
||||
final AutoCompleteTextView cat = (AutoCompleteTextView) dialog.findViewById(R.id.Category);
|
||||
cat.setText(point.getCategory());
|
||||
AndroidUtils.softKeyboardDelayed(editText);
|
||||
AndroidUtils.softKeyboardDelayed(activity, editText);
|
||||
}
|
||||
|
||||
public static Dialog createAddFavouriteDialog(final Activity activity, final Bundle args) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class EditCategoryDialogFragment extends DialogFragment {
|
|||
nameEdit = (EditText)v.findViewById(R.id.edit_name);
|
||||
nameEdit.setText(name);
|
||||
nameEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(nameEdit);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), nameEdit);
|
||||
colorSpinner = (Spinner)v.findViewById(R.id.edit_color);
|
||||
final TIntArrayList colors = new TIntArrayList();
|
||||
final int intColor = color;
|
||||
|
|
|
@ -207,7 +207,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
if (editor != null && editor.isNew()) {
|
||||
nameEdit.selectAll();
|
||||
nameEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(nameEdit);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), nameEdit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
addDelDescription.setText(view.getResources().getString(R.string.delete_description));
|
||||
View descriptionEdit = view.findViewById(R.id.description_edit);
|
||||
descriptionEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(descriptionEdit);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), descriptionEdit);
|
||||
} else {
|
||||
descriptionCaption.setVisibility(View.GONE);
|
||||
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
||||
|
@ -267,7 +267,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
deleteIcon.setVisibility(View.GONE);
|
||||
nameEdit.selectAll();
|
||||
nameEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(nameEdit);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), nameEdit);
|
||||
} else {
|
||||
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
||||
deleteButton.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -391,7 +391,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
final View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
AndroidUtils.softKeyboardDelayed(focusedView);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), focusedView);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -707,7 +707,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
final View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
if (!isOsmandKeyboardOn()) {
|
||||
AndroidUtils.softKeyboardDelayed(focusedView);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), focusedView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1039,7 +1039,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AndroidUtils.showSoftKeyboard(focusedView);
|
||||
AndroidUtils.showSoftKeyboard(getActivity(), focusedView);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
changeOsmandKeyboardVisibility(true);
|
||||
}
|
||||
} else if (!softKeyboardShown && focusedView != null) {
|
||||
AndroidUtils.softKeyboardDelayed(focusedView);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), focusedView);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
|||
});
|
||||
poiNameEditText.setText(editPoiData.getTag(OSMSettings.OSMTagKey.NAME.getValue()));
|
||||
poiNameEditText.requestFocus();
|
||||
AndroidUtils.showSoftKeyboard(poiNameEditText);
|
||||
AndroidUtils.showSoftKeyboard(getActivity(), poiNameEditText);
|
||||
poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout);
|
||||
poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText);
|
||||
AndroidUtils.setTextHorizontalGravity(poiTypeEditText, Gravity.START);
|
||||
|
|
|
@ -450,7 +450,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
((EditText) view.findViewById(R.id.message_field)).setText(text);
|
||||
}
|
||||
view.findViewById(R.id.message_field).requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(view.findViewById(R.id.message_field));
|
||||
AndroidUtils.softKeyboardDelayed(activity, view.findViewById(R.id.message_field));
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.shared_string_commit);
|
||||
|
|
|
@ -223,7 +223,7 @@ public class QuickSearchCustomPoiFragment extends DialogFragment implements OnFi
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
searchEditText.requestFocus();
|
||||
AndroidUtils.showSoftKeyboard(searchEditText);
|
||||
AndroidUtils.showSoftKeyboard(getActivity(), searchEditText);
|
||||
}
|
||||
});
|
||||
searchCloseIcon = view.findViewById(R.id.search_close);
|
||||
|
|
|
@ -1928,7 +1928,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
|
||||
private void openKeyboard() {
|
||||
searchEditText.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(searchEditText);
|
||||
AndroidUtils.softKeyboardDelayed(getActivity(), searchEditText);
|
||||
}
|
||||
|
||||
public void replaceQueryWithText(String txt) {
|
||||
|
|
|
@ -210,7 +210,7 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
searchEditText.requestFocus();
|
||||
AndroidUtils.showSoftKeyboard(searchEditText);
|
||||
AndroidUtils.showSoftKeyboard(getActivity(), searchEditText);
|
||||
}
|
||||
});
|
||||
ImageView searchCloseIcon = root.findViewById(R.id.search_close);
|
||||
|
|
|
@ -368,7 +368,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
|||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if(hasFocus){
|
||||
profileName.setSelection(profileName.getText().length());
|
||||
AndroidUtils.showSoftKeyboard(profileName);
|
||||
AndroidUtils.showSoftKeyboard(getMyActivity(), profileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue