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.dsdar.thosearoundme.TeamViewActivity.java

@Override
protected void onCreate(Bundle theSavedInstanceState) {
    super.onCreate(theSavedInstanceState);
    itsHandler = new Handler();
    itsHandler1 = new Handler();

    // MyAppConstants.INVITATION_CNT=1;
    // invite_count = String.valueOf(MyAppConstants.INVITATION_CNT);

    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_team);
    initializeComponents();// ww  w .jav a 2  s  . co  m

    itsSharedPreference = getSharedPreferences(MyAppConstants.APP_PREFERENCE, MODE_PRIVATE);

    // Retrieving userId from preference
    aSharedPreference = getSharedPreferences(MyAppConstants.APP_PREFERENCE, MODE_PRIVATE);
    itsLoginUserId = aSharedPreference.getString(TeamBuilder.MEMBERID, "");
    itsLoginPhone = aSharedPreference.getString(TeamBuilder.PHONE, "");
    intSupported = aSharedPreference.getInt(MyAppConstants.SUPPORTED, 0);

    itsNormalMapView.setOnClickListener(this);
    itsSatelliteMapView.setOnClickListener(this);
    itsHybridMapView.setOnClickListener(this);
    itsShowAllButton.setOnClickListener(this);
    itsTeamView.setOnClickListener(this);
    itsHomeView.setOnClickListener(this);
    itsFollowersView.setOnClickListener(this);
    itsAddTeam.setOnClickListener(this);
    itsAddTeamMember.setOnClickListener(this);
    itsTvMan.setOnClickListener(this);
    itsMyLoc.setOnClickListener(this);
    itsStickyMarker.setOnClickListener(this);
    itsStickyMarker.setVisibility(View.GONE);
    // calling location service
    startService(new Intent(getBaseContext(), LocationUpdates.class));

    aEditor = itsSharedPreference.edit();

    getAndLoadTeamInfo();
    // MyAppConstants.selTab = 1;

}

From source file:org.artoolkit.ar.samples.ARMovie.ARMovieActivity.java

/** Called when the activity is first created. */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override// w  ww.jav  a2  s.c o  m
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate()");
    super.onCreate(savedInstanceState);

    boolean needActionBar = false;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            if (!ViewConfiguration.get(this).hasPermanentMenuKey())
                needActionBar = true;
        } else {
            needActionBar = true;
        }
    }
    if (needActionBar) {
        requestWindowFeature(Window.FEATURE_ACTION_BAR);
    } else {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // Force landscape-only.
    updateNativeDisplayParameters();

    //Bundle extras = getIntent().getExtras();
    //String baseFolderPath = extras.getString("baseFolderPath");

    //int markerID = ARToolKit.getInstance().addMarker("multi;"+baseFolderPath +"/marker.dat");

    setContentView(R.layout.main_video);
    mButton = (Button) findViewById(R.id.button_capture);
    mButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //Toast.makeText(ARCloud.this, "Take picture", Toast.LENGTH_LONG).show();
            LinearLayout linearLayoutResultWrapper = (LinearLayout) findViewById(R.id.result_wrapper);
            if (linearLayoutResultWrapper.getChildCount() > 0) {
                linearLayoutResultWrapper.removeViewAt(0);
                linearLayoutResultWrapper.removeAllViews();
            }

            camSurface.getCamera().takePicture(null, null, mPicture);
            ;
        }
    });

    ARMovieActivity.nativeCreate(this);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private void initActionBar() {
    if (DEBUG)//from w ww. j  a v  a 2s  . co  m
        Log.d(TAG, "[initActionBar]");

    // Initializing the window decor can change window feature flags.
    // Make sure that we have the correct set before performing the test below.
    if (mDecor == null) {
        installDecor();
    }

    if ((aActionBar != null) || !hasFeature(Window.FEATURE_ACTION_BAR) || hasFeature(Window.FEATURE_NO_TITLE)
            || mActivity.isChild()) {
        return;
    }

    aActionBar = new ActionBarImpl(mActivity, mFeatures);

    if (!mIsDelegate) {
        //We may never get another chance to set the title
        wActionBar.setWindowTitle(mActivity.getTitle());
    }
}

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  ww  .j  av a 2 s  . c  o  m*/
    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:com.google.code.twisty.Twisty.java

