List of usage examples for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS
int HIDE_NOT_ALWAYS
To view the source code for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.
Click Source Link
From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "OnCreate!!~~~"); ctx = this;//from w w w. j av a 2 s.co m // Setup the window //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Set result CANCELED incase the user backs out setResult(Activity.RESULT_CANCELED); //////////////////////////////////////////////////////////////////// tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign)); tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff)); setContentView(tabHost); shp = getSharedPreferences(Utilities.SP_LOGIN, Context.MODE_PRIVATE); editor = shp.edit(); asID = (EditText) findViewById(R.id.assigned_ID); deasID = (EditText) findViewById(R.id.deassigned_ID); AssignButton = (Button) findViewById(R.id.btn_assign); RemoveButton = (Button) findViewById(R.id.btn_remove); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN); asID.setFocusable(true); asID.setFocusableInTouchMode(true); asID.requestFocus(); setListeners(); DialadminPin = AdminPinSetDialog(this); DialadminPin.show(); setHints(); }
From source file:org.imdea.panel.GeneralFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_general, container, false); messages = new ArrayList<>(); messages = DBHelper.recoverMessages(Global.db); Log.i(TAG, "Showing General list"); listv = (ListView) rootView.findViewById(R.id.listViewG); send_btn = (Button) rootView.findViewById(R.id.btnSend); text_field = (EditText) rootView.findViewById(R.id.inputMsg); send_btn.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j ava2s . co m public void onClick(View v) { String text = text_field.getText().toString(); text = text.replace("\n", " "); if (text.isEmpty()) return; if (isBlank(text)) return; BtMessage item = new BtMessage(text, SP.getString("username_field", "anonymous")); item.isMine = true; Log.i(TAG, "NEW MSG" + text); DBHelper.insertMessage(Global.db, item); text_field.setText(""); item.last_mac_address = Global.DEVICE_ADDRESS; if (Global.mqtt) mqttService.sendToPeers(item); getActivity().sendBroadcast(new Intent("org.imdea.panel.MESSAGE_WRITTEN")); InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); refresh(); } }); adapter = new ItemAdapter(getActivity(), messages) { public void onEntrada(Object item, View view) { BtMessage Btitem = (BtMessage) item; TextView text_msg = (TextView) view.findViewById(R.id.msg); text_msg.setText(Btitem.msg); TextView text_user = (TextView) view.findViewById(R.id.name); text_user.setText(Btitem.user); } }; listv.setAdapter(adapter); listv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object listItem = listv.getItemAtPosition(position); Log.i(TAG, "Click! " + listItem.toString()); } }); listv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { final BtMessage listItem = (BtMessage) listv.getItemAtPosition(position); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final CharSequence[] shareItems = { "Delete", "Information", "Share" }; builder.setCancelable(true).setItems(shareItems, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (id == 0) { Intent deleteIntent = new Intent(); deleteIntent.setAction("org.imdea.panel.MESSAGE_DELETED"); deleteIntent.putExtra("HASH", listItem.toHash()); DBHelper.deleteMessage(Global.db, listItem); refresh(); } else if (id == 1) { Intent intent = new Intent(getActivity(), InfoActivity.class); intent.putExtra("HASH", listItem.toHash()); startActivity(intent); } else { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Share")); } } }); AlertDialog alert = builder.create(); alert.show(); return false; } }); return rootView; }
From source file:edu.missouri.bas.activities.AdminManageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "OnCreate!!~~~"); ctx = this;//from w ww. j a va 2s .c o m // Setup the window //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Set result CANCELED incase the user backs out //setResult(Activity.RESULT_CANCELED); //////////////////////////////////////////////////////////////////// tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign)); tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff)); setContentView(tabHost); shp = getSharedPreferences("PINLOGIN", Context.MODE_PRIVATE); editor = shp.edit(); bedTime = ctx.getSharedPreferences(SensorService.BED_TIME, MODE_PRIVATE); editor2 = bedTime.edit(); asID = (EditText) findViewById(R.id.assigned_ID); deasID = (EditText) findViewById(R.id.deassigned_ID); AssignButton = (Button) findViewById(R.id.btn_assign); RemoveButton = (Button) findViewById(R.id.btn_remove); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN); asID.setFocusable(true); asID.setFocusableInTouchMode(true); asID.requestFocus(); setListeners(); Dialog adminPin = AdminPinDialog(this); adminPin.show(); setResult(9); setHints(); }
From source file:com.app.jiaxiaotong.activity.RobotsActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.fragment_robots); inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override//from w ww.j a va2s .com public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = ((MyHXSDKHelper) HXSDKHelper.getInstance()).getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }
From source file:com.efithealth.app.activity.RobotsActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.fragment_robots); inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); swipeRefreshLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override/*w ww. jav a2 s . c o m*/ public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }
From source file:com.longshihan.mvpretrofit.activity.im.RobotsActivity.java
@Override protected void initAllMembersView(Bundle savedInstanceState) { inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); ListView mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); if (android.os.Build.VERSION.SDK_INT >= 14) { swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); }/*from www. j av a 2s. c o m*/ progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }
From source file:app.view.chat.ChatHistoryFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); errorItem = (RelativeLayout) getView().findViewById(R.id.rl_error_item); errorText = (TextView) errorItem.findViewById(R.id.tv_connect_errormsg); // contact list contactList = DemoApplication.getInstance().getContactList(); listView = (ListView) getView().findViewById(R.id.list); adapter = new ChatHistoryAdapter(getActivity(), 1, loadUsersWithRecentChat()); // adapter//from ww w.j a v a 2 s . co m listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { EMContact emContact = adapter.getItem(position); if (adapter.getItem(position).getUsername().equals(DemoApplication.getInstance().getUsername())) Toast.makeText(getActivity(), "??", Toast.LENGTH_SHORT).show(); else { // ?? Intent intent = new Intent(getActivity(), ChatActivity.class); if (emContact instanceof EMGroup) { //it is group chat intent.putExtra("chatType", ChatActivity.CHATTYPE_GROUP); intent.putExtra("groupId", ((EMGroup) emContact).getGroupId()); } else { //it is single chat intent.putExtra("userId", emContact.getUsername()); } startActivity(intent); } } }); // ?? registerForContextMenu(listView); listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // ?? if (getActivity().getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getActivity().getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); // ? query = (EditText) getView().findViewById(R.id.query); // ?button clearSearch = (ImageButton) getView().findViewById(R.id.search_clear); query.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s); if (s.length() > 0) { clearSearch.setVisibility(View.VISIBLE); } else { clearSearch.setVisibility(View.INVISIBLE); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void afterTextChanged(Editable s) { } }); clearSearch.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { query.getText().clear(); } }); }
From source file:liqui.droid.activity.Base.java
/** * Hide keyboard./*from w w w . j av a 2 s . c o m*/ * * @param binder the binder */ public void hideKeyboard(IBinder binder) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(binder, InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:app.view.chat.ContactListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); listView = (ListView) getView().findViewById(R.id.list); sideBar = (SideBar) getView().findViewById(R.id.sidebar); sideBar.setListView(listView);// w w w . j a va2s . co m contactList = new ArrayList<User>(); // ?contactlist getContactList(); // adapter adapter = new ContactAdapter(getActivity(), R.layout.row_contact, contactList, sideBar); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String username = adapter.getItem(position).getUsername(); if (Constant.NEW_FRIENDS_USERNAME.equals(username)) { // ? User user = DemoApplication.getInstance().getContactList().get(Constant.NEW_FRIENDS_USERNAME); user.setUnreadMsgCount(0); startActivity(new Intent(getActivity(), NewFriendsMsgActivity.class)); } else if (Constant.GROUP_USERNAME.equals(username)) { // ?? startActivity(new Intent(getActivity(), GroupsActivity.class)); } else { // demo?? startActivity(new Intent(getActivity(), ChatActivity.class).putExtra("userId", adapter.getItem(position).getUsername())); } } }); listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // ?? if (getActivity().getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getActivity().getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); ImageView addContactView = (ImageView) getView().findViewById(R.id.iv_new_contact); // ? addContactView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getActivity(), AddContactActivity.class)); } }); registerForContextMenu(listView); }
From source file:com.nxt.yn.app.ui.RobotsActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); MyApplication.getInstance().addActivity(this); setContentView(R.layout.em_fragment_robots); findViewById(R.id.layout_title).setBackgroundColor( ZPreferenceUtils.getPrefInt(Constant.SKIN_COLOR, getResources().getColor(R.color.title_color))); inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override//w w w .jav a 2 s . c o m public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }