android.view.Window.clearFlags()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(227)

本文整理了Java中android.view.Window.clearFlags()方法的一些代码示例,展示了Window.clearFlags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.clearFlags()方法的具体详情如下:
包路径:android.view.Window
类名称:Window
方法名:clearFlags

Window.clearFlags介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ContextCompat.getColor(activity, R.color.example_color));

代码示例来源:origin: stackoverflow.com

Window window = activity.getWindow();

// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

// finally change the color
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));

代码示例来源:origin: gzu-liyujiang/AndroidPicker

public static void toggleFullScreen(Activity activity) {
  Window window = activity.getWindow();
  int flagFullscreen = WindowManager.LayoutParams.FLAG_FULLSCREEN;
  if (isFullScreen) {
    window.clearFlags(flagFullscreen);
    isFullScreen = false;
  } else {
    window.setFlags(flagFullscreen, flagFullscreen);
    isFullScreen = true;
  }
}

代码示例来源:origin: stackoverflow.com

if (Build.VERSION.SDK_INT >= 21) {
      Window window = getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.setStatusBarColor(getResources().getColor(R.color.primaryDark));
}

代码示例来源:origin: JessYanCoding/MVPArms

public static void cancelFullScreen(Activity activity) {
  WindowManager.LayoutParams params = activity.getWindow()
      .getAttributes();
  params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
  activity.getWindow().setAttributes(params);
  activity.getWindow().clearFlags(
      WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}

代码示例来源:origin: guardianproject/haven

public void onFinish() {
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  txtTimer.setText(R.string.status_on);
  initMonitor();
  mOnTimerTicking = false;
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

/**
 * android 6.0设置字体颜色
 */
@TargetApi(Build.VERSION_CODES.M)
public static void setStatusBarDarkModeForM(Window window) {
  window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  window.setStatusBarColor(Color.TRANSPARENT);
  int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
  systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  window.getDecorView().setSystemUiVisibility(systemUiVisibility);
}

代码示例来源:origin: seven332/EhViewer

@Override
void show() {
  if (mLevel > SystemUiHelper.LEVEL_LOW_PROFILE) {
    mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setIsShowing(true);
  }
}

代码示例来源:origin: AppIntro/AppIntro

/**
 * Allows for setting statusbar visibility (true by default)
 *
 * @param isVisible put true to show status bar, and false to hide it
 */
public void showStatusBar(boolean isVisible) {
  if (!isVisible) {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
  } else {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

public static void immersive(Window window, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) {
  if (Build.VERSION.SDK_INT >= 21) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(mixtureColor(color, alpha));
    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else if (Build.VERSION.SDK_INT >= 19) {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    setTranslucentView((ViewGroup) window.getDecorView(), color, alpha);
  } else if (Build.VERSION.SDK_INT >= MIN_API && Build.VERSION.SDK_INT > 16) {
    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  }
}
//</editor-fold>

代码示例来源:origin: jdamcd/android-crop

@TargetApi(Build.VERSION_CODES.KITKAT)
private void setupWindowFlags() {
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }
}

代码示例来源:origin: ZieIony/Carbon

private void initLayout() {
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  Window window = getWindow();
  if (window != null) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
  }
  dialogLayout = getLayoutInflater().inflate(R.layout.carbon_dialog, null);
  container = dialogLayout.findViewById(R.id.carbon_windowContent);
  super.setContentView(dialogLayout);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onCreate(Bundle state) {
 super.onCreate(state);
 if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
  Window window=getWindow();
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  window.setStatusBarColor(getResources().getColor(R.color.primary_dark));
 }
 setContentView(R.layout.list_content_simple);
 initAdapter();
}

代码示例来源:origin: seven332/EhViewer

@Override
protected void onResume() {
  super.onResume();
  if(Settings.getEnabledSecurity()){
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
        WindowManager.LayoutParams.FLAG_SECURE);
  }else{
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
  }
}

代码示例来源:origin: seven332/EhViewer

protected void onSystemUiShown() {
  ActionBar ab = mActivity.getActionBar();
  if (ab != null) {
    ab.show();
  }
  mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setIsShowing(true);
}

代码示例来源:origin: seven332/EhViewer

@Override
protected void onResume() {
  super.onResume();
  if(Settings.getEnabledSecurity()){
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
        WindowManager.LayoutParams.FLAG_SECURE);
  }else{
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
  }
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

@SuppressLint("RestrictedApi")
public static void showSupportActionBar(Context context) {
  if (ACTION_BAR_EXIST && JZUtils.getAppCompActivity(context) != null) {
    ActionBar ab = JZUtils.getAppCompActivity(context).getSupportActionBar();
    if (ab != null) {
      ab.setShowHideAnimationEnabled(false);
      ab.show();
    }
  }
  if (TOOL_BAR_EXIST) {
    JZUtils.getWindow(context).clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

public void onAutoCompletion() {
  Runtime.getRuntime().gc();
  Log.i(TAG, "onAutoCompletion " + " [" + this.hashCode() + "] ");
  onEvent(JZUserAction.ON_AUTO_COMPLETE);
  dismissVolumeDialog();
  dismissProgressDialog();
  dismissBrightnessDialog();
  onStateAutoComplete();
  if (currentScreen == SCREEN_WINDOW_FULLSCREEN || currentScreen == SCREEN_WINDOW_TINY) {
    backPress();
  }
  JZMediaManager.instance().releaseMediaPlayer();
  JZUtils.scanForActivity(getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  JZUtils.saveProgress(getContext(), jzDataSource.getCurrentUrl(), 0);
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@Override
public void onAutoCompletion() {
  setStateAndUi(CURRENT_STATE_AUTO_COMPLETE);
  mSaveChangeViewTIme = 0;
  mCurrentPosition = 0;
  if (mTextureViewContainer.getChildCount() > 0) {
    mTextureViewContainer.removeAllViews();
  }
  if (!mIfCurrentIsFullscreen)
    getGSYVideoManager().setLastListener(null);
  mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
  ((Activity) getActivityContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  releaseNetWorkState();
  if (mVideoAllCallBack != null && isCurrentMediaListener()) {
    Debuger.printfLog("onAutoComplete");
    mVideoAllCallBack.onAutoComplete(mOriginUrl, mTitle, this);
  }
}

代码示例来源:origin: Rukey7/MvpApp

/**
 * 暂停
 */
public void pause() {
  mIvPlay.setSelected(false);
  if (mVideoView.isPlaying()) {
    mVideoView.pause();
  }
  _pauseDanmaku();
  // 视频暂停时关闭屏幕常亮
  mAttachActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

相关文章

Window类方法