net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent Java Examples

The following examples show how to use net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent. 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: AuthFragment.java    From android-login with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  View root = inflater.inflate(authLayout(), container, false);
  ButterKnife.bind(this, root);
  KeyboardVisibilityEvent.setEventListener(getActivity(), isOpen -> {
    callback.scale(isOpen);
    if (!isOpen) {
      clearFocus();
    }
  });
  return root;
}
 
Example #2
Source File: AuthFragment.java    From android-login with MIT License 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  KeyboardVisibilityEvent.setEventListener(getActivity(), isOpen -> {
    final float scale = isOpen ? 0.75f : 1f;
    ViewCompat.animate(logo)
            .scaleX(scale)
            .scaleY(scale)
            .setDuration(300)
            .start();
    if (!isOpen) cleaFocus();
  });
}
 
Example #3
Source File: L3PostActivity.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
private void initKeyBoard() {
    KeyboardVisibilityEvent.setEventListener(this, new KeyboardVisibilityEventListener() {
        @Override
        public void onVisibilityChanged(boolean isOpen) {
            if (isOpen) {
                checkFace.setChecked(false);
            }
        }
    });
    facePanel.setOnFaceItemClickListener(this);
}
 
Example #4
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 #5
Source File: RxKeyboard.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void subscribe(ObservableEmitter<Boolean> emitter) throws Exception {
    unregistrar = KeyboardVisibilityEvent.registerEventListener(activity, isOpen -> {
        if (!emitter.isDisposed()) {
            emitter.onNext(isOpen);
        }
    });
    emitter.setCancellable(() -> {
        activity = null;
        unregistrar.unregister();
        unregistrar = null;
    });
}