net.yslibrary.android.keyboardvisibilityevent.util.UIUtil Java Examples

The following examples show how to use net.yslibrary.android.keyboardvisibilityevent.util.UIUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InputDialog.java    From ChatRecyclerView with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final EditText editText = (EditText) view.findViewById(R.id.mEtInput);
    view.findViewById(R.id.mBtnSend).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mAction.send(editText.getText().toString());
            dismiss();
        }
    });
    KeyboardVisibilityEvent.setEventListener(getActivity(),
            new KeyboardVisibilityEventListener() {
                @Override
                public void onVisibilityChanged(boolean isOpen) {
                    if (!isOpen) {
                        dismiss();
                    }
                }
            });
    editText.post(new Runnable() {
        @Override
        public void run() {
            UIUtil.showKeyboard(getContext(), editText);
        }
    });
}
 
Example #2
Source File: MainActivity.java    From photosearcher with Apache License 2.0 5 votes vote down vote up
private void setupRightDrawer() {
    mTabListAdapter = new TabListAdapter(
            mTimelineManager,
            this,
            this::onDeleteQuery,
            this::onMoveTab,
            this::onTabSelect);

    mTabListTouchCallback = new TabListTouchHelperCallback(mTabListAdapter);

    mTabList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    mTabList.setHasFixedSize(true);
    mTabList.setAdapter(mTabListAdapter);

    mItemTouchHelper = new ItemTouchHelper(mTabListTouchCallback);
    mItemTouchHelper.attachToRecyclerView(mTabList);

    mDrawerToggle = new ActionBarDrawerToggle(
            this,
            mDrawerLayout,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close) {

        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            UIUtil.hideKeyboard(MainActivity.this);

            int newPosition = mCurrentTabPosition;
            mDrawerToggle.syncState();

            mHandler.postDelayed(() -> mViewPager.setCurrentItem(newPosition, false), 100);
        }
    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);
}