@@ -20,13 +20,13 @@ public interface TitleBarAction extends OnTitleBarListener {
2020 * 获取标题栏对象
2121 */
2222 @ Nullable
23- TitleBar getTitleBar ();
23+ TitleBar acquireTitleBar ();
2424
2525 /**
2626 * 设置标题栏的标题
2727 */
2828 default void setTitle (@ StringRes int id ) {
29- TitleBar titleBar = getTitleBar ();
29+ TitleBar titleBar = acquireTitleBar ();
3030 if (titleBar == null ) {
3131 return ;
3232 }
@@ -37,7 +37,7 @@ default void setTitle(@StringRes int id) {
3737 * 设置标题栏的标题
3838 */
3939 default void setTitle (CharSequence title ) {
40- TitleBar titleBar = getTitleBar ();
40+ TitleBar titleBar = acquireTitleBar ();
4141 if (titleBar == null ) {
4242 return ;
4343 }
@@ -48,23 +48,23 @@ default void setTitle(CharSequence title) {
4848 * 设置标题栏的左标题
4949 */
5050 default void setLeftTitle (int id ) {
51- TitleBar titleBar = getTitleBar ();
51+ TitleBar titleBar = acquireTitleBar ();
5252 if (titleBar == null ) {
5353 return ;
5454 }
5555 titleBar .setLeftTitle (id );
5656 }
5757
5858 default void setLeftTitle (CharSequence text ) {
59- TitleBar titleBar = getTitleBar ();
59+ TitleBar titleBar = acquireTitleBar ();
6060 if (titleBar == null ) {
6161 return ;
6262 }
6363 titleBar .setLeftTitle (text );
6464 }
6565
6666 default CharSequence getLeftTitle () {
67- TitleBar titleBar = getTitleBar ();
67+ TitleBar titleBar = acquireTitleBar ();
6868 if (titleBar == null ) {
6969 return "" ;
7070 }
@@ -75,23 +75,23 @@ default CharSequence getLeftTitle() {
7575 * 设置标题栏的右标题
7676 */
7777 default void setRightTitle (int id ) {
78- TitleBar titleBar = getTitleBar ();
78+ TitleBar titleBar = acquireTitleBar ();
7979 if (titleBar == null ) {
8080 return ;
8181 }
8282 titleBar .setRightTitle (id );
8383 }
8484
8585 default void setRightTitle (CharSequence text ) {
86- TitleBar titleBar = getTitleBar ();
86+ TitleBar titleBar = acquireTitleBar ();
8787 if (titleBar == null ) {
8888 return ;
8989 }
9090 titleBar .setRightTitle (text );
9191 }
9292
9393 default CharSequence getRightTitle () {
94- TitleBar titleBar = getTitleBar ();
94+ TitleBar titleBar = acquireTitleBar ();
9595 if (titleBar == null ) {
9696 return "" ;
9797 }
@@ -102,15 +102,15 @@ default CharSequence getRightTitle() {
102102 * 设置标题栏的左图标
103103 */
104104 default void setLeftIcon (int id ) {
105- TitleBar titleBar = getTitleBar ();
105+ TitleBar titleBar = acquireTitleBar ();
106106 if (titleBar == null ) {
107107 return ;
108108 }
109109 titleBar .setLeftIcon (id );
110110 }
111111
112112 default void setLeftIcon (Drawable drawable ) {
113- TitleBar titleBar = getTitleBar ();
113+ TitleBar titleBar = acquireTitleBar ();
114114 if (titleBar == null ) {
115115 return ;
116116 }
@@ -119,7 +119,7 @@ default void setLeftIcon(Drawable drawable) {
119119
120120 @ Nullable
121121 default Drawable getLeftIcon () {
122- TitleBar titleBar = getTitleBar ();
122+ TitleBar titleBar = acquireTitleBar ();
123123 if (titleBar == null ) {
124124 return null ;
125125 }
@@ -130,15 +130,15 @@ default Drawable getLeftIcon() {
130130 * 设置标题栏的右图标
131131 */
132132 default void setRightIcon (int id ) {
133- TitleBar titleBar = getTitleBar ();
133+ TitleBar titleBar = acquireTitleBar ();
134134 if (titleBar == null ) {
135135 return ;
136136 }
137137 titleBar .setRightIcon (id );
138138 }
139139
140140 default void setRightIcon (Drawable drawable ) {
141- TitleBar titleBar = getTitleBar ();
141+ TitleBar titleBar = acquireTitleBar ();
142142 if (titleBar == null ) {
143143 return ;
144144 }
@@ -147,7 +147,7 @@ default void setRightIcon(Drawable drawable) {
147147
148148 @ Nullable
149149 default Drawable getRightIcon () {
150- TitleBar titleBar = getTitleBar ();
150+ TitleBar titleBar = acquireTitleBar ();
151151 if (titleBar == null ) {
152152 return null ;
153153 }
@@ -157,7 +157,7 @@ default Drawable getRightIcon() {
157157 /**
158158 * 递归获取 ViewGroup 中的 TitleBar 对象
159159 */
160- default TitleBar obtainTitleBar (ViewGroup group ) {
160+ default TitleBar findTitleBar (ViewGroup group ) {
161161 if (group == null ) {
162162 return null ;
163163 }
@@ -168,7 +168,7 @@ default TitleBar obtainTitleBar(ViewGroup group) {
168168 }
169169
170170 if (view instanceof ViewGroup ) {
171- TitleBar titleBar = obtainTitleBar ((ViewGroup ) view );
171+ TitleBar titleBar = findTitleBar ((ViewGroup ) view );
172172 if (titleBar != null ) {
173173 return titleBar ;
174174 }
0 commit comments