下面列出了android.view.ViewGroup#isShown ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
}
@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.");
}
}
@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)});
}
@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());
}