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:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);/* ww  w .ja  v a2 s.  co m*/
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

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();/*from   w  w w.  j a v a2s  .  c  o m*/
    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.nononsenseapps.filepicker.ui.core.AbstractFilePickerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setupFauxDialog();//from w  w  w. j  a va 2 s. c o m
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_filepicker);

    Intent intent = getIntent();
    if (intent != null) {
        startPath = intent.getStringExtra(Extras.EXTRA_START_PATH);
        mode = AbstractFilePickerFragment.SelectionMode.values()[intent.getIntExtra(Extras.EXTRA_MODE,
                AbstractFilePickerFragment.SelectionMode.MODE_FILE.ordinal())];
        allowCreateDir = intent.getBooleanExtra(Extras.EXTRA_ALLOW_CREATE_DIR, allowCreateDir);
        allowMultiple = intent.getBooleanExtra(Extras.EXTRA_ALLOW_MULTIPLE, allowMultiple);
    }

    setupActionBar();

    FragmentManager fm = getSupportFragmentManager();
    AbstractFilePickerFragment fragment = (AbstractFilePickerFragment) fm.findFragmentByTag(TAG);

    if (fragment == null) {
        fragment = getFragment(startPath, mode, allowMultiple, allowCreateDir);
    }

    if (fragment != null) {
        fm.beginTransaction().replace(R.id.fragment, fragment, TAG).commit();
    }

    // Default to cancelled
    setResult(Activity.RESULT_CANCELED);
}

From source file:dentex.youtube.downloader.menu.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BugSenseHandler.leaveBreadcrumb("AboutActivity_onCreate");
    this.setTitle(R.string.title_activity_about);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    // Theme init
    Utils.themeInit(this);

    // Language init
    Utils.langInit(this);

    // Load default preferences values
    PreferenceManager.setDefaultValues(this, R.xml.about, false);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new AboutFragment()).commit();
    setupActionBar();/*from   w w w  . ja  va2s.  co  m*/
}

From source file:com.deemsysinc.gpsmobiletracking.DashboardActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();//from   w  w  w .  ja  va2 s. com
    setContentView(R.layout.dashboard);
    cd = new ConnectionDetector(getApplicationContext());
    isInternetPresent = cd.isConnectingToInternet();
    if (isInternetPresent) {
        new VehicleDetails().execute();
    }

    list2 = (ListView) findViewById(R.id.list);
    aboutus = (Button) findViewById(R.id.aboutus);
    contactus = (Button) findViewById(R.id.contactus);
    signout = (Button) findViewById(R.id.logout);
    welcomeusername = (TextView) findViewById(R.id.welcomeusername);
    welcomeusername.setText(LoginActivity.usernamepassed + "!");

    signout.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            LoginActivity.usernamepassed = "";
            VehichleArrayAdapter.data.clear();
            vehicleall.clear();
            Intent intentSignUP = new Intent(getApplicationContext(), LoginActivity.class);
            startActivity(intentSignUP);
        }
    });

    aboutus.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent intentSignUP = new Intent(getApplicationContext(), Aboutus.class);
            startActivity(intentSignUP);
        }
    });

    contactus.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent intentSignUP = new Intent(getApplicationContext(), ContactUs.class);
            startActivity(intentSignUP);
        }
    });
}

From source file:org.debian.paulliu.kajiradoubra.controller.KajiraDouBraController.java

/** Called when the activity is first created. */
@Override/* w w w .  j  av a2s.  c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.main);

    // Initilization
    mViewPager = (ViewPager) findViewById(R.id.main_pager);
    mActionBar = getActionBar();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager());

    mViewPager.setAdapter(mAdapter);
    mActionBar.setHomeButtonEnabled(false);
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Adding Tabs
    for (String tab_name : mTabs) {
        mActionBar.addTab(mActionBar.newTab().setText(tab_name).setTabListener(this));
    }

    /**
          * on swiping the viewpager make respective tab selected
          * */
    mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            // on changing the page
            // make respected tab selected
            mActionBar.setSelectedNavigationItem(position);
        }

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

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }
    });
}

From source file:dentex.youtube.downloader.UpgradeApkActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BugSenseHandler.leaveBreadcrumb("UpgradeApkActivity_onCreate");
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    // Theme init
    Utils.themeInit(this);

    // Language init
    Utils.langInit(this);

    setContentView(R.layout.activity_upgrade_apk);

    try {/*from ww  w. j  a  va  2  s  . co m*/
        currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        Utils.logger("d", "current version: " + currentVersion, DEBUG_TAG);
    } catch (NameNotFoundException e) {
        Log.e(DEBUG_TAG, "version not read: " + e.getMessage());
        currentVersion = "100";
    }

    upgradeButton = (Button) findViewById(R.id.upgrade_button);

    progressBar2 = (ProgressBar) findViewById(R.id.progressBar2);
    progressBar2.setVisibility(View.GONE);

    tv = (TextView) findViewById(R.id.upgrade_upper_text);
    tv.setText(getString(R.string.upgrade_uppertext_init) + currentVersion);

    cl = (TextView) findViewById(R.id.upgrade_textview2);

    setupActionBar();
}

From source file:com.example.jenil.parsedemo.GamePlayActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_game_play);

    Intent intent = getIntent();/*from  www .  ja  v  a 2  s. c o  m*/
    Phrase = intent.getStringExtra("MOVIE");
    words = Phrase.split(" ");

    opponent = intent.getStringExtra("OPPONENT");

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.

    final ActionBar actionBar = getActionBar();

    if (actionBar == null) {
        Log.i("ALERT", "NULL");
    } else {
        Log.i("ALERT", "NOT NULL");
    }

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount() - 1; i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
    actionBar.addTab(actionBar.newTab().setText("Submit").setTabListener(this));

}

From source file:info.guardianproject.otr.app.im.app.AccountWizardActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*w  w w .j av  a  2 s  .co m*/
protected void onCreate(Bundle icicle) {

    if (Build.VERSION.SDK_INT >= 11)
        getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    super.onCreate(icicle);

    getSupportActionBar().hide();

    mApp = (ImApp) getApplication();
    mApp.maybeInit(this);
    mApp.setAppTheme(this);

    if (!Imps.isUnlocked(this)) {
        onDBLocked();
        return;
    }

    mHandler = new MyHandler(this);
    mSignInHelper = new SignInHelper(this);

    buildAccountList();

    setContentView(R.layout.account_list_activity);

    // Instantiate a ViewPager and a PagerAdapter.
    mPager = (ViewPager) findViewById(R.id.pager);
    mPagerAdapter = new WizardPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);

    PageIndicator titleIndicator = (PageIndicator) findViewById(R.id.indicator);
    titleIndicator.setViewPager(mPager);
}

From source file:com.superyu.slidingmenu.SlidingMenu02.java

/**
 **??/* w  ww.j  av a2s  . com*/
 **/

@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);
                m.invoke(menu, true);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

    return super.onMenuOpened(featureId, menu);
}