Bug 876938: MenuItem should handle closing the menu of share action. [r=wesj]

--HG--
extra : rebase_source : ca005ac974e3efbf858edac3fd360a3cfddc21b9
This commit is contained in:
Sriram Ramasubramanian 2013-05-29 21:54:57 -07:00
parent 691ca38200
commit f085bc3ffe
2 changed files with 10 additions and 6 deletions

View File

@ -1439,12 +1439,6 @@ abstract public class BrowserApp extends GeckoApp
if (Build.VERSION.SDK_INT >= 14) {
MenuItem share = mMenu.findItem(R.id.share);
GeckoActionProvider provider = new GeckoActionProvider(this);
provider.setOnTargetSelectedListener(new GeckoActionProvider.OnTargetSelectedListener() {
@Override
public void onTargetSelected() {
closeOptionsMenu();
}
});
share.setActionProvider(provider);
}

View File

@ -218,6 +218,16 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
@Override
public MenuItem setActionProvider(ActionProvider actionProvider) {
mActionProvider = actionProvider;
if (mActionProvider != null && mActionProvider instanceof GeckoActionProvider) {
GeckoActionProvider provider = (GeckoActionProvider) mActionProvider;
provider.setOnTargetSelectedListener(new GeckoActionProvider.OnTargetSelectedListener() {
@Override
public void onTargetSelected() {
mMenu.close();
}
});
}
return this;
}