Skip to content

Commit b04728a

Browse files
committed
Fix #937:Hiding keyboard on button press
1 parent 6f677a1 commit b04728a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableDialogFragment.java

+9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.mifos.mifosxdroid.core;
22

3+
import android.content.Context;
34
import android.os.Bundle;
45
import android.support.annotation.Nullable;
56
import android.support.v4.app.DialogFragment;
67
import android.util.Log;
78
import android.view.View;
9+
import android.view.inputmethod.InputMethodManager;
810
import android.widget.ProgressBar;
911
import android.widget.ViewFlipper;
1012

@@ -48,4 +50,11 @@ public void showProgress(boolean show) {
4850
" Fragment contains a ViewFlipper with ID \"view_flipper\"?");
4951
}
5052
}
53+
54+
public void hideKeyboard(View view) {
55+
InputMethodManager inputManager = (InputMethodManager) getActivity()
56+
.getSystemService(Context.INPUT_METHOD_SERVICE);
57+
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager
58+
.RESULT_UNCHANGED_SHOWN);
59+
}
5160
}

mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/identifierdialog/IdentifierDialogFragment.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.view.ViewGroup;
88
import android.widget.AdapterView;
99
import android.widget.ArrayAdapter;
10+
import android.widget.Button;
1011
import android.widget.EditText;
1112
import android.widget.Spinner;
1213
import android.widget.Toast;
@@ -47,6 +48,9 @@ public class IdentifierDialogFragment extends ProgressableDialogFragment impleme
4748
@BindView(R.id.et_description)
4849
EditText et_description;
4950

51+
@BindView(R.id.btn_create_identifier)
52+
Button btn_identifier;
53+
5054
@BindView(R.id.et_unique_id)
5155
EditText et_unique_id;
5256

@@ -126,12 +130,12 @@ public void showIdentifierSpinners() {
126130

127131
@OnClick(R.id.btn_create_identifier)
128132
void onClickCreateIdentifier() {
129-
130133
if (et_unique_id.getText().toString().trim().equals("")) {
131134
et_unique_id.setError(getResources().getString(R.string.unique_id_required));
132135
} else if (mListIdentifierType.size() == 0) {
133136
showError(R.string.empty_identifier_document_type);
134137
} else {
138+
hideKeyboard(btn_identifier);
135139
IdentifierPayload identifierPayload = new IdentifierPayload();
136140
identifierPayload.setDocumentTypeId(identifierDocumentTypeId);
137141
identifierPayload.setStatus(status);
@@ -145,7 +149,6 @@ void onClickCreateIdentifier() {
145149
identifier.setDocumentKey(et_unique_id.getText().toString());
146150
identifier.setDocumentType(documentTypeHashMap
147151
.get(sp_identifier_type.getSelectedItem().toString()));
148-
149152
mIdentifierDialogPresenter.createClientIdentifier(clientId, identifierPayload);
150153
}
151154
}

0 commit comments

Comments
 (0)