From 7373fb48f8af7cf58bfb877caf3757fcc84d9deb Mon Sep 17 00:00:00 2001 From: Abdullah Alhazmy Date: Wed, 18 Apr 2018 13:58:47 +0300 Subject: [PATCH] * fix #66 --- .../mediapickerexample/ImageFragment.java | 3 +- .../mediapickerexample/MainActivity.java | 6 +- gradle.properties | 7 +-- libary/build.gradle | 22 +++---- libary/src/jni/hello-jni.c | 63 ------------------- .../alhazmy13/mediapicker/FileProcessing.java | 18 +++--- .../mediapicker/Image/ImageConfig.java | 2 +- .../mediapicker/Image/ImagePicker.java | 17 +---- .../mediapicker/Image/ImageProcessing.java | 2 +- .../mediapicker/Image/ImageTags.java | 17 ++--- .../net/alhazmy13/mediapicker/Utility.java | 17 ----- .../mediapicker/Video/VideoActivity.java | 23 +++---- .../mediapicker/Video/VideoConfig.java | 11 +--- .../mediapicker/Video/VideoPicker.java | 4 +- .../Video/VideoPickerBuilderBase.java | 5 -- .../mediapicker/Video/VideoTags.java | 15 +---- libary/src/main/res/layout/video_capture.xml | 9 --- libary/src/main/res/layout/voice_picker.xml | 6 -- libary/src/main/res/values/xml.xml | 2 - libary/src/main/res/xml/provider_paths.xml | 6 +- rxjava/build.gradle | 2 +- .../rxjava/image/ImagePickerHelper.java | 6 +- .../rxjava/image/ImagePickerReceiver.java | 2 +- .../rxjava/video/VideoPickerObservable.java | 2 - .../rxjava/video/VideoPickerReceiver.java | 2 +- 25 files changed, 58 insertions(+), 211 deletions(-) delete mode 100755 libary/src/jni/hello-jni.c delete mode 100644 libary/src/main/res/layout/video_capture.xml delete mode 100644 libary/src/main/res/layout/voice_picker.xml delete mode 100644 libary/src/main/res/values/xml.xml diff --git a/app/src/main/java/net/alhazmy13/mediapickerexample/ImageFragment.java b/app/src/main/java/net/alhazmy13/mediapickerexample/ImageFragment.java index 5558370..a2ccdfb 100644 --- a/app/src/main/java/net/alhazmy13/mediapickerexample/ImageFragment.java +++ b/app/src/main/java/net/alhazmy13/mediapickerexample/ImageFragment.java @@ -3,6 +3,7 @@ import android.content.Intent; import android.graphics.BitmapFactory; import android.os.Bundle; +import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; @@ -31,7 +32,7 @@ public class ImageFragment extends Fragment { @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.image_layout, container, false); diff --git a/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java b/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java index e637eea..52ff1f8 100644 --- a/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java +++ b/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java @@ -14,16 +14,14 @@ public class MainActivity extends AppCompatActivity { private Fragment videoFragment = new VideoFragment(); private Fragment imageFragment = new ImageFragment(); - private ViewPager mPager; - private PagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - mPager = findViewById(R.id.pager); - mPagerAdapter = new PickerAdapter(getSupportFragmentManager()); + ViewPager mPager = findViewById(R.id.pager); + PagerAdapter mPagerAdapter = new PickerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); TabLayout tabLayout = findViewById(R.id.tabs); tabLayout.setupWithViewPager(mPager); diff --git a/gradle.properties b/gradle.properties index ad1cd5b..80ce10e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,9 +13,4 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Sat Sep 10 13:03:48 EAT 2016 -isDubgMode=true -org.gradle.jvmargs=-Xmx2048m -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8 -org.gradle.daemon=true -org.gradle.parallel=true -systemProp.http.proxyPort=9050 -android.useDeprecatedNdk=true +org.gradle.jvmargs=-Xmx1536m diff --git a/libary/build.gradle b/libary/build.gradle index 9a86051..259c65d 100644 --- a/libary/build.gradle +++ b/libary/build.gradle @@ -1,18 +1,18 @@ apply plugin: 'com.android.library' -//apply plugin: 'com.novoda.bintray-release' +apply plugin: 'com.novoda.bintray-release' //apply from: '../deps.gradle' //./gradlew bintrayUpload -//publish { -// userOrg = 'alhazmy13' -// groupId = 'net.alhazmy13.MediaPicker' -// artifactId = 'libary' -// uploadName = 'MediaPicker' -// publishVersion = '2.4.1-beta' -// desc = 'MediaPicker' -// dryRun = false -// website = 'https://github.com/alhzmy13/MediaPicker' -//} +publish { + userOrg = 'alhazmy13' + groupId = 'net.alhazmy13.MediaPicker' + artifactId = 'libary' + uploadName = 'MediaPicker' + publishVersion = '2.4.2-beta' + desc = 'MediaPicker' + dryRun = false + website = 'https://github.com/alhzmy13/MediaPicker' +} android { compileSdkVersion 27 diff --git a/libary/src/jni/hello-jni.c b/libary/src/jni/hello-jni.c deleted file mode 100755 index 80e9804..0000000 --- a/libary/src/jni/hello-jni.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include - -/* This is a trivial JNI example where we use a native method - * to return a new VM String. See the corresponding Java source - * file located at: - * - * apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java - */ -jstring -Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, - jobject thiz ) -{ -#if defined(__arm__) - #if defined(__ARM_ARCH_7A__) - #if defined(__ARM_NEON__) - #if defined(__ARM_PCS_VFP) - #define ABI "armeabi-v7a/NEON (hard-float)" - #else - #define ABI "armeabi-v7a/NEON" - #endif - #else - #if defined(__ARM_PCS_VFP) - #define ABI "armeabi-v7a (hard-float)" - #else - #define ABI "armeabi-v7a" - #endif - #endif - #else - #define ABI "armeabi" - #endif -#elif defined(__i386__) - #define ABI "x86" -#elif defined(__x86_64__) - #define ABI "x86_64" -#elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */ - #define ABI "mips64" -#elif defined(__mips__) - #define ABI "mips" -#elif defined(__aarch64__) - #define ABI "arm64-v8a" -#else - #define ABI "unknown" -#endif - - return (*env)->NewStringUTF(env, "Hello from JNI ! Compiled with ABI " ABI "."); -} diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/FileProcessing.java b/libary/src/main/java/net/alhazmy13/mediapicker/FileProcessing.java index 2820a57..4d4d437 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/FileProcessing.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/FileProcessing.java @@ -106,8 +106,8 @@ else if ("file".equalsIgnoreCase(uri.getScheme())) { * @param selectionArgs (Optional) Selection arguments used in the query. * @return The value of the _data column, which is typically a file path. */ - public static String getDataColumn(Context context, Uri uri, String selection, - String[] selectionArgs) { + private static String getDataColumn(Context context, Uri uri, String selection, + String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; @@ -134,7 +134,7 @@ public static String getDataColumn(Context context, Uri uri, String selection, * @param uri The Uri to check. * @return Whether the Uri authority is ExternalStorageProvider. */ - public static boolean isExternalStorageDocument(Uri uri) { + private static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } @@ -142,7 +142,7 @@ public static boolean isExternalStorageDocument(Uri uri) { * @param uri The Uri to check. * @return Whether the Uri authority is DownloadsProvider. */ - public static boolean isDownloadsDocument(Uri uri) { + private static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } @@ -150,7 +150,7 @@ public static boolean isDownloadsDocument(Uri uri) { * @param uri The Uri to check. * @return Whether the Uri authority is MediaProvider. */ - public static boolean isMediaDocument(Uri uri) { + private static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } @@ -174,9 +174,9 @@ public static void copyDirectory(File sourceLocation , File targetLocation) { } String[] children = sourceLocation.list(); - for (int i = 0; i < children.length; i++) { - copyDirectory(new File(sourceLocation, children[i]), - new File(targetLocation, children[i])); + for (String aChildren : children) { + copyDirectory(new File(sourceLocation, aChildren), + new File(targetLocation, aChildren)); } } else { @@ -192,6 +192,6 @@ public static void copyDirectory(File sourceLocation , File targetLocation) { in.close(); out.close(); } - }catch (Exception ex){} + }catch (Exception ignored){} } } diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageConfig.java b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageConfig.java index c1b5198..e2e8588 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageConfig.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageConfig.java @@ -21,7 +21,7 @@ class ImageConfig implements Serializable { protected boolean allowOnlineImages; protected boolean debug; - public ImageConfig() { + ImageConfig() { this.extension = ImagePicker.Extension.PNG; this.compressLevel = ImagePicker.ComperesLevel.NONE; this.mode = ImagePicker.Mode.CAMERA; diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImagePicker.java b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImagePicker.java index 0cf5a38..1f76565 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImagePicker.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImagePicker.java @@ -23,20 +23,18 @@ public class ImagePicker { */ public static final String EXTRA_IMAGE_PATH = "EXTRA_IMAGE_PATH"; - private final ImageConfig imageConfig; - /** * Instantiates a new Image picker. * * @param builder the builder */ - public ImagePicker(Builder builder) { + ImagePicker(Builder builder) { // Required WeakReference context = builder.context; // Optional - imageConfig = builder.imageConfig; + ImageConfig imageConfig = builder.imageConfig; Intent callingIntent = ImageActivity.getCallingIntent(context.get(), imageConfig); context.get().startActivityForResult(callingIntent, IMAGE_PICKER_REQUEST_CODE); @@ -203,17 +201,6 @@ public int getValue() { return value; } - /** - * Gets enum. - * - * @param value the value - * @return the enum - */ - public static ComperesLevel getEnum(int value) { - for (ComperesLevel v : values()) - if (v.getValue() == value) return v; - throw new IllegalArgumentException(); - } } /** diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java index 25c6d39..9ca9af5 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java @@ -24,7 +24,7 @@ public static List processMultiImage(Context context, Intent data) { if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) && (null == data.getData())) { ClipData clipdata = data.getClipData(); - for (int i=0; i path) { private void pickVideoWrapper() { if (Build.VERSION.SDK_INT >= 23) { - List permissionsNeeded = new ArrayList(); + List permissionsNeeded = new ArrayList<>(); - final List permissionsList = new ArrayList(); + final List permissionsList = new ArrayList<>(); if ((mVideoConfig.mode == VideoPicker.Mode.CAMERA || mVideoConfig.mode == VideoPicker.Mode.CAMERA_AND_GALLERY) && !addPermission(permissionsList, Manifest.permission.CAMERA)) permissionsNeeded.add(getString(R.string.media_picker_camera)); if (!addPermission(permissionsList, Manifest.permission.WRITE_EXTERNAL_STORAGE)) @@ -262,10 +263,10 @@ private void pickVideoWrapper() { if (permissionsList.size() > 0) { if (permissionsNeeded.size() > 0) { // Need Rationale - String message = getString(R.string.media_picker_you_need_to_grant_access_to) + permissionsNeeded.get(0); + StringBuilder message = new StringBuilder(getString(R.string.media_picker_you_need_to_grant_access_to) + permissionsNeeded.get(0)); for (int i = 1; i < permissionsNeeded.size(); i++) - message = message + ", " + permissionsNeeded.get(i); - showMessageOKCancel(message, + message.append(", ").append(permissionsNeeded.get(i)); + showMessageOKCancel(message.toString(), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -299,8 +300,7 @@ private boolean addPermission(List permissionsList, String permission) { if (ActivityCompat.checkSelfPermission(VideoActivity.this, permission) != PackageManager.PERMISSION_GRANTED) { permissionsList.add(permission); // Check for Rationale Option - if (!ActivityCompat.shouldShowRequestPermissionRationale(VideoActivity.this, permission)) - return false; + return ActivityCompat.shouldShowRequestPermissionRationale(VideoActivity.this, permission); } return true; } @@ -341,14 +341,14 @@ private static class CompresVideoTask extends AsyncTask { private WeakReference mContext; - public CompresVideoTask(List listOfImgs, VideoConfig videoConfig, VideoActivity context) { + CompresVideoTask(List listOfImgs, VideoConfig videoConfig, VideoActivity context) { this.listOfImgs = listOfImgs; this.mContext = new WeakReference<>(context); this.mVideoConfig = videoConfig; this.destinationPaths = new ArrayList<>(); } - public CompresVideoTask(String absolutePath, VideoConfig videoConfig, VideoActivity context) { + CompresVideoTask(String absolutePath, VideoConfig videoConfig, VideoActivity context) { List list = new ArrayList<>(); list.add(absolutePath); this.listOfImgs = list; @@ -370,11 +370,6 @@ protected Void doInBackground(Void... params) { FileProcessing.copyDirectory(file, destinationFile); } destinationPaths.add(destinationFile.getAbsolutePath()); -// try { -// Utility.compressAndRotateIfNeeded(file, destinationFile, mVideoConfig.compressLevel.getValue(), mVideoConfig.reqWidth, mVideoConfig.reqHeight); -// } catch (IOException e) { -// e.printStackTrace(); -// } } diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoConfig.java b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoConfig.java index 366efe9..7b2b412 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoConfig.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoConfig.java @@ -11,22 +11,16 @@ class VideoConfig implements Serializable { protected VideoPicker.Extension extension; - // protected VideoPicker.ComperesLevel compressLevel; protected VideoPicker.Mode mode; protected String directory; - protected int reqHeight; - protected int reqWidth; protected boolean allowMultiple; protected boolean isImgFromCamera; protected boolean debug; - public VideoConfig() { + VideoConfig() { this.extension = VideoPicker.Extension.MP4; -// this.compressLevel = VideoPicker.ComperesLevel.NONE; this.mode = VideoPicker.Mode.CAMERA; this.directory = Environment.getExternalStorageDirectory() + VideoTags.Tags.IMAGE_PICKER_DIR; - this.reqHeight = 0; - this.reqWidth = 0; this.allowMultiple = false; } @@ -34,11 +28,8 @@ public VideoConfig() { public String toString() { return "ImageConfig{" + "extension=" + extension + -// ", compressLevel=" + compressLevel + ", mode=" + mode + ", directory='" + directory + '\'' + - ", reqHeight=" + reqHeight + - ", reqWidth=" + reqWidth + ", allowMultiple=" + allowMultiple + ", isImgFromCamera=" + isImgFromCamera + ", debug=" + debug + diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPicker.java b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPicker.java index aa499cd..55661fb 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPicker.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPicker.java @@ -16,15 +16,13 @@ public class VideoPicker { public static final int VIDEO_PICKER_REQUEST_CODE = 53213; public static final String EXTRA_VIDEO_PATH = "EXTRA_VIDEO_PATH"; - private final VideoConfig imageConfig; - VideoPicker(VideoPicker.Builder builder) { // Required WeakReference context = builder.context; // Optional - imageConfig = builder.imageConfig; + VideoConfig imageConfig = builder.imageConfig; Intent callingIntent = VideoActivity.getCallingIntent(context.get(), imageConfig); context.get().startActivityForResult(callingIntent, VIDEO_PICKER_REQUEST_CODE); diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPickerBuilderBase.java b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPickerBuilderBase.java index a4f0613..18832ba 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPickerBuilderBase.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoPickerBuilderBase.java @@ -5,7 +5,6 @@ * MediaPicker */ public interface VideoPickerBuilderBase { -// VideoPicker.Builder compressLevel(VideoPicker.ComperesLevel compressLevel); VideoPicker.Builder mode(VideoPicker.Mode mode); @@ -15,10 +14,6 @@ public interface VideoPickerBuilderBase { VideoPicker.Builder extension(VideoPicker.Extension extension); -// VideoPicker.Builder scale(int minWidth, int minHeight); -// -// VideoPicker.Builder allowMultipleImages(boolean allowMultiple); - VideoPicker.Builder enableDebuggingMode(boolean debug); VideoPicker build(); diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoTags.java b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoTags.java index c91dff7..0eef182 100644 --- a/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoTags.java +++ b/libary/src/main/java/net/alhazmy13/mediapicker/Video/VideoTags.java @@ -5,29 +5,20 @@ * MediaPicker */ public class VideoTags { - public static final class Tags{ + public static final class Tags { public static final String TAG = "VideoPicker"; - public static final String LEVEL = "level"; - public static final String EXTENSION = "extension"; - public static final String MODE = "mode"; - public static final String DIRECTORY = "DIRECTORY"; public static final String CAMERA_IMAGE_URI = "cameraVideoUri"; - public static final String COMPRESS_LEVEL = "COMPRESS_LEVEL"; - public static final String REQUESTED_WIDTH = "REQUESTED_WIDTH"; - public static final String REQUESTED_HEIGHT = "REQUESTED_HEIGHT"; public static final String VIDEO_PATH = "VIDEO_PATH"; - public static final String ALLOW_MULTIPLE = "ALLOW_MULTIPLE"; - public static final String DEBUG = "DEBUG"; public static final String IMAGE_PICKER_DIR = "/mediapicker/videos/"; public static final String IMG_CONFIG = "IMG_CONFIG"; public static final String PICK_ERROR = "PICK_ERROR"; } - public static final class Action{ + public static final class Action { public static final String SERVICE_ACTION = "net.alhazmy13.mediapicker.rxjava.video.service"; } - public final class IntentCode{ + public final class IntentCode { public static final int REQUEST_CODE_SELECT_MULTI_PHOTO = 5341; public static final int CAMERA_REQUEST = 1888; public static final int REQUEST_CODE_ASK_PERMISSIONS = 123; diff --git a/libary/src/main/res/layout/video_capture.xml b/libary/src/main/res/layout/video_capture.xml deleted file mode 100644 index bb85e28..0000000 --- a/libary/src/main/res/layout/video_capture.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/libary/src/main/res/layout/voice_picker.xml b/libary/src/main/res/layout/voice_picker.xml deleted file mode 100644 index 3509b84..0000000 --- a/libary/src/main/res/layout/voice_picker.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/libary/src/main/res/values/xml.xml b/libary/src/main/res/values/xml.xml deleted file mode 100644 index a6b3dae..0000000 --- a/libary/src/main/res/values/xml.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/libary/src/main/res/xml/provider_paths.xml b/libary/src/main/res/xml/provider_paths.xml index e3363f7..d1c4d5b 100644 --- a/libary/src/main/res/xml/provider_paths.xml +++ b/libary/src/main/res/xml/provider_paths.xml @@ -1,4 +1,6 @@ - - + + \ No newline at end of file diff --git a/rxjava/build.gradle b/rxjava/build.gradle index 6e7c772..11f03e3 100644 --- a/rxjava/build.gradle +++ b/rxjava/build.gradle @@ -9,7 +9,7 @@ publish { groupId = 'net.alhazmy13.MediaPicker' artifactId = 'rxjava' uploadName = 'MediaPickerRx' - publishVersion = '2.4.1-beta' + publishVersion = '2.4.2-beta' desc = 'MediaPickerRx' dryRun = false website = 'https://github.com/alhzmy13/MediaPicker' diff --git a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerHelper.java b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerHelper.java index 558c05a..e5d3589 100644 --- a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerHelper.java +++ b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerHelper.java @@ -1,4 +1,5 @@ package net.alhazmy13.mediapicker.rxjava.image; + import net.alhazmy13.mediapicker.Image.ImagePicker; import java.util.List; @@ -12,11 +13,12 @@ */ public class ImagePickerHelper { private ImagePicker.Builder mBuilder; - public ImagePickerHelper(ImagePicker.Builder builder){ + + public ImagePickerHelper(ImagePicker.Builder builder) { this.mBuilder = builder; } - public Observable> getObservable(){ + public Observable> getObservable() { return Observable.create(new ImagePickerObservable(mBuilder)); } diff --git a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerReceiver.java b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerReceiver.java index 0d3cef1..e005a32 100644 --- a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerReceiver.java +++ b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/image/ImagePickerReceiver.java @@ -27,7 +27,7 @@ public ImagePickerReceiver(Emitter> observer) { public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received message " + intent); - List imagePath = (List) intent.getSerializableExtra(ImageTags.Tags.IMAGE_PATH); + List imagePath = intent.getStringArrayListExtra(ImageTags.Tags.IMAGE_PATH); if (imagePath != null && imagePath.size() > 0) { emitter.onNext(imagePath); emitter.onComplete(); diff --git a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerObservable.java b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerObservable.java index 16f357f..4888f06 100644 --- a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerObservable.java +++ b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerObservable.java @@ -4,10 +4,8 @@ import android.content.Context; import android.content.IntentFilter; -import net.alhazmy13.mediapicker.Image.ImageTags; import net.alhazmy13.mediapicker.Video.VideoPicker; import net.alhazmy13.mediapicker.Video.VideoTags; -import net.alhazmy13.mediapicker.rxjava.image.ImagePickerReceiver; import java.lang.ref.WeakReference; import java.util.List; diff --git a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerReceiver.java b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerReceiver.java index 81bc634..09cf249 100644 --- a/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerReceiver.java +++ b/rxjava/src/main/java/net/alhazmy13/mediapicker/rxjava/video/VideoPickerReceiver.java @@ -26,7 +26,7 @@ public VideoPickerReceiver(ObservableEmitter> observer) { public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received message " + intent); - List imagePath = (List) intent.getSerializableExtra(VideoTags.Tags.VIDEO_PATH); + List imagePath = intent.getStringArrayListExtra(VideoTags.Tags.VIDEO_PATH); if (imagePath != null && imagePath.size() > 0) observer.onNext(imagePath); else