Back to project page HapiPodcastJ.
The source code is released under:
GNU General Public License
If you think the Android project HapiPodcastJ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package info.xuluan.podcast; //from w w w . jav a2s . com import android.preference.PreferenceActivity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import info.xuluan.podcast.actionbar.ActionBarHelper; public class HapiPreferenceActivity extends PreferenceActivity { 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) { mActionBarHelper.onCreate(savedInstanceState); super.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; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: tapHome(); break; } return super.onOptionsItemSelected(item); } protected void tapHome() { //Toast.makeText(this, "Tapped Home", Toast.LENGTH_SHORT).show(); SharedPreferences prefsPrivate = getSharedPreferences(Pref.HAPI_PREFS_FILE_NAME, Context.MODE_PRIVATE); int homeActivity = prefsPrivate.getInt("homeActivity", 0); if (homeActivity!=0) startActivity(new Intent(this, HomeActivity.class)); else startActivity(new Intent(this, MainActivity.class)); } /**{@inheritDoc}*/ @Override protected void onTitleChanged(CharSequence title, int color) { mActionBarHelper.onTitleChanged(title, color); super.onTitleChanged(title, color); } }