implemented homeAsUp button

This commit is contained in:
daniel oeh 2012-07-11 21:03:17 +02:00
parent 254fad8f70
commit 75e2288654
4 changed files with 63 additions and 17 deletions

View File

@ -44,6 +44,7 @@ public class DownloadActivity extends SherlockListActivity implements
super.onCreate(savedInstanceState);
Log.d(TAG, "Creating Activity");
requester = DownloadRequester.getInstance();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@ -104,6 +105,9 @@ public class DownloadActivity extends SherlockListActivity implements
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
case MENU_SHOW_LOG:
startActivity(new Intent(this, DownloadLogActivity.class));
break;

View File

@ -6,7 +6,6 @@ import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
import de.podfetcher.adapter.DownloadLogAdapter;
import de.podfetcher.feed.FeedManager;
@ -16,20 +15,31 @@ public class DownloadLogActivity extends SherlockListActivity {
DownloadLogAdapter dla;
FeedManager manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
manager = FeedManager.getInstance();
dla = new DownloadLogAdapter(this, 0, manager.getDownloadLog());
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setListAdapter(dla);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
return false;
}
return true;
}
}

View File

@ -40,6 +40,7 @@ import android.widget.ViewSwitcher;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
import com.viewpagerindicator.TabPageIndicator;
@ -124,8 +125,19 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
return super.onCreateOptionsMenu(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
return false;
}
return true;
}
@Override
@ -172,7 +184,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
orientation = getResources().getConfiguration().orientation;
manager = FeedManager.getInstance();
getWindow().setFormat(PixelFormat.TRANSPARENT);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
bindToService();
}
@ -665,8 +677,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
holderCreated = false;
}
public static class MediaPlayerPagerAdapter extends
FragmentPagerAdapter {
public static class MediaPlayerPagerAdapter extends FragmentPagerAdapter {
private int numItems;
private MediaplayerActivity activity;

View File

@ -3,6 +3,8 @@ package de.podfetcher.activity;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
@ -10,6 +12,25 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preferences);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
return false;
}
return true;
}
}