Bug 884133: Kill sAppContext in GeckoApp. [r=blassey]

--HG--
extra : rebase_source : 28ce06926299a7d6c9f1413a9de89ea535ae60a3
This commit is contained in:
Sriram Ramasubramanian 2013-06-17 17:31:17 -07:00
Родитель 28da1b7d59
Коммит 5a77d35813
1 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -334,7 +334,7 @@ abstract public class GeckoApp
@Override
public MenuInflater getMenuInflater() {
if (Build.VERSION.SDK_INT >= 11)
return new GeckoMenuInflater(sAppContext);
return new GeckoMenuInflater(this);
else
return super.getMenuInflater();
}
@ -607,7 +607,7 @@ abstract public class GeckoApp
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
BrowserDB.addBookmark(GeckoApp.sAppContext.getContentResolver(), title, url);
BrowserDB.addBookmark(getContentResolver(), title, url);
}
});
}
@ -795,7 +795,7 @@ abstract public class GeckoApp
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(sAppContext, resId, duration).show();
Toast.makeText(GeckoApp.this, resId, duration).show();
}
});
}
@ -806,9 +806,9 @@ abstract public class GeckoApp
public void run() {
Toast toast;
if (duration.equals("long"))
toast = Toast.makeText(sAppContext, message, Toast.LENGTH_LONG);
toast = Toast.makeText(GeckoApp.this, message, Toast.LENGTH_LONG);
else
toast = Toast.makeText(sAppContext, message, Toast.LENGTH_SHORT);
toast = Toast.makeText(GeckoApp.this, message, Toast.LENGTH_SHORT);
toast.show();
}
});
@ -920,21 +920,21 @@ abstract public class GeckoApp
}
private void setImageAsWallpaper(final String aSrc) {
final String progText = sAppContext.getString(R.string.wallpaper_progress);
final String successText = sAppContext.getString(R.string.wallpaper_success);
final String failureText = sAppContext.getString(R.string.wallpaper_fail);
final String progText = getString(R.string.wallpaper_progress);
final String successText = getString(R.string.wallpaper_success);
final String failureText = getString(R.string.wallpaper_fail);
final String fileName = aSrc.substring(aSrc.lastIndexOf("/") + 1);
final PendingIntent emptyIntent = PendingIntent.getActivity(sAppContext, 0, new Intent(), 0);
final AlertNotification notification = new AlertNotification(sAppContext, fileName.hashCode(),
final PendingIntent emptyIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
final AlertNotification notification = new AlertNotification(this, fileName.hashCode(),
R.drawable.alert_download, fileName, progText, System.currentTimeMillis(), null);
notification.setLatestEventInfo(sAppContext, fileName, progText, emptyIntent );
notification.setLatestEventInfo(this, fileName, progText, emptyIntent );
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.show();
new UiAsyncTask<Void, Void, Boolean>(ThreadUtils.getBackgroundHandler()) {
@Override
protected Boolean doInBackground(Void... params) {
WallpaperManager mgr = WallpaperManager.getInstance(sAppContext);
WallpaperManager mgr = WallpaperManager.getInstance(GeckoApp.this);
if (mgr == null) {
return false;
}
@ -1052,10 +1052,10 @@ abstract public class GeckoApp
notification.flags |= Notification.FLAG_AUTO_CANCEL;
if(!success) {
notification.tickerText = failureText;
notification.setLatestEventInfo(sAppContext, fileName, failureText, emptyIntent);
notification.setLatestEventInfo(GeckoApp.this, fileName, failureText, emptyIntent);
} else {
notification.tickerText = successText;
notification.setLatestEventInfo(sAppContext, fileName, successText, emptyIntent);
notification.setLatestEventInfo(GeckoApp.this, fileName, successText, emptyIntent);
}
notification.show();
}
@ -1291,7 +1291,7 @@ abstract public class GeckoApp
final String profilePath = getProfile().getDir().getAbsolutePath();
final EventDispatcher dispatcher = GeckoAppShell.getEventDispatcher();
Log.i(LOGTAG, "Creating BrowserHealthRecorder.");
mHealthRecorder = new BrowserHealthRecorder(sAppContext, profilePath, dispatcher,
mHealthRecorder = new BrowserHealthRecorder(GeckoApp.this, profilePath, dispatcher,
previousSession);
}
});
@ -1437,7 +1437,7 @@ abstract public class GeckoApp
// Check if launched from data reporting notification.
if (ACTION_LAUNCH_SETTINGS.equals(action)) {
Intent settingsIntent = new Intent(GeckoApp.sAppContext, GeckoPreferences.class);
Intent settingsIntent = new Intent(GeckoApp.this, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent);
startActivity(settingsIntent);
@ -1530,7 +1530,7 @@ abstract public class GeckoApp
// Record our launch time for the announcements service
// to use in assessing inactivity.
final Context context = GeckoApp.sAppContext;
final Context context = GeckoApp.this;
AnnouncementsBroadcastService.recordLastLaunch(context);
// Kick off our background services that fetch product
@ -1799,7 +1799,7 @@ abstract public class GeckoApp
processAlertCallback(intent);
} if (ACTION_LAUNCH_SETTINGS.equals(action)) {
// Check if launched from data reporting notification.
Intent settingsIntent = new Intent(GeckoApp.sAppContext, GeckoPreferences.class);
Intent settingsIntent = new Intent(GeckoApp.this, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent);
startActivity(settingsIntent);