Skip to content

Commit

Permalink
优化部分代码命名规范
Browse files Browse the repository at this point in the history
精简 META-INF 文件下的一些开源信息
修正视频播放界面在挖孔屏下的显示效果
修正 RegexEdit 正则表达式编写不规范的问题
  • Loading branch information
getActivity committed Jul 17, 2020
1 parent f2cbe13 commit 5885540
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 17 deletions.
Binary file modified AndroidProject.apk
Binary file not shown.
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ android {
}
}

packagingOptions {
// 剔除这个包下的所有文件(除了签名信息)
exclude 'META-INF/*******'
}

// AOP 配置
aspectjx {
// 排除一些第三方库的包名(Gson、 LeakCanary 和 AOP 有冲突)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/widget_player_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:fitsSystemWindows="true"
android:keepScreenOn="true"
android:orientation="vertical">

<VideoView
android:id="@+id/vv_player_view_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:keepScreenOn="true" />
android:layout_gravity="center" />

<FrameLayout
android:id="@+id/ll_player_view_top"
Expand Down
4 changes: 2 additions & 2 deletions base/src/main/java/com/hjq/base/BaseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.hjq.base.action.ContextAction;
import com.hjq.base.action.ResourcesAction;

/**
* author : Android 轮子哥
Expand All @@ -20,7 +20,7 @@
* desc : RecyclerView 适配器基类
*/
public abstract class BaseAdapter<VH extends BaseAdapter.ViewHolder>
extends RecyclerView.Adapter<VH> implements ContextAction {
extends RecyclerView.Adapter<VH> implements ResourcesAction {

/** 上下文对象 */
private final Context mContext;
Expand Down
10 changes: 6 additions & 4 deletions base/src/main/java/com/hjq/base/BaseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.hjq.base.action.AnimAction;
import com.hjq.base.action.ClickAction;
import com.hjq.base.action.HandlerAction;
import com.hjq.base.action.ResourcesAction;

import java.lang.ref.SoftReference;
import java.util.ArrayList;
Expand All @@ -52,7 +53,8 @@
* time : 2018/11/24
* desc : Dialog 基类
*/
public class BaseDialog extends AppCompatDialog implements LifecycleOwner, ActivityAction, HandlerAction, ClickAction, AnimAction,
public class BaseDialog extends AppCompatDialog implements LifecycleOwner,
ActivityAction, ResourcesAction, HandlerAction, ClickAction, AnimAction,
DialogInterface.OnShowListener, DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {

private final ListenersWrapper<BaseDialog> mListeners = new ListenersWrapper<>(this);
Expand Down Expand Up @@ -161,7 +163,7 @@ public void setBackgroundDimEnabled(boolean enabled) {
/**
* 设置背景遮盖层的透明度(前提条件是背景遮盖层开关必须是为开启状态)
*/
public void setBackgroundDimAmount(@FloatRange(from = 0, to = 1) float dimAmount) {
public void setBackgroundDimAmount(@FloatRange(from = 0.0, to = 1.0) float dimAmount) {
Window window = getWindow();
if (window != null) {
window.setDimAmount(dimAmount);
Expand Down Expand Up @@ -400,7 +402,7 @@ protected void onStop() {
}

@SuppressWarnings("unchecked")
public static class Builder<B extends Builder> implements LifecycleOwner, ActivityAction, ClickAction {
public static class Builder<B extends Builder> implements LifecycleOwner, ActivityAction, ResourcesAction, ClickAction {

/** 上下文对象 */
private final Context mContext;
Expand Down Expand Up @@ -617,7 +619,7 @@ public B setBackgroundDimEnabled(boolean enabled) {
/**
* 设置背景遮盖层的透明度(前提条件是背景遮盖层开关必须是为开启状态)
*/
public B setBackgroundDimAmount(@FloatRange(from = 0, to = 1) float dimAmount) {
public B setBackgroundDimAmount(@FloatRange(from = 0.0, to = 1.0) float dimAmount) {
mBackgroundDimAmount = dimAmount;
if (isCreated()) {
mDialog.setBackgroundDimAmount(dimAmount);
Expand Down
5 changes: 3 additions & 2 deletions base/src/main/java/com/hjq/base/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.hjq.base.action.BundleAction;
import com.hjq.base.action.ClickAction;
import com.hjq.base.action.HandlerAction;
import com.hjq.base.action.ResourcesAction;

import java.util.Random;

Expand All @@ -27,8 +28,8 @@
* time : 2018/10/18
* desc : Fragment 基类
*/
public abstract class BaseFragment<A extends BaseActivity>
extends Fragment implements ActivityAction, HandlerAction, ClickAction, BundleAction {
public abstract class BaseFragment<A extends BaseActivity> extends Fragment implements
ActivityAction, ResourcesAction, HandlerAction, ClickAction, BundleAction {

/** Activity 对象 */
private A mActivity;
Expand Down
8 changes: 4 additions & 4 deletions base/src/main/java/com/hjq/base/BasePopupWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import com.hjq.base.action.ActivityAction;
import com.hjq.base.action.AnimAction;
import com.hjq.base.action.ClickAction;
import com.hjq.base.action.ContextAction;
import com.hjq.base.action.ResourcesAction;
import com.hjq.base.action.HandlerAction;

import java.lang.ref.SoftReference;
Expand Down Expand Up @@ -226,7 +226,7 @@ public void setOverlapAnchor(boolean overlapAnchor) {
/**
* 设置背景遮盖层的透明度
*/
public void setBackgroundDimAmount(@FloatRange(from = 0, to = 1) float dimAmount) {
public void setBackgroundDimAmount(@FloatRange(from = 0.0, to = 1.0) float dimAmount) {
float alpha = 1 - dimAmount;
if (isShowing()) {
setActivityAlpha(alpha);
Expand Down Expand Up @@ -263,7 +263,7 @@ private void setActivityAlpha(float alpha) {
}

@SuppressWarnings("unchecked")
public static class Builder<B extends BasePopupWindow.Builder> implements ContextAction, ClickAction {
public static class Builder<B extends BasePopupWindow.Builder> implements ResourcesAction, ClickAction {

private static final int DEFAULT_ANCHORED_GRAVITY = Gravity.TOP | Gravity.START;

Expand Down Expand Up @@ -447,7 +447,7 @@ public B setAnimStyle(@StyleRes int id) {
/**
* 设置背景遮盖层的透明度
*/
public B setBackgroundDimAmount(@FloatRange(from = 0, to = 1) float dimAmount) {
public B setBackgroundDimAmount(@FloatRange(from = 0.0, to = 1.0) float dimAmount) {
mBackgroundDimAmount = dimAmount;
if (isShowing()) {
mPopupWindow.setBackgroundDimAmount(dimAmount);
Expand Down
7 changes: 6 additions & 1 deletion base/src/main/java/com/hjq/base/action/ActivityAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
* time : 2020/03/08
* desc : Activity 相关意图
*/
public interface ActivityAction extends ContextAction {
public interface ActivityAction {

/**
* 获取 Context
*/
Context getContext();

/**
* 获取 Activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* time : 2019/09/15
* desc : Context 意图处理(扩展非 Context 类的方法,禁止 Context 类实现此接口)
*/
public interface ContextAction {
public interface ResourcesAction {

/**
* 获取 Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RegexEditText extends AppCompatEditText implements InputFilter {
/** 计数(非 0 开头的数字) */
public static final String REGEX_COUNT = "[1-9]\\d*";
/** 用户名(中文、英文、数字) */
public static final String REGEX_NAME = REGEX_CHINESE + "|" + REGEX_ENGLISH + "|\\d*";
public static final String REGEX_NAME = "[[\\u4e00-\\u9fa5]|[a-zA-Z]|\\d]*";
/** 非空格的字符(不能输入空格) */
public static final String REGEX_NONNULL = "\\S+";

Expand Down

0 comments on commit 5885540

Please sign in to comment.