Example usage for android.view Window FEATURE_ACTION_BAR_OVERLAY

List of usage examples for android.view Window FEATURE_ACTION_BAR_OVERLAY

Introduction

In this page you can find the example usage for android.view Window FEATURE_ACTION_BAR_OVERLAY.

Prototype

int FEATURE_ACTION_BAR_OVERLAY

To view the source code for android.view Window FEATURE_ACTION_BAR_OVERLAY.

Click Source Link

Document

Flag for requesting an Action Bar that overlays window content.

Usage

From source file:fr.matthiasbosc.translucentmap.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    settings = getSharedPreferences(PREFERENCES, 0);
    editor = settings.edit();//w  w  w. j a  v  a  2  s .  com
    setContentView(R.layout.activity_main);

    if (isGMSInstalled() == ConnectionResult.SUCCESS) {
        if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && (!isLowRamDevice())) {
            mWindow = getWindow();
            mWindow.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            mWindow.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

            hasTranslucentBars = true;
            firstRun();
        }

        mActionBar = getActionBar();
        if (mActionBar != null) {
            mActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3F000000")));
            mActionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#3F000000")));
            getMap();
        }
    } else {
        FrameLayout fl = (FrameLayout) findViewById(R.id.map);
        fl.setPadding(0, getActionBarHeight(), 0, 0);
    }
}

From source file:com.miz.mizuu.ShowDetails.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!MizLib.isPortrait(this))
        if (isFullscreen())
            setTheme(R.style.Theme_Example_Transparent_NoBackGround_FullScreen);
        else//  ww w.  j a  va  2  s  .  c om
            setTheme(R.style.Theme_Example_Transparent_NoBackGround);
    else if (isFullscreen())
        setTheme(R.style.Theme_Example_Transparent_FullScreen);
    else
        setTheme(R.style.Theme_Example_Transparent);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    setContentView(R.layout.viewpager);

    actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    if (spinnerAdapter == null)
        spinnerAdapter = new ActionBarSpinner(this, spinnerItems);

    setTitle(null);

    awesomePager = (ViewPager) findViewById(R.id.awesomepager);
    awesomePager.setOffscreenPageLimit(3); // Required in order to retain all fragments when swiping between them
    awesomePager.setAdapter(new ShowDetailsAdapter(getSupportFragmentManager()));
    awesomePager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
            invalidateOptionsMenu();
        }
    });

    ignorePrefixes = PreferenceManager.getDefaultSharedPreferences(this)
            .getBoolean("prefsIgnorePrefixesInTitles", false);

    // Create and open database
    dbHelper = MizuuApplication.getTvDbAdapter();

    String showId = "";
    // Fetch the database ID of the TV show to view
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        showId = getIntent().getStringExtra(SearchManager.EXTRA_DATA_KEY);
    } else {
        showId = getIntent().getStringExtra("showId");
    }

    Cursor cursor = dbHelper.getShow(showId);
    try {
        while (cursor.moveToNext()) {
            thisShow = new TvShow(this, cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_ID)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_TITLE)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_PLOT)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_RATING)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_GENRES)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_ACTORS)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_CERTIFICATION)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_FIRST_AIRDATE)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_RUNTIME)), ignorePrefixes,
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_EXTRA1)));
        }
    } catch (Exception e) {
        finish();
        return;
    } finally {
        cursor.close();
    }

    if (thisShow == null) {
        finish(); // Finish the activity if the movie doesn't load
        return;
    }

    setupSpinnerItems();

    if (savedInstanceState != null) {
        awesomePager.setCurrentItem(savedInstanceState.getInt("tab", 0));
    }

    // Set the current page item to 1 (episode page) if the TV show start page setting has been changed from TV show details
    if (!PreferenceManager.getDefaultSharedPreferences(this)
            .getString("prefsTvShowsStartPage", getString(R.string.showDetails))
            .equals(getString(R.string.showDetails)))
        awesomePager.setCurrentItem(1);
}

