-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,294 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
utils/src/main/java/com/br3ant/bar/ITitleBarInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.br3ant.bar; | ||
|
||
import android.content.Context; | ||
import android.graphics.drawable.Drawable; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
|
||
|
||
/** | ||
* author : Android 轮子哥 | ||
* github : https://github.com/getActivity/TitleBar | ||
* time : 2020/08/16 | ||
* desc : 默认初始化器 | ||
*/ | ||
public interface ITitleBarInitializer { | ||
|
||
/** | ||
* 获取左标题 View | ||
*/ | ||
TextView getLeftView(Context context); | ||
|
||
/** | ||
* 获取中间标题 View | ||
*/ | ||
TextView getTitleView(Context context); | ||
|
||
/** | ||
* 获取右标题 View | ||
*/ | ||
TextView getRightView(Context context); | ||
|
||
/** | ||
* 获取分割线 View | ||
*/ | ||
View getLineView(Context context); | ||
|
||
/** | ||
* 获取标题栏背景 | ||
*/ | ||
Drawable getBackgroundDrawable(Context context); | ||
|
||
/** | ||
* 获取子控件的水平内间距 | ||
*/ | ||
int getHorizontalPadding(Context context); | ||
|
||
/** | ||
* 获取子控件的垂直内间距 | ||
*/ | ||
int getVerticalPadding(Context context); | ||
} |
33 changes: 33 additions & 0 deletions
33
utils/src/main/java/com/br3ant/bar/OnTitleBarListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.br3ant.bar; | ||
|
||
import android.view.View; | ||
|
||
/** | ||
* author : Android 轮子哥 | ||
* github : https://github.com/getActivity/TitleBar | ||
* time : 2018/08/20 | ||
* desc : 标题栏点击监听接口 | ||
*/ | ||
public interface OnTitleBarListener { | ||
|
||
/** | ||
* 左项被点击 | ||
* | ||
* @param v 被点击的左项View | ||
*/ | ||
void onLeftClick(View v); | ||
|
||
/** | ||
* 标题被点击 | ||
* | ||
* @param v 被点击的标题View | ||
*/ | ||
void onTitleClick(View v); | ||
|
||
/** | ||
* 右项被点击 | ||
* | ||
* @param v 被点击的右项View | ||
*/ | ||
void onRightClick(View v); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.br3ant.bar; | ||
|
||
import android.graphics.drawable.Drawable; | ||
import android.graphics.drawable.StateListDrawable; | ||
import android.os.Build; | ||
|
||
/** | ||
* author : Android 轮子哥 | ||
* github : https://github.com/getActivity/TitleBar | ||
* time : 2019/03/10 | ||
* desc : 状态选择器构建器 | ||
*/ | ||
public final class SelectorDrawable extends StateListDrawable { | ||
|
||
public final static class Builder { | ||
|
||
/** 默认状态 */ | ||
private Drawable mDefault; | ||
/** 焦点状态 */ | ||
private Drawable mFocused; | ||
/** 按下状态 */ | ||
private Drawable mPressed; | ||
/** 选中状态 */ | ||
private Drawable mChecked; | ||
/** 启用状态 */ | ||
private Drawable mEnabled; | ||
/** 选择状态 */ | ||
private Drawable mSelected; | ||
/** 光标悬浮状态(4.0新特性) */ | ||
private Drawable mHovered; | ||
|
||
public Builder setDefault(Drawable drawable) { | ||
mDefault = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setFocused(Drawable drawable) { | ||
mFocused = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setPressed(Drawable drawable) { | ||
mPressed = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setChecked(Drawable drawable) { | ||
mChecked = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setEnabled(Drawable drawable) { | ||
mEnabled = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setSelected(Drawable drawable) { | ||
mSelected = drawable; | ||
return this; | ||
} | ||
|
||
public Builder setHovered(Drawable drawable) { | ||
mHovered = drawable; | ||
return this; | ||
} | ||
|
||
public SelectorDrawable build() { | ||
SelectorDrawable selector = new SelectorDrawable(); | ||
if (mPressed != null) { | ||
selector.addState(new int[]{android.R.attr.state_pressed}, mPressed); | ||
} | ||
if (mFocused != null) { | ||
selector.addState(new int[]{android.R.attr.state_focused}, mFocused); | ||
} | ||
if (mChecked != null) { | ||
selector.addState(new int[]{android.R.attr.state_checked}, mChecked); | ||
} | ||
if (mEnabled != null) { | ||
selector.addState(new int[]{android.R.attr.state_enabled}, mEnabled); | ||
} | ||
if (mSelected != null) { | ||
selector.addState(new int[]{android.R.attr.state_selected}, mSelected); | ||
} | ||
if (mHovered != null) { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { | ||
selector.addState(new int[]{android.R.attr.state_hovered}, mHovered); | ||
} | ||
} | ||
if (mDefault != null) { | ||
selector.addState(new int[]{}, mDefault); | ||
} | ||
return selector; | ||
} | ||
} | ||
} |
Oops, something went wrong.