This repository has been archived by the owner on May 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from alhazmy13/refactor-video
version 2.3.0
- Loading branch information
Showing
38 changed files
with
1,130 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
apply plugin: 'com.android.application' | ||
apply from: '../deps.gradle' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.3" | ||
compileSdkVersion versions.TARGET_SDK_VERSION | ||
buildToolsVersion versions.BUILD_TOOLS_VERSION | ||
|
||
defaultConfig { | ||
minSdkVersion versions.MIN_SDK_VERSION | ||
targetSdkVersion versions.TARGET_SDK_VERSION | ||
applicationId 'net.alhazmy13.mediapicker' | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
shrinkResources true | ||
} | ||
debug{ | ||
shrinkResources true | ||
} | ||
} | ||
productFlavors { | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.4.0' | ||
compile "com.android.support:appcompat-v7:25.2.0" | ||
compile "com.android.support:design:25.2.0" | ||
compile "com.android.support:support-v13:25.2.0" | ||
compile project(':libary') | ||
compile project(':rxjava') | ||
} |
13 changes: 0 additions & 13 deletions
13
app/src/androidTest/java/net/alhazmy13/mediapickerexample/ApplicationTest.java
This file was deleted.
Oops, something went wrong.
109 changes: 109 additions & 0 deletions
109
app/src/main/java/net/alhazmy13/mediapickerexample/ImageFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package net.alhazmy13.mediapickerexample; | ||
|
||
import android.app.Fragment; | ||
import android.graphics.BitmapFactory; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import net.alhazmy13.mediapicker.Image.ImagePicker; | ||
import net.alhazmy13.mediapicker.rxjava.image.ImagePickerHelper; | ||
|
||
import java.util.List; | ||
|
||
import rx.Subscriber; | ||
|
||
/** | ||
* Created by alhazmy13 on 3/13/17. | ||
*/ | ||
|
||
public class ImageFragment extends Fragment { | ||
private ImageView imageView; | ||
private TextView path; | ||
|
||
private static final String TAG = "MainActivity"; | ||
private static final String IMAGE_PATH = "IMAGE_TAGS_IMAGE_PATH"; | ||
private String videoPath; | ||
private List<String> mPath; | ||
|
||
|
||
public ImageFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.image_layout, container, false); | ||
|
||
// Find our View instances | ||
imageView = (ImageView) view.findViewById(R.id.iv_image); | ||
path = (TextView) view.findViewById(R.id.tv_path); | ||
view.findViewById(R.id.bt_pick).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
pickImage(); | ||
} | ||
}); | ||
return view; | ||
} | ||
|
||
|
||
private void pickImage() { | ||
new ImagePickerHelper( | ||
new ImagePicker.Builder(getActivity()) | ||
.mode(ImagePicker.Mode.CAMERA_AND_GALLERY) | ||
.compressLevel(ImagePicker.ComperesLevel.MEDIUM) | ||
.directory(ImagePicker.Directory.DEFAULT) | ||
.extension(ImagePicker.Extension.PNG) | ||
.scale(600, 600) | ||
.allowMultipleImages(true) | ||
.enableDebuggingMode(true)) | ||
.getObservable() | ||
.subscribe(new Subscriber<List<String>>() { | ||
@Override | ||
public void onCompleted() { | ||
Log.d(TAG, "onCompleted() called with: " + ""); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable e) { | ||
Log.d(TAG, "onError() called with: " + "e = [" + e + "]"); | ||
e.printStackTrace(); | ||
} | ||
|
||
@Override | ||
public void onNext(List<String> imagePath) { | ||
Log.d(TAG, "onNext() called with: " + "imagePath = [" + imagePath + "]"); | ||
mPath = imagePath; | ||
loadImage(); | ||
} | ||
}); | ||
} | ||
// | ||
// @Override | ||
// protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
// super.onActivityResult(requestCode, resultCode, data); | ||
// | ||
// if (requestCode == VideoPicker.VIDEO_PICKER_REQUEST_CODE && resultCode == RESULT_OK) { | ||
// videoPath = data.getStringExtra(VideoPicker.EXTRA_VIDEO_PATH); | ||
// loadImage(); | ||
// } | ||
// else if(requestCode == ImagePicker.IMAGE_PICKER_REQUEST_CODE && resultCode == RESULT_OK) { | ||
// mPath = (List<String>) data.getSerializableExtra(ImagePicker.EXTRA_IMAGE_PATH); | ||
// loadImage(); | ||
// } | ||
// } | ||
|
||
private void loadImage() { | ||
Log.d(TAG, "loadImage: " + mPath.size()); | ||
path.setText(mPath.get(0)); | ||
imageView.setImageBitmap(BitmapFactory.decodeFile(mPath.get(0))); | ||
} | ||
|
||
} |
Oops, something went wrong.