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