111
hxb
2022-11-24 0a3e07f10937484145f33c7560607b4b2353cb81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
package com.mm.android.deviceaddmodule.mobilecommon.widget;
 
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
 
import com.mm.android.deviceaddmodule.R;
import com.mm.android.deviceaddmodule.mobilecommon.utils.UIUtils;
 
/**
 * <p>
 * 工具类使用说明:左按钮,左内按钮,中间按钮,右内按钮,右按钮,均支持图片和文字背景二选一,左右按钮默认支持图片,中间按钮默认支持文字
 * </p>
 * <p>
 * xml使用注意:需要在xml文件中使用style="@style/common_titile"
 * </p>
 * <p>
 * 函数使用介绍:
 * </p>
 * <p>
 * initView(int tvLeftResId, int tvRightResId, int tvCenterResId) 初始化控件:左按钮,中间按钮,右按钮,属于普通用法
 * </p>
 * <p>
 * getTextViewXXX() 获取xxx按钮,进行自定义功能扩展操作。例如,实现展开下来listview的功能
 * </p>
 * <p>
 * setTitleXXXView(int resId, int colorId, int textSizeDimenId) 设置xxx按钮的文字,文字颜色,文字大小
 * </p>
 * <p>
 * setTitleXXX(int resId) 设置xxx按钮图片或文字
 * </p>
 * <p>
 * setTextColorXXX(int colorId) 设置xxx按钮文字的颜色资源
 * </p>
 * <p>
 * setTextSizeXXX(int textSizeDimenId) 设置xxx按钮文字的大小
 * </p>
 * <p>
 * setTitleTextXXX(int resId) 通过resId设置xxx按钮的文字
 * </p>
 * <p>
 * setTitleTextXXX(String titleTextXXX) 通过String设置xxx按钮的文字
 * </p>
 * <p>
 * setVisibleXXX(int flag) 通过flag设置xxx是否隐藏,flag:View.GONE,View.INVISIBLE,View.VISIBLE;
 * </p>
 */
