Clover Coverage Report - SaveApp Coverage Report
Coverage timestamp: mar dic 23 2014 15:53:11 EST
../../../../img/srcFileCovDistChart0.png 77% of files have more coverage
24   83   9   6
8   60   0,38   4
4     2,25  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  WidgetSaveApp       Line # 12 24 9 0% 0.0
 
No Tests
 
1    package com.loopback.androidapps.saveapp;
2   
3    import android.app.PendingIntent;
4    import android.appwidget.AppWidgetManager;
5    import android.appwidget.AppWidgetProvider;
6    import android.content.Context;
7    import android.content.Intent;
8    import android.util.Log;
9    import android.widget.RemoteViews;
10    import android.widget.Toast;
11   
 
12    public class WidgetSaveApp extends AppWidgetProvider {
13   
14    public DBManager dbManager;
15    public SaveApp saveApp;
16    String account;
17    RemoteViews views;
18    public static String ACTION_WIDGET_CONFIGURE = "ConfigureWidget";
19    public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget";
20   
 
21  0 toggle public void onUpdate(Context context, AppWidgetManager appWidgetManager,
22    int[] appWidgetIds) {
23  0 final int N = appWidgetIds.length;
24   
25    // Perform this loop procedure for each App Widget that belongs to this
26    // provider
27  0 for (int i = 0; i < N; i++) {
28  0 int appWidgetId = appWidgetIds[i];
29   
30    // Create an Intent to launch ExampleActivity
31  0 Intent intent = new Intent(context, WidgetSaveApp.class);
32  0 intent.setAction(ACTION_WIDGET_RECEIVER);
33  0 intent.putExtra("msg", "New Movement Added");
34  0 PendingIntent actionPendingIntent = PendingIntent.getBroadcast(
35    context, 0, intent, 0);
36   
37    // Get the layout for the App Widget and attach an on-click listener
38    // to the button
39  0 views = new RemoteViews(context.getPackageName(), R.layout.widget);
40  0 views.setOnClickPendingIntent(R.id.btnWidget, actionPendingIntent);
41   
42    // Tell the AppWidgetManager to perform an update on the current app
43    // widget
44  0 Log.d("WUP", "Painting..." + String.valueOf(i));
45  0 appWidgetManager.updateAppWidget(appWidgetId, views);
46    }
47    }
48   
 
49  0 toggle public void onReceive(Context context, Intent intent) {
50    // v1.5 fix that doesn't call onDelete Action
51  0 final String action = intent.getAction();
52  0 if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
53  0 final int appWidgetId = intent.getExtras().getInt(
54    AppWidgetManager.EXTRA_APPWIDGET_ID,
55    AppWidgetManager.INVALID_APPWIDGET_ID);
56  0 if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
57  0 this.onDeleted(context, new int[] { appWidgetId });
58    }
59    } else {
60    // check, if our Action was called
61  0 if (intent.getAction().equals(ACTION_WIDGET_RECEIVER)) {
62  0 String msg = "null";
63  0 try {
64  0 msg = intent.getStringExtra("msg");
65    } catch (NullPointerException e) {
66  0 Log.e("Error", "msg = null");
67    }
68  0 Toast.makeText(context, msg + account, Toast.LENGTH_SHORT).show();
69    }
70   
71  0 super.onReceive(context, intent);
72    }
73    }
74   
 
75  0 toggle public void onEnabled(Context context) {
76  0 dbManager.open();
77    }
78   
 
79  0 toggle public void onDisable(Context context) {
80    // Delete Alarms
81    }
82   
83    }