Java Code Examples for android.view.ViewGroup#FOCUS_BLOCK_DESCENDANTS

The following examples show how to use android.view.ViewGroup#FOCUS_BLOCK_DESCENDANTS . These examples are extracted from open source projects. 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
@Override
public int getDescendantFocusability() {
    if (workspaceInModalState()) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 2
Source Project: WhatsappWebToGo   File: WebviewActivity.java    License: MIT License 5 votes vote down vote up
private void setKeyboardEnabled(final boolean enable) {
    mKeyboardEnabled = enable;
    InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
    if (enable && mMainView.getDescendantFocusability() == ViewGroup.FOCUS_BLOCK_DESCENDANTS) {
        mMainView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
        showSnackbar("Unblocking keyboard...");
        //inputMethodManager.showSoftInputFromInputMethod(activity.getCurrentFocus().getWindowToken(), 0);
    } else if (!enable) {
        mMainView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
        mWebView.getRootView().requestFocus();
        showSnackbar("Blocking keyboard...");
        inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
    }
    mSharedPrefs.edit().putBoolean("keyboardEnabled", enable).apply();
}
 
Example 3
@Override
public int getDescendantFocusability() {
    if (workspaceInModalState()) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 4
/**
 * Disable focus on anything under this view in the hierarchy if we are not visible.
 */
@Override
public int getDescendantFocusability() {
    if (getVisibility() != View.VISIBLE) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 5
Source Project: TurboLauncher   File: Workspace.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int getDescendantFocusability() {
    if (isSmall()) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 6
/**
 * Disable focus on anything under this view in the hierarchy if we are not visible.
 */
@Override
public int getDescendantFocusability() {
    if (getVisibility() != View.VISIBLE) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 7
Source Project: cube-sdk   File: BlockListView.java    License: Apache License 2.0 5 votes vote down vote up
public void onDataListChange() {

        removeAllViews();

        int len = mBlockListAdapter.getCount();
        int w = mBlockListAdapter.getBlockWidth();
        int h = mBlockListAdapter.getBlockHeight();
        int columnNum = mBlockListAdapter.getCloumnNum();

        int horizontalSpacing = mBlockListAdapter.getHorizontalSpacing();
        int verticalSpacing = mBlockListAdapter.getVerticalSpacing();

        boolean blockDescendant = getDescendantFocusability() == ViewGroup.FOCUS_BLOCK_DESCENDANTS;

        for (int i = 0; i < len; i++) {

            RelativeLayout.LayoutParams lyp = new RelativeLayout.LayoutParams(w, h);
            int row = i / columnNum;
            int clo = i % columnNum;
            int left = 0;
            int top = 0;

            if (clo > 0) {
                left = (horizontalSpacing + w) * clo;
            }
            if (row > 0) {
                top = (verticalSpacing + h) * row;
            }
            lyp.setMargins(left, top, 0, 0);
            View view = mBlockListAdapter.getView(mLayoutInflater, i);
            if (!blockDescendant) {
                view.setOnClickListener(mOnClickListener);
            }
            view.setTag(INDEX_TAG, i);
            addView(view, lyp);
        }
        requestLayout();
    }
 
Example 8
@Override
public int getDescendantFocusability() {
    return mChildrenFocused ? ViewGroup.FOCUS_BEFORE_DESCENDANTS
            : ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 9
@Override public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 10
@Override public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 11
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 12
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 13
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 14
@Override
public int getDescendantFocusability ()
{
	return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 15
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}