android.view.View.OnFocusChangeListener Java Examples

The following examples show how to use android.view.View.OnFocusChangeListener. 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: ViewGroupFocusHelper.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the alpha of this FocusIndicatorHelper to 0 when a view with this listener
 * receives focus.
 */
public View.OnFocusChangeListener getHideIndicatorOnFocusListener() {
    return new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                endCurrentAnimation();
                setCurrentView(null);
                setAlpha(0);
                invalidateDirty();
            }
        }
    };
}
 
Example #2
Source File: BaseDialog.java    From VSigner with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 获取焦点改变事件监听,设置EditText文本默认全选
 * @return 焦点改变事件监听
 */
protected OnFocusChangeListener GetOnFocusChangeListener() {
	return new OnFocusChangeListener() {
		public void onFocusChange(View v, boolean hasFocus) {
			if (hasFocus && v instanceof EditText) {
				((EditText) v).setSelection(0, ((EditText) v).getText().length());
			}
		}
	};
}
 
Example #3
Source File: DialtactsActivity.java    From coursera-android with MIT License 5 votes vote down vote up
private void prepareSearchView() {
    final View searchViewLayout =
            getLayoutInflater().inflate(R.layout.dialtacts_custom_action_bar, null);
    mSearchView = (SearchView) searchViewLayout.findViewById(R.id.search_view);
    mSearchView.setOnQueryTextListener(mPhoneSearchQueryTextListener);
    mSearchView.setOnCloseListener(mPhoneSearchCloseListener);
    // Since we're using a custom layout for showing SearchView instead of letting the
    // search menu icon do that job, we need to manually configure the View so it looks
    // "shown via search menu".
    // - it should be iconified by default
    // - it should not be iconified at this time
    // See also comments for onActionViewExpanded()/onActionViewCollapsed()
    mSearchView.setIconifiedByDefault(true);
    mSearchView.setQueryHint(getString(R.string.hint_findContacts));
    mSearchView.setIconified(false);
    mSearchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean hasFocus) {
            if (hasFocus) {
                showInputMethod(view.findFocus());
            }
        }
    });

    if (!ViewConfiguration.get(this).hasPermanentMenuKey()) {
        // Filter option menu should be shown on the right side of SearchView.
        final View filterOptionView = searchViewLayout.findViewById(R.id.search_option);
        filterOptionView.setVisibility(View.VISIBLE);
        filterOptionView.setOnClickListener(mFilterOptionClickListener);
    }

    getActionBar().setCustomView(searchViewLayout,
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
 
Example #4
Source File: FullScreenContext.java    From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public View.OnFocusChangeListener getOnFocusChangeListener()
{
	if (_onFocusChangeListener == null)
	{
		_onFocusChangeListener = getDecorView().getOnFocusChangeListener();
	}
	
	return _onFocusChangeListener; 
}
 
Example #5
Source File: AllAppsGridAdapter.java    From LaunchEnr with GNU General Public License v3.0 4 votes vote down vote up
void setIconFocusListener(OnFocusChangeListener focusListener) {
    mIconFocusListener = focusListener;
}
 
Example #6
Source File: FocusedItemDecorator.java    From LaunchEnr with GNU General Public License v3.0 4 votes vote down vote up
public OnFocusChangeListener getFocusListener() {
    return mHelper;
}
 
Example #7
Source File: ClearableEditText.java    From SimpleDialogFragments with Apache License 2.0 4 votes vote down vote up
@Override
public void setOnFocusChangeListener(OnFocusChangeListener f) {
    this.f = f;
}
 
Example #8
Source File: ClearableEditText.java    From SimpleDialogFragments with Apache License 2.0 4 votes vote down vote up
@Override
public void setOnFocusChangeListener(OnFocusChangeListener f) {
    this.f = f;
}