/** Called when activity is first created. */
@Override//w  ww. j av  a  2s.c  o m
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);

    // Map our built-in game resources to real filenames
    builtinGames.clear();
    builtinGames.put(R.raw.violet, "violet.z8");
    builtinGames.put(R.raw.rover, "rover.gblorb");
    builtinGames.put(R.raw.glulxercise, "glulxercise.ulx");
    builtinGames.put(R.raw.windowtest, "windowtest.ulx");

    UISync.setInstance(this);

    // An imageview to show the twisty icon
    iv = new ImageView(this);
    iv.setBackgroundColor(0xffffff);
    iv.setImageResource(R.drawable.app_icon);
    iv.setAdjustViewBounds(true);
    iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    // The main 'welcome screen' window from which games are launched.
    tv = new TextBufferView(this);
    mainWin = new TextBufferIO(tv, new StyleManager());
    //final GlkEventQueue eventQueue = null;
    tv.setFocusableInTouchMode(true);

    // The Glk window layout manager
    glkLayout = new GlkLayout(this);

    // put it all together
    ll = new LinearLayout(this);
    ll.setBackgroundColor(Color.argb(0xFF, 0xFE, 0xFF, 0xCC));
    ll.setOrientation(android.widget.LinearLayout.VERTICAL);
    ll.addView(iv);
    ll.addView(tv);
    glkLayout.setVisibility(View.GONE);
    ll.addView(glkLayout);
    setContentView(ll);

    dialog_handler = new DialogHandler(this);
    terp_handler = new TerpHandler(this);

    // Ensure we can write story files and save games to external storage
    checkWritePermission();

    Uri dataSource = this.getIntent().getData();
    if (dataSource != null) {
        /* Suck down the URI we received to sdcard, launch terp on it. */
        try {
            startTerp(dataSource);
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
        }
    } else {
        printWelcomeMessage();
    }
}

From source file:com.klinker.android.twitter.activities.tweet_viewer.TweetPager.java

public void setUpWindow(boolean youtube) {

    requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_PROGRESS);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
            WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    // Params for the window.
    // You can easily set the alpha and the dim behind the window from here
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.alpha = 1.0f; // lower than one makes it more transparent
    if (!youtube) {
        params.dimAmount = .75f; // set it higher if you want to dim behind the window
    } else {/*from  ww  w  .j a  v a  2s. com*/
        params.dimAmount = 0f;
    }
    getWindow().setAttributes(params);

    // Gets the display size so that you can set the window to a percent of that
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

    // You could also easily used an integer value from the shared preferences to set the percent
    if (height > width) {
        getWindow().setLayout((int) (width * .9), (int) (height * .8));
    } else {
        getWindow().setLayout((int) (width * .7), (int) (height * .8));
    }
}

