Bug 970081 - Use Activity context instead of Application context for UI. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Fri, 14 Feb 2014 15:12:31 -0800
changeset 169392 3487558d7e3a321004df3131763885a8e63a72c6
parent 169391 f7cfdd3207738ee07fdcee551cedfd49f5fed624
child 169393 55b19bbcbdc7c0ed592966620d021dcce3d1aac8
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmfinkle
bugs970081
milestone30.0a1
Bug 970081 - Use Activity context instead of Application context for UI. r=mfinkle
mobile/android/base/home/HomeFragment.java
--- a/mobile/android/base/home/HomeFragment.java
+++ b/mobile/android/base/home/HomeFragment.java
@@ -112,17 +112,17 @@ abstract class HomeFragment extends Frag
         // between the activity and its fragments.
 
         ContextMenuInfo menuInfo = item.getMenuInfo();
         if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
             return false;
         }
 
         final HomeContextMenuInfo info = (HomeContextMenuInfo) menuInfo;
-        final Context context = getActivity().getApplicationContext();
+        final Context context = getActivity();
 
         final int itemId = item.getItemId();
         if (itemId == R.id.home_share) {
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't share because URL is null");
                 return false;
             } else {
                 GeckoAppShell.openUriExternal(info.url, SHARE_MIME_TYPE, "", "",
@@ -155,17 +155,17 @@ abstract class HomeFragment extends Frag
             final String url = (info.isInReadingList() ? ReaderModeUtils.getAboutReaderForUrl(info.url) : info.url);
             Tabs.getInstance().loadUrl(url, flags);
             Toast.makeText(context, R.string.new_tab_opened, Toast.LENGTH_SHORT).show();
             return true;
         }
 
         if (itemId == R.id.home_edit_bookmark) {
             // UI Dialog associates to the activity context, not the applications'.
-            new EditBookmarkDialog(getActivity()).show(info.url);
+            new EditBookmarkDialog(context).show(info.url);
             return true;
         }
 
         if (itemId == R.id.home_open_in_reader) {
             final String url = ReaderModeUtils.getAboutReaderForUrl(info.url);
             Tabs.getInstance().loadUrl(url, Tabs.LOADURL_NONE);
             return true;
         }