Skip to content

Commit

Permalink
Fix openMF#937:Hiding keyboard on button press
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshGautam committed May 19, 2018
1 parent 6f677a1 commit b04728a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.mifos.mifosxdroid.core;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ProgressBar;
import android.widget.ViewFlipper;

Expand Down Expand Up @@ -48,4 +50,11 @@ public void showProgress(boolean show) {
" Fragment contains a ViewFlipper with ID \"view_flipper\"?");
}
}

public void hideKeyboard(View view) {
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager
.RESULT_UNCHANGED_SHOWN);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
Expand Down Expand Up @@ -47,6 +48,9 @@ public class IdentifierDialogFragment extends ProgressableDialogFragment impleme
@BindView(R.id.et_description)
EditText et_description;

@BindView(R.id.btn_create_identifier)
Button btn_identifier;

@BindView(R.id.et_unique_id)
EditText et_unique_id;

Expand Down Expand Up @@ -126,12 +130,12 @@ public void showIdentifierSpinners() {

@OnClick(R.id.btn_create_identifier)
void onClickCreateIdentifier() {

if (et_unique_id.getText().toString().trim().equals("")) {
et_unique_id.setError(getResources().getString(R.string.unique_id_required));
} else if (mListIdentifierType.size() == 0) {
showError(R.string.empty_identifier_document_type);
} else {
hideKeyboard(btn_identifier);
IdentifierPayload identifierPayload = new IdentifierPayload();
identifierPayload.setDocumentTypeId(identifierDocumentTypeId);
identifierPayload.setStatus(status);
Expand All @@ -145,7 +149,6 @@ void onClickCreateIdentifier() {
identifier.setDocumentKey(et_unique_id.getText().toString());
identifier.setDocumentType(documentTypeHashMap
.get(sp_identifier_type.getSelectedItem().toString()));

mIdentifierDialogPresenter.createClientIdentifier(clientId, identifierPayload);
}
}
Expand Down

0 comments on commit b04728a

Please sign in to comment.