From source file:usbong.android.likha_collection_1.UsbongDecisionTreeEngineActivity.java

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

    super.onCreate(savedInstanceState);

    instance = this;

    //added by Mike, 20160511
    if (UsbongUtils.hasUnlockedAllLanguages) {
        UsbongUtils.hasUnlockedLocalLanguages = true;
        UsbongUtils.hasUnlockedForeignLanguages = true;
    }/*  w ww .j ava  2  s .  co  m*/

    //edited by Mike, 20160417
    UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getCacheDir()
            .getAbsolutePath() + UsbongUtils.myAppTreeFolder;

    //added by Mike, 20151212
    //       UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getCacheDir().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";
    //       UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getApplicationContext().getExternalCacheDir().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";
    //       UsbongUtils.USBONG_TREES_FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";

    //added by Mike, 27 Sept. 2015
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    UsbongUtils.myAssetManager = getAssets();

    //added by Mike, 22 Sept. 2015
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Title Screen");

    currUsbongNode = ""; //added by Mike, 20160417
    isAutoLoopedTree = false; //added by Mike, 20160417

    /*//commented out by Mike, 20161110
          //added by Mike, 29 Sept. 2015
          myProgressDialog = ProgressDialog.show(instance, "Loading...",
      "This takes only a short while.", true, false);              
          new MyBackgroundTask().execute();        
    */
    //added by Mike, 20161111
    myInitTreeProgressDialog = ProgressDialog.show(instance, "Loading Trees...",
            "This takes only a short while.", true, false);
    new MyInitTreeBackgroundTask().execute();

    //        init(); //added by Mike, 20161110
}

From source file:usbong.android.retrocc.UsbongDecisionTreeEngineActivity.java

@SuppressWarnings("deprecation")
@Override//  w  w  w  .ja va 2 s  . c o m
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    super.onCreate(savedInstanceState);

    instance = this;

    myBuyActivity = new BuyActivity();

    //added by Mike, 20160511
    if (UsbongUtils.hasUnlockedAllLanguages) {
        UsbongUtils.hasUnlockedLocalLanguages = true;
        UsbongUtils.hasUnlockedForeignLanguages = true;
    }

    //edited by Mike, 20160417
    UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getCacheDir()
            .getAbsolutePath() + UsbongUtils.myAppTreeFolder;

    //added by Mike, 20151212
    //       UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getCacheDir().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";
    //       UsbongUtils.USBONG_TREES_FILE_PATH = UsbongDecisionTreeEngineActivity.getInstance().getApplicationContext().getExternalCacheDir().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";
    //       UsbongUtils.USBONG_TREES_FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/usbong_kuto/" + "usbong_kuto_trees/";

    //added by Mike, 27 Sept. 2015
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    UsbongUtils.myAssetManager = getAssets();

    //added by Mike, 22 Sept. 2015
    //        getSupportActionBar().setDisplayHomeAsUpEnabled(true);        
    //        getSupportActionBar().setTitle("Title Screen");
    getSupportActionBar().setTitle(getResources().getString(R.string.app_name)); //edited by Mike, 20170214
    /*
            //added by Mike, 20170314
            //Reference: https://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging;
            //last accessed: 20170314
            final ActionBar actionBar = getSupportActionBar();
            
            // Specify that tabs should be displayed in the action bar.
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
                    
            // Create a tab listener that is called when the user changes tabs.
            ActionBar.TabListener tabListener = new ActionBar.TabListener() {
             @Override
             public void onTabReselected(Tab arg0, FragmentTransaction arg1) {
    // TODO Auto-generated method stub
            
             }
            
             @Override
             public void onTabSelected(Tab arg0, FragmentTransaction arg1) {
    // TODO Auto-generated method stub
            
             }
            
             @Override
             public void onTabUnselected(Tab arg0, FragmentTransaction arg1) {
    // TODO Auto-generated method stub
            
             }
            };
            
            // Add 3 tabs, specifying the tab's text and TabListener
            for (int i = 0; i < 3; i++) {
    actionBar.addTab(
            actionBar.newTab()
                    .setText("Tab " + (i + 1))
                    .setTabListener(tabListener));
            }
    */
    currUsbongNode = ""; //added by Mike, 20160417
    isAutoLoopedTree = false; //added by Mike, 20160417

    //added by Mike, 29 Sept. 2015
    myProgressDialog = ProgressDialog.show(instance, "Loading...", "This takes only a short while.", true,
            false);
    new MyBackgroundTask().execute();
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
    if (DEBUG)/*  ww  w .j a  v  a  2s.  co  m*/
        Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(true);
        }
        return true;
    }

    return false;
}

