Java Code Examples for android.view.ViewGroup#FOCUS_BLOCK_DESCENDANTS

The following examples show how to use android.view.ViewGroup#FOCUS_BLOCK_DESCENDANTS . 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: Workspace.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getDescendantFocusability() {
    if (workspaceInModalState()) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 2
Source File: WebviewActivity.java    From WhatsappWebToGo with 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
Source File: Workspace.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getDescendantFocusability() {
    if (workspaceInModalState()) {
        return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
    }
    return super.getDescendantFocusability();
}
 
Example 4
Source File: AppsCustomizeLayout.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
/**
 * 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 File: Workspace.java    From TurboLauncher with 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
Source File: AppsCustomizeTabHost.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
/**
 * 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 File: BlockListView.java    From cube-sdk with 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
Source File: LauncherAppWidgetHostView.java    From LaunchEnr with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDescendantFocusability() {
    return mChildrenFocused ? ViewGroup.FOCUS_BEFORE_DESCENDANTS
            : ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 9
Source File: LauncherAppWidgetHostView.java    From HgLauncher with GNU General Public License v3.0 4 votes vote down vote up
@Override public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 10
Source File: LauncherAppWidgetHostView.java    From HgLauncher with GNU General Public License v3.0 4 votes vote down vote up
@Override public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 11
Source File: LauncherAppWidgetHostView.java    From Trebuchet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 12
Source File: LauncherAppWidgetHostView.java    From TurboLauncher with Apache License 2.0 4 votes vote down vote up
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 13
Source File: LauncherAppWidgetHostView.java    From LB-Launcher with Apache License 2.0 4 votes vote down vote up
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 14
Source File: WidgetHostView.java    From DistroHopper with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDescendantFocusability ()
{
	return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
 
Example 15
Source File: MyAppWidgetHostView.java    From AcDisplay with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int getDescendantFocusability() {
    return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}