From source file:com.brodev.socialapp.view.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    ColorDrawable color = new ColorDrawable(Color.TRANSPARENT);
    color.setAlpha(128);/*  ww w .j a  v  a2  s . c  o  m*/
    getSupportActionBar().setBackgroundDrawable(color);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    setContentView(R.layout.ac_image_pager);

    File cacheDir = new File(this.getCacheDir(), "imgcachedir");
    if (!cacheDir.exists())
        cacheDir.mkdir();

    // phrase manager
    phraseManager = new PhraseManager(getApplicationContext());

    Bundle bundle = getIntent().getExtras();

    String[] imageUrls = bundle.getStringArray("image");
    String[] imagesId = bundle.getStringArray("photo_id");
    String[] HasLike = bundle.getStringArray("HasLike");
    String[] FeedisLike = bundle.getStringArray("FeedisLike");
    String[] Total_like = bundle.getStringArray("Total_like");
    String[] Total_comment = bundle.getStringArray("Total_comment");
    String[] Itemid = bundle.getStringArray("Itemid");
    String[] Type = bundle.getStringArray("Type");

    int pagerPosition = bundle.getInt("position", 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(this, imageUrls, imagesId, HasLike, FeedisLike, Total_like,
            Total_comment, Itemid, Type));

    pager.setOffscreenPageLimit(2);
    pager.setCurrentItem(pagerPosition);

    this.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}

From source file:com.commonsware.cwac.cam2.support.CameraActivity.java

/**
 * Standard lifecycle method, serving as the main entry
 * point of the activity.// w ww. j  av  a2s. c om
 *
 * @param savedInstanceState the state of a previous instance
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Utils.validateEnvironment(this);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    cameraFrag = (CameraFragment) getSupportFragmentManager().findFragmentByTag(TAG_CAMERA);
    confirmFrag = (ConfirmationFragment) getSupportFragmentManager().findFragmentByTag(TAG_CONFIRM);

    Uri output = getOutputUri();

    needsThumbnail = (output == null);

    if (cameraFrag == null) {
        cameraFrag = CameraFragment.newInstance(output);

        CameraController ctrl = new CameraController();

        cameraFrag.setController(ctrl);

        CameraSelectionCriteria.Facing facing = (CameraSelectionCriteria.Facing) getIntent()
                .getSerializableExtra(EXTRA_FACING);

        if (facing == null) {
            facing = CameraSelectionCriteria.Facing.BACK;
        }

        CameraSelectionCriteria criteria = new CameraSelectionCriteria.Builder().facing(facing).build();

        ctrl.setEngine(CameraEngine.buildInstance(this), criteria);
        ctrl.getEngine().setDebug(getIntent().getBooleanExtra(EXTRA_DEBUG_ENABLED, false));
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, cameraFrag, TAG_CAMERA)
                .commit();
    }

    if (confirmFrag == null) {
        confirmFrag = ConfirmationFragment.newInstance();
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, confirmFrag, TAG_CONFIRM)
                .commit();
    }

    if (!cameraFrag.isVisible() && !confirmFrag.isVisible()) {
        getSupportFragmentManager().beginTransaction().hide(confirmFrag).show(cameraFrag).commit();
    }
}

From source file:am.hour.beebird.Activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    setContentView(R.layout.activity_main);
    //?sharedpreference?
    spu = new SharedPreferenceUtil();
    DBUtil = new DBUtil4Image();
    actionbar = getActionBar();/* ww  w .ja  v a2  s.  com*/
    actionbar.setBackgroundDrawable(PicLoadUtil.getActionBarDrawable());
    mTitle = mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLeftLayout = (LinearLayout) findViewById(R.id.ll_left_drawer);
    ll_person = (LinearLayout) findViewById(R.id.ll_person);
    ll_random = (LinearLayout) findViewById(R.id.ll_random);
    ll_liked = (LinearLayout) findViewById(R.id.ll_liked);
    ll_setting = (LinearLayout) findViewById(R.id.ll_setting);

    iv_ll_person_pic = (ImageView) findViewById(R.id.people_logo);
    tv_ll_person_username = (TextView) findViewById(R.id.people_name);
    //??????
    updatePersonalInfoLeftDrawer();
    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    LeftLayoutClickListener llcl = new LeftLayoutClickListener();

    mDrawerLeftLayout.setOnClickListener(llcl);
    ll_person.setOnClickListener(llcl);
    ll_random.setOnClickListener(llcl);
    ll_liked.setOnClickListener(llcl);
    ll_setting.setOnClickListener(llcl);

    // enable ActionBar app icon to behave as action to toggle nav drawer
    actionbar.setDisplayHomeAsUpEnabled(true);
    //        getActionBar().setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            actionbar.show();
            actionbar.setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()

        }

        public void onDrawerOpened(View drawerView) {
            if (!(recent_fragment_number == -1) && !fragment.equals(null))
                fragments.put(recent_fragment_number, fragment);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()

        }

        // Called when a drawer's position changes.
        public void onDrawerSlide(View drawerView, float slideOffset) {
            if (slideOffset == 0) {
                actionbar.show();
            } else {
                actionbar.hide();
            }

        }

    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {

        selectItem(1, Constant.NORMAL_ENTRY);
        recent_fragment_number = 1;
        setTitle(R.string.list_left_one);

    }

}

