Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {


dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class PickerActivity extends AppCompatActivity {

public static final String KEY_ACTION_BAR_TITLE = "actionBarKey";
public static final String KEY_SHOULD_SHOW_ACTIONBAR_UP = "shouldShowUpKey";
public static final String CAPTURED_IMAGES_ALBUM_NAME = "captured_images";
public static final String CAPTURED_IMAGES_DIR = Environment.getExternalStoragePublicDirectory(CAPTURED_IMAGES_ALBUM_NAME).getAbsolutePath();
public static String CAPTURED_IMAGES_ALBUM_NAME = "captured_images";
public static String CAPTURED_IMAGES_DIR = Environment.getExternalStoragePublicDirectory(CAPTURED_IMAGES_ALBUM_NAME).getAbsolutePath();
private static final int REQUEST_PORTRAIT_RFC = 1337;
private static final int REQUEST_PORTRAIT_FFC = REQUEST_PORTRAIT_RFC + 1;
public static ArrayList<ImageEntry> sCheckedImages = new ArrayList<>();
Expand All @@ -56,6 +56,7 @@ public class PickerActivity extends AppCompatActivity {

private com.melnykov.fab.FloatingActionButton mDoneFab;
private Picker mPickOptions;

//For ViewPager
private ImageEntry mCurrentlyDisplayedImage;
private AlbumEntry mSelectedAlbum;
Expand All @@ -76,12 +77,14 @@ protected void onCreate(Bundle savedInstanceState) {
mPickOptions = (EventBus.getDefault().getStickyEvent(Events.OnPublishPickOptionsEvent.class)).options;
initTheme();
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_pick);
addToolbarToLayout();
initActionbar(savedInstanceState);
setupAlbums(savedInstanceState);
initFab();
updateFab();
initCaptureImagesDir();
}

@Override
Expand Down Expand Up @@ -254,6 +257,14 @@ public void onClick(DialogInterface dialog, int which) {

}

private void initCaptureImagesDir() {
if (mPickOptions.mCameraImagePath != null) {
CAPTURED_IMAGES_ALBUM_NAME = mPickOptions.mCameraImagePath;
CAPTURED_IMAGES_DIR = Environment.getExternalStoragePublicDirectory(CAPTURED_IMAGES_ALBUM_NAME).getAbsolutePath();
}
Log.d("ImagesFolder", CAPTURED_IMAGES_DIR);
}

public void capturePhoto() {
final File captureImageFile = createTemporaryFileForCapturing(".png");
CameraSupport.startPhotoCaptureActivity(this, captureImageFile, REQUEST_PORTRAIT_FFC);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package net.yazeed44.imagepicker.util;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -43,6 +45,7 @@ public final class Picker {
public final int doneFabIconTintColor;
public final boolean shouldShowCaptureMenuItem;
public final int checkIconTintColor;
public final String mCameraImagePath;
public final boolean videosEnabled;
public final int videoLengthLimit;
public final int videoThumbnailOverlayColor;
Expand All @@ -69,22 +72,22 @@ private Picker(final Builder builder) {
doneFabIconTintColor = builder.mDoneFabIconTintColor;
shouldShowCaptureMenuItem = builder.mShouldShowCaptureMenuItem;
checkIconTintColor = builder.mCheckIconTintColor;
mCameraImagePath = builder.mCameraImagePath;
videosEnabled = builder.mVideosEnabled;
videoLengthLimit = builder.mVideoLengthLimit;
videoThumbnailOverlayColor = builder.mVideoThumbnailOverlayColor;
videoIconTintColor = builder.mVideoIconTintColor;
backBtnInMainActivity = builder.mBackBtnInMainActivity;

}

public void startActivity() {

EventBus.getDefault().postSticky(new Events.OnPublishPickOptionsEvent(this));

final Intent intent = new Intent(context, PickerActivity.class);
intent.putExtra("camera_image_path", mCameraImagePath);

context.startActivity(intent);

}


Expand Down Expand Up @@ -121,6 +124,7 @@ public static class Builder {
private int mCaptureItemIconTintColor;
private boolean mShouldShowCaptureMenuItem;
private int mCheckIconTintColor;
private String mCameraImagePath;
private boolean mVideosEnabled;
private int mVideoLengthLimit;
private int mVideoThumbnailOverlayColor;
Expand Down Expand Up @@ -160,6 +164,7 @@ private void init() {
mAlbumBackgroundColor = getColor(R.color.alter_album_background);
mAlbumNameTextColor = getColor(R.color.alter_album_name_text_color);
mAlbumImagesCountTextColor = getColor(R.color.alter_album_images_count_text_color);

mFabBackgroundColorWhenPressed = ColorUtils.setAlphaComponent(mFabBackgroundColor, (int) (android.graphics.Color.alpha(mFabBackgroundColor) * 0.8f));
mPickMode = PickMode.MULTIPLE_IMAGES;

Expand Down Expand Up @@ -271,6 +276,11 @@ public Picker.Builder setCheckIconTintColor(@ColorInt final int color) {
return this;
}

public Picker.Builder setCapturesImageDir(final String path) {
mCameraImagePath = path;
return this;
}

public Picker.Builder setBackBtnInMainActivity(final boolean backBtn) {
mBackBtnInMainActivity = backBtn;
return this;
Expand Down Expand Up @@ -299,7 +309,5 @@ public Picker.Builder setVideoIconTintColor(@ColorInt final int color) {
public Picker build() {
return new Picker(this);
}


}
}