public class CommonSubTitle extends RelativeLayout
// implements OnClickListener
{
    /**
     * 左侧按钮ID
     */
    public static final int ID_LEFT = 0;
 
    /**
     * 左侧内按钮ID
     */
    public static final int ID_LEFT_2 = 1;
 
    /**
     * 右侧按钮ID
     */
    public static final int ID_RIGHT = 2;
 
    /**
     * 右侧内按钮ID
     */
    public static final int ID_RIGHT_2 = 3;
 
    /**
     * 中间按钮ID, 暂时不加监听器
     */
    public static final int ID_CENTER = 4;
    
    /**
     * 中间下方按钮ID, 暂时不加监听器
     */
    public static final int ID_CENTER_SUB = 5;
 
    /**
     * 左侧按钮/ 左侧按钮LinearLayout
     */
    private TextView mTitleLeftTv;
 
    private LinearLayout mTitleLeftLl;
 
    /**
     * 左侧按钮(靠内) /左侧按钮(靠内)LinearLayout
     */
    private TextView mTitleLeft2Tv;
 
    private LinearLayout mTitleLeft2Ll;
 
    /**
     * 右侧按钮 /右侧按钮LinearLayout
     */
    private TextView mTitleRightTv;
 
    private LinearLayout mTitleRightLl;
 
    /**
     * 右侧按钮(靠内) /右侧按钮(靠内)LinearLayout
     */
    private TextView mTitleRight2Tv;
 
    private LinearLayout mTitleRight2Ll;
 
    /**
     * 大标题(上)/小标题(下)LinearLayout
     */
    private LinearLayout mTitleCenterLl;
    
    private TextView mTitleCenterTv;
    
    private TextView mTitleCenterSubTv;
    
    /**
     * 点击监听
     */
    private OnTitleSubClickListener mListener;
 
    private View mBottomV;
 
    /**
     * 默认隐藏左2和右2的按钮 ,创建一个新的实例CommonTitle.
     * 
     * @param context
     * @param attrs
     */
    public CommonSubTitle(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.widget_common_sub_title, this);
        initView();
        setListeners();
        setVisibleLeft2(View.GONE);
        setVisibleRight2(View.GONE);
    }
 
    private void initView() {
        mBottomV = findViewById(R.id.v_bottom_line);
        mTitleLeftLl = findViewById(R.id.ll_title_left);
        mTitleLeft2Ll = findViewById(R.id.ll_title_left2);
        mTitleRightLl = findViewById(R.id.ll_title_right);
        mTitleRight2Ll = findViewById(R.id.ll_title_right2);
        mTitleCenterLl = findViewById(R.id.ll_title_center);
 
        mTitleLeftTv = findViewById(R.id.tv_title_left);
        mTitleLeft2Tv = findViewById(R.id.tv_title_left2);
        mTitleRightTv = findViewById(R.id.tv_title_right);
        mTitleRight2Tv = findViewById(R.id.tv_title_right2);
        mTitleCenterTv = findViewById(R.id.tv_title_center);
        mTitleCenterSubTv = findViewById(R.id.tv_title_center_sub);
 
        mTitleLeftTv.setTextColor(getResources().getColor(R.color.common_title_text_color));
        mTitleLeft2Tv.setTextColor(getResources().getColor(R.color.common_title_text_color));
        mTitleRightTv.setTextColor(getResources().getColor(R.color.common_title_text_color));
        mTitleRight2Tv.setTextColor(getResources().getColor(R.color.common_title_text_color));
        mTitleCenterTv.setTextColor(getResources().getColor(R.color.c2));
 
        mTitleLeftTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources()
                .getDimensionPixelSize(R.dimen.text_size_mid));
        mTitleLeft2Tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.text_size_mid));
        mTitleRightTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.text_size_mid));
        mTitleRight2Tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.text_size_mid));
        mTitleCenterTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.text_size_large));
    }
 
    private void setListeners() {
        mTitleLeftLl.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null) {
                    mListener.onCommonTitleClick(ID_LEFT);
                }
 
            }
        });
 
        mTitleLeft2Ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null) {
                    mListener.onCommonTitleClick(ID_LEFT_2);
                }
 
            }
        });
 
        mTitleRightLl.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null) {
                    mListener.onCommonTitleClick(ID_RIGHT);
                }
 
            }
        });
 
        mTitleRight2Ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null)
                    mListener.onCommonTitleClick(ID_RIGHT_2);
            }
        });
 
        mTitleCenterLl.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null)
                    mListener.onCommonTitleClick(ID_CENTER);
            }
        });
    }
 
    /**
     * <p>
     * 初始化参数,按钮均可支持图片或者文字背景
     * @param tvLeftResId
     *            左按钮
     * @param tvRightResId
     *            右按钮
     * @param tvCenterResId
     *            中间按钮
     */
 
    public void initView(int tvLeftResId, int tvRightResId, int tvCenterResId) {
        setTitleLeftView(tvLeftResId, 0, 0);
        setTitleRightView(tvRightResId, 0, 0);
        setTitleCenterView(tvCenterResId, 0, 0);
    }
 
    public TextView getTextViewCenter() {
        return mTitleCenterTv;
    }
    
    public TextView getTextViewCenterSub() {
        return mTitleCenterSubTv;
    }
 
    /**
     * <p>
     * 设置是否选中按钮
     * </p>
     * @param selected
     *            {true,false}
     * @param id
     *            {ID_LEFT ,ID_LEFT_2,ID_RIGHT,ID_RIGHT_2,ID_CENTER}
     */
    public void setTitleSelected(boolean selected, int id) {
        View v = findViewByID(id);
        if (v != null) {
            v.setSelected(selected);
        }
    }
 
    /**
     * <p>
     * 设置按钮是否可用
     * </p>
     */
    public void setTitleEnabled(boolean enabled, int id) {
        View v = findParentViewById(id);
        if (v != null) {
            UIUtils.setEnabledEX(enabled, v);
        }
    }
 
    private View findParentViewById(int id) {
        switch (id) {
            case ID_LEFT:
                return mTitleLeftLl;
            case ID_LEFT_2:
                return mTitleLeft2Ll;
            case ID_RIGHT:
                return mTitleRightLl;
            case ID_RIGHT_2:
                return mTitleRight2Ll;
            case ID_CENTER:
                return mTitleCenterLl;
            default:
                return null;
        }
    }
 
    private View findViewByID(int id) {
        switch (id) {
            case ID_LEFT:
                return mTitleLeftTv;
            case ID_LEFT_2:
                return mTitleLeft2Tv;
            case ID_RIGHT:
                return mTitleRightTv;
            case ID_RIGHT_2:
                return mTitleRight2Tv;
            case ID_CENTER:
                return mTitleCenterTv;
            case ID_CENTER_SUB:
                return mTitleCenterSubTv;
            default:
                return null;
        }
    }
 
    /*------------------------------------------getTextView END------------------------------*/
 
    /*-----------------------------------setTitleView START---------------------------------*/
    public void setTitleLeftView(int resId, int colorId, int textSizeDimenId) {
        setTitleLeft(resId);
        setTextColorLeft(colorId);
        setTextSizeLeft(textSizeDimenId);
    }
 
    public void setTitleRightView(int resId, int colorId, int textSizeDimenId) {
        setTitleRight(resId);
        setTextColorRight(colorId);
        setTextSizeRight(textSizeDimenId);
    }
 
    public void setTitleCenterView(int resId, int colorId, int textSizeDimenId) {
        setTitleCenter(resId);
        setTextColorCenter(colorId);
        setTextSizeCenter(textSizeDimenId);
    }
 
    /*-----------------------------------setTitleView END---------------------------------*/
    /*------------------------------------------setTitle START------------------------------*/
    /**
     * <p>
     * 设置左边按钮图片或文字
     * </p>
     * @param leftResId
     */
    public void setTitleLeft(int leftResId) {
        if (mTitleLeftTv != null) {
            if (leftResId != 0) {
                if (mTitleLeftLl != null && mTitleLeftLl.getVisibility() != View.VISIBLE)
                    mTitleLeftLl.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(leftResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleLeftTv.setBackgroundResource(leftResId);
                        mTitleLeftTv.setText(null);
                    } else {
                        mTitleLeftTv.setText(leftResId);
                        mTitleLeftTv.setBackgroundResource(0);
                    }
                }
            } else {
                if (mTitleLeftLl != null)
                    mTitleLeftLl.setVisibility(INVISIBLE);
            }
        }
    }
 
    /**
     * <p>
     * 设置左边按钮图片或文字
     * </p>
     */
    public void setTitleLeft2(int left2ResId) {
        if (mTitleLeft2Tv != null) {
            if (left2ResId != 0) {
                if (mTitleLeft2Ll != null && mTitleLeft2Ll.getVisibility() != View.VISIBLE)
                    mTitleLeft2Ll.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(left2ResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleLeft2Tv.setBackgroundResource(left2ResId);
                        mTitleLeft2Tv.setText(null);
                    } else {
                        mTitleLeft2Tv.setText(left2ResId);
                        mTitleLeft2Tv.setBackgroundResource(0);
                    }
                }
            } else {
                if (mTitleLeft2Ll != null)
                    mTitleLeft2Ll.setVisibility(INVISIBLE);
            }
        }
    }
 
    /**
     * <p>
     * 设置右边按钮图片或文字
     * </p>
     *
     * @param rightResId
     */
    public void setTitleRight(int rightResId) {
        if (mTitleRightTv != null) {
            if (rightResId != 0) {
                if (mTitleRightLl != null && mTitleRightLl.getVisibility() != View.VISIBLE)
                    mTitleRightLl.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(rightResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleRightTv.setBackgroundResource(rightResId);
                        mTitleRightTv.setText(null);
                    } else {
                        mTitleRightTv.setText(rightResId);
                        mTitleRightTv.setBackgroundResource(0);
                    }
 
                }
            } else {
                if (mTitleRightLl != null)
                    mTitleRightLl.setVisibility(INVISIBLE);
            }
        }
    }
 
    public void setTitleRight2(int right2ResId) {
        if (mTitleRight2Tv != null) {
            if (right2ResId != 0) {
                if (mTitleRight2Ll != null && mTitleRight2Ll.getVisibility() != View.VISIBLE)
                    mTitleRight2Ll.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(right2ResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleRight2Tv.setBackgroundResource(right2ResId);
                        mTitleRight2Tv.setText(null);
                    } else {
                        mTitleRight2Tv.setText(right2ResId);
                        mTitleRight2Tv.setBackgroundResource(0);
                    }
                }
            } else {
                if (mTitleRight2Ll != null)
                    mTitleRight2Ll.setVisibility(INVISIBLE);
            }
        }
    }
 
    /**
     * <p>
     * 设置中间按钮图片或文字
     * </p>
     *
     * @param centerResId
     */
    public void setTitleCenter(int centerResId) {
        if (mTitleCenterTv != null) {
            if (centerResId != 0) {
                if (mTitleCenterLl != null && mTitleCenterLl.getVisibility() != View.VISIBLE)
                    mTitleCenterLl.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(centerResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleCenterTv.setBackgroundResource(centerResId);
                        mTitleCenterTv.setText(null);
                    } else {
                        mTitleCenterTv.setText(centerResId);
                        mTitleCenterTv.setBackgroundResource(0);
                    }
                }
            } else {
                if (mTitleCenterLl != null)
                    mTitleCenterLl.setVisibility(INVISIBLE);
            }
        }
    }
    
    /**
     * <p>
     * 设置中间下方按钮图片或文字
     * </p>
     * 
     * @param centerResId
     */
    public void setTitleCenterSub(int centerResId) {
        if (mTitleCenterSubTv != null) {
            if (centerResId != 0) {
                if (mTitleCenterLl != null && mTitleCenterLl.getVisibility() != View.VISIBLE)
                    mTitleCenterLl.setVisibility(VISIBLE);
                Drawable drawable = null;
                try {
                    drawable = getResources().getDrawable(centerResId);
                } catch (Exception e) {
                    // e.printStackTrace();
                } finally {
                    if (drawable != null) {
                        mTitleCenterSubTv.setBackgroundResource(centerResId);
                        mTitleCenterSubTv.setText(null);
                    } else {
                        mTitleCenterSubTv.setText(centerResId);
                        mTitleCenterSubTv.setBackgroundResource(0);
                    }
                }
            } else {
                if (mTitleCenterLl != null)
                    mTitleCenterLl.setVisibility(INVISIBLE);
            }
        }
    }
 
    /*------------------------------------------setTitle END------------------------------*/
    /*-----------------------------------------setTextColor START--------------------------------------*/
    public void setTextColorLeft(int colorId) {
        if (mTitleLeftTv != null) {
            mTitleLeftTv.setTextColor(colorId != 0 ? getResources().getColor(colorId) : getResources().getColor(
                    R.color.common_title_text_color));
        }
    }
 
    public void setTextColorLeft2(int colorId) {
        if (mTitleLeft2Tv != null) {
            mTitleLeft2Tv.setTextColor(colorId != 0 ? getResources().getColor(colorId) : getResources().getColor(
                    R.color.common_title_text_color));
        }
    }
 
    public void setTextColorRight(int colorId) {
        if (mTitleRightTv != null) {
            mTitleRightTv.setTextColor(colorId != 0 ? getResources().getColorStateList(colorId) : getResources()
                    .getColorStateList(R.color.common_title_text_color));
        }
    }
 
    public void setTextColorRight2(int colorId) {
        if (mTitleRight2Tv != null) {
            mTitleRight2Tv.setTextColor(colorId != 0 ? getResources().getColor(colorId) : getResources().getColor(
                    R.color.c43));
        }
    }
 
    public void setTextColorCenter(int colorId) {
        if (mTitleCenterTv != null) {
            mTitleCenterTv.setTextColor(colorId != 0 ? getResources().getColor(colorId) : getResources().getColor(
                    R.color.c2));
        }
    }
    
    public void setTextColorCenterSub(int colorId) {
        if (mTitleCenterSubTv != null) {
            mTitleCenterSubTv.setTextColor(colorId != 0 ? getResources().getColor(colorId) : getResources().getColor(
                    R.color.c2));
        }
    }
 
    /*-----------------------------------------setTextColor END--------------------------------------*/
    /*-----------------------------------------setTextSize START--------------------------------------*/
    public void setTextSizeLeft(int textSizeDimenId) {
        if (mTitleLeftTv != null) {
            mTitleLeftTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_mid));
        }
    }
 
    public void setTextSizeLeft2(int textSizeDimenId) {
        if (mTitleLeft2Tv != null) {
            mTitleLeft2Tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_mid));
        }
    }
 
    public void setTextSizeRight(int textSizeDimenId) {
        if (mTitleRightTv != null) {
            mTitleRightTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_mid));
        }
    }
 
    public void setTextSizeRight2(int textSizeDimenId) {
        if (mTitleRight2Tv != null) {
            mTitleRight2Tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_mid));
        }
    }
 
    public void setTextSizeCenter(int textSizeDimenId) {
        if (mTitleCenterTv != null) {
            mTitleCenterTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_large));
        }
    }
    
    public void setTextSizeCenterSub(int textSizeDimenId) {
        if (mTitleCenterSubTv != null) {
            mTitleCenterSubTv.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    textSizeDimenId != 0 ? getResources().getDimensionPixelSize(textSizeDimenId) : getResources()
                            .getDimensionPixelSize(R.dimen.text_size_small));
        }
    }
 
    /*-----------------------------------------setTextSize END--------------------------------------*/
 
    /*-----------------------------------------setIcon START--------------------------------------*/
 
    public void setIconLeft(int resId) {
        if (mTitleLeftLl != null) {
            if (mTitleLeftLl.getVisibility() != View.VISIBLE) {
                mTitleLeftLl.setVisibility(View.VISIBLE);
            }
            setTitleLeft(resId);
        }
    }
 
    public void setIconLeft2(int resId) {
        if (mTitleLeft2Ll != null) {
            if (mTitleLeft2Ll.getVisibility() != View.VISIBLE) {
                mTitleLeft2Ll.setVisibility(View.VISIBLE);
            }
            setTitleLeft2(resId);
        }
    }
 
    public void setIconRight(int resId) {
        if (mTitleRightLl != null) {
            if (mTitleRightLl.getVisibility() != View.VISIBLE) {
                mTitleRightLl.setVisibility(View.VISIBLE);
            }
            setTitleRight(resId);
        }
    }
 
    public void setIconRight2(int resId) {
        if (mTitleRight2Ll != null) {
            if (mTitleRight2Ll.getVisibility() != View.VISIBLE) {
                mTitleRight2Ll.setVisibility(View.VISIBLE);
            }
            setTitleRight2(resId);
        }
    }
 
    public void setIconCenter(int resId) {
        if (mTitleCenterLl != null) {
            if (mTitleCenterLl.getVisibility() != View.VISIBLE) {
                mTitleCenterLl.setVisibility(View.VISIBLE);
            }
            setTitleCenter(resId);
        }
    }
 
    /*-----------------------------------------setIcon END--------------------------------------*/
    /*-----------------------------------------setTextById START--------------------------------------*/
 
    public void setTitleTextLeft(int resId) {
        if (mTitleLeftLl != null) {
            if (mTitleLeftLl.getVisibility() != View.VISIBLE) {
                mTitleLeftLl.setVisibility(View.VISIBLE);
            }
            setTitleLeft(resId);
        }
    }
 
    public void setTitleTextLeft2(int resId) {
        if (mTitleLeft2Ll != null) {
            if (mTitleLeft2Ll.getVisibility() != View.VISIBLE) {
                mTitleLeft2Ll.setVisibility(View.VISIBLE);
            }
            setTitleLeft(resId);
        }
    }
 
    public void setTitleTextRight(int resId) {
        if (mTitleRightLl != null) {
            if (mTitleRightLl.getVisibility() != View.VISIBLE) {
                mTitleRightLl.setVisibility(View.VISIBLE);
            }
            setTitleRight(resId);
        }
    }
 
    public void setTitleTextRight2(int resId) {
        if (mTitleRight2Ll != null) {
            if (mTitleRight2Ll.getVisibility() != View.VISIBLE) {
                mTitleRight2Ll.setVisibility(View.VISIBLE);
            }
            setTitleRight2(resId);
        }
    }
 
    public void setTitleTextCenter(int resId) {
        if (mTitleCenterLl != null) {
            if (mTitleCenterLl.getVisibility() != View.VISIBLE) {
                mTitleCenterLl.setVisibility(View.VISIBLE);
            }
            setTitleCenter(resId);
        }
    }
    
    public void setTitleTextCenterSub(int resId) {
        if (mTitleCenterLl != null) {
            if (mTitleCenterLl.getVisibility() != View.VISIBLE) {
                mTitleCenterLl.setVisibility(View.VISIBLE);
            }
            setTitleCenterSub(resId);
        }
    }
 
    /*-----------------------------------------setTextById END--------------------------------------*/
    /*-----------------------------------------setTextByString START--------------------------------------*/
    public void setTitleTextLeft(String titleTextLeft) {
        if (mTitleLeftTv != null) {
            if (mTitleLeftTv.getVisibility() != View.VISIBLE) {
                mTitleLeftTv.setVisibility(View.VISIBLE);
            }
            mTitleLeftTv.setText(titleTextLeft);
            mTitleLeftTv.setBackgroundResource(0);
        }
    }
 
    public void setTitleTextLeft2(String titleTextLeft2) {
        if (mTitleLeft2Tv != null) {
            if (mTitleLeft2Tv.getVisibility() != View.VISIBLE) {
                mTitleLeft2Tv.setVisibility(View.VISIBLE);
            }
            mTitleLeft2Tv.setText(titleTextLeft2);
            mTitleLeft2Tv.setBackgroundResource(0);
        }
    }
 
    public void setTitleTextRight(String titleTextRight) {
        if (mTitleRightTv != null) {
            if (mTitleRightTv.getVisibility() != View.VISIBLE) {
                mTitleRightTv.setVisibility(View.VISIBLE);
            }
            mTitleRightTv.setText(titleTextRight);
            mTitleRightTv.setBackgroundResource(0);
        }
    }
 
    public void setTitleTextRight2(String titleTextRight2) {
        if (mTitleRight2Tv != null) {
            if (mTitleRight2Tv.getVisibility() != View.VISIBLE) {
                mTitleRight2Tv.setVisibility(View.VISIBLE);
            }
            mTitleRight2Tv.setText(titleTextRight2);
            mTitleRight2Tv.setBackgroundResource(0);
        }
    }
 
    public void setTitleTextCenter(String titleTextCenter) {
        if (mTitleCenterLl != null) {
            if (mTitleCenterLl.getVisibility() != View.VISIBLE) {
                mTitleCenterLl.setVisibility(View.VISIBLE);
            }
            mTitleCenterTv.setText(titleTextCenter);
            mTitleCenterTv.setBackgroundResource(0);
        }
    }
    
    public void setTitleTextCenterSub(String titleTextCenter) {
        if (mTitleCenterLl != null) {
            if (mTitleCenterLl.getVisibility() != View.VISIBLE) {
                mTitleCenterLl.setVisibility(View.VISIBLE);
            }
            mTitleCenterSubTv.setText(titleTextCenter);
            mTitleCenterSubTv.setBackgroundResource(0);
        }
    }
 
    /*-----------------------------------------setTextByString END--------------------------------------*/
    /*-----------------------------------------setVisible START--------------------------------------*/
 
    public void setVisibleLeft(int flag) {
        if (mTitleLeftLl != null) {
            mTitleLeftLl.setVisibility(flag);
        }
    }
 
    public void setVisibleLeft2(int flag) {
        if (mTitleLeft2Ll != null) {
            mTitleLeft2Ll.setVisibility(flag);
        }
    }
 
    public void setVisibleRight(int flag) {
        if (mTitleRightLl != null) {
            mTitleRightLl.setVisibility(flag);
        }
    }
 
    public void setVisibleRight2(int flag) {
        if (mTitleRight2Ll != null) {
            mTitleRight2Ll.setVisibility(flag);
        }
    }
 
    public void setVisibleCenter(int flag) {
        if (mTitleCenterLl != null) {
            mTitleCenterLl.setVisibility(flag);
        }
    }
    
    public void setVisibleCenterSub(int flag) {
        if (mTitleCenterSubTv != null) {
            mTitleCenterSubTv.setVisibility(flag);
        }
    }
 
    public void setVisibleBottom(int flag) {
        if (mBottomV != null) {
            mBottomV.setVisibility(flag);
        }
    }
 
    /*-----------------------------------------setVisible END--------------------------------------*/
    public void setOnTitleSubClickListener(OnTitleSubClickListener listener) {
        mListener = listener;
    }
 
    public interface OnTitleSubClickListener {
        public void onCommonTitleClick(int id);
    }
}