Example usage for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS

List of usage examples for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.

Prototype

int HIDE_NOT_ALWAYS

To view the source code for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.

Click Source Link

Document

Flag for #hideSoftInputFromWindow and InputMethodService#requestShowSelf(int) to indicate that the soft input window should normally be hidden, unless it was originally shown with #SHOW_FORCED .

Usage

From source file:cn.ucai.SuperWechat.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 w  w  .ja  v  a 2s.  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.kevin.cattalk.ui.RobotsActivity.java

@Override
@TargetApi(14)/*from w  w w  .  j a va2s  .co  m*/
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    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);
    }
    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:cn.ucai.foraging.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(cn.ucai.foraging.R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(cn.ucai.foraging.R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(cn.ucai.foraging.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(cn.ucai.foraging.R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override//ww  w  .j  a v  a 2 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:cmu.cconfs.instantMessage.activities.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   ww  w . j a  v  a  2 s. c  o m*/
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((IMHXSDKHelper) 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.hzx.luoyechat.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    inflateContentView(R.layout.fragment_robots, R.string.robot_chat, true);

    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 w w.ja  v  a  2  s  . c  om
        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:cn.moon.superwechat.ui.RobotsActivity.java

@Override
@TargetApi(14)//ww w.j  a  va  2s .  c  om
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(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);
    }
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = SuperWeChatHelper.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:cn.ucai.superwechat.ui.RobotsActivity.java

@Override
@TargetApi(14)/*  w ww.  j a v a2s  .  co  m*/
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(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);
    }
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = SuperWeChatDemoHelper.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:cn.gen.superwechat.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(cn.gen.superwechat.R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(cn.gen.superwechat.R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(cn.gen.superwechat.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(cn.gen.superwechat.R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override/*w ww  .  ja  va2s. c om*/
        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.app.khclub.base.easeim.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//  ww w  . ja  v a 2s.  com
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((KHHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
    }
    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;
        }
    });

    getRobotNamesFromServer();
}

From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "OnCreate!!~~~");

    ctx = this;// w w  w  . j  a v  a  2s  .co  m
    // Setup the window
    //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set result CANCELED in case 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(Util.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();
}