Java Code Examples for android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE

The following are Jave code examples for showing how to use SYSTEM_UI_FLAG_LOW_PROFILE of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Quran   File: PagerActivity.java   View Source Code Vote up 6 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setUiVisibility(boolean isVisible) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
      (isLandscape || isImmersiveInPortrait)){
    setUiVisibilityKitKat(isVisible);
    if (isInMultiWindowMode) {
      animateToolBar(isVisible);
    }
    return;
  }

  int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
  if (!isVisible) {
    flags |= View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN;
  }
  viewPager.setSystemUiVisibility(flags);
  if (isInMultiWindowMode) {
    animateToolBar(isVisible);
  }
}
 
Example 2
Project: whatanime-android   File: VideoPreviewActivity.java   View Source Code Vote up 6 votes
private int getFullscreenUiFlags() {
    int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    return flags;
}
 
Example 3
Project: Phoenicia   File: SystemUiHiderHoneycomb.java   View Source Code Vote up 6 votes
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 4
Project: PictureShow   File: PhotoActivity.java   View Source Code Vote up 6 votes
private void enterFullScreen() {
    if(mToolbar == null || rootView == null || bottomView == null) return;

    //bottomView.setVisibility(View.GONE);

    int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    if(ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE)
        flag = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

    mToolbar.setVisibility(View.INVISIBLE);
    rootView.setSystemUiVisibility(flag);
    fullScreen = true;
}
 
Example 5
Project: TitanCompanion   File: SystemUiHiderHoneycomb.java   View Source Code Vote up 6 votes
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
	super(activity, anchorView, flags);

	mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
	mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
	mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

	if ((mFlags & FLAG_FULLSCREEN) != 0) {
		// If the client requested fullscreen, add flags relevant to hiding
		// the status bar. Note that some of these constants are new as of
		// API 16 (Jelly Bean). It is safe to use them, as they are inlined
		// at compile-time and do nothing on pre-Jelly Bean devices.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN;
	}

	if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
		// If the client requested hiding navigation, add relevant flags.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
		mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
	}
}
 
