use of android.view.KeyEvent in project materialistic by hidroh.
the class BaseListActivityLandTest method testBackPressed.
@Test
public void testBackPressed() {
activity.onItemSelected(new TestHnItem(1L) {
@NonNull
@Override
public String getType() {
return STORY_TYPE;
}
});
activity.onKeyDown(KeyEvent.KEYCODE_BACK, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));
verify(keyDelegate).setBackInterceptor(any(KeyDelegate.BackInterceptor.class));
verify(keyDelegate).onKeyDown(anyInt(), any(KeyEvent.class));
}
use of android.view.KeyEvent in project materialistic by hidroh.
the class ThreadPreviewActivityTest method testVolumeNavigation.
@Test
public void testVolumeNavigation() {
activity.onKeyDown(KeyEvent.KEYCODE_VOLUME_UP, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_VOLUME_UP));
verify(keyDelegate).setScrollable(any(Scrollable.class), any());
verify(keyDelegate).onKeyDown(anyInt(), any(KeyEvent.class));
activity.onKeyUp(KeyEvent.KEYCODE_VOLUME_UP, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_VOLUME_UP));
verify(keyDelegate).onKeyUp(anyInt(), any(KeyEvent.class));
activity.onKeyLongPress(KeyEvent.KEYCODE_VOLUME_UP, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_VOLUME_UP));
verify(keyDelegate).onKeyLongPress(anyInt(), any(KeyEvent.class));
}
use of android.view.KeyEvent in project ToolBarLib by jjhesk.
the class MaterialSearchView method initSearchView.
protected void initSearchView() {
mSearchSrcTextView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
onSubmitQuery();
return true;
}
});
mSearchSrcTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mUserQuery = s;
startFilter(s);
MaterialSearchView.this.onTextChanged(s);
}
@Override
public void afterTextChanged(Editable s) {
}
});
mSearchSrcTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
showKeyboard(mSearchSrcTextView);
showSuggestions();
}
}
});
}
use of android.view.KeyEvent in project KJFrameForAndroid by kymjs.
the class CurtainViewController method prepareSlidingLayout.
/**
* 为控件做一些属性设置
*/
protected void prepareSlidingLayout() {
curtainLayoutParams = (FrameLayout.LayoutParams) curtainParent.getLayoutParams();
ViewTreeObserver vto = curtainParent.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
@SuppressLint("NewApi")
public void onGlobalLayout() {
hideCurtainLayout();
ViewTreeObserver obs = curtainParent.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
curtainParent.setOnTouchListener(new OnContentTouchListener());
curtainParent.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && getSlidingStatus() == SlidingStatus.EXPANDED) {
collapse();
return true;
} else {
return false;
}
}
});
}
use of android.view.KeyEvent in project KJFrameForAndroid by kymjs.
the class InputHelper method backspace.
public static void backspace(EditText editText) {
if (editText == null) {
return;
}
KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
Aggregations