本文主要是介绍galleryfinal 实现Android图片单选/多选、拍照、裁剪、压缩。视频选择和录制。,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
RxGalleryFinal是一个android图片/视频文件选择器。其支持多选、单选、拍摄和裁剪,主题可自定义,无强制绑定第三方图片加载器。
1.首先加入权限
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2.在module gradle中项目依赖代码:
compile 'cn.finalteam.rxgalleryfinal:library:0.0.1'
//支持以下主流图片加载器,开发者自行选择compile 'com.squareup.picasso:picasso:2.5.2'compile 'com.facebook.fresco:fresco:0.12.0'compile 'com.github.bumptech.glide:glide:3.7.0'compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
3.在fest加入所需的activity
<application...android:theme="@style/Theme_Light"><activityandroid:name="cn.finalteam.rxgalleryfinal.ui.activity.MediaActivity"android:screenOrientation="portrait"android:exported="true"android:theme="@style/Theme_Light.Default"/><activityandroid:name="com.yalantis.ucrop.UCropActivity"android:screenOrientation="portrait"android:theme="@style/Theme_Light.Default"/>
</application
4.java代码
RxGalleryFinal.with(PhotoActivity.this).image().radio().crop().imageLoader(ImageLoaderType.FRESCO).subscribe(new RxBusResultSubscriber<ImageRadioResultEvent>() {@Overrideprotected void onEvent(ImageRadioResultEvent imageRadioResultEvent) throws Exception {//图片选择结果simpleDraweeView.setImageURI("file://" + imageRadioResultEvent.getResult().getCropPath());
// simpleDraweeView.setImageURI(imageRadioResultEvent.getResult().getOriginalPath());imageView.setImageURI(Uri.parse(imageRadioResultEvent.getResult().getOriginalPath()));}}).openGallery();
最后有混淆代码的请看下面
#1.support-v7-appcompat
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }-keep public class * extends android.support.v4.view.ActionProvider {public <init>(android.content.Context);
}#2.rxjava
-keep class rx.schedulers.Schedulers {public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {public <methods>;
}
-keep class rx.schedulers.TestScheduler {public <methods>;
}
-keep class rx.schedulers.Schedulers {public static ** test();
}
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {long producerIndex;long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {rx.internal.util.atomic.LinkedQueueNode consumerNode;
}#3.retrolambda
-dontwarn java.lang.invoke.*#4.support-v4
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }#5.ucrop
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }#6.photoview
-keep class uk.co.senab.photoview** { *; }
-keep interface uk.co.senab.photoview** { *; }#7.rxgalleryfinal
-keep class cn.finalteam.rxgalleryfinal.ui.widget** { *; }-keepclassmembers class * extends android.app.Activity {public void *(android.view.View);
}
-keepclassmembers enum * {public static **[] values();public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {public static <fields>;
}-keepattributes *Annotation*
-keepclasseswithmembernames class * {native <methods>;
}
-keepclassmembers public class * extends android.view.View {void set*(***);*** get*();
}
另附上demo地址: https://github.com/meijius/RxGalleryFinal
这篇关于galleryfinal 实现Android图片单选/多选、拍照、裁剪、压缩。视频选择和录制。的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!