Clover Coverage Report - Subsonic-Android Coverage Report
Coverage timestamp: ven dic 19 2014 17:57:13 EST
../../../../../img/srcFileCovDistChart0.png 86% of files have more coverage
13   61   6   3,25
4   34   0,46   4
4     1,5  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  ErrorDialog       Line # 29 13 6 0% 0.0
 
No Tests
 
1    /*
2    This file is part of Subsonic.
3   
4    Subsonic is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8   
9    Subsonic is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12    GNU General Public License for more details.
13   
14    You should have received a copy of the GNU General Public License
15    along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
16   
17    Copyright 2009 (C) Sindre Mehus
18    */
19    package net.sourceforge.subsonic.androidapp.util;
20   
21    import android.app.Activity;
22    import android.app.AlertDialog;
23    import android.content.DialogInterface;
24    import net.sourceforge.subsonic.androidapp.R;
25   
26    /**
27    * @author Sindre Mehus
28    */
 
29    public class ErrorDialog {
30   
 
31  0 toggle public ErrorDialog(Activity activity, int messageId, boolean finishActivityOnCancel) {
32  0 this(activity, activity.getResources().getString(messageId), finishActivityOnCancel);
33    }
34   
 
35  0 toggle public ErrorDialog(final Activity activity, String message, final boolean finishActivityOnClose) {
36   
37  0 AlertDialog.Builder builder = new AlertDialog.Builder(activity);
38  0 builder.setIcon(android.R.drawable.ic_dialog_alert);
39  0 builder.setTitle(R.string.error_label);
40  0 builder.setMessage(message);
41  0 builder.setCancelable(true);
42  0 builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
 
43  0 toggle @Override
44    public void onCancel(DialogInterface dialogInterface) {
45  0 if (finishActivityOnClose) {
46  0 activity.finish();
47    }
48    }
49    });
50  0 builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
 
51  0 toggle @Override
52    public void onClick(DialogInterface dialogInterface, int i) {
53  0 if (finishActivityOnClose) {
54  0 activity.finish();
55    }
56    }
57    });
58   
59  0 builder.create().show();
60    }
61    }