From source file:uk.org.downiesoft.slideshow.SlideShowActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window win = getWindow();//w w  w .j  a v  a2s. c  o  m
    win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    win.requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    mUiHider = new UiHider(this);
    getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(mUiHider);
    mCacheManager = ThumbnailCacheManager.getInstance(this);
    SlideShowActivity.debug(1, TAG, "onCreate: %s",
            savedInstanceState == null ? "null" : savedInstanceState.toString());
    setContentView(R.layout.activity_slide_show);
    PreferenceManager.setDefaultValues(this, R.xml.view_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.slideshow_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.cache_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.wallpaper_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.other_preferences, false);
    mSlideshowSettings = PreferenceManager.getDefaultSharedPreferences(this);
    int thumbSize = Integer.parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_THUMBSIZE), "1"));
    // Hack to convert old hard-coded thumbsize settings to platform dependent sizes
    if (thumbSize > 2) {
        thumbSize = thumbSize / 90;
        SharedPreferences.Editor editor = mSlideshowSettings.edit();
        editor.putString(getString(R.string.PREFS_THUMBSIZE), Integer.toString(thumbSize));
        editor.apply();
    }
    FragmentManager fm = getFragmentManager();
    int cacheLimit = Integer
            .parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_CACHE_LIMIT), "10"));
    mPreviewButton = (ImageView) findViewById(R.id.slideShowImageButton);
    mPreviewView = (FrameLayout) findViewById(R.id.previewContainer);
    RelativeLayout divider = (RelativeLayout) findViewById(R.id.frameDivider);
    if (divider != null) {
        divider.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent event) {
                return mGestureDetector.onTouchEvent(event) || view.onTouchEvent(event);
            }
        });
    }
    mPreviewFragment = (PreviewFragment) fm.findFragmentByTag(PreviewFragment.TAG);
    if (mPreviewView != null && mPreviewFragment == null) {
        mPreviewFragment = new PreviewFragment();
        fm.beginTransaction().replace(R.id.previewContainer, mPreviewFragment, PreviewFragment.TAG).commit();
    }
    mGridViewFragment = (GridViewFragment) fm.findFragmentByTag(GridViewFragment.TAG);
    if (mGridViewFragment == null) {
        mGridViewFragment = new GridViewFragment();
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.fragmentContainer, mGridViewFragment, GridViewFragment.TAG);
        ft.commit();
    }
    mGestureDetector = new GestureDetector(this, new DividerGestureListener());
    // restart/stop service as required
    Intent intent = getIntent();
    if (intent != null && intent.getAction() != null && intent.getAction().equals(ACTION_STOP_WALLPAPER)
            && isServiceRunning()) {
        stopWallpaperService();
        finish();
    } else {
        if (!mSlideshowSettings.getBoolean(getString(R.string.PREFS_WALLPAPER_ENABLE), false)) {
            if (isServiceRunning()) {
                stopWallpaperService();
            }
        } else {
            if (!isServiceRunning()) {
                Intent startIntent = new Intent(SlideShowActivity.this, WallpaperService.class);
                startService(startIntent);
                invalidateOptionsMenu();
            }
        }
    }
    mCacheManager.tidyCache(cacheLimit);
    BitmapManager.setDisplayMetrics(getResources().getDisplayMetrics());
}

