android.view.animation.AnticipateOvershootInterpolator#android.view.WindowManager源码实例Demo

下面列出了android.view.animation.AnticipateOvershootInterpolator#android.view.WindowManager 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AirFree-Client   文件: CaptureActivity.java
@Override
public void onCreate(Bundle icicle) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(icicle);

    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);

    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);

    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation
            .RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
            0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}
 
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // Pre-Honeycomb this is the best we can do.
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    setContentView(R.layout.main);

    mStatusTextView = (TextView) findViewById(R.id.status_text);

    mTargetView = findViewById(R.id.target);
    mTargetView.setOnTouchListener(mTouchListener);
    mTargetView.getViewTreeObserver().addOnGlobalLayoutListener(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mSystemUiHider = new SystemUiHider(mTargetView);
        mSystemUiHider.setup(getWindow());
    } else {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
}
 
源代码3 项目: JCVideoPlayer   文件: JCVideoPlayer.java
@Override
    public void onCompletion() {
        setUiWitStateAndScreen(CURRENT_STATE_NORMAL);
        if (textureViewContainer.getChildCount() > 0) {
            textureViewContainer.removeAllViews();
        }

        JCVideoPlayerManager.setListener(null);//这里还不完全,
//        JCVideoPlayerManager.setLastListener(null);
        JCMediaManager.instance().currentVideoWidth = 0;
        JCMediaManager.instance().currentVideoHeight = 0;

        AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
        mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
        JCUtils.scanForActivity(getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        clearFullscreenLayout();
    }
 
源代码4 项目: juda   文件: IntroActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    addSlide(new Slide1Fragment());
    addSlide(new Slide2Fragment());
    addSlide(new Slide3Fragment());
    addSlide(new Slide4Fragment());

    showSkipButton(false);

    askForPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
}
 
源代码5 项目: 30-android-libraries-in-30-days   文件: Engine.java
/**
 * @return <code>true</code> when the sensor was successfully enabled, <code>false</code> otherwise.
 */
public boolean enableAccelerationSensor(final Context pContext, final IAccelerationListener pAccelerationListener, final AccelerationSensorOptions pAccelerationSensorOptions) {
	final SensorManager sensorManager = (SensorManager) pContext.getSystemService(Context.SENSOR_SERVICE);
	if(Engine.isSensorSupported(sensorManager, Sensor.TYPE_ACCELEROMETER)) {
		this.mAccelerationListener = pAccelerationListener;

		if(this.mAccelerationData == null) {
			final Display display = ((WindowManager) pContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
			final int displayRotation = display.getOrientation();
			this.mAccelerationData = new AccelerationData(displayRotation);
		}

		this.registerSelfAsSensorListener(sensorManager, Sensor.TYPE_ACCELEROMETER, pAccelerationSensorOptions.getSensorDelay());

		return true;
	} else {
		return false;
	}
}
 
源代码6 项目: 365browser   文件: NativePageDialog.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FrameLayout view = (FrameLayout) LayoutInflater.from(getContext()).inflate(
            R.layout.dialog_with_titlebar, null);
    view.addView(mPage.getView(), 0);
    setContentView(view);

    getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    TextView title = (TextView) view.findViewById(R.id.title);
    title.setText(mPage.getTitle());

    ImageButton closeButton = (ImageButton) view.findViewById(R.id.close_button);
    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
}
 
源代码7 项目: BottomNavigationBar   文件: MainActivity.java
private boolean hasSystemNavigationBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display d = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

        DisplayMetrics realDisplayMetrics = new DisplayMetrics();
        d.getRealMetrics(realDisplayMetrics);

        int realHeight = realDisplayMetrics.heightPixels;
        int realWidth = realDisplayMetrics.widthPixels;

        DisplayMetrics displayMetrics = new DisplayMetrics();
        d.getMetrics(displayMetrics);

        int displayHeight = displayMetrics.heightPixels;
        int displayWidth = displayMetrics.widthPixels;

        return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
    } else {
        boolean hasMenuKey = ViewConfiguration.get(this).hasPermanentMenuKey();
        boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        return !hasMenuKey && !hasBackKey;
    }
}
 
源代码8 项目: LeisureRead   文件: SystemUiVisibilityUtil.java
/**
 * * 显示或隐藏StatusBar
 *
 * @param enable false 显示,true 隐藏
 */
