|
1 | 1 | package fr.free.nrw.commons.upload; |
2 | 2 |
|
| 3 | +import android.app.Activity; |
3 | 4 | import android.content.Context; |
4 | 5 | import android.content.Intent; |
5 | 6 | import android.content.SharedPreferences; |
|
11 | 12 | import android.support.v7.app.AlertDialog; |
12 | 13 | import android.text.Editable; |
13 | 14 | import android.text.TextWatcher; |
| 15 | +import android.util.Log; |
14 | 16 | import android.view.LayoutInflater; |
15 | 17 | import android.view.Menu; |
16 | 18 | import android.view.MenuInflater; |
@@ -136,11 +138,29 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, |
136 | 138 |
|
137 | 139 | titleEdit.addTextChangedListener(textWatcher); |
138 | 140 |
|
| 141 | + titleEdit.setOnFocusChangeListener((v, hasFocus) -> { |
| 142 | + if (!hasFocus) { |
| 143 | + hideKeyboard(v); |
| 144 | + } |
| 145 | + }); |
| 146 | + |
| 147 | + descEdit.setOnFocusChangeListener((v, hasFocus) -> { |
| 148 | + if(!hasFocus){ |
| 149 | + hideKeyboard(v); |
| 150 | + } |
| 151 | + }); |
| 152 | + |
139 | 153 | setLicenseSummary(license); |
140 | 154 |
|
141 | 155 | return rootView; |
142 | 156 | } |
143 | 157 |
|
| 158 | + public void hideKeyboard(View view) { |
| 159 | + Log.i("hide", "hideKeyboard: "); |
| 160 | + InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); |
| 161 | + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); |
| 162 | + } |
| 163 | + |
144 | 164 | @Override |
145 | 165 | public void onDestroyView() { |
146 | 166 | titleEdit.removeTextChangedListener(textWatcher); |
|
0 commit comments