From source file:fr.bde_eseo.eseomega.lacommande.OrderDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_order_detail);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    toolbar.setPadding(0, Utilities.getStatusBarHeight(this), 0, 0);
    setSupportActionBar(toolbar);//  w  w w. j a  v  a  2s.  com
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00263238")));
    getSupportActionBar().setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#550000ff")));

    // Android setup
    context = OrderDetailsActivity.this;

    // Intent recuperation
    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            Toast.makeText(context, "Erreur de l'application (c'est pas normal)", Toast.LENGTH_SHORT).show();
            finish();
        } else {
            idcmd = extras.getInt(Constants.KEY_ORDER_ID);
        }
    }

    // Layout
    tvOrderDate = (TextView) findViewById(R.id.tvCommandDate);
    tvOrderPrice = (TextView) findViewById(R.id.tvCommandPrice);
    tvOrderDetails = (TextView) findViewById(R.id.tvOrderDetail);
    tvOrderNumero = (TextView) findViewById(R.id.tvCommandNumero);
    tvInstruction = (TextView) findViewById(R.id.tvOrderInstructions);
    tvInstrHeader = (TextView) findViewById(R.id.tvHeaderInstructions);
    progressBar = (ProgressBar) findViewById(R.id.progressDetails);
    tvDesc = (TextView) findViewById(R.id.textView3);
    imgCategory = (ImageView) findViewById(R.id.imgOrder);
    rl1 = (RelativeLayout) findViewById(R.id.relativeLayout3);
    rl2 = (RelativeLayout) findViewById(R.id.relativeLayout5);

    progressBar.setVisibility(View.VISIBLE);
    tvOrderDate.setVisibility(View.INVISIBLE);
    tvOrderPrice.setVisibility(View.INVISIBLE);
    tvOrderDetails.setVisibility(View.INVISIBLE);
    tvOrderNumero.setVisibility(View.INVISIBLE);
    tvDesc.setVisibility(View.INVISIBLE);
    imgCategory.setVisibility(View.INVISIBLE);
    rl1.setVisibility(View.INVISIBLE);
    rl2.setVisibility(View.INVISIBLE);

    // profile
    profile = new UserProfile();
    profile.readProfilePromPrefs(context);

    // Save old brightness level and set it now to 100%
    WindowManager.LayoutParams layout = getWindow().getAttributes();
    oldScreenBrightness = layout.screenBrightness;
    layout.screenBrightness = 1F;
    getWindow().setAttributes(layout);

    // Couleurs
    circle_preparing = context.getResources().getColor(R.color.circle_preparing);
    blue_light = context.getResources().getColor(R.color.blue_light);
    circle_done = context.getResources().getColor(R.color.circle_done);
    gray_light = context.getResources().getColor(R.color.gray_light);
    circle_ready = context.getResources().getColor(R.color.circle_ready);
    green_light = context.getResources().getColor(R.color.green_light);
    circle_error = context.getResources().getColor(R.color.circle_error);
    orange_light = context.getResources().getColor(R.color.orange_light);
}

From source file:com.cerema.cloud2.ui.preview.PreviewImageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.preview_image_activity);

    // Navigation Drawer
    initDrawer();/*from   w  w  w  .jav a  2  s  .  c  o m*/

    // ActionBar
    ActionBar actionBar = getSupportActionBar();
    updateActionBarTitleAndHomeButton(null);
    actionBar.hide();

    // Make sure we're running on Honeycomb or higher to use FullScreen and
    // Immersive Mode
    if (isHoneycombOrHigher()) {

        mFullScreenAnchorView = getWindow().getDecorView();
        // to keep our UI controls visibility in line with system bars
        // visibility
        mFullScreenAnchorView
                .setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
                    @SuppressLint("InlinedApi")
                    @Override
                    public void onSystemUiVisibilityChange(int flags) {
                        boolean visible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
                        ActionBar actionBar = getSupportActionBar();
                        if (visible) {
                            actionBar.show();
                            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
                        } else {
                            actionBar.hide();
                            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
                        }
                    }
                });

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(getResources().getColor(R.color.owncloud_blue_dark_transparent));
        }
    }

    if (savedInstanceState != null) {
        mRequestWaitingForBinder = savedInstanceState.getBoolean(KEY_WAITING_FOR_BINDER);
    } else {
        mRequestWaitingForBinder = false;
    }

}

From source file:com.snowdream.wallpaper.ImagePagerActivity.java

private void initUI() {

    setTitle(R.string.app_name);//from   www  .j a  va2  s  .  c  o  m
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    ColorDrawable color = new ColorDrawable(Color.BLACK);
    color.setAlpha(128);
    getSupportActionBar().setBackgroundDrawable(color);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    this.getWindow().setBackgroundDrawableResource(android.R.color.black);
    setContentView(R.layout.activity_image_pager);

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int arg0) {
            if (actionProvider != null) {
                actionProvider.setShareIntent(createShareIntent());
            }
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {

        }

        @Override
        public void onPageScrollStateChanged(int arg0) {

        }
    });

}