public static void hideStatusBar(Window window, boolean enable) {

  WindowManager.LayoutParams p = window.getAttributes();
  if (enable)
  //|=:或等于,取其一
  {
    p.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
  } else
  //&=:与等于,取其二同时满足,     ~ : 取反
  {
    p.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }

  window.setAttributes(p);
  window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
 
/**
 * Add camera preview to the root of the activity layout.
 *
 * @return {@link CameraPreview} that was added to the view.
 */
private CameraPreview addPreView() {
    //create fake camera view
    CameraPreview cameraSourceCameraPreview = new CameraPreview(this, this);
    cameraSourceCameraPreview.setLayoutParams(new ViewGroup
            .LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(1, 1,
            Build.VERSION.SDK_INT < Build.VERSION_CODES.O ?
                    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY :
                    WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
            WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
            PixelFormat.TRANSLUCENT);

    mWindowManager.addView(cameraSourceCameraPreview, params);
    return cameraSourceCameraPreview;
}
 
源代码10 项目: YCProgress   文件: CarlProgressbar.java
private void initView(Context context) {
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mLayoutParams = new WindowManager.LayoutParams();
    mLayoutParams.gravity = Gravity.START | Gravity.TOP;
    mLayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLayoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLayoutParams.format = PixelFormat.TRANSLUCENT;
    mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
            | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;
    } else {
        mLayoutParams.type = WindowManager.LayoutParams.TYPE_TOAST;
    }
}
 
源代码11 项目: Android-Application-ZJB   文件: UserTextDialog.java
/**
 * 初始化
 */
private void init() {
    // 弹出自定义dialog
    LayoutInflater inflater = LayoutInflater.from(getContext());
    View view = inflater.inflate(R.layout.dlg_user_text, null);

    // 对话框
    getWindow().setBackgroundDrawable(new ColorDrawable(0));
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // 设置宽度为屏幕的宽度
    WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.width = 666; // 设置宽度
    getWindow().setAttributes(lp);
    getWindow().setContentView(view);
    setCancelable(false);
    ButterKnife.inject(this);
}
 
源代码12 项目: AndroidAPS   文件: InsightAlertActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_insight_alert);

    bindService(new Intent(this, InsightAlertService.class), serviceConnection, BIND_AUTO_CREATE);

    icon = findViewById(R.id.icon);
    errorCode = findViewById(R.id.error_code);
    errorTitle = findViewById(R.id.error_title);
    errorDescription = findViewById(R.id.error_description);
    mute = findViewById(R.id.mute);
    confirm = findViewById(R.id.confirm);

    setFinishOnTouchOutside(false);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
            | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
 
源代码13 项目: MeiBaseModule   文件: Eyes.java
/**
 * 设置状态栏图标为深色和魅族特定的文字风格,Flyme4.0以上
 */
static boolean FlymeSetStatusBarLightMode(Activity activity, boolean darkmode) {
    boolean result = false;
    try {
        WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
        Field darkFlag = WindowManager.LayoutParams.class
                .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
        Field meizuFlags = WindowManager.LayoutParams.class
                .getDeclaredField("meizuFlags");
        darkFlag.setAccessible(true);
        meizuFlags.setAccessible(true);
        int bit = darkFlag.getInt(null);
        int value = meizuFlags.getInt(lp);
        if (darkmode) {
            value |= bit;
        } else {
            value &= ~bit;
        }
        meizuFlags.setInt(lp, value);
        activity.getWindow().setAttributes(lp);
        result = true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}
 
源代码14 项目: FastAndroid   文件: UIStatusBarController.java
/**
 * OPPOAndroid系统
 * https://open.oppomobile.com/wiki/index#id=73494
 */
public static void setStatusBarOppo(@NonNull Activity activity, boolean lightMode) {
    int SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT = 0x00000010;
    Window window = activity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.getDecorView().setSystemUiVisibility(SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT);

    int vis = window.getDecorView().getSystemUiVisibility();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (lightMode) {
            vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        } else {
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (lightMode) {
            vis |= SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
        } else {
            vis &= ~SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
        }
    }
    window.getDecorView().setSystemUiVisibility(vis);
}
 
源代码15 项目: BaseAndroidApp   文件: AdjustStatusbar.java
@TargetApi (Build.VERSION_CODES.KITKAT)
public static void addColorAndHeight(@NonNull Activity activity) {
   if (!activity.getResources()
         .getBoolean(R.bool.should_color_status_bar)) {
      return;
   }
   View statusBar = activity.findViewById(R.id.statusBarBackground);
   if (statusBar == null) {
      return;
   }
   Window window = activity.getWindow();
   window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
         WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
   int statusBarHeight = getStatusBarHeight(activity);
   if (statusBarHeight != 0) {
      final int color = ContextCompat.getColor(activity, R.color.primary_dark);
      statusBar.getLayoutParams().height = +statusBarHeight;
      statusBar.setBackgroundColor(color);
      statusBar.setVisibility(View.VISIBLE);
   } else {
      statusBar.setVisibility(View.GONE);
   }
}
 
源代码16 项目: WanAndroid   文件: DisplayUtils.java
public static int getDpi(Context context){
    int dpi = 0;
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    DisplayMetrics displayMetrics = new DisplayMetrics();
    @SuppressWarnings("rawtypes")
    Class c;
    try {
        c = Class.forName("android.view.Display");
        @SuppressWarnings("unchecked")
        Method method = c.getMethod("getRealMetrics",DisplayMetrics.class);
        method.invoke(display, displayMetrics);
        dpi=displayMetrics.heightPixels;
    }catch(Exception e){
        e.printStackTrace();
    }
    return dpi;
}
 
源代码17 项目: iGap-Android   文件: ActivityRatingBar.java
@Override
public void onCreate(Bundle savedInstanceState) {

    G.isShowRatingDialog = true;

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
            | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rating_bar);

    id = getIntent().getExtras().getLong(ID_EXTRA);

    initComponent();
}
 
