Commit 647fff9dd782d729263ce135f77e05bb89fa2f00

Authored by 吴奎庆
1 parent 23923a69

听云崩溃处理

app/src/main/java/com/cnlive/strike/debug/MainActivity.java
... ... @@ -51,11 +51,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
51 51 switch (view.getId()) {
52 52 case R.id.tv_camera:
53 53 //打开相机
  54 +
  55 +
54 56 new ImagePicker
55 57 .Builder()
56   - .setJumpCameraMode(PickerConfig.CAMERA_MODE_ALL)
  58 + .setJumpCameraMode(3) // 1 图片 3 视频
57 59 .builder()
58 60 .startCamera(this, select, PickerConfig.PICKER_IMAGE, PickerConfig.DEFAULT_RESULT_CODE);
  61 +
  62 +// new ImagePicker
  63 +// .Builder()
  64 +// .setJumpCameraMode(PickerConfig.CAMERA_MODE_ALL)
  65 +// .builder()
  66 +// .startCamera(this, select, PickerConfig.PICKER_IMAGE, PickerConfig.DEFAULT_RESULT_CODE);
59 67 break;
60 68 case R.id.bt_preview:
61 69 //打开预览
... ...
config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "1.0.3.9",
  24 + version: "1.0.4.4",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.media",
27 27 //Lib库名称
... ...
lib_media/src/main/java/com/cnlive/media/frame/view/MediaPickerFragmentView.java
... ... @@ -137,7 +137,7 @@ public class MediaPickerFragmentView implements MvpView {
137 137 if (isCheckMediaSupport(mActivity, media)) {
138 138 MediaSelectStateObservable.getInstance().selectStateUpdateMedia(media);
139 139 media.setSelect(!isSelect);
140   - mFragment.mMediaAdapter.notifyItemChanged(position, media);
  140 + mFragment.mMediaAdapter.notifyItemChanged(position);
141 141 }
142 142 }
143 143  
... ...
lib_media/src/main/java/com/cnlive/media/frame/view/MediaView.java
... ... @@ -239,7 +239,7 @@ public class MediaView implements MvpView {
239 239 if (mActivity.selects.indexOf(mMedia) < 0) {
240 240 previewBottomAdapter = new PreviewBottomMediaAdapter(mActivity, 0, mActivity.isPre);
241 241 } else {
242   - previewBottomAdapter = new PreviewBottomMediaAdapter(mActivity, mActivity.selects.indexOf(mMedia), mActivity.isPre);
  242 + previewBottomAdapter = new PreviewBottomMediaAdapter(mActivity, mActivity.selects.indexOf(mMedia),true);
243 243 }
244 244 bottomRv.setAdapter(previewBottomAdapter);
245 245 if (mActivity.selects != null && mActivity.selects.size() > 0) {
... ...
lib_media/src/main/java/com/cnlive/media/ui/activity/MediaActivity.java
... ... @@ -4,6 +4,7 @@ import android.Manifest;
4 4 import android.app.Dialog;
5 5 import android.content.Intent;
6 6 import android.os.Bundle;
  7 +import android.util.Log;
7 8 import android.view.View;
8 9 import android.widget.ListPopupWindow;
9 10  
... ... @@ -136,7 +137,7 @@ public class MediaActivity extends MvpBindingActivity&lt;MediaView, MediaPresenter,
136 137 protected int getLayoutId() {
137 138 return R.layout.activity_media;
138 139 }
139   -
  140 + long time;
140 141 @Override
141 142 protected void onCreate(Bundle savedInstanceState) {
142 143 super.onCreate(savedInstanceState);
... ... @@ -145,12 +146,14 @@ public class MediaActivity extends MvpBindingActivity&lt;MediaView, MediaPresenter,
145 146 if (getPresenter() != null) getPresenter().initIntentData(this);
146 147 if (getMvpView() != null) getMvpView().initView();
147 148 getSupportFragmentManager().beginTransaction().add(R.id.frame, MediaPickerFragment.newInstanse(), MEDIA_HOME).addToBackStack("").commit();
  149 + time=System.currentTimeMillis();
148 150 getMediaData();
149 151 }
150 152  
151 153 void getMediaData() {
152 154 boolean hasPermissions = getPresenter()
153 155 .checkPermissions(this, permissionsRead, REQUEST_CODE_PERMISSION_READ, getResources().getString(R.string.dialog_imagepicker_permission_sdcard_nerver_ask_message), true);
  156 +
154 157 if (hasPermissions) {
155 158 if (needCrop && singlePick) {
156 159 // ThumbnailsUtils.getThumbnails(this);
... ... @@ -189,6 +192,7 @@ public class MediaActivity extends MvpBindingActivity&lt;MediaView, MediaPresenter,
189 192 Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.frame);
190 193 if (currentFragment instanceof MediaPickerFragment) {
191 194 ((MediaPickerFragment) currentFragment).setMediaData(list);
  195 + Log.e("时间:",System.currentTimeMillis()-time+"");
192 196 if (mFolderAdapter != null) mFolderAdapter.updateAdapter(list);
193 197 }
194 198  
... ...
lib_media/src/main/java/com/cnlive/media/ui/activity/RecordActivity.java
... ... @@ -96,7 +96,6 @@ public class RecordActivity extends MvpBindingActivity&lt;RecordView, RecordPresent
96 96 if (mOptions.getJumpCameraMode() == PickerConfig.CAMERA_MODE_PIC) {
97 97 isNeedAudio = false;
98 98 } else {
99   - mOptions.setJumpCameraMode(PickerConfig.CAMERA_MODE_ALL);
100 99 isNeedAudio = true;
101 100 }
102 101 } else {
... ...
lib_media/src/main/java/com/cnlive/media/ui/adapter/PreviewBottomMediaAdapter.java
... ... @@ -53,13 +53,11 @@ public class PreviewBottomMediaAdapter extends BaseRecyclerViewAdapter&lt;Media&gt; {
53 53 public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
54 54 MediaViewHolder mediaViewHolder = (MediaViewHolder) holder;
55 55 MediaPreviewBottomBarItemBinding bottomBarItemBinding = (MediaPreviewBottomBarItemBinding) mediaViewHolder.getBinding();
56   - GlideCacheUtil.intoItemImageThumbnail(context, getItem(position), bottomBarItemBinding.bottomItemImageView, null);
57   - if (isPre) {
58   - if (selectedPosition == position) {
59   - bottomBarItemBinding.bottomItemImageView.setBackgroundResource(R.drawable.shape_green_square_bg);
60   - } else {
61   - bottomBarItemBinding.bottomItemImageView.setBackgroundResource(R.drawable.shape_gray_square_bg);
62   - }
  56 + GlideCacheUtil.intoItemImage(context, getItem(position), bottomBarItemBinding.bottomItemImageView, null);
  57 + if (selectedPosition == position) {
  58 + bottomBarItemBinding.bottomItemImageView.setBackgroundResource(R.drawable.shape_green_square_bg);
  59 + } else {
  60 + bottomBarItemBinding.bottomItemImageView.setBackgroundResource(R.drawable.shape_gray_square_bg);
63 61 }
64 62  
65 63 bottomBarItemBinding.bottomItemImageView.setOnClickListener(v -> {
... ... @@ -70,7 +68,7 @@ public class PreviewBottomMediaAdapter extends BaseRecyclerViewAdapter&lt;Media&gt; {
70 68  
71 69  
72 70 public void updateBgState(int curPosition) {
73   - if (curPosition < 0) return;
  71 +// if (curPosition < 0) return;
74 72 selectedPosition = curPosition;
75 73 notifyDataSetChanged();
76 74 }
... ...
lib_media/src/main/java/com/cnlive/media/ui/fragment/MediaPickerFragment.java
... ... @@ -121,4 +121,8 @@ public class MediaPickerFragment extends MvpBindingFragment&lt;MediaPickerFragmentV
121 121 getMvpView().selectDateUpdate(mActivity, isUpdateMedia);
122 122 }
123 123 }
  124 +
  125 + public void notifySelect(){
  126 +
  127 + }
124 128 }
... ...
lib_media/src/main/java/com/cnlive/media/utils/GlideCacheUtil.java
... ... @@ -319,7 +319,7 @@ public class GlideCacheUtil {
319 319 if (FileTypeUtil.isGif(media.path)) {
320 320 } else {
321 321 option = option
322   - .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
  322 + .diskCacheStrategy(DiskCacheStrategy.NONE)
323 323 .dontAnimate();
324 324 }
325 325 if (media.mediaType == 1) {
... ...
lib_media/src/main/java/com/cnlive/media/utils/ThumbnailsUtils.java
... ... @@ -36,7 +36,6 @@ public class ThumbnailsUtils {
36 36 _id = cursor.getInt(_idColumn);
37 37 image_id = cursor.getInt(image_idColumn);
38 38 image_path = cursor.getString(dataColumn);
39   - Log.e("缩略图视频:","--->videoId:"+image_id+" videoPath:"+image_path);
40 39 thumbnails.put(image_id + "", image_path);
41 40 }
42 41 getImageThumbnails(context);
... ... @@ -58,7 +57,6 @@ public class ThumbnailsUtils {
58 57 _id = cursor.getInt(_idColumn);
59 58 image_id = cursor.getInt(image_idColumn);
60 59 image_path = cursor.getString(dataColumn);
61   - Log.e("缩略图图片:","--->image_id:"+image_id+" image_path:"+image_path);
62 60 thumbnails.put(image_id + "", image_path);
63 61 }
64 62 }
... ...
lib_media/src/main/res/layout/layout_record_camera.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<layout xmlns:app="http://schemas.android.com/apk/res-auto"
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
3 4 xmlns:tools="http://schemas.android.com/tools">
4 5  
5 6  
6   - <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  7 + <RelativeLayout
7 8 android:layout_width="match_parent"
8 9 android:layout_height="match_parent"
9 10 android:background="@color/transparent">
... ... @@ -64,8 +65,8 @@
64 65  
65 66 <com.cnlive.media.ui.widget.record.ShootView
66 67 android:id="@+id/shootView"
67   - android:layout_width="100dp"
68   - android:layout_height="100dp"
  68 + android:layout_width="106dp"
  69 + android:layout_height="94dp"
69 70 android:layout_centerInParent="true"
70 71 app:innerRadius="28dp"
71 72 app:outerRadius="35dp" />
... ...