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:dentex.youtube.downloader.menu.DonateActivity.java

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

    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    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.donate, false);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new DonateFragment()).commit();
    setupActionBar();/*from   w w  w.  j a v a2s  .c om*/
}

From source file:com.andro_yce.safedelhi.ScreenSlideActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();//from  w  ww .  j  a va 2s  .com
    setContentView(R.layout.activity_screen_slide);

    // Instantiate a ViewPager and a PagerAdapter.
    mPager = (ViewPager) findViewById(R.id.pager);
    mPagerAdapter = new ScreenSlidePagerAdapter(getFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            /* if(position==3)
             {
                Intent main_intent = new Intent(ScreenSlideActivity.this, MainActivity.class);
              startActivity(main_intent);
             }*/
            invalidateOptionsMenu();
        }
    });
}

From source file:dentex.youtube.downloader.docs.TranslatorsListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    // Theme init
    Utils.themeInit(this);

    setContentView(R.layout.activity_translators_list);

    setupActionBar();//from   www  . j  av  a2 s .co m

    String[] languagesArray = getLanguages(false);
    String[] decodedLanguagesArray = getLanguages(true);

    for (int i = 0; i < languagesArray.length; i++) {
        String[] list = getTranslatorsNames(languagesArray[i]);
        adapter.addSection(decodedLanguagesArray[i],
                new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list));
    }

    setListAdapter(adapter);
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setTitle(R.string.title_activity_donate);

    settings = getSharedPreferences(PREFS_NAME, 0);

    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    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.donate, false);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new DonateFragment()).commit();
    setupActionBar();//from   w w w . j a  v  a2s.  c  om
}

From source file:io.imoji.sdk.ui.sample.WidgetActivity.java

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

    getSupportActionBar().setBackgroundDrawable(
            new ColorDrawable(getResources().getColor(R.color.widget_activity_action_bar_color)));
    setContentView(R.layout.activity_widget);

    RelativeLayout container = (RelativeLayout) findViewById(R.id.widget_main_view);

    int identifier = getIntent().getIntExtra(WIDGET_IDENTIFIER, 1);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    SearchResultAdapter.ImageLoader imageLoader = new SearchResultAdapter.ImageLoader() {
        @Override//from   ww  w  .  ja va2 s. co  m
        public void loadImage(@NonNull ImageView target, @NonNull Uri uri,
                @NonNull final SearchResultAdapter.ImageLoaderCallback callback) {
            Ion.with(target).load(uri.toString()).setCallback(new FutureCallback<ImageView>() {
                @Override
                public void onCompleted(Exception e, ImageView result) {
                    callback.updateImageView();
                }
            });
        }
    };

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    RenderingOptions renderingOptions = new RenderingOptions(
            preferences.getBoolean(getString(R.string.pref_key_sticker_borders_enabled), true)
                    ? RenderingOptions.BorderStyle.Sticker
                    : RenderingOptions.BorderStyle.None,
            RenderingOptions.ImageFormat.Png, RenderingOptions.Size.Thumbnail);
    WidgetDisplayOptions options = new WidgetDisplayOptions(renderingOptions);
    options.setIncludeRecentsAndCreate(
            preferences.getBoolean(getString(R.string.pref_key_recents_create_enabled), true));

    switch (identifier) {
    case 0:
        widget = new QuarterScreenWidget(this, options, imageLoader);
        setTitle(R.string.activity_title_quarter_screen);
        container.addView(widget, params);
        break;
    case 1:
        widget = new HalfScreenWidget(this, options, imageLoader);
        setTitle(R.string.activity_title_half_screen);
        container.addView(widget, params);
        break;
    case 2:
        widget = new FullScreenWidget(this, options, imageLoader);
        getSupportActionBar().hide();
        container.addView(widget);
        widget.setWidgetListener(new WidgetListener() {
            @Override
            public void onCloseButtonTapped() {
                NavUtils.navigateUpFromSameTask(WidgetActivity.this);
            }

            @Override
            public void onStickerTapped(Imoji imoji) {

            }
        });
        break;
    }
}

From source file:com.acrylicgoat.scrumnotes.MainActivity.java

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

    setContentView(R.layout.activity_main);
    sharedPref = getSharedPreferences("com.acrylicgoat.scrumnotes", MODE_PRIVATE);
    if (savedInstanceState != null) {
        currentOwner = savedInstanceState.getString("currentOwner");
    }//w ww.  java 2 s.c o  m
    if (currentOwner == null || currentOwner.equals("")) {
        currentOwner = sharedPref.getString("currentOwner", "");
    }
    aBar = this.getActionBar();

    today = (EditText) findViewById(R.id.editToday);
    today.setAutoLinkMask(Linkify.ALL);
    today.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            Linkify.addLinks(today, Linkify.ALL);

        }
    });
    devName = (TextView) findViewById(R.id.devName);
    yesterday = (ImageButton) findViewById(R.id.calendarButton);
    yesterday.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            displayPopup();

        }
    });

    String[] items = getResources().getStringArray(R.array.nav_list);
    setDrawer(items);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerList = (ListView) findViewById(R.id.left_drawer);
    SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to);

    // Set the adapter for the list view
    //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles));
    // Set the list's click listener
    drawerList.setOnItemClickListener(new DrawerItemClickListener());

    drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            drawerLayout, /* 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) {
            getActionBar().setTitle(getString(R.string.app_name));
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(getString(R.string.app_name));
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    drawerToggle.setDrawerIndicatorEnabled(true);
    drawerToggle.syncState();
    drawerLayout.setDrawerListener(drawerToggle);
    aBar.setTitle(getString(R.string.app_name));
    //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    aBar.setDisplayHomeAsUpEnabled(true);
    aBar.setHomeButtonEnabled(true);
    drawerList.setAdapter(sAdapter);

}

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

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

    // 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();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.//w w w . ja v  a 2 s.c o m
    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.pagerShow);
    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(); 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));
    }

}

From source file:com.acrylicgoat.devchat.MainActivity.java

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

    setContentView(R.layout.activity_main);

    sharedPref = getSharedPreferences("com.acrylicgoat.devchat", MODE_PRIVATE);
    if (savedInstanceState != null) {
        currentOwner = savedInstanceState.getString("currentOwner");
    }//from  w  ww  .  ja  v a2s.c  om
    if (currentOwner == null || currentOwner.equals("")) {
        currentOwner = sharedPref.getString("currentOwner", "");
    }
    aBar = this.getActionBar();

    today = (EditText) findViewById(R.id.editToday);
    today.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            Linkify.addLinks(today, Linkify.ALL);

        }
    });
    devName = (TextView) findViewById(R.id.devName);
    yesterday = (ImageButton) findViewById(R.id.calendarButton);
    yesterday.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            displayPopup();

        }
    });

    String[] items = getResources().getStringArray(R.array.nav_list);
    setDrawer(items);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerList = (ListView) findViewById(R.id.left_drawer);
    SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to);

    // Set the adapter for the list view
    //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles));
    // Set the list's click listener
    drawerList.setOnItemClickListener(new DrawerItemClickListener());

    drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            drawerLayout, /* 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) {
            getActionBar().setTitle(getString(R.string.app_name));
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(getString(R.string.app_name));
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    drawerToggle.setDrawerIndicatorEnabled(true);
    drawerToggle.syncState();
    drawerLayout.setDrawerListener(drawerToggle);
    aBar.setTitle(getString(R.string.app_name));
    //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    aBar.setDisplayHomeAsUpEnabled(true);
    aBar.setHomeButtonEnabled(true);
    drawerList.setAdapter(sAdapter);

}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setTitle(R.string.title_activity_about);

    settings = getSharedPreferences(PREFS_NAME, 0);

    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();/* w  ww .j ava2s. c o  m*/
}

From source file:com.manoj.macawplayer.SwipeViewActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.drawable.theme_skyblue);/*from   w  ww  . j a  va2 s  .  co m*/
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.swipe_view);
    int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
    TextView actionBarTextView = (TextView) findViewById(actionBarTitleId);

    if (actionBarTextView != null) {
        Log.i("actionBarTextView :", "not null");
        actionBarTextView.setTextColor(Color.GREEN);
    } else
        Log.i("actionBarTextView :", "null");

    // 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();

    // 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);

    //to remove the title and icon above the action bar
    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayShowHomeEnabled(false);

    // 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);
    LinearLayout homeScreen = (LinearLayout) findViewById(R.id.swipeviewl);
    utilities = new Utilities();
    utilities.colorSeter(homeScreen, getApplicationContext());

    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(); 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));
        /*Tab tab = actionBar.getTabAt(i);
        View v  = tab.setgetCustomView();
        v.setBackgroundResource(R.drawable.theme_skyblue);*/
    }
}