源代码18 项目: browser   文件: AppBaseActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	//PushAgent.getInstance(this).onAppStart();
	MobclickAgent.openActivityDurationTrack(false);

	getWindow().setSoftInputMode(
			WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
	);
	mBaseActivity.init(getBaseContext(), this);
	onActivityInit();
	LogUtil.d(TAG, "checktask onCreate:" + super.getClass().getSimpleName()
			+ "#0x" + super.hashCode() + ", taskid:" + getTaskId()
			+ ", task:" + new ActivityTaskUtils(this));
	abstracrRegist();
	getTopBarView().showSearch(hasSearch());

}
 
源代码19 项目: Nimingban   文件: TypeSendFragment.java
@Override
public void onDestroyView() {
    super.onDestroyView();

    if (mPreview != null && mImagePreview != null && mEditText != null) {
        clearImagePreview();
    }

    if (mNMBRequest != null) {
        mNMBRequest.cancel();
        mNMBRequest = null;
    }

    // Hide ime keyboard
    View view = getActivity().getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }

    // Cancel FLAG_ALT_FOCUSABLE_IM
    getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}
 
源代码20 项目: StatusBarUtil   文件: StatusBarUtil.java
/**
 * 设置Flyme4+的状态栏的darkMode,darkMode时候字体颜色及icon
 * http://open-wiki.flyme.cn/index.php?title=Flyme%E7%B3%BB%E7%BB%9FAPI
 *
 * @param window 目标window
 * @param dark   亮色 or 暗色
 */
private static void setModeForFlyme4(Window window, boolean dark) {
    try {
        WindowManager.LayoutParams lp = window.getAttributes();
        Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
        Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
        darkFlag.setAccessible(true);
        meizuFlags.setAccessible(true);
        int bit = darkFlag.getInt(null);
        int value = meizuFlags.getInt(lp);
        if (dark) {
            value |= bit;
        } else {
            value &= ~bit;
        }
        meizuFlags.setInt(lp, value);
        window.setAttributes(lp);
    } catch (Exception e) {
        Log.e("StatusBar", "darkIcon: failed");
    }
}
 
源代码21 项目: TinyDancer   文件: TinyCoach.java
public TinyCoach(Application context, FPSConfig config) {

        fpsConfig = config;

        //create meter view
        meterView = (TextView) LayoutInflater.from(context).inflate(R.layout.meter_view, null);

        //set initial fps value....might change...
        meterView.setText((int) fpsConfig.refreshRate + "");

        // grab window manager and add view to the window
        windowManager = (WindowManager) meterView.getContext().getSystemService(Service.WINDOW_SERVICE);

        int minWidth = meterView.getLineHeight()
                + meterView.getTotalPaddingTop()
                + meterView.getTotalPaddingBottom()
                + (int) meterView.getPaint().getFontMetrics().bottom;
        meterView.setMinWidth(minWidth);

        addViewToWindow(meterView);
    }
 
源代码22 项目: android_9.0.0_r45   文件: DreamService.java
private void applyWindowFlags(int flags, int mask) {
    if (mWindow != null) {
        WindowManager.LayoutParams lp = mWindow.getAttributes();
        lp.flags = applyFlags(lp.flags, flags, mask);
        mWindow.setAttributes(lp);
        mWindow.getWindowManager().updateViewLayout(mWindow.getDecorView(), lp);
    }
}
 