Example 6
Project: starcor.xul   File: SystemUiHiderHoneycomb.java   View Source Code Vote up 6 votes
/**
 * Constructor not intended to be called by clients. Use {@link SystemUiHider#getInstance} to
 * obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= 0x00000400;// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= 0x00000400 //View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                      | 0x00000004; // View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= 0x00000200;//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= 0x00000200//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                      | 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 7
Project: Quran   File: PagerActivity.java   View Source Code Vote up 5 votes
@TargetApi(Build.VERSION_CODES.KITKAT)
private void setUiVisibilityKitKat(boolean isVisible) {
  int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
      | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
      | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
  if (!isVisible) {
    flags |= View.SYSTEM_UI_FLAG_LOW_PROFILE
        | View.SYSTEM_UI_FLAG_FULLSCREEN
        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_IMMERSIVE;
  }
  viewPager.setSystemUiVisibility(flags);
}
 
Example 8
Project: yabaking   File: StepsNavigationActivity.java   View Source Code Vote up 5 votes
private void setUpViewForFullscreen() {
    if (isFullscreenLayout() && !isMultipaneLayout()) {
        View decorView = getWindow().getDecorView();
        int uiOptions = decorView.getSystemUiVisibility();
        uiOptions ^= View.SYSTEM_UI_FLAG_LOW_PROFILE;
        uiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
        uiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        uiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        uiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        uiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
Example 9
Project: Instincts-2k17   File: GalleryViewPagerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityCompat.postponeEnterTransition(this);
    ActivityCompat.setEnterSharedElementCallback(this, enterTransitionCallback);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_view_pager_gallery);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Gallery");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    galleryViewPagerAdapter = new GalleryViewPagerAdapter(this);

    viewPager = (ViewPager) findViewById(R.id.container);
    viewPager.setAdapter(galleryViewPagerAdapter);

    int position = selectedIndex = getIntent().getIntExtra(EXTRA_POSITION, 0);
    viewPager.setCurrentItem(position);
    viewPager.setOnPageChangeListener(pageChangeListener);
    viewPager.getViewTreeObserver().addOnGlobalLayoutListener(pagerLayoutListener);
}
 
Example 10
Project: Instincts-2k17   File: SplashActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_splash);
    ButterKnife.bind(this);

    DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();
    spinArrow.setTranslationX(-2000);
    wheelView.setTranslationX(2000);
    wheelView.setWheelRadius(displayMetrics.widthPixels / 2);
    wheelView.setWheelItemRadius(displayMetrics.widthPixels / 6);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            startSecondActivity();
        }
    }, 1000);
}
 
Example 11
Project: RetroMusicPlayer   File: SystemUiHelperImplICS.java   View Source Code Vote up 5 votes
@Override
protected int createTestFlags() {
    if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
        // Intentionally override test flags.
        return View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    return View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
 
Example 12
Project: Instincts-2k17   File: RegisterActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_register);
    ButterKnife.bind(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    ShowEnterAnimation();

    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animateRevealClose();
        }
    });

    databaseReference = FirebaseDatabase.getInstance().getReference();
    currentUser = FirebaseAuth.getInstance().getCurrentUser();
    auth = FirebaseAuth.getInstance();
    authStateListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                Log.d(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };

    try {
        populateProfile();
    } catch (Exception e) {
        LogHelper.e(TAG, e.toString());
    }
}
 
Example 13
Project: Instincts-2k17   File: LoginActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    auth = FirebaseAuth.getInstance();
    authListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                Log.d(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };

    moveClouds();
}
 
Example 14
Project: CodeCompilerApp   File: SystemUiHelperImplICS.java   View Source Code Vote up 5 votes
@Override
protected int createTestFlags() {
    if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
        // Intentionally override test flags.
        return View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    return View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
 
Example 15
Project: CodeCompilerApp   File: SystemUiHelperImplICS.java   View Source Code Vote up 5 votes
@Override
protected int createHideFlags() {
    int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
        flag |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    return flag;
}
 
Example 16
Project: Simpler   File: VideoPlayerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 设置无标题
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // 设置全屏
    Window window = getWindow();
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // 隐藏虚拟按键
    WindowManager.LayoutParams params = window.getAttributes();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    }
    window.setAttributes(params);
    // 强行开启屏幕旋转效果
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);

    setContentView(R.layout.activity_video_player);
    ButterKnife.bind(this);

    Intent intent = getIntent();
    mMiaoPaiUrl = intent.getStringExtra(INTENT_MIAO_PAI_URL);
    mVideoUrl = intent.getStringExtra(INTENT_VIDEO_URL);

    setListener();  // 设置监听器
    init();         // 初始化VideoView
}
 
Example 17
Project: featurea   File: AndroidInputUtil.java   View Source Code Vote up 5 votes
/**
 * <pre>{@code
 * @Override
 * public void onWindowFocusChanged(boolean hasFocus) {
 *   super.onWindowFocusChanged(hasFocus);
 *   if (hasFocus) {
 *     // place here
 *   }
 * }
 * }</pre>
 */

public static void hideNavigationBar(Window window) {
    if (window == null) {
        return;
    }

    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    final View decorView = window.getDecorView();

    if (decorView != null) {
        int uiOptions = decorView.getSystemUiVisibility();

        if (Build.VERSION.SDK_INT >= 14) {
            uiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
        }

        if (Build.VERSION.SDK_INT >= 16) {
            uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        if (Build.VERSION.SDK_INT >= 19) {
            uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }

        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
Example 18
Project: Instincts-2k17   File: HomeActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_home);
    ButterKnife.bind(this);

    new LocalJSONSource(this);
    new RemoteJSONSource(this);

    DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();

    logo.bringToFront();

    List<Map.Entry<String, Integer>> entries = new ArrayList<>(6);
    for (int i = 0; i < 6; i++) {
        Map.Entry<String, Integer> entry = new AbstractMap.SimpleEntry<>("", 0x0);
        entries.add(entry);
    }

    wheelView.setWheelRadius(displayMetrics.widthPixels / 2);
    wheelView.setWheelItemRadius(displayMetrics.widthPixels / 6);
    wheelView.setOnWheelItemClickListener(new WheelView.OnWheelItemClickListener() {
        @Override
        public void onWheelItemClick(WheelView parent, int position, boolean isSelected) {
            switch (position) {
                case 0:
                    startActivity(new Intent(HomeActivity.this, SponsorsActivity.class));
                    break;
                case 1:
                    startActivity(new Intent(HomeActivity.this, GalleryActivity.class));
                    break;
                case 2:
                    startActivity(new Intent(HomeActivity.this, HospitalityActivity.class));
                    break;
                case 3:
                    if (firebaseUser == null)
                        startActivity(new Intent(HomeActivity.this, LoginActivity.class));
                    else
                        startActivity(new Intent(HomeActivity.this, ProfileActivity.class));
                    break;
                case 4:
                    startActivity(new Intent(HomeActivity.this, EventsActivity.class));
                    break;
                case 5:
                    startActivity(new Intent(HomeActivity.this, ScheduleActivity.class));
                    break;
            }
        }
    });
    wheelView.setAdapter(new WheelAdapter(entries));

    moveClouds();

    spinArrow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            wheelView.setSelected(ThreadLocalRandom.current().nextInt(0, 5 + 1));
        }
    });

    AppUpdater appUpdater = new AppUpdater(this);
    appUpdater.setUpdateFrom(UpdateFrom.GITHUB)
            .setGitHubUserAndRepo("adithya321", "Instincts")
            .start();
}
 
