Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 705: Sync button does not work on Honeycomb. #39

Merged
merged 1 commit into from
Aug 30, 2011

Conversation

flerda
Copy link

@flerda flerda commented Aug 30, 2011

I updated the commit to use Build.VERSION.SDK instead of Build.VERSION.SDK_INT.
This should fix the compatibility problem with API level 3.
Could you confirm if this works on Android 1.5?

The underlying reason for the issue is that in Honeycomb the menu items
are generated whenever the action bar is shown instead of when the user
presses the menu key on the device; as a consequence, the StudyOptions
activity will get first a disabled Sync button in the action bar (while
the deck is loading) and this will not be enabled when the deck finally
loads (or disabled when the deck is closed).

To fix this, we need to call Activity.invalidateOptionsMenu() any time
something happens that causes the options menu options to change.

However, this method is only available is API Level 11 and above. To fix
this (and future problems of this sort). I introduced a new Compat
interface which is meant to contain functions which need to be
implemented differently on different API levels.

There are a number of implementations of this interface (currently on
CompatV3 and CompatV11) which may do different things on the different
platforms: for example, there is no need to invalidate the options menu
items on any platform before Honeycomb, so
Compat.invalidOptionsMenu(Activity) is simply an empty function in
CompatV3.

The underlying reason for the issue is that in Honeycomb the menu items
are generated whenever the action bar is shown instead of when the user
presses the menu key on the device; as a consequence, the StudyOptions
activity will get first a disabled Sync button in the action bar (while
the deck is loading) and this will not be enabled when the deck finally
loads (or disabled when the deck is closed).

To fix this, we need to call Activity.invalidateOptionsMenu() any time
something happens that causes the options menu options to change.

However, this method is only available is API Level 11 and above. To fix
this (and future problems of this sort). I introduced a new Compat
interface which is meant to contain functions which need to be
implemented differently on different API levels.

There are a number of implementations of this interface (currently on
CompatV3 and CompatV11) which may do different things on the different
platforms: for example, there is no need to invalidate the options menu
items on any platform before Honeycomb, so
Compat.invalidOptionsMenu(Activity) is simply an empty function in
CompatV3.
@nicolas-raoul nicolas-raoul merged commit 3ffa1a1 into nicolas-raoul:master Aug 30, 2011
nicolas-raoul pushed a commit that referenced this pull request Jan 29, 2013
diogovk pushed a commit to diogovk/Anki-Android that referenced this pull request Sep 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants