Java Code Examples for androidx.appcompat.app.ActionBar#hide()

The following examples show how to use androidx.appcompat.app.ActionBar#hide() . 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
Source File: CameraFiltersPopup.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
protected void showFullScreen(boolean fullscreen) {
    Activity activity = getActivity();
    if (activity == null || !(activity instanceof BaseActivity)) {
        return;
    }

    ActionBar actionBar = ((BaseActivity)activity).getSupportActionBar();
    if (actionBar != null) {
        if (fullscreen) {
            actionBar.hide();
        }
        else {
            actionBar.show();
        }
    }
}
 
Example 2
Source File: MainActivity.java    From lbry-android with MIT License 6 votes vote down vote up
public void enterFullScreenMode() {
    inFullscreenMode = true;
    hideFloatingWalletBalance();
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
    findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
    lockDrawer();

    View decorView = getWindow().getDecorView();
    decorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
            View.SYSTEM_UI_FLAG_FULLSCREEN |
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
            View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
 
Example 3
Source File: LockScreenActivity.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
protected void initData() {
    is_lock = true;
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mMusicPlayBean = MusicPlayerManager.getInstance().getMusicPlayBean();
    updateContent();
    addDisposable(Observable.interval(200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread())
            .subscribe(aLong -> {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm-MM月dd日 E", Locale.CHINESE);
                String date[] = simpleDateFormat.format(new Date()).split("-");
                time.setText(date[0]);
                week.setText(date[1]);
                bottomLrc.seekTo(MusicPlayerManager.getInstance().getPosition(), false, false);
            }));
}
 
Example 4
Source File: TutorialActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar bar = getSupportActionBar();
    if (bar != null) bar.hide();

    showStatusBar(false);
    setSkipButtonEnabled(true);
    setIndicatorEnabled(true);

    addSlide(newSlide(R.string.tutorial_firstTitle, R.string.tutorial_firstDesc, R.drawable.ic_launcher));
    addSlide(newSlide(R.string.tutorial_secondTitle, R.string.tutorial_secondDesc, 0));
    addSlide(newSlide(R.string.tutorial_thirdTitle, R.string.tutorial_thirdDesc, 0));
    addSlide(newSlide(R.string.tutorial_fourthTitle, R.string.tutorial_fourthDesc, 0));
}
 
Example 5
Source File: UncaughtExceptionActivity.java    From CommonUtils with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unchaught_exception);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    Button email = findViewById(R.id.uncaughtException_email);
    email.setOnClickListener(v -> LogsHelper.sendEmail(this, (Throwable) getIntent().getSerializableExtra("exception")));
}
 
Example 6
Source File: UploadWidgetActivity.java    From cloudinary_android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_upload_widget);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }

    action = (UploadWidget.Action) getIntent().getSerializableExtra(ACTION_EXTRA);

    final ArrayList<Uri> uris = getIntent().getParcelableArrayListExtra(UploadWidget.URIS_EXTRA);
    if (uris != null && !uris.isEmpty()) {
        showImages(uris);
    } else {
        UploadWidget.openMediaChooser(this, MEDIA_CHOOSER_REQUEST_CODE);
    }
}
 
Example 7
Source File: PuzzleActivity.java    From EasyPhotos with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    getWindow().setAttributes(attrs);
    setContentView(R.layout.activity_puzzle_easy_photos);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    if (null == Setting.imageEngine) {
        finish();
        return;
    }
    initData();
    initView();
}
 
Example 8
Source File: ArcusFloatingFragment.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
protected void showFullScreen(boolean fullscreen) {
    Activity activity = getActivity();
    if (activity == null || !(activity instanceof BaseActivity)) {
        return;
    }

    ActionBar actionBar = ((BaseActivity)activity).getSupportActionBar();
    if (actionBar != null) {
        if (fullscreen) {
            actionBar.hide();
        }
        else {
            actionBar.show();
        }
    }
}
 
Example 9
Source File: HTMLActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    utils.holographic(this);
    utils.finishOnHomeButton(this);
    this.setContentView(R.layout.html_view);
    ActionBar actionBar = getSupportActionBar();
    actionBar.hide();
    WebView webview = (WebView) this.findViewById(R.id.webkit);
    Uri u = this.getIntent()
                .getData();
    webview.loadUrl(u.toString());
    FloatingActionButton download = (FloatingActionButton) this.findViewById(R.id.button_floating_action);
    if(download != null) {
        download.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        download.setImageBitmap(createBitmap("icons1.ttf", "k"));
        webview.setOnTouchListener(new ShowHideOnScroll(download));
    }
}
 
Example 10
Source File: GuideVideoActivity.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
private void hide() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    mHideHandler.removeCallbacks(mShowPart2Runnable);
    mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
}
 
Example 11
Source File: OfflineActivity.java    From CommonUtils with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_offline);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    Button email = findViewById(R.id.offline_email);
    email.setOnClickListener(v -> LogsHelper.sendEmail(this, null));

    Button offline = findViewById(R.id.offline_retry);
    final Class<?> retryClass = (Class) getIntent().getSerializableExtra("retry");
    if (retryClass == null) {
        offline.setVisibility(View.GONE);
    } else {
        offline.setVisibility(View.VISIBLE);
        offline.setOnClickListener(v -> startActivity(new Intent(OfflineActivity.this, retryClass)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)));
    }
}
 
Example 12
Source File: FullScreenImageActivity.java    From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void toggleActionBar() {

        ActionBar actionBar = getSupportActionBar();

        if (actionBar != null) {
            if (actionBar.isShowing()) {
                actionBar.hide();
                hideUi();
            } else {
                showUi();
                actionBar.show();
            }
        }
    }
 
Example 13
Source File: CommonUtil.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@SuppressLint("RestrictedApi")
public static void hideSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
    if (actionBar) {
        AppCompatActivity appCompatActivity = CommonUtil.getAppCompActivity(context);
        if (appCompatActivity != null) {
            ActionBar ab = appCompatActivity.getSupportActionBar();
            if (ab != null) {
                ab.setShowHideAnimationEnabled(false);
                ab.hide();
            }
        }
    }
    if (statusBar) {
        if (context instanceof FragmentActivity) {
            FragmentActivity fragmentActivity = (FragmentActivity) context;
            fragmentActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else if (context instanceof Activity) {
            Activity activity = (Activity) context;
            activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            CommonUtil.getAppCompActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }
}
 
Example 14
Source File: HoneycombUtil.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
public void hideActionBar(AppCompatActivity a) {
	ActionBar ab = a.getSupportActionBar();
	if(ab == null){
		return;
	}
	ab.hide();
}
 
Example 15
Source File: FullscreenActivity.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
private void hide() {
    // Hide UI first
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    mControlsView.setVisibility(View.GONE);
    mVisible = false;

    // Schedule a runnable to remove the status and navigation bar after a delay
    mHideHandler.removeCallbacks(mShowPart2Runnable);
    mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
}
 
Example 16
Source File: PlacePickerActivity.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Hide any toolbar an apps theme might automatically place in activities. Typically creating an
  // activity style would cover this issue but this seems to prevent us from getting the users
  // application colorPrimary color.
  getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.hide();
  }
  setContentView(R.layout.mapbox_activity_place_picker);

  if (savedInstanceState == null) {
    accessToken = getIntent().getStringExtra(PlaceConstants.ACCESS_TOKEN);
    options = getIntent().getParcelableExtra(PlaceConstants.PLACE_OPTIONS);
    includeReverseGeocode = options.includeReverseGeocode();
  }

  // Initialize the view model.
  viewModel = ViewModelProviders.of(this).get(PlacePickerViewModel.class);
  viewModel.getResults().observe(this, this);

  bindViews();
  addBackButtonListener();
  addPlaceSelectedButton();
  customizeViews();

  mapView.onCreate(savedInstanceState);
  mapView.getMapAsync(this);
}
 
Example 17
Source File: EasyPhotosActivity.java    From EasyPhotos with Apache License 2.0 4 votes vote down vote up
private void hideActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
}
 
