Skip to content

Commit

Permalink
1. 根据阿里巴巴规范优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
aaatttcccc committed May 7, 2021
1 parent 6b9f984 commit 710fb35
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
5 changes: 0 additions & 5 deletions app/src/main/java/com/zhongjh/cameraapp/MainSeeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main_see);
progressDialog = new ProgressDialog(MainSeeActivity.this);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main_see);


mBinding.mplImageList.setMaskProgressLayoutListener(new MaskProgressLayoutListener() {

@Override
Expand Down Expand Up @@ -145,11 +143,8 @@ public void onItemVideoStartDownload(String url) {
}

});

initConfig();

initData();

}

/**
Expand Down
11 changes: 11 additions & 0 deletions common/src/main/java/gaode/zhongjh/com/common/enums/Constant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package gaode.zhongjh.com.common.enums;

/**
* @author zhongjh
*/
public class Constant {

public final static String IMAGE = "image";
public final static String VIDEO = "video";

}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public static ImageHoming fitHoming(RectF win, RectF frame, boolean isJustInner)
}

// 宽高都小于Win,才有必要放大
if (isJustInner || frame.width() < win.width() && frame.height() < win.height()) {
boolean isScale = isJustInner || frame.width() < win.width() && frame.height() < win.height();
if (isScale) {
dHoming.scale = Math.min(win.width() / frame.width(), win.height() / frame.height());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public abstract class BaseImageStickerView extends ViewGroup implements ImageSti

private float mScale = 1f;

// TODO
private int mDownShowing = 0;

private ImageStickerMoveHelper mMoveHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import java.util.List;
import java.util.Set;

import static gaode.zhongjh.com.common.enums.Constant.IMAGE;
import static gaode.zhongjh.com.common.enums.Constant.VIDEO;

/**
* 选择的数据源
*
Expand Down Expand Up @@ -268,12 +271,12 @@ public IncapableCause isAcceptable(MultiMedia item) {
// 混合检查
getSelectCount();
GlobalSpec spec = GlobalSpec.getInstance();
if (item.getMimeType().startsWith("image")) {
if (item.getMimeType().startsWith(IMAGE)) {
if (mSelectedImageCount == spec.maxImageSelectable) {
maxSelectableReached = true;
maxSelectable = spec.maxVideoSelectable;
}
} else if (item.getMimeType().startsWith("video")) {
} else if (item.getMimeType().startsWith(VIDEO)) {
if (mSelectedVideoCount == spec.maxVideoSelectable) {
maxSelectableReached = true;
maxSelectable = spec.maxVideoSelectable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.zhongjh.albumcamerarecorder.album.MatissFragment;

import com.zhongjh.albumcamerarecorder.album.entity.Album;
import com.zhongjh.albumcamerarecorder.album.utils.UIUtils;
import com.zhongjh.albumcamerarecorder.album.utils.UiUtils;
import com.zhongjh.albumcamerarecorder.settings.AlbumSpec;
import com.zhongjh.albumcamerarecorder.album.model.AlbumMediaCollection;
import com.zhongjh.albumcamerarecorder.album.model.SelectedItemCollection;
Expand Down Expand Up @@ -144,7 +144,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
int spanCount;
AlbumSpec albumSpec = AlbumSpec.getInstance();
if (albumSpec.gridExpectedSize > 0) {
spanCount = UIUtils.spanCount(getContext(), albumSpec.gridExpectedSize);
spanCount = UiUtils.spanCount(getContext(), albumSpec.gridExpectedSize);
} else {
spanCount = albumSpec.spanCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* @author zhongjh
*/
public class UIUtils {
public class UiUtils {

public static int spanCount(Context context, int gridExpectedSize) {
int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author zhongjh
* @date 2017/10/25
*/
public class DisplayMetricsSPUtils {
public class DisplayMetricsSpUtils {

private static final String CAMERAVIEWSOUNDRECORDERSHAREDPREFERENCES = "cameraviewsoundrecorderSharedPreferences";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.zhongjh.albumcamerarecorder.R;
import com.zhongjh.albumcamerarecorder.camera.common.Constants;
import com.zhongjh.albumcamerarecorder.camera.listener.ClickOrLongListener;
import com.zhongjh.albumcamerarecorder.camera.util.DisplayMetricsSPUtils;
import com.zhongjh.albumcamerarecorder.camera.util.DisplayMetricsSpUtils;
import com.zhongjh.albumcamerarecorder.widget.clickorlongbutton.ClickOrLongButton;
import com.zhongjh.circularprogressview.CircularProgress;
import com.zhongjh.circularprogressview.CircularProgressListener;
Expand Down Expand Up @@ -133,7 +133,7 @@ public BaseOperationLayout(@NonNull Context context, @Nullable AttributeSet attr
public BaseOperationLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

mLayoutWidth = DisplayMetricsSPUtils.getScreenWidth(context);
mLayoutWidth = DisplayMetricsSpUtils.getScreenWidth(context);
// 中心的按钮大小
int mButtonSize = (int) (mLayoutWidth / 4.5f);
mLayoutHeight = mButtonSize + (mButtonSize / 5) * 2 + 100;
Expand Down

0 comments on commit 710fb35

Please sign in to comment.