Added missing up-navigation buttons

This commit is contained in:
daniel oeh 2013-09-04 21:04:53 +02:00
parent 8d94bf9e67
commit 09977992bf
6 changed files with 84 additions and 1 deletions

View File

@ -343,6 +343,10 @@
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.AddFeedActivity" />
</activity>
<activity
android:name=".activity.gpoddernet.GpodnetTagActivity"
@ -353,6 +357,9 @@
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.gpoddernet.GpodnetMainActivity" />
</activity>
<activity
@ -366,6 +373,9 @@
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.gpoddernet.GpodnetMainActivity" />
</activity>
<activity
@ -381,6 +391,9 @@
<action android:name=".activity.gpoddernet.GpodnetAuthenticationActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.PreferenceActivity" />
</activity>

View File

@ -2,7 +2,10 @@ package de.danoeh.antennapod.activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
@ -32,6 +35,22 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
private Button subscribeButton;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void loadData() {
super.loadData();

View File

@ -5,9 +5,11 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.*;
import de.danoeh.antennapod.AppConfig;
@ -55,6 +57,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTheme(UserPreferences.getTheme());
setContentView(R.layout.gpodnetauth_activity);
@ -82,6 +85,16 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
}

View File

@ -4,7 +4,9 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastTopListFragment;
import de.danoeh.antennapod.fragment.gpodnet.SuggestionListFragment;
@ -24,12 +26,22 @@ public class GpodnetMainActivity extends GpodnetActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.gpodnet_main);
ViewPager viewpager = (ViewPager) findViewById(R.id.viewpager);
viewpager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
private class PagerAdapter extends FragmentStatePagerAdapter {
private static final int NUM_PAGES_LOGGED_OUT = 2;

View File

@ -4,6 +4,8 @@ import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment;
import org.apache.commons.lang3.StringUtils;
@ -18,6 +20,7 @@ public class GpodnetSearchActivity extends GpodnetActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.gpodnet_search);
}
@ -47,4 +50,14 @@ public class GpodnetSearchActivity extends GpodnetActivity {
searchFragment.changeQuery(query);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@ -3,6 +3,8 @@ package de.danoeh.antennapod.activity.gpoddernet;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastListFragment;
import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment;
@ -26,6 +28,7 @@ public class GpodnetTagActivity extends GpodnetActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.gpodnet_tag_activity);
if (!getIntent().hasExtra(ARG_TAGNAME)) {
@ -48,4 +51,14 @@ public class GpodnetTagActivity extends GpodnetActivity{
return service.getPodcastsForTag(tag, PODCAST_COUNT);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}