package mprog.nl.mars_weather_explorer;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;


/**
 * Created by Nadeche
 */
public class MarsWeatherWidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {

        // Get all ids
        ComponentName thisWidget = new ComponentName(context, MarsWeatherWidgetProvider.class);
        int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);

        // Build the intent to call the service
        Intent intent = new Intent(context.getApplicationContext(), UpdateWidgetService.class);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds);

        // Update the widgets via the service
        context.startService(intent);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        super.onReceive(context, intent);
    }
}

@@ -34,16 +34,92 @@
 lorer;%0A%0A
+/**%0A * MarsWeatherWidgetProvider.java%0A *%0A * Created by Nadeche Studer%0A * */%0A
 import a
@@ -307,34 +307,135 @@
 %0A/**%0A * 
-Created by Nadeche
+This class contains an AppWidgetProvider that calls the UpdateWidgetService%0A * when the widget receives an update call.
 %0A */%0Apub
@@ -628,15 +628,26 @@
  // 
-Get all
+collect all widget
  ids
@@ -834,9 +834,9 @@
  // 
-B
+b
 uild
@@ -1056,18 +1056,28 @@
  // 
-U
+u
 pdate 
-the
+all installed
  wid
@@ -1144,130 +1144,7 @@
    %7D
-%0A%0A    @Override%0A    public void onReceive(Context context, Intent intent) %7B%0A        super.onReceive(context, intent);%0A    %7D
 %0A%7D%0A

Refactor and comments added to MarsWeatherWidgetProvider.