下面列出了androidx.appcompat.app.ActionBar#hide ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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));
}
}
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();
}
}
}
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();
}
}
}
@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();
}
@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);
}
}
@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")));
}
@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));
}
@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);
}));
}
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);
}
private void toggleActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
if (actionBar.isShowing()) {
actionBar.hide();
hideUi();
} else {
showUi();
actionBar.show();
}
}
}
private void hide() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
mHideHandler.removeCallbacks(mShowPart2Runnable);
mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
}
@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)));
}
}
@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);
}
}
}
public void hideActionBar(AppCompatActivity a) {
ActionBar ab = a.getSupportActionBar();
if(ab == null){
return;
}
ab.hide();
}
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);
}
@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);
}
@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);
}
private void hideActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
}
public void hideActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
}
@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();
}