源代码23 项目: ViewDebugHelper   文件: MyWindowManager.java
/**
 * 将小悬浮窗从屏幕上移除。
 * 
 * @param context
 *            必须为应用程序的Context.
 */
public static void removeFloatWindow(Context context) {
	if (mFloatWindow != null) {
		WindowManager windowManager = getWindowManager(context);
		windowManager.removeView(mFloatWindow);
		mFloatWindow = null;
	}
}
 
源代码24 项目: Telegram   文件: PhotoAlbumPickerActivity.java
private void fixLayoutInternal() {
    if (getParentActivity() == null) {
        return;
    }

    WindowManager manager = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Activity.WINDOW_SERVICE);
    int rotation = manager.getDefaultDisplay().getRotation();
    columnsCount = 2;
    if (!AndroidUtilities.isTablet() && (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90)) {
        columnsCount = 4;
    }
    listAdapter.notifyDataSetChanged();
}
 
源代码25 项目: Taskbar   文件: AbstractSelectAppActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boolean noShadow = getIntent().hasExtra("no_shadow");

    setContentView(R.layout.tb_desktop_icon_select_app);
    setFinishOnTouchOutside(false);
    setTitle(getString(R.string.tb_select_an_app));

    if(noShadow) {
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.dimAmount = 0;
        getWindow().setAttributes(params);

        if(U.isChromeOs(this) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
            getWindow().setElevation(0);
    }

    SharedPreferences pref = U.getSharedPreferences(this);
    isCollapsed = !pref.getBoolean(PREF_COLLAPSED, false);

    if(!isCollapsed) {
        U.sendBroadcast(this, ACTION_HIDE_TASKBAR);
    }

    progressBar = findViewById(R.id.progress_bar);
    appList = findViewById(R.id.list);

    appListGenerator = new DesktopIconAppListGenerator();
    appListGenerator.execute();
}
 
源代码26 项目: cast-videos-android   文件: LocalPlayerActivity.java
@SuppressLint("NewApi")
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    getSupportActionBar().show();
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        }
        updateMetadata(false);
        mContainer.setBackgroundColor(getResources().getColor(R.color.black));

    } else {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().clearFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        }
        updateMetadata(true);
        mContainer.setBackgroundColor(getResources().getColor(R.color.white));
    }
}
 
源代码27 项目: Android-Application-ZJB   文件: BaseActivity.java
/**
 * If the Android version is higher than KitKat(API>=19) <br> use this call to show & hide
 *
 * @param enable
 */
@SuppressLint("NewApi")
public final void makeFullScreenAfterKitKat(boolean enable) {
    try {
        View decorView = getWindow().getDecorView();
        if (enable) {
            int uiOptionsEnable = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            decorView.setSystemUiVisibility(uiOptionsEnable);

        } else {
            int uiOptionsDisable = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            decorView.setSystemUiVisibility(uiOptionsDisable);
        }

    } catch (Exception e) {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        if (enable) {
            lp.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        } else {
            lp.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
        getWindow().setAttributes(lp);
    }
}
 
源代码28 项目: rebootmenu   文件: UIUtils.java
/**
 * 使状态栏透明
 * 来自https://github.com/laobie/StatusBarUtil
 *
 * @param activity 要渲染的活动
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void transparentStatusBar(@NonNull Activity activity) {
    new DebugLog("transparentStatusBar", DebugLog.LogLevel.V);
    Window window = activity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    window.setStatusBarColor(Color.TRANSPARENT);
}
 
public SetAsWallpaperAsyncTask(Bitmap bitmap, int setTo, WallpaperManager manager, WindowManager windowManager,
                               WallpaperSetter.SetWallpaperListener setWallpaperListener) {
    this.bitmap = bitmap;
    this.setTo = setTo;
    this.manager = manager;
    this.windowManager = windowManager;
    this.setWallpaperListener = setWallpaperListener;
}
 
源代码30 项目: monolog-android   文件: AbstractActivity.java
/**
 * 小米的沉浸式控制
 * @param on
 */
@TargetApi(19)
protected void setTranslucentStatus(boolean on) {
    Window win = getWindow();
    WindowManager.LayoutParams winParams = win.getAttributes();
    final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
    if (on) {
        winParams.flags |= bits;
    } else {
        winParams.flags &= ~bits;
    }
    win.setAttributes(winParams);
}