Example 18
Source File: ReadArticleActivity.java    From android-app with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    settings = App.getInstance().getSettings();

    fullscreenArticleView = settings.isFullscreenArticleView();
    if (fullscreenArticleView) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    if (settings.isKeepScreenOn()) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }

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

    if (fullscreenArticleView) {
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) actionBar.hide();
    }

    Intent intent = getIntent();
    long articleID = intent.getLongExtra(EXTRA_ID, -1);
    Log.d(TAG, "onCreate() articleId: " + articleID);

    if (intent.hasExtra(EXTRA_LIST_FAVORITES)) {
        contextFavorites = intent.getBooleanExtra(EXTRA_LIST_FAVORITES, false);
    }
    if (intent.hasExtra(EXTRA_LIST_ARCHIVED)) {
        contextArchived = intent.getBooleanExtra(EXTRA_LIST_ARCHIVED, false);
    }

    articleDao = DbConnection.getSession().getArticleDao();

    if (!loadArticle(articleID)) {
        Log.e(TAG, "onCreate() did not find article with ID: " + articleID);
        finish();
        return;
    }

    fontSize = settings.getArticleFontSize();
    volumeButtonsScrolling = settings.isVolumeButtonsScrollingEnabled();
    tapToScroll = settings.isTapToScrollEnabled();
    disableTouchOptionEnabled = settings.isDisableTouchEnabled();
    disableTouch = settings.isDisableTouchLastState();
    disableTouchKeyCode = settings.getDisableTouchKeyCode();
    screenScrollingPercent = settings.getScreenScrollingPercent();
    smoothScrolling = settings.isScreenScrollingSmooth();
    scrolledOverBottom = settings.getScrolledOverBottom();
    swipeArticles = settings.getSwipeArticles();
    annotationsEnabled = settings.isAnnotationsEnabled();
    onyxWorkaroundEnabled = settings.isOnyxWorkaroundEnabled();

    setTitle(articleTitle);

    // article is loaded - update menu
    invalidateOptionsMenu();

    scrollView = findViewById(R.id.scroll);
    scrollViewLastChild = scrollView.getChildAt(scrollView.getChildCount() - 1);
    webViewContent = findViewById(R.id.webViewContent);
    loadingPlaceholder = findViewById(R.id.tv_loading_article);
    bottomTools = findViewById(R.id.bottomTools);
    hrBar = findViewById(R.id.view1);

    initButtons();

    initWebView();

    loadArticleToWebView();

    initTts();

    if (disableTouch) {
        showDisableTouchToast();
    }

    EventBus.getDefault().register(this);
}
 
Example 19
Source File: MainActivity.java    From lbry-android with MIT License 4 votes vote down vote up
public void hideActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
}
 
Example 20
Source File: LoadingActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_loading);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    new Handler().postDelayed(() -> {
        finished = true;
        if (goTo != null) startActivity(goTo);
    }, 1000);

    if (Prefs.getBoolean(PK.FIRST_RUN, true)) {
        startActivity(new Intent(this, TutorialActivity.class)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
        return;
    }

    Button preferences = findViewById(R.id.loading_preferences);
    preferences.setOnClickListener(v -> startActivity(new Intent(LoadingActivity.this, PreferenceActivity.class)));

    tutorialManager = new TutorialManager(this, Discovery.LOGIN);

    loading = findViewById(R.id.loading_loading);
    loading.getIndeterminateDrawable().setColorFilter(CommonUtils.resolveAttrAsColor(this, android.R.attr.textColorPrimary), PorterDuff.Mode.SRC_IN);
    currentServer = findViewById(R.id.loading_currentServer);
    register = findViewById(R.id.loading_register);
    registerNickname = findViewById(R.id.loading_registerNickname);
    registerSubmit = findViewById(R.id.loading_registerSubmit);
    registerIdCode = findViewById(R.id.loading_registerIdCode);
    welcomeMessage = findViewById(R.id.loading_welcomeMsg);

    changeServer = findViewById(R.id.loading_changeServer);
    changeServer.setOnClickListener(v -> changeServerDialog(true));

    registerIdCode.setEndIconOnClickListener(v -> CommonUtils.setText(registerIdCode, CommonUtils.randomString(100, new SecureRandom())));
    CommonUtils.clearErrorOnEdit(registerIdCode);

    if (Objects.equals(getIntent().getAction(), Intent.ACTION_VIEW) || Objects.equals(getIntent().getAction(), Intent.ACTION_SEND)) {
        Uri url = getIntent().getData();
        if (url != null) {
            Pyx.Server server = Pyx.Server.fromUrl(url);
            if (server != null) setServer(server);

            String fragment = url.getFragment();
            if (fragment != null) {
                List<NameValuePair> params = Utils.splitQuery(fragment);
                for (NameValuePair pair : params) {
                    if (Objects.equals(pair.key(), "game")) {
                        try {
                            launchGame = new GamePermalink(Integer.parseInt(pair.value("")), new JSONObject()); // A bit hacky
                        } catch (NumberFormatException ignored) {
                        }
                    } else if (Objects.equals(pair.key(), "password")) {
                        launchGamePassword = pair.value("");
                    }
                }

                launchGameShouldRequest = true;
            }
        }
    }

    discoveryApi = PyxDiscoveryApi.get();
    discoveryApi.getWelcomeMessage(this, new Pyx.OnResult<String>() {
        @Override
        public void onDone(@NonNull String result) {
            if (result.isEmpty()) {
                welcomeMessage.setVisibility(View.GONE);
            } else {
                welcomeMessage.setVisibility(View.VISIBLE);
                welcomeMessage.setHtml(result);
            }
        }

        @Override
        public void onException(@NonNull Exception ex) {
            Log.e(TAG, "Failed loading welcome message.", ex);
            welcomeMessage.setVisibility(View.GONE);
        }
    });
    discoveryApi.firstLoad(this, null, this);

    signInSilently();
}