Clover Coverage Report - AnCal Coverage Report
Coverage timestamp: gio dic 18 2014 12:18:42 EST
../../../../img/srcFileCovDistChart6.png 88% of files have more coverage
42   112   18   3,82
12   92   0,43   11
11     1,64  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  Utils       Line # 16 42 18 53,8% 0.53846157
 
No Tests
 
1   
2    package pl.magot.vetch.ancal;
3   
4   
5    import java.util.Calendar;
6   
7    import android.content.*;
8    import android.content.pm.PackageInfo;
9    import android.content.pm.PackageManager.NameNotFoundException;
10    import android.view.View;
11    import android.view.animation.AlphaAnimation;
12    import android.view.animation.TranslateAnimation;
13    import android.app.AlertDialog;
14   
15   
 
16    public class Utils
17    {
18    private Context ctx = null;
19   
20    public static int ANIM_ALPHA_DURATION = 100;
21    public static int ANIM_TRANSLATE_DURATION = 30;
22   
23    //UTILS
 
24  32 toggle public Utils(Context context) {
25  32 ctx = context;
26    }
27   
 
28  181 toggle public String GetResStr(int id)
29    {
30  181 return ctx.getResources().getString(id);
31    }
32   
 
33  0 toggle public void alert(String msg)
34    {
35  0 int iconId = 0;
36  0 AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
37  0 dlg.setMessage(msg);
38  0 dlg.setPositiveButton(GetResStr(R.string.msgBoxButtonOk), null);
39  0 dlg.setTitle(ctx.getClass().getName().toString());
40  0 dlg.setIcon(iconId);
41  0 dlg.create();
42  0 dlg.show();
43    }
44   
 
45  0 toggle public void alert(int i)
46    {
47  0 Integer ii = i;
48  0 alert(ii.toString());
49    }
50   
 
51  0 toggle public void ShowMsgResStr(int i, MessageType msgType)
52    {
53  0 AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
54  0 dlg.setMessage(GetResStr(i));
55  0 dlg.setPositiveButton(GetResStr(R.string.msgBoxButtonOk), null);
56  0 dlg.setTitle(msgType.getTitle());
57  0 dlg.setIcon(msgType.getIcon());
58  0 dlg.create();
59  0 dlg.show();
60    }
61   
 
62  10 toggle public static boolean YearDaysEqual(Calendar calDate, Calendar calDateTo)
63    {
64  10 if (calDate.get(Calendar.YEAR) == calDateTo.get(Calendar.YEAR))
65  9 if (calDate.get(Calendar.MONTH) == calDateTo.get(Calendar.MONTH))
66  9 if (calDate.get(Calendar.DAY_OF_MONTH) == calDateTo.get(Calendar.DAY_OF_MONTH))
67  9 return true;
68  1 return false;
69    }
70   
 
71  6 toggle public static boolean YearDaysGreater(Calendar calDate, Calendar calDateTo)
72    {
73  6 if (calDate.get(Calendar.YEAR) >= calDateTo.get(Calendar.YEAR))
74  3 if (calDate.get(Calendar.MONTH) >= calDateTo.get(Calendar.MONTH))
75  3 if (calDate.get(Calendar.DAY_OF_MONTH) >= calDateTo.get(Calendar.DAY_OF_MONTH))
76  3 return true;
77  3 return false;
78    }
79   
 
80  9 toggle public static String CapitalizeFirstLetter(String sText)
81    {
82  9 return sText.substring(0,1).toUpperCase() + sText.substring(1, sText.length()).toLowerCase();
83    }
84   
 
85  1 toggle public static String getAppVersionName(Context ctx)
86    {
87  1 try
88    {
89  1 PackageInfo pi = ctx.getPackageManager().getPackageInfo("pl.magot.vetch.ancal", 0);
90  1 return pi.versionName;
91    } catch (NameNotFoundException e) {
92    }
93  0 return "";
94    }
95   
 
96  26 toggle public static void startAlphaAnimIn(View view)
97    {
98  26 AlphaAnimation anim = new AlphaAnimation(0.5F, 1);
99  26 anim.setDuration(ANIM_ALPHA_DURATION);
100  26 anim.startNow();
101  26 view.startAnimation(anim);
102    }
103   
 
104  0 toggle public static void startTranslateAnimIn(View view)
105    {
106  0 TranslateAnimation anim = new TranslateAnimation(0, 0, - view.getHeight(), 0);
107  0 anim.setDuration(ANIM_TRANSLATE_DURATION);
108  0 anim.startNow();
109  0 view.startAnimation(anim);
110    }
111   
112    }