From source file:lu.fisch.canze.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // always create an instance

    // needed to get strings from resources in non-Activity classes
    res = getResources();/*from   w  ww. j  a v  a2  s .co  m*/

    // dataLogger = DataLogger.getInstance();
    dataLogger = new DataLogger();

    debug("MainActivity: onCreate");

    instance = this;

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // navigation bar
    AppSectionsPagerAdapter appSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());
    actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    viewPager = (ViewPager) findViewById(R.id.main);
    viewPager.setAdapter(appSectionsPagerAdapter);
    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            //actionBar.setSelectedNavigationItem(position);
            updateActionBar();
        }
    });
    updateActionBar();

    /*
    for (int i = 0; i < appSectionsPagerAdapter.getCount(); i++) {
    actionBar.addTab(
            actionBar.newTab()
                    .setText(appSectionsPagerAdapter.getPageTitle(i))
                    .setTabListener(MainActivity.this));
    }
    */

    // load the initial "main" fragment
    //loadFragement(new MainFragment());

    setTitle(TAG + " - not connected");
    setBluetoothState(BLUETOOTH_DISCONNECTED);

    // tabs
    //final ActionBar actionBar = getSupportActionBar();
    // Specify that tabs should be displayed in the action bar.

    // open the database
    CanzeDataSource.getInstance(getBaseContext()).open();
    // cleanup
    CanzeDataSource.getInstance().cleanUp();

    // setup cleaning (once every hour)
    Runnable cleanUpRunnable = new Runnable() {
        @Override
        public void run() {
            CanzeDataSource.getInstance().cleanUp();
        }
    };
    Handler handler = new Handler();
    handler.postDelayed(cleanUpRunnable, 60 * 1000);

    // register for bluetooth changes
    IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED);
    this.registerReceiver(broadcastReceiver, intentFilter);

    // configure Bluetooth manager
    BluetoothManager.getInstance().setBluetoothEvent(new BluetoothEvent() {
        @Override
        public void onBeforeConnect() {
            setBluetoothState(BLUETOOTH_SEARCH);
        }

        @Override
        public void onAfterConnect(BluetoothSocket bluetoothSocket) {
            device.init(visible);
            device.registerFilters();

            // set title
            debug("MainActivity: onAfterConnect > set title");
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    setTitle(TAG + " - connected to <" + bluetoothDeviceName + "@" + bluetoothDeviceAddress
                            + ">");
                    setBluetoothState(BLUETOOTH_CONNECTED);
                }
            });
        }

        @Override
        public void onBeforeDisconnect(BluetoothSocket bluetoothSocket) {
        }

        @Override
        public void onAfterDisconnect() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    setTitle(TAG + " - disconnected");
                }
            });
        }
    });
    // detect hardware status
    int BT_STATE = BluetoothManager.getInstance().getHardwareState();
    if (BT_STATE == BluetoothManager.STATE_BLUETOOTH_NOT_AVAILABLE)
        toast("Sorry, but your device doesn't seem to have Bluetooth support!");
    else if (BT_STATE == BluetoothManager.STATE_BLUETOOTH_NOT_ACTIVE) {
        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        startActivityForResult(enableBtIntent, 1);
    }

    // load settings
    // - includes the reader
    // - includes the decoder
    //loadSettings(); --> done in onResume

    // load fields from static code
    debug("Loaded fields: " + fields.size());

    // load fields
    //final SharedPreferences settings = getSharedPreferences(PREFERENCES_FILE, 0);
    (new Thread(new Runnable() {
        @Override
        public void run() {
            debug("Loading fields last field values from database");
            for (int i = 0; i < fields.size(); i++) {
                Field field = fields.get(i);
                field.setCalculatedValue(CanzeDataSource.getInstance().getLast(field.getSID()));
                //debug("MainActivity: Setting "+field.getSID()+" = "+field.getValue());
                //f.setValue(settings.getFloat(f.getUniqueID(), 0));
            }
            debug("Loading fields last field values from database (done)");
        }
    })).start();
}