Clover Coverage Report - Subsonic-Android Coverage Report
Coverage timestamp: ven dic 19 2014 17:57:13 EST
../../../../../img/srcFileCovDistChart7.png 55% of files have more coverage
19   67   11   2,38
4   54   0,58   8
8     1,38  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  TabActivityBackgroundTask       Line # 9 19 11 67,7% 0.67741936
 
No Tests
 
1    package net.sourceforge.subsonic.androidapp.util;
2   
3    import net.sourceforge.subsonic.androidapp.activity.SubsonicTabActivity;
4   
5    /**
6    * @author Sindre Mehus
7    * @version $Id$
8    */
 
9    public abstract class TabActivityBackgroundTask<T> extends BackgroundTask<T> {
10   
11    private final SubsonicTabActivity tabActivity;
12   
 
13  20 toggle public TabActivityBackgroundTask(SubsonicTabActivity activity) {
14  20 super(activity);
15  20 tabActivity = activity;
16    }
17   
 
18  20 toggle @Override
19    public void execute() {
20  20 tabActivity.setProgressVisible(true);
21   
22  20 new Thread() {
 
23  20 toggle @Override
24    public void run() {
25  20 try {
26  20 final T result = doInBackground();
27  20 if (isCancelled()) {
28  0 return;
29    }
30   
31  20 getHandler().post(new Runnable() {
 
32  20 toggle @Override
33    public void run() {
34  20 tabActivity.setProgressVisible(false);
35  20 done(result);
36    }
37    });
38    } catch (final Throwable t) {
39  0 if (isCancelled()) {
40  0 return;
41    }
42  0 getHandler().post(new Runnable() {
 
43  0 toggle @Override
44    public void run() {
45  0 tabActivity.setProgressVisible(false);
46  0 error(t);
47    }
48    });
49    }
50    }
51    }.start();
52    }
53   
 
54  20 toggle private boolean isCancelled() {
55  20 return tabActivity.isDestroyed();
56    }
57   
 
58  57 toggle @Override
59    public void updateProgress(final String message) {
60  57 getHandler().post(new Runnable() {
 
61  57 toggle @Override
62    public void run() {
63  57 tabActivity.updateProgress(message);
64    }
65    });
66    }
67    }