Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inceasing Usability by adding Personalized Keyboard feature #57

Merged
merged 1 commit into from
Feb 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.buildmlearn.toolkit.model.TemplateInterface;
import org.buildmlearn.toolkit.simulator.Simulator;
import org.buildmlearn.toolkit.utilities.FileUtils;
import org.buildmlearn.toolkit.utilities.KeyboardHelper;
import org.buildmlearn.toolkit.utilities.SignerThread;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
Expand Down Expand Up @@ -84,6 +85,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
oldFileName = null;
setContentView(R.layout.activity_template_editor);
KeyboardHelper.hideKeyboard(this, findViewById(R.id.toolbar));
KeyboardHelper.hideKeyboard(this,findViewById(R.id.template_editor_listview));
KeyboardHelper.hideKeyboard(this,findViewById(R.id.empty));
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
toolkit = (ToolkitApplication) getApplicationContext();
templateId = getIntent().getIntExtra(Constants.TEMPLATE_ID, -1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.buildmlearn.toolkit.utilities;

import android.app.Activity;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
* User : opticod(Anupam Das)
* Date : 24/2/16.
*/
public class KeyboardHelper {
public static void hideKeyboard(final Activity activity, View view) {
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
View view = activity.getCurrentFocus();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
return false;
}
});
}
}