Example usage for android.view Window FEATURE_ACTION_BAR

List of usage examples for android.view Window FEATURE_ACTION_BAR

Introduction

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

Prototype

int FEATURE_ACTION_BAR

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

Click Source Link

Document

Flag for enabling the Action Bar.

Usage

From source file:com.juick.android.MessagesActivity.java

@Override
public void requestWindowFeature(long featureId) {
    // actionbar sherlock deducing flag from theme id.
    if (featureId == com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR)
        return;//ww  w  . j  ava 2 s  .c  o m
    super.requestWindowFeature(featureId);
}

From source file:com.moro.synapsemod.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    startTime = System.nanoTime();

    // Define Busybox
    if (new File("/su/xbin/busybox").exists())
        BB = "/su/xbin/busybox";
    else if (new File("/sbin/busybox").exists())
        BB = "/sbin/busybox";
    else/* w  w w  . j  a v a 2s  .c o m*/
        BB = "/system/xbin/busybox";

    // Comprobar carpeta backup
    File bk_folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
            + getString(R.string.dir_backups));
    if (!bk_folder.exists()) {
        bk_folder.mkdirs();
    }

    Utils.mainActivity = this;
    Utils.density = getResources().getDisplayMetrics().density;
    Utils.imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    Synapse.openExecutor();
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    Settings.setWallpaper(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        SystemBarTintManager tintManager = new SystemBarTintManager(this);

        if (Settings.getAppTheme() == Settings.Theme.TRANSLUCENT_DARK) {
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setStatusBarTintResource(R.drawable.black_gradient_270);
        }

        if (Utils.hasSoftKeys(getWindowManager())) {
            tintManager.setNavigationBarTintEnabled(true);
            tintManager.setNavigationBarTintResource(R.drawable.black_gradient_90);
        }
    }

    getActionBar().hide();

    setPaddingDimensions();
    setContentView(R.layout.activity_loading);

    super.onCreate(fragments == null ? null : savedInstanceState);

    if (fragments == null) {
        if (Synapse.currentEnvironmentState != Synapse.environmentState.VALID_ENVIRONMENT) {
            findViewById(R.id.initialProgressBar).setVisibility(View.INVISIBLE);
            switch (Synapse.currentEnvironmentState) {
            case ROOT_FAILURE:
                ((TextView) findViewById(R.id.initialText)).setText(R.string.initial_no_root);
                break;
            case UCI_FAILURE:
                ((TextView) findViewById(R.id.initialText)).setText(R.string.initial_no_uci);
                break;
            case JSON_FAILURE:
                ((TextView) findViewById(R.id.initialText)).setText(R.string.initial_json_parse);
            }

            return;
        }
    }

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    /**
     *  The UI building continues in buildFragment after fragment generation, or if
     *  the fragments are already live, continue here.
     */

    if (fragmentsDone.get() == Utils.configSections.size())
        continueCreate();
}

From source file:android.support.v7.app.ActionBarActivityDelegateICS.java

@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
        if (mMenu == null) {
            mMenu = MenuWrapperFactory.createMenuWrapper(menu);
        }/*  ww w.  j  av  a  2 s.  co m*/
        return mActivity.superOnCreatePanelMenu(featureId, mMenu);
    }
    return mActivity.superOnCreatePanelMenu(featureId, menu);
}

From source file:com.android.audiorecorder.ui.ImageViewActvity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    mFileDeleteHandlerThread = new HandlerThread("ImageView");
    mFileDeleteHandlerThread.start();/*from ww  w .  j av a  2s . com*/
    mFileDeleteHandler = new Handler(mFileDeleteHandlerThread.getLooper(), mFileProcHandlerCallback);
    orientationEventListener = new MyOrientationEventListener(this);
    orientationEventListener.enable();
    setContentView(R.layout.layout_image_view);
    rootView = (RotateLayout) findViewById(R.id.picture_view_root);
    /*rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);*/
    //ImageCacheParams cacheParams = new ImageCacheParams(this, IMAGE_CACHE_DIR);
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;
    final int longest = (height > width ? height : width) * 2 / 3;
    mBitmapUtils = new BitmapUtils(this);
    mBitmapUtils.configDefaultBitmapConfig(Config.RGB_565);
    mBitmapUtils.configDefaultAutoRotation(true);
    mBitmapUtils.configDiskCacheEnabled(true);
    mBitmapUtils.configMemoryCacheEnabled(true);
    Intent intent = getIntent();
    mGalleryViewPager = (GalleryViewPager) findViewById(R.id.viewer);
    pagerAdapter = new FilePagerAdapter(this, 100, 0, mBitmapUtils, null);
    mGalleryViewPager.setAdapter(pagerAdapter);
    mGalleryViewPager.setOffscreenPageLimit(1);
    final BitmapDisplayConfig bd = new BitmapDisplayConfig();
    bd.setAutoRotation(true);
    bd.setBitmapConfig(Config.RGB_565);
    mGalleryViewPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int index) {
            mBitmapUtils.display(mGalleryViewPager.mCurrentView, pagerAdapter.getCurrentPath(0, 0));
            /*ImageCache imageCache = mImageFetcher.getImageCache();
            if(imageCache != null) {
            BitmapDrawable value = imageCache.getBitmapFromMemCache(pagerAdapter.getCurrentPath(0, mCurrentSelect));
            if(value != null){
                mGalleryViewPager.mCurrentView.setImageBitmap(value.getBitmap());
            }
            }
            Log.i(TAG, "---> page index " + index + " select.");*/
        }

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

        @Override
        public void onPageScrollStateChanged(int state) {
            if (ViewPager.SCROLL_STATE_IDLE == state) {
                mHandler.removeMessages(MSG_LOAD_BITMAP);
                mHandler.sendEmptyMessageDelayed(MSG_LOAD_BITMAP, 0);
            }
        }
    });
    mHandler.removeMessages(MSG_LOAD_BITMAP);
    mHandler.sendEmptyMessageDelayed(MSG_LOAD_BITMAP, 50);
}

From source file:android.support.v7.app.ActionBarActivityDelegateICS.java

@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
        return mActivity.superOnPreparePanel(featureId, view, mMenu);
    }//from  w  w w  .jav a 2  s. c om
    return mActivity.superOnPreparePanel(featureId, view, menu);
}

From source file:com.hellofyc.base.app.activity.BaseActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if ("com.android.internal.view.menu.MenuBuilder".equals(menu.getClass().getName())) {
            Reflect.on(menu).call("setOptionalIconsVisible", true);
        }//from w ww. java  2 s .co  m
    }
    return super.onMenuOpened(featureId, menu);
}

From source file:org.wheelmap.android.activity.MainMultiPaneActivity.java

@SuppressLint("NewApi")
@Override// w  w w .j  av a2 s . c om
public void onCreate(Bundle savedInstanceState) {

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);

    super.onCreate(savedInstanceState);

    appProperties = new AppProperties(WheelmapApp.getApp());
    Log.d(TAG, "onCreate");

    setProgressBarIndeterminate(true);
    setSupportProgressBarIndeterminateVisibility(false);

    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setHomeButtonEnabled(false);

    setContentView(R.layout.activity_multipane);
    mMovableLayout = (ViewGroup) findViewById(R.id.movable_layout);
    mResizeButton = (ImageButton) findViewById(R.id.button_movable_resize);

    ViewGroup g = (ViewGroup) findViewById(R.id.layout_multi);
    if (Build.VERSION.SDK_INT > 16) {
        g.getLayoutTransition().disableTransitionType(LayoutTransition.APPEARING);
    }

    if (savedInstanceState != null) {
        executeState(savedInstanceState);
    } else {
        executeDefaultInstanceState();
    }

    Bundle extras = getIntent().getExtras();
    if (extras.containsKey(Extra.MAP_MODE_ENGAGE)) {
        mapModeType = MapModeType.MAP_MODE_ENGAGE;
    } else {
        mapModeType = MapModeType.MAP_MODE_NORMAL;
    }

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);

    mResizeButton.setOnClickListener(this);

    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction t = fm.beginTransaction();

    mWorkerFragment = (CombinedWorkerFragment) fm.findFragmentByTag(CombinedWorkerFragment.TAG);

    if (mWorkerFragment == null) {
        mWorkerFragment = new CombinedWorkerFragment();
        t.add(mWorkerFragment, CombinedWorkerFragment.TAG);
    }

    mListFragment = (POIsListFragment) fm.findFragmentById(R.id.list_layout);
    if (mListFragment == null) {
        mListFragment = POIsListFragment.newInstance(false, true);
        t.add(R.id.list_layout, mListFragment, POIsListFragment.TAG);
    }

    mMapFragment = (POIsOsmdroidFragment) fm.findFragmentById(R.id.map_layout);
    if (mMapFragment == null) {
        mMapFragment = POIsOsmdroidFragment.newInstance(false, true);
        t.add(R.id.map_layout, mMapFragment, POIsOsmdroidFragment.TAG);
    }

    mDetailFragment = (POIDetailFragment) fm.findFragmentById(R.id.detail_layout);
    if (mDetailFragment == null) {
        mDetailFragment = POIDetailFragment.newInstance();
        t.add(R.id.detail_layout, mDetailFragment);
    }

    t.commit();

    WheelmapApp.checkForUpdates(this);

    app = (WheelmapApp) this.getApplication();
    String uri = null;

    try {
        address = app.getAddressString();
    } catch (Exception ex) {
    }

    if (address != null) {
        showSearch();
    }

    // Show a dialog if meets conditions
    AppRate.showRateDialogIfMeetsConditions(this);

}

From source file:tn.codeit.darna.MainActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);/*from  w ww  . j a  v a 2s . c om*/
                m.invoke(menu, true);
            } catch (NoSuchMethodException e) {
                Log.e(null, "onMenuOpened", e);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
    return super.onMenuOpened(featureId, menu);
}

From source file:im.vector.activity.MXCActionBarActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    // display the menu icon with the text
    if (((featureId == Window.FEATURE_ACTION_BAR) || ((featureId == Window.FEATURE_OPTIONS_PANEL)))
            && menu != null) {//from w  w w . j a  v a  2 s.  c o  m
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);
                m.invoke(menu, true);
            } catch (NoSuchMethodException e) {
                //Log.e(TAG, "onMenuOpened", e);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
    return super.onMenuOpened(featureId, menu);
}

From source file:de.ribeiro.android.gso.activities.PlanActivity.java

@SuppressLint("NewApi")
@Override/*from   w  ww  .  ja  v a2  s .  c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ImageButton FAB;
    // Android Version prfen, wenn neuer als API11,
    Boolean actionBarAvailable = false;
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // ActionBar anfragen
        actionBarAvailable = getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    }
    _logger = new Logger(this, "PlanActivity");
    setContentView(R.layout.activity_plan);
    this.ctxt = new MyContext(this, this);

    Configuration c = getResources().getConfiguration();
    this.orientation = c.orientation;
    _logger.Info("Creating PlanActivity with orientation int: " + orientation);
    try {
        File f = new File(this.getCacheDir(), "date.bin");
        if (f.exists() && f.canRead()) {
            ctxt.mProfil.stupid.currentDate = (Calendar) FileOPs.loadObject(f);
            f.delete();
        }
    } catch (Exception e) {
        _logger.Error("An Error occurred while loading date.bin file", e);
    }

    ctxt.mProfil = new ProfilManager(ctxt).getCurrentProfil();
    ctxt.mProfil.setPrefs();
    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
    lbm.registerReceiver(mMessageReceiver, new IntentFilter(Const.BROADCASTREFRESH));
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        int noticationId = extras.getInt("notificationId");

        if (noticationId != 0) {
            extras.remove("notificationId");
            //notication aus taskbar entfernen
            NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            nm.cancel(noticationId);
            Calendar date = new GregorianCalendar();
            date.setTimeInMillis(extras.getLong("date"));

            extras.remove("weekIndex");
            int profilIndex = extras.getInt("profilIndex");
            extras.remove("profilIndex");

            //alle Profile laden
            ProfilManager pm = new ProfilManager(ctxt);
            if (pm.profiles.size() >= pm.currentProfilIndex) {
                pm.profiles.get(pm.currentProfilIndex).setPrefs();
                if (profilIndex > pm.profiles.size() - 1)
                    profilIndex = 0;
                else
                    pm.currentProfilIndex = profilIndex;
                pm.applyProfilIndex();
                ctxt.mProfil.loadPrefs();
            }

            ctxt.mProfil.stupid.currentDate = date;

        }

        ctxt.newVersionReqSetup = extras.getBoolean("newVersionInfo", false);
    }

    ActionBar actionBar = getActionBar();
    if (ctxt.mIsRunning)
        actionBar.show();

    ctxt.executor.post(new PlanActivityLuncher(PlanActivity.this));

    //        FAB = (ImageButton) findViewById(R.id.imageButton);
    //        FAB.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                ctxt.getCurStupid().currentDate = new GregorianCalendar();
    //                ctxt.pager.setPage(ctxt.getCurStupid().currentDate);
    //            }
    //        });
}