Clover Coverage Report - Main Coverage Report
Coverage timestamp: ven dic 19 2014 16:47:52 EST
../../../../img/srcFileCovDistChart7.png 35% of files have more coverage
31   104   13   3,44
8   81   0,42   3
9     1,44  
3    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  ActivityTitle       Line # 14 31 13 68,8% 0.6875
  ActivityTitle.IActivityTitleRightImageClickEvent       Line # 97 0 0 - -1.0
  ActivityTitle.IActivityTitleLeftImageClickEvent       Line # 101 0 0 - -1.0
 
No Tests
 
1    package com.dreamcatcher.bicycle.view;
2   
3    import android.content.Context;
4    import android.util.AttributeSet;
5    import android.view.LayoutInflater;
6    import android.view.View;
7    import android.widget.ImageView;
8    import android.widget.LinearLayout;
9    import android.widget.TextView;
10   
11    import com.dreamcatcher.bicycle.BicycleApp;
12    import com.dreamcatcher.bicycle.R;
13   
 
14    public class ActivityTitle extends LinearLayout {
15    private TextView mTitleText = null;
16    private ImageView mRightImage = null;
17    private ImageView mRightImageSplit = null;
18   
19    private ImageView mLeftImageView = null;
20    private ImageView mLeftImageSplit = null;
21   
22    private boolean mRightImageSelected = false;
23    private boolean mLeftImageSelected = false;
24   
 
25  0 toggle public ActivityTitle(Context context) {
26  0 super(context);
27  0 initTitle();
28    }
29   
 
30  13 toggle public ActivityTitle(Context context, AttributeSet attrs) {
31  13 super(context, attrs);
32  13 initTitle();
33    }
34   
 
35  13 toggle private void initTitle() {
36  13 LayoutInflater inflater = LayoutInflater.from(BicycleApp.getInstance());
37  13 inflater.inflate(R.layout.activity_title, this, true);
38  13 mTitleText = (TextView) findViewById(R.id.activity_title_text);
39  13 mRightImage = (ImageView) findViewById(R.id.activity_title_right_image);
40  13 mRightImageSplit = (ImageView) findViewById(R.id.activity_title_right_image_split);
41  13 mLeftImageView = (ImageView) findViewById(R.id.activity_title_left_image);
42  13 mLeftImageSplit = (ImageView) findViewById(R.id.activity_title_left_image_split);
43    }
44   
45    /**
46    * set activity tile
47    * @param title
48    */
 
49  4 toggle public void setActivityTitle(CharSequence title) {
50  4 mTitleText.setText(title);
51    }
52   
53    /**
54    * set activity title
55    * @param strId string id in strings.xml
56    */
 
57  9 toggle public void setActivityTitle(int strId) {
58  9 mTitleText.setText(strId);
59    }
60   
 
61  2 toggle public void setRightImage(int resId, final IActivityTitleRightImageClickEvent rightImageClickEvent, final boolean changImage){
62  2 mRightImage.setImageResource(resId);
63  2 mRightImage.setVisibility(View.VISIBLE);
64  2 mRightImageSplit.setVisibility(View.VISIBLE);
65  2 if(rightImageClickEvent != null){
66  2 mRightImage.setOnClickListener(new OnClickListener() {
 
67  2 toggle public void onClick(View v) {
68  2 rightImageClickEvent.onRightImageClicked();
69  2 if(changImage){
70  0 mRightImageSelected = !mRightImageSelected;
71  0 mRightImage.setSelected(mRightImageSelected);
72    }
73    }
74    });
75    }
76    }
77   
 
78  1 toggle public void setLeftImage(int resId, final IActivityTitleLeftImageClickEvent leftImageClickEvent, final boolean changeImage){
79  1 mLeftImageView.setImageResource(resId);
80  1 mLeftImageView.setVisibility(View.VISIBLE);
81  1 mLeftImageSplit.setVisibility(View.VISIBLE);
82   
83  1 if(leftImageClickEvent != null){
84  1 mLeftImageView.setOnClickListener(new OnClickListener() {
 
85  0 toggle @Override
86    public void onClick(View v) {
87  0 leftImageClickEvent.onLeftImageClicked();
88  0 if(changeImage){
89  0 mLeftImageSelected = !mLeftImageSelected;
90  0 mLeftImageView.setSelected(mLeftImageSelected);
91    }
92    }
93    });
94    }
95    }
96   
 
97    public interface IActivityTitleRightImageClickEvent{
98    void onRightImageClicked();
99    }
100   
 
101    public interface IActivityTitleLeftImageClickEvent{
102    void onLeftImageClicked();
103    }
104    }