List of usage examples for android.view Window FEATURE_ACTION_BAR_OVERLAY
int FEATURE_ACTION_BAR_OVERLAY
To view the source code for android.view Window FEATURE_ACTION_BAR_OVERLAY.
Click Source Link
From source file:com.google.android.apps.santatracker.map.SantaMapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // App Measurement mMeasurement = FirebaseAnalytics.getInstance(this); MeasurementManager.recordScreenView(mMeasurement, getString(R.string.analytics_screen_tracker)); // [ANALYTICS SCREEN]: Tracker AnalyticsManager.sendScreenView(R.string.analytics_screen_tracker); // Needs to be called before setting the content view supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_map); // Set up timer to remove screen lock resetScreenTimer();//ww w.ja v a 2s . c o m mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); Resources resources = getResources(); if (actionBar != null) { // set visibility flags *AFTER* values have been set, // otherwise nothing is displayed on Galaxy devices actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(false); } LOST_CONTACT_STRING = resources.getString(R.string.lost_contact_with_santa); ANNOUNCE_ARRIVED_AT = resources.getString(R.string.santa_is_now_arriving_in_x); ARRIVING_IN = resources.getString(R.string.arriving_in); DEPARTING_IN = resources.getString(R.string.departing_in); NO_NEXT_DESTINATION = resources.getString(R.string.no_next_destination); CURRENT_LOCATION = resources.getString(R.string.current_location); NEXT_LOCATION = resources.getString(R.string.next_destination); // Concatenate String for 'travel to' announcement StringBuilder sb = new StringBuilder(); sb.append(resources.getString(R.string.in_transit)); sb.append(" "); sb.append(resources.getString(R.string.next_destination)); sb.append(" %s"); ANNOUNCE_TRAVEL_TO = sb.toString(); sb.setLength(0); // Get all fragments mMapFragment = (SantaMapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_map); mButtonTop = (ImageButton) findViewById(R.id.top); mButtonTop.setOnClickListener(mOnClickListener); mRecyclerView = (RecyclerView) findViewById(R.id.stream); mSupportStreetView = Intents.canHandleStreetView(this); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.addItemDecoration(new SeparatorDecoration(this)); mRecyclerView.addOnScrollListener(mOnScrollListener); mAdapter = new CardAdapter(getApplicationContext(), mCardAdapterListener); mAdapter.setHasStableIds(true); mRecyclerView.setAdapter(mAdapter); if (NotificationDataCastManager.checkGooglePlayServices(this)) { mCastManager = SantaApplication.getCastManager(this); } // Santacam button mSantaCamButton = (SantaCamButton) findViewById(R.id.santacam); mSantaCamButton.setOnClickListener(mOnClickListener); if (mMapFragment.isInSantaCam()) { mSantaCamButton.setVisibility(View.GONE); } View bottomSheet = findViewById(R.id.bottom_sheet); if (bottomSheet != null) { mBottomSheetBehavior = (BottomSheetBehavior) ((CoordinatorLayout.LayoutParams) bottomSheet .getLayoutParams()).getBehavior(); mBottomSheetBehavior.setBottomSheetListener(mBottomSheetListener); } findViewById(R.id.main_touchinterceptor).setOnTouchListener(mInterceptorListener); }
From source file:com.mediatek.galleryfeature.stereo.segment.background.StereoBackgroundActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); // exit if file to edit has been deleted @{ // it mainly aims to handle language switch or LCA case here boolean needExit = finishIfInvalidUri(); mNeedCheckInvalid = false;/*from w w w . ja v a 2 s .c om*/ if (needExit) { return; } // avoid flash when launching getWindow().setBackgroundDrawable(new ColorDrawable(0)); loadXML(); mMasterImage = new MainImageMaster(this); mImageShowBackground.setImageMaster(mMasterImage); loadMainBitmapAsync(); loadThumbnails(); loadMainPanel(); }
From source file:uk.co.senab.photoview.sample.ViewPagerActivity.java
protected void setWindowFeatures() { getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); }
From source file:com.plusot.senselib.SenseMain.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override// w w w . jav a 2 s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); shouldFinish = 0; if (Build.VERSION.SDK_INT >= 11) requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); //.FEATURE_ACTION_BAR_OVERLAY); Log.d(Globals.TAG, CLASSTAG + ".onCreate:\n" + " ******************************************************\n" + " * *\n" + " * *\n" + " * SenseMain Started *\n" + " * *\n" + " * *\n" + " ******************************************************"); if (Build.VERSION.SDK_INT < 14 || ViewConfiguration.get(this).hasPermanentMenuKey()) requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); ActivityUtil.lockScreenOrientation(this); app = (SenseApp) getApplication(); app.activityCreated(SenseMain.this); init(getIntent(), true); watchId = Watchdog.addProcessS(CLASSTAG); String state = android.os.Environment.getExternalStorageState(); if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) { AlertDialog alertDialog = new AlertDialog.Builder(SenseMain.this).create(); alertDialog.setTitle(R.string.no_sd_title); alertDialog.setMessage(SenseMain.this.getString(R.string.no_sd_message)); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, SenseMain.this.getString(R.string.button_confirm), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); } if (SenseGlobals.screenLock) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //ActivityUtil.lockScreenOrientation(SenseMain.this); updateSettings(); PreferenceHelper.getPrefs().registerOnSharedPreferenceChangeListener(this); LLog.i(Globals.TAG, CLASSTAG + ".onCreate. Wakelock acquired"); Device.setListener(SenseMain.this); HttpSender.checkSession(); if (System.currentTimeMillis() - Value.getSessionTime() > 3600000L * 12 && SenseGlobals.stopState.equals(SenseGlobals.StopState.PAUZE)) { closeValues(SenseGlobals.ActivityMode.STOP, false); PreferenceKey.setStopState(SenseGlobals.StopState.STOP); } if (SenseApp.firstActivity && SenseGlobals.loadSplash) { //creating = true; showSplashScreen(true); if (SenseGlobals.isBikeApp) { View view = this.findViewById(R.id.main_layout); if (view != null) view.setVisibility(View.INVISIBLE); } } SenseApp.firstActivity = false; Watchdog.getInstance().add(this, 1000); Watchdog.getInstance().add(this); //for (PreferenceKey prefKey : PreferenceKey.values()) updateSetting(prefs, prefKey); //if (PreferenceKey.HASMAP.isTrue()) addMap(); try { PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); setTitle(Globals.appName + " " + info.versionName); } catch (NameNotFoundException ignored) { } File file = new File(SenseGlobals.getGpxPath()); if (!file.isDirectory() && !file.mkdirs()) { Log.w(Globals.TAG, CLASSTAG + " Could not create: " + SenseGlobals.getGpxPath()); } }
From source file:org.readium.sdk.android.biblemesh.WebViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_web_view); final int abTitleId = getResources().getIdentifier("action_bar_title", "id", "android"); findViewById(abTitleId).setOnClickListener(new View.OnClickListener() { @Override//from ww w.ja va 2s. c o m public void onClick(View v) { finish(); } }); mWebview = (WebView) findViewById(R.id.webview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && 0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)) { WebView.setWebContentsDebuggingEnabled(true); } mProgress = (ProgressBar) findViewById(R.id.progressBar); initWebView(); final GestureDetector gestureDetector = new GestureDetector(this, new MyGestureListener()); mWebview.setOnTouchListener(new View.OnTouchListener() { private final static long MAX_TOUCH_DURATION = 150; float lastEventX; float m_DownTime; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: lastEventX = event.getX(); m_DownTime = event.getEventTime(); //init time break; case MotionEvent.ACTION_MOVE: { float distanceX = lastEventX - event.getX(); ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); marginLayoutParams.leftMargin = marginLayoutParams.leftMargin - (int) distanceX; marginLayoutParams.rightMargin = -marginLayoutParams.leftMargin;// marginLayoutParams.rightMargin + (int) distanceX; mWebview.requestLayout(); } break; case MotionEvent.ACTION_UP: { ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); if (marginLayoutParams.leftMargin < 10 && marginLayoutParams.leftMargin > -10) { Log.i("up", "small margin, open menu?"); if (event.getEventTime() - m_DownTime <= MAX_TOUCH_DURATION) { Log.i("up", "quick"); showActionBar(null); } else { Log.i("up", "too long"); } } } case MotionEvent.ACTION_CANCEL: { ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); //Log.i("snap", "snap width: "+mWebview.getWidth()+" left:" + marginLayoutParams.leftMargin + " raw:" + event.getRawX() + " " + event.getX());//+" "+e2.toString()+" "+e1.toString()); //mWebview.getWidth() if (marginLayoutParams.leftMargin < -0.5 * mWebview.getWidth()) { mReadiumJSApi.openPageRight(); mWebview.setAlpha(0.0f); } else if (marginLayoutParams.leftMargin > 0.5 * mWebview.getWidth()) { mReadiumJSApi.openPageLeft(); mWebview.setAlpha(0.0f); } else { snapBack(); //return true; } } break; } ; return gestureDetector.onTouchEvent(event); } }); /*mWebview.setHapticFeedbackEnabled(false);*/ Intent intent = getIntent(); if (intent.getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) { Bundle extras = intent.getExtras(); if (extras != null) { mContainer = ContainerHolder.getInstance().get(extras.getLong(Constants.CONTAINER_ID)); if (mContainer == null) { finish(); return; } mPackage = mContainer.getDefaultPackage(); String rootUrl = "http://" + EpubServer.HTTP_HOST + ":" + EpubServer.HTTP_PORT + "/"; mPackage.setRootUrls(rootUrl, null); try { mOpenPageRequestData = OpenPageRequest .fromJSON(extras.getString(Constants.OPEN_PAGE_REQUEST_DATA)); } catch (JSONException e) { Log.e(TAG, "Constants.OPEN_PAGE_REQUEST_DATA must be a valid JSON object: " + e.getMessage(), e); } } } // No need, EpubServer already launchers its own thread // new AsyncTask<Void, Void, Void>() { // @Override // protected Void doInBackground(Void... params) { // //xxx // return null; // } // }.execute(); mServer = new EpubServer(EpubServer.HTTP_HOST, EpubServer.HTTP_PORT, mPackage, quiet, dataPreProcessor); mServer.startServer(); // Load the page skeleton mWebview.loadUrl(READER_SKELETON); mViewerSettings = new ViewerSettings(ViewerSettings.SyntheticSpreadMode.SINGLE, ViewerSettings.ScrollMode.AUTO, 100, 20); mReadiumJSApi = new ReadiumJSApi(new ReadiumJSApi.JSLoader() { @Override public void loadJS(String javascript) { mWebview.loadUrl(javascript); } }); /*Button back = (Button)findViewById(R.id.btnBack); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); if(getActionBar.isShowing()) { hideActionBar(); } else { getActionBar.show(); hideActionBar(); } } });*/ r = new Runnable() { @Override public void run() { getActionBar().hide(); //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } }; hide2 = null; hideActionBar(); //ActionBar actionBar = getActionBar(); //actionBar.hide(); //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); }
From source file:com.aimfire.gallery.GalleryActivity.java
@Override public void onCreate(Bundle savedInstanceState) { supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); setContentView(R.layout.activity_gallery); getSupportActionBar().setDisplayHomeAsUpEnabled(true); /*/*w w w.ja v a2 s .com*/ * load display mode, swap and color mode that were last used */ loadDisplayPrefs(); /* * show overflow button even if we have a physical menu button */ forceOverflowButton(); /* * Obtain the FirebaseAnalytics instance. */ mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); /* * initialize the view pager with current media we have */ initViewPager(); mNoMedia = (ImageView) findViewById(R.id.no_media_bg); mNoMedia.setOnTouchListener(otl); mCardboardButton = (FloatingActionButton) findViewById(R.id.cardboardFAB); mCardboardButton.setOnClickListener(oclCardboard); if (savedInstanceState != null) { mIsMyMedia = savedInstanceState.getBoolean(KEY_PAGER_MY_MEDIA); updateViewPager(null, savedInstanceState.getInt(KEY_PAGER_POSITION), -1); } else { /* * parse the intent */ Intent intent = getIntent(); parseIntent(intent); } showHideView(); /* * initial command to hide action bar */ if (AUTO_HIDE) { delayedHide(AUTO_HIDE_DELAY_SHORT_MILLIS); } }
From source file:com.klinker.android.twitter.activities.MainActivity.java
@Override public void onStart() { super.onStart(); MainActivity.isPopup = false;//from w w w .j ava 2 s. c o m Log.v("talon_starting", "main activity starting"); sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", 0); // check for night mode switching int theme = AppSettings.getCurrentTheme(sharedPrefs); if (!getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY) || sharedPrefs.getBoolean("launcher_frag_switch", false) || (theme != settings.theme && !settings.addonTheme)) { sharedPrefs.edit().putBoolean("launcher_frag_switch", false).putBoolean("dont_refresh", true).commit(); AppSettings.invalidate(); Log.v("talon_theme", "no action bar overlay found, recreating"); finish(); overridePendingTransition(0, 0); startActivity(getRestartIntent()); overridePendingTransition(0, 0); MainActivity.caughtstarting = true; // return so that it doesn't start the background refresh, that is what caused the dups. sharedPrefs.edit().putBoolean("dont_refresh_on_start", true).commit(); return; } else { sharedPrefs.edit().putBoolean("dont_refresh", false).putBoolean("should_refresh", true).commit(); } if (DrawerActivity.settings.pushNotifications) { if (!TalonPullNotificationService.isRunning) { context.startService(new Intent(context, TalonPullNotificationService.class)); } } else { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); } // cancel the alarm to start the catchup service AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getService(context, 236, new Intent(context, CatchupPull.class), 0); am.cancel(pendingIntent); // cancel the old one, then start the new one in 1 min // clear the pull unread sharedPrefs.edit().putInt("pull_unread", 0).commit(); // will only run when debugging new Handler().postDelayed(new Runnable() { @Override public void run() { NotificationUtils.sendTestNotification(MainActivity.this); } }, 1000); }
From source file:com.klinker.android.twitter.ui.MainActivity.java
@Override public void onStart() { super.onStart(); MainActivity.isPopup = false;/*from w w w . j a v a2s. c o m*/ Log.v("talon_starting", "main activity starting"); sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); // check for night mode switching int theme = AppSettings.getCurrentTheme(sharedPrefs); if (!getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY) || sharedPrefs.getBoolean("launcher_frag_switch", false) || (theme != settings.theme && !settings.addonTheme)) { sharedPrefs.edit().putBoolean("launcher_frag_switch", false).putBoolean("dont_refresh", true).commit(); AppSettings.invalidate(); Log.v("talon_theme", "no action bar overlay found, recreating"); finish(); overridePendingTransition(0, 0); startActivity(getRestartIntent()); overridePendingTransition(0, 0); MainActivity.caughtstarting = true; // return so that it doesn't start the background refresh, that is what caused the dups. sharedPrefs.edit().putBoolean("dont_refresh_on_start", true).commit(); return; } else { sharedPrefs.edit().putBoolean("dont_refresh", false).putBoolean("should_refresh", true).commit(); } if (DrawerActivity.settings.pushNotifications) { if (!TalonPullNotificationService.isRunning) { context.startService(new Intent(context, TalonPullNotificationService.class)); } } else { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); } // cancel the alarm to start the catchup service AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getService(context, 236, new Intent(context, CatchupPull.class), 0); am.cancel(pendingIntent); // cancel the old one, then start the new one in 1 min // clear the pull unread sharedPrefs.edit().putInt("pull_unread", 0).commit(); UpdateUtils.checkUpdate(this); /*new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } NotificationUtils.refreshNotification(context); } }).start();*/ }
From source file:org.connectbot.ConsoleActivity.java
@TargetApi(11) private void requestActionBar() { supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); }
From source file:android.support.v7.internal.widget.ActionBarOverlayLayout.java
@Override public void initFeature(int windowFeature) { pullChildren();//from w w w. j a v a 2 s .com switch (windowFeature) { case Window.FEATURE_PROGRESS: mDecorToolbar.initProgress(); break; case Window.FEATURE_INDETERMINATE_PROGRESS: mDecorToolbar.initIndeterminateProgress(); break; case Window.FEATURE_ACTION_BAR_OVERLAY: setOverlayMode(true); break; } }