Skip to content

Commit

Permalink
1.更新 ViewUtils 部分代码
Browse files Browse the repository at this point in the history
  • Loading branch information
afkT committed Sep 6, 2021
1 parent 571e5f2 commit e3428c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ListenerActivity : BaseActivity<ActivityCommonTipsBinding>() {
override fun initValue() {
super.initValue()

val view = ViewUtils.inflate(R.layout.base_view_textview)
val view = ViewUtils.inflate(this, R.layout.base_view_textview)
ViewHelper.get().setText(view, "单击绑定, 长按注销")
.setTextColor(view, ResourceUtils.getColor(R.color.gray))
binding.vidActLinear.addView(view)
Expand Down
12 changes: 12 additions & 0 deletions art/regex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,15 @@ lambda alternative
anonymous type can be replaced with lambda



=========
= Regex =
=========



Dev[\w]+Engine\.(get|set)Engine\(




42 changes: 0 additions & 42 deletions lib/DevApp/src/main/java/dev/utils/app/ViewUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,48 +130,6 @@ public static Activity getActivity(final View view) {

// =

/**
* 获取 View
* @param resource R.layout.id
* @return {@link View}
*/
public static View inflate(@LayoutRes final int resource) {
return inflate(resource, null, false);
}

/**
* 获取 View
* @param resource R.layout.id
* @param root {@link ViewGroup}
* @return {@link View}
*/
public static View inflate(
@LayoutRes final int resource,
final ViewGroup root
) {
return inflate(resource, root, root != null);
}

/**
* 获取 View
* @param resource R.layout.id
* @param root {@link ViewGroup}
* @param attachToRoot 是否添加到 root 上
* @return {@link View}
*/
public static View inflate(
@LayoutRes final int resource,
final ViewGroup root,
final boolean attachToRoot
) {
try {
return LayoutInflater.from(DevUtils.getContext()).inflate(resource, root, attachToRoot);
} catch (Exception e) {
LogPrintUtils.eTag(TAG, e, "inflate");
}
return null;
}

/**
* 获取 View
* @param context {@link Context}
Expand Down

0 comments on commit e3428c3

Please sign in to comment.