Example 19
Project: aos-Video   File: PlayerController.java   View Source Code Vote up 4 votes
protected void showSystemBar(boolean show) {
    if (mSystemBarShowing == show) return;
    mSystemUiVisibility = mPlayerView.getSystemUiVisibility();
    if (PlayerConfig.hasHackedFullScreen()) {
        final int STATUS_BAR_GONE =  (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 ? 0x00000004 : 0x000008);
        if (show)
            mSystemUiVisibility &= ~STATUS_BAR_GONE;
        else
            mSystemUiVisibility |= STATUS_BAR_GONE;
        manualVisibilityChange=true;
        mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
        mSystemBarGone = !show;
    } else {
        int systemUiFlag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { /* ICS and less */
            if (show)
                mWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            else
                mWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else { /* JB and more */
            systemUiFlag |= 0x00000004 /* View.SYSTEM_UI_FLAG_FULLSCREEN */;
        }
        if (show) {
            mSystemUiVisibility &= ~systemUiFlag;
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
                mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
        }
        else {
            mSystemUiVisibility |= systemUiFlag;
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
                    mSystemUiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
        }
        mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
        manualVisibilityChange=true;
        mSystemBarGone = false;
        if (PlayerConfig.canSystemBarHide()) {
            if (!show)
                mHandler.sendEmptyMessageDelayed(MSG_HIDE_SYSTEM_BAR, 1000);
        }
    }
    mSystemBarShowing = show;
}
 
Example 20
Project: FLFloatingButton   File: FloatingViewManager.java   View Source Code Vote up 4 votes
/**
 * 画面がフルスクリーンになった場合はViewを非表示にします。
 */
@Override
public void onScreenChanged(Rect windowRect, int visibility) {
    // detect status bar
    final boolean isFitSystemWindowTop = windowRect.top == 0;
    boolean isHideStatusBar;
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && visibility != FullscreenObserverView.NO_LAST_VISIBILITY) {
        // Support for screen rotation when setSystemUiVisibility is used
        isHideStatusBar = isFitSystemWindowTop || (visibility & View.SYSTEM_UI_FLAG_LOW_PROFILE) == View.SYSTEM_UI_FLAG_LOW_PROFILE;
    } else {
        isHideStatusBar = isFitSystemWindowTop;
    }

    // detect navigation bar
    final boolean isHideNavigationBar;
    if (visibility == FullscreenObserverView.NO_LAST_VISIBILITY) {
        // At the first it can not get the correct value, so do special processing
        mWindowManager.getDefaultDisplay().getMetrics(mDisplayMetrics);
        isHideNavigationBar = windowRect.width() - mDisplayMetrics.widthPixels > 0 || windowRect.height() - mDisplayMetrics.heightPixels > 0;
    } else {
        isHideNavigationBar = (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
    final boolean isPortrait = mResources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;

    // update FloatingView layout
    mTargetFloatingView.onUpdateSystemLayout(isHideStatusBar, isHideNavigationBar, isPortrait);

    // フルスクリーンでの非表示モードでない場合は何もしない
    if (mDisplayMode != DISPLAY_MODE_HIDE_FULLSCREEN) {
        return;
    }

    mIsMoveAccept = false;
    final int state = mTargetFloatingView.getState();
    // 重なっていない場合は全て非表示処理
    if (state == FloatingView.STATE_NORMAL) {
        final int size = mFloatingViewList.size();
        for (int i = 0; i < size; i++) {
            final FloatingView floatingView = mFloatingViewList.get(i);
            floatingView.setVisibility(isFitSystemWindowTop ? View.GONE : View.VISIBLE);
        }
        mTrashView.dismiss();
    }
    // 重なっている場合は削除
    else if (state == FloatingView.STATE_INTERSECTING) {
        mTargetFloatingView.setFinishing();
        mTrashView.dismiss();
    }
}