Commit f35492a900ee3abbd043adce763e6932d339b7f8
Merge branch 'test1' of bj.gitlab.cnlive.com:cnlive-team/NewMediaPicker into test1
Conflicts: lib_media/src/main/java/com/cnlive/media/frame/view/RecordView.java
Showing
3 changed files
with
11 additions
and
11 deletions
lib_media/src/main/java/com/cnlive/media/frame/view/RecordView.java
| @@ -69,13 +69,7 @@ public class RecordView implements MvpView { | @@ -69,13 +69,7 @@ public class RecordView implements MvpView { | ||
| 69 | hasPermissions = mActivity.getPresenter().checkPermissions(mActivity, mActivity.permissionsRecordNoAudio, mActivity.PERMISISSION_CODE_ASK, true); | 69 | hasPermissions = mActivity.getPresenter().checkPermissions(mActivity, mActivity.permissionsRecordNoAudio, mActivity.PERMISISSION_CODE_ASK, true); |
| 70 | } | 70 | } |
| 71 | if (hasPermissions) { | 71 | if (hasPermissions) { |
| 72 | - mActivity.isInit = true; | ||
| 73 | - mActivity.getSupportFragmentManager() | ||
| 74 | - .beginTransaction() | ||
| 75 | - .replace(R.id.pre_frame, RecordFragment.newInstance()) | ||
| 76 | - .addToBackStack("") | ||
| 77 | - .commit(); | ||
| 78 | - | 72 | + mActivity.getSupportFragmentManager().beginTransaction().replace(R.id.pre_frame, RecordFragment.newInstance()).addToBackStack("").commit(); |
| 79 | } | 73 | } |
| 80 | 74 | ||
| 81 | } | 75 | } |
lib_media/src/main/java/com/cnlive/media/ui/adapter/MediaAdapter.java
| @@ -40,12 +40,14 @@ public class MediaAdapter extends BaseRecyclerViewAdapter<Media> { | @@ -40,12 +40,14 @@ public class MediaAdapter extends BaseRecyclerViewAdapter<Media> { | ||
| 40 | OnItemClickListener listener; | 40 | OnItemClickListener listener; |
| 41 | ImagePickerOptions mOptions; | 41 | ImagePickerOptions mOptions; |
| 42 | private MediaImageItemBinding binding; | 42 | private MediaImageItemBinding binding; |
| 43 | + int itemHight=0; | ||
| 43 | 44 | ||
| 44 | public MediaAdapter(Context context, boolean showTime, ImagePickerOptions mOptions) { | 45 | public MediaAdapter(Context context, boolean showTime, ImagePickerOptions mOptions) { |
| 45 | super(context); | 46 | super(context); |
| 46 | mContxt = context; | 47 | mContxt = context; |
| 47 | this.showTime = showTime; | 48 | this.showTime = showTime; |
| 48 | this.mOptions = mOptions; | 49 | this.mOptions = mOptions; |
| 50 | + itemHight=getItemWidth(); | ||
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | /** | 53 | /** |
| @@ -71,7 +73,7 @@ public class MediaAdapter extends BaseRecyclerViewAdapter<Media> { | @@ -71,7 +73,7 @@ public class MediaAdapter extends BaseRecyclerViewAdapter<Media> { | ||
| 71 | break; | 73 | break; |
| 72 | } | 74 | } |
| 73 | //让图片是个正方形 | 75 | //让图片是个正方形 |
| 74 | - viewDataBinding.getRoot().setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getItemWidth())); | 76 | + viewDataBinding.getRoot().setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, itemHight)); |
| 75 | MediaViewHolder holder = new MediaViewHolder(viewDataBinding.getRoot()); | 77 | MediaViewHolder holder = new MediaViewHolder(viewDataBinding.getRoot()); |
| 76 | holder.setBinding(viewDataBinding); | 78 | holder.setBinding(viewDataBinding); |
| 77 | return holder; | 79 | return holder; |
lib_media/src/main/java/com/cnlive/media/utils/GlideCacheUtil.java
| @@ -6,6 +6,7 @@ import android.graphics.Bitmap; | @@ -6,6 +6,7 @@ import android.graphics.Bitmap; | ||
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Looper; | 7 | import android.os.Looper; |
| 8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
| 9 | +import android.util.Log; | ||
| 9 | import android.view.View; | 10 | import android.view.View; |
| 10 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| 11 | import android.widget.ProgressBar; | 12 | import android.widget.ProgressBar; |
| @@ -207,7 +208,7 @@ public class GlideCacheUtil { | @@ -207,7 +208,7 @@ public class GlideCacheUtil { | ||
| 207 | // rb = rm.asGif(); | 208 | // rb = rm.asGif(); |
| 208 | } else { | 209 | } else { |
| 209 | option = option | 210 | option = option |
| 210 | - .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) | 211 | + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) |
| 211 | .centerCrop() | 212 | .centerCrop() |
| 212 | .dontAnimate(); | 213 | .dontAnimate(); |
| 213 | } | 214 | } |
| @@ -291,7 +292,7 @@ public class GlideCacheUtil { | @@ -291,7 +292,7 @@ public class GlideCacheUtil { | ||
| 291 | } | 292 | } |
| 292 | } | 293 | } |
| 293 | 294 | ||
| 294 | - | 295 | + static long start=0; |
| 295 | 296 | ||
| 296 | @SuppressLint("CheckResult") | 297 | @SuppressLint("CheckResult") |
| 297 | public static void intoItemImageThumbnail(Context context, Media media, ImageView view, ProgressBar loading) { | 298 | public static void intoItemImageThumbnail(Context context, Media media, ImageView view, ProgressBar loading) { |
| @@ -311,7 +312,7 @@ public class GlideCacheUtil { | @@ -311,7 +312,7 @@ public class GlideCacheUtil { | ||
| 311 | // rb = rm.asGif(); | 312 | // rb = rm.asGif(); |
| 312 | } else { | 313 | } else { |
| 313 | option = option | 314 | option = option |
| 314 | - .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) | 315 | + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) |
| 315 | .dontAnimate(); | 316 | .dontAnimate(); |
| 316 | } | 317 | } |
| 317 | 318 | ||
| @@ -338,11 +339,14 @@ public class GlideCacheUtil { | @@ -338,11 +339,14 @@ public class GlideCacheUtil { | ||
| 338 | @Override | 339 | @Override |
| 339 | public boolean onResourceReady(Object resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) { | 340 | public boolean onResourceReady(Object resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) { |
| 340 | if (loading != null) loading.setVisibility(View.GONE); | 341 | if (loading != null) loading.setVisibility(View.GONE); |
| 342 | + | ||
| 343 | + Log.e("加载:",System.currentTimeMillis()-start+""); | ||
| 341 | return false; | 344 | return false; |
| 342 | } | 345 | } |
| 343 | }); | 346 | }); |
| 344 | 347 | ||
| 345 | rb.apply(option).into(view); | 348 | rb.apply(option).into(view); |
| 349 | + start= System.currentTimeMillis(); | ||
| 346 | } catch (Exception e) { | 350 | } catch (Exception e) { |
| 347 | if (loading != null) loading.setVisibility(View.GONE); | 351 | if (loading != null) loading.setVisibility(View.GONE); |
| 348 | } | 352 | } |