Java Code Examples for android.support.v7.app.ActionBar.setDisplayOptions()

The following are Jave code examples for showing how to use setDisplayOptions() of the android.support.v7.app.ActionBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Loyalty   File: SearchResultsActivity.java   Source Code and License Vote up 7 votes
@Override
protected void onResume() {
    super.onResume();

    ActionBar actionBar = getSupportActionBar();

    if (actionBar != null && !resumed) {

        // add the custom view to the action bar
        actionBar.setCustomView(R.layout.search_actionbar);

        searchField = (EditText) actionBar.getCustomView().findViewById(R.id.searchField);
        searchField.addTextChangedListener(this);

        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setDisplayHomeAsUpEnabled(true);

        resumed = true;
    }
}
 
Example 2
Project: QueryHighlighter   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAdapter = new CheesesAdapter();

    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.search_view);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    final EditText editText = (EditText) actionBar.getCustomView();
    editText.addTextChangedListener(mTextWatcher);
    editText.requestFocus();
}
 
Example 3
Project: mapbook-android   File: MapbookActivity.java   Source Code and License Vote up 6 votes
/**
 * On creation of the activity, set up the action bar title
 * and check that the user has granted permissions for reading
 * external storage.
 * @param savedInstanceState - Bundle
 */
@Override
final protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);
  mLayout = findViewById(R.id.coordinator_layout);

  final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  if (toolbar != null){
    final ActionBar actionBar = (this).getSupportActionBar();
    if (actionBar != null){

      actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
      actionBar.setTitle(R.string.title);
      actionBar.setCustomView(R.layout.logged_in_user);
    }
    toolbar.setNavigationIcon(null);
  }

}
 
Example 4
Project: Treebolic   File: TreebolicBasicActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// widget
	this.widget = new Widget(this, this);

	// content view
	setContentView(R.layout.activity_treebolic);
	final ViewGroup container = findViewById(R.id.container);
	final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.F);
	container.addView(this.widget, params);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);

	// action bar
	setSupportActionBar(toolbar);
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setElevation(0);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
Example 5
Project: Treebolic   File: ServicesActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_services);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// adapter
	final SimpleAdapter adapter = Services.makeAdapter(this, R.layout.item_services, from, to, true);
	final ListView listView = findViewById(R.id.services);
	listView.setAdapter(adapter);
}
 
Example 6
Project: Treebolic   File: SettingsActivity.java   Source Code and License Vote up 6 votes
@SuppressWarnings("unchecked")
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// read args
	final String action = getIntent().getAction();
	if (action == null)
	{
		SettingsActivity.provider = (HashMap<String, Object>) getIntent().getSerializableExtra(SettingsActivity.ARG_PROVIDER_SELECTED);
	}
}
 
Example 7
Project: Treebolic   File: ProvidersActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_providers);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// adapter
	final BaseAdapter adapter = Providers.makeAdapter(this, R.layout.item_providers, from, to, true);
	final ListView listView = findViewById(R.id.providers);
	listView.setAdapter(adapter);
}
 
Example 8
Project: TreebolicPlugins   File: SettingsActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
Example 9
Project: TreebolicPlugins   File: SettingsActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
Example 10
Project: TreebolicPlugins   File: SettingsActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
Example 11
Project: OSchina_resources_android   File: BaseActivity.java   Source Code and License Vote up 5 votes
protected void initActionBar(ActionBar actionBar) {
    if (actionBar == null)
        return;
    if (hasBackButton()) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
        mActionBar.setHomeButtonEnabled(true);
    } else {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.setDisplayUseLogoEnabled(false);
        int titleRes = getActionBarTitle();
        if (titleRes != 0) {
            actionBar.setTitle(titleRes);
        }
    }
}
 
Example 12
Project: Treebolic   File: TreebolicClientActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// widget
	this.widget = new Widget(this, this);

	// content view
	setContentView(R.layout.activity_treebolic);
	final ViewGroup container = findViewById(R.id.container);
	container.addView(this.widget);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);

	// action bar
	setSupportActionBar(toolbar);
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setElevation(0);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// init widget with model is asynchronous
}
 
Example 13
Project: TreebolicPlugins   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_main);

	// toolbar
	final Toolbar toolbar = findViewById(org.treebolic.download.R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
	}

	// initialize
	initialize();

	// check
	Checker.check(this);

	// fragment
	if (savedInstanceState == null)
	{
		PlaceholderFragment fragment = new PlaceholderFragment();
		getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
	}
}
 
Example 14
Project: TreebolicPlugins   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_main);

	// toolbar
	final Toolbar toolbar = findViewById(org.treebolic.download.R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
	}

	// initialize
	initialize();

	// check
	Checker.check(this);

	// fragment
	if (savedInstanceState == null)
	{
		PlaceholderFragment fragment = new PlaceholderFragment();
		getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
	}
}
 
Example 15
Project: TreebolicPlugins   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_main);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
	}

	// initialize
	initialize();

	// check
	Checker.check(this);

	// fragment
	if (savedInstanceState == null)
	{
		PlaceholderFragment fragment = new PlaceholderFragment();
		getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
	}
}