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 |
|
|
|
|
| 68,8% |
Uncovered Elements: 15 (48) |
Complexity: 13 |
Complexity Density: 0,42 |
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
25 |
0
|
public ActivityTitle(Context context) {... |
26 |
0
|
super(context); |
27 |
0
|
initTitle(); |
28 |
|
} |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
30 |
13
|
public ActivityTitle(Context context, AttributeSet attrs) {... |
31 |
13
|
super(context, attrs); |
32 |
13
|
initTitle(); |
33 |
|
} |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0,14 |
|
35 |
13
|
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 |
|
|
47 |
|
@param |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
4
|
public void setActivityTitle(CharSequence title) {... |
50 |
4
|
mTitleText.setText(title); |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@param |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
9
|
public void setActivityTitle(int strId) {... |
58 |
9
|
mTitleText.setText(strId); |
59 |
|
} |
60 |
|
|
|
|
| 85,7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
|
61 |
2
|
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() { |
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
67 |
2
|
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 |
|
|
|
|
| 85,7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
|
78 |
1
|
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() { |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
85 |
0
|
@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 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
97 |
|
public interface IActivityTitleRightImageClickEvent{ |
98 |
|
void onRightImageClicked(); |
99 |
|
} |
100 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
101 |
|
public interface IActivityTitleLeftImageClickEvent{ |
102 |
|
void onLeftImageClicked(); |
103 |
|
} |
104 |
|
} |