Java Code Examples for android.view.ViewGroup#isShown()

The following examples show how to use android.view.ViewGroup#isShown() . 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
private void toggleInputMethod(ViewGroup controlPanel) {
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm == null) {
        return;
    }
    if (controlPanel.isShown()) {
        imm.showSoftInput(mFocusView, 0);
        adjustImeDelay();
    } else if (mKeyboardActive) {
        mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
        controlPanel.setVisibility(VISIBLE);
        imm.hideSoftInputFromWindow(getWindowToken(), 0);
    } else {
        controlPanel.setVisibility(VISIBLE);
        mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
    }
}
 
Example 2
Source Project: EtsyBlur   File: BlurDialogFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    blur = new Blur(context, blurConfig());

    if (context instanceof Activity) {
        final Activity activity = (Activity) context;
        root = (ViewGroup) activity.getWindow().getDecorView();
        if (root.isShown()) {
            setUpBlurringViews();
            startEnterAnimation();
        } else {
            root.getViewTreeObserver().addOnPreDrawListener(preDrawListener);
        }
    } else {
        Log.w(TAG, "onAttach(Context context) - context is not type of Activity. Currently Not supported.");
    }
}
 
Example 3
Source Project: xposed-aweme   File: AutoPlayHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onHandler() throws Exception {

    if (!isPlaying) return;

    ViewGroup mViewPager = (ViewGroup) mObjectManager.getViewPager();

    if (mViewPager == null || !mUserConfigManager.isAutoPlay()) {
        // 停止播放处理
        stop();
        return ;
    }

    if (!mViewPager.isShown()) {
        // 停止播放(界面不可见了)
        stop();
        ToastUtil.show("界面切换,自动播放将暂停");
        return;
    }

    // 获取当前页
    int currentItem = (int) XposedHelpers
            .callMethod(mViewPager, mVersionConfig.methodGetCurrentItem);

    // 切换页面
    XposedHelpers.callMethod(mViewPager, mVersionConfig.methodVerticalViewPagerChange,
            new Object[]{ currentItem + 1, true, true, -1270 + RandomUtil.random(100)});
}
 
Example 4
Source Project: xposed-aweme   File: AutoPlayHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onHandler() throws Exception {

    if (!isPlaying) return;

    ViewGroup mViewPager = (ViewGroup) mObjectManager.getViewPager();

    if (mViewPager == null || !mUserConfigManager.isAutoPlay()) {
        // 停止播放处理
        stop();
        return;
    }

    if (!mViewPager.isShown()) {
        // 停止播放(界面不可见了)
        stop();
        ToastUtil.show("界面切换,自动播放将暂停");
        return;
    }

    // 获取当前页
    int currentItem = (int) XposedHelpers
            .callMethod(mViewPager, mVersionConfig.methodGetCurrentItem);

    // 切换页面
    XposedHelpers.callMethod(mViewPager, mVersionConfig.methodVerticalViewPagerChange,
            new Object[]{currentItem + 1, true, true, -1270 + RandomUtil.random(100)});

    // 继续播放下一个
    next(mUserConfigManager.getAutoPlaySleepTime());
}