64 lines
1.6 KiB
Java
64 lines
1.6 KiB
Java
package com.dougkeen.bart.actionbarcompat;
|
|
|
|
import android.app.Activity;
|
|
import android.os.Bundle;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
|
|
/**
|
|
* Damn, I wish Java had mixins
|
|
*/
|
|
public class ActionBarActivity extends Activity {
|
|
final ActionBarHelper mActionBarHelper = ActionBarHelper
|
|
.createInstance(this);
|
|
|
|
/**
|
|
* Returns the {@link ActionBarHelper} for this activity.
|
|
*/
|
|
protected ActionBarHelper getActionBarHelper() {
|
|
return mActionBarHelper;
|
|
}
|
|
|
|
/** {@inheritDoc} */
|
|
@Override
|
|
public MenuInflater getMenuInflater() {
|
|
return mActionBarHelper.getMenuInflater(super.getMenuInflater());
|
|
}
|
|
|
|
/** {@inheritDoc} */
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
mActionBarHelper.onCreate(savedInstanceState);
|
|
}
|
|
|
|
/** {@inheritDoc} */
|
|
@Override
|
|
protected void onPostCreate(Bundle savedInstanceState) {
|
|
super.onPostCreate(savedInstanceState);
|
|
mActionBarHelper.onPostCreate(savedInstanceState);
|
|
}
|
|
|
|
/**
|
|
* Base action bar-aware implementation for
|
|
* {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
|
|
*
|
|
* Note: marking menu items as invisible/visible is not currently supported.
|
|
*/
|
|
@Override
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
boolean retValue = false;
|
|
retValue |= mActionBarHelper.onCreateOptionsMenu(menu);
|
|
retValue |= super.onCreateOptionsMenu(menu);
|
|
return retValue;
|
|
}
|
|
|
|
/** {@inheritDoc} */
|
|
@Override
|
|
protected void onTitleChanged(CharSequence title, int color) {
|
|
mActionBarHelper.onTitleChanged(title, color);
|
|
super.onTitleChanged(title, color);
|
|
}
|
|
|
|
}
|