Skip to content

Commit c0db69e

Browse files
committed
Added #41 , Personalized Keyboard feature
1 parent 73699fc commit c0db69e

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

source-code/app/src/main/java/org/buildmlearn/toolkit/activity/TemplateEditor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.buildmlearn.toolkit.model.TemplateInterface;
3838
import org.buildmlearn.toolkit.simulator.Simulator;
3939
import org.buildmlearn.toolkit.utilities.FileUtils;
40+
import org.buildmlearn.toolkit.utilities.KeyboardHelper;
4041
import org.buildmlearn.toolkit.utilities.SignerThread;
4142
import org.w3c.dom.Attr;
4243
import org.w3c.dom.Document;
@@ -84,6 +85,9 @@ protected void onCreate(Bundle savedInstanceState) {
8485
super.onCreate(savedInstanceState);
8586
oldFileName = null;
8687
setContentView(R.layout.activity_template_editor);
88+
KeyboardHelper.hideKeyboard(this, findViewById(R.id.toolbar));
89+
KeyboardHelper.hideKeyboard(this,findViewById(R.id.template_editor_listview));
90+
KeyboardHelper.hideKeyboard(this,findViewById(R.id.empty));
8791
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
8892
toolkit = (ToolkitApplication) getApplicationContext();
8993
templateId = getIntent().getIntExtra(Constants.TEMPLATE_ID, -1);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.buildmlearn.toolkit.utilities;
2+
3+
import android.app.Activity;
4+
import android.view.MotionEvent;
5+
import android.view.View;
6+
import android.view.inputmethod.InputMethodManager;
7+
8+
/**
9+
* User : opticod(Anupam Das)
10+
* Date : 24/2/16.
11+
*/
12+
public class KeyboardHelper {
13+
public static void hideKeyboard(final Activity activity, View view) {
14+
view.setOnTouchListener(new View.OnTouchListener() {
15+
@Override
16+
public boolean onTouch(View v, MotionEvent event) {
17+
View view = activity.getCurrentFocus();
18+
if (view != null) {
19+
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
20+
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
21+
}
22+
return false;
23+
}
24+
});
25+
}
26+
}
27+

0 commit comments

Comments
 (0)