Added workarounds for ActionMode/Option menu bugs

This commit is contained in:
daniel oeh 2013-09-05 14:39:53 +02:00
parent 5bcfd2c255
commit 7926494d76
2 changed files with 97 additions and 92 deletions

View File

@ -9,7 +9,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
@ -21,7 +20,9 @@ import de.danoeh.antennapod.storage.DownloadRequestException;
import de.danoeh.antennapod.util.LangUtils;
import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler;
/** Displays information about a feed. */
/**
* Displays information about a feed.
*/
public class FeedInfoActivity extends ActionBarActivity {
private static final String TAG = "FeedInfoActivity";
@ -55,7 +56,6 @@ public class FeedInfoActivity extends ActionBarActivity {
super.onPostExecute(result);
if (result != null) {
feed = result;
if (feed != null) {
if (AppConfig.DEBUG)
Log.d(TAG, "Language is " + feed.getLanguage());
if (AppConfig.DEBUG)
@ -84,7 +84,7 @@ public class FeedInfoActivity extends ActionBarActivity {
.getLanguageString(feed.getLanguage()));
}
supportInvalidateOptionsMenu();
}
} else {
Log.e(TAG, "Activity was started with invalid arguments");
}
@ -106,11 +106,14 @@ public class FeedInfoActivity extends ActionBarActivity {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (feed != null) {
menu.findItem(R.id.support_item).setVisible(
feed.getPaymentLink() != null);
menu.findItem(R.id.share_link_item).setVisible(feed.getLink() != null);
return true;
} else {
return false;
}
}
@Override

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
@ -244,10 +245,11 @@ public class FeedlistFragment extends Fragment implements
}
private boolean actionModeDestroyWorkaround = false; // TODO remove this workaround
private boolean skipWorkAround = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH;
@Override
public void onDestroyActionMode(ActionMode mode) {
if (actionModeDestroyWorkaround) {
if (skipWorkAround || actionModeDestroyWorkaround) {
mActionMode = null;
selectedFeed = null;
fla.setSelectedItemIndex(FeedlistAdapter.SELECTION_NONE);