Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	ImageLibrary/build.gradle
  • Loading branch information
r17171709 committed Jun 16, 2017
2 parents c31edef + a38ffbd commit 4d6645c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import com.renyu.imagelibrary.camera.CameraActivity;
import com.renyu.imagelibrary.crop.UCrop;
import com.renyu.imagelibrary.photopicker.PhotoPickerActivity;
import com.renyu.imagelibrary.preview.ImagePreviewActivity;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

/**
* Created by renyu on 2017/1/3.
Expand Down Expand Up @@ -150,4 +152,23 @@ public static void displayToGallery(Context context, File photoFile) {
// 最后通知图库更新
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + photoPath)));
}

/**
* 相册预览
* @param context
* @param canDownload
* @param position
* @param canEdit
* @param urls
*/
public static void showPreiew(Context context, boolean canDownload, int position, boolean canEdit, ArrayList<String> urls) {
Intent intent=new Intent(context, ImagePreviewActivity.class);
Bundle bundle=new Bundle();
bundle.putBoolean("canDownload", canDownload);
bundle.putInt("position", position);
bundle.putBoolean("canEdit", canEdit);
bundle.putStringArrayList("urls", urls);
intent.putExtras(bundle);
context.startActivity(intent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public void remove(String path) {
public void show(String path) {
Intent intent=new Intent(PhotoPickerActivity.this, ImagePreviewActivity.class);
Bundle bundle=new Bundle();
bundle.putBoolean("canHead", false);
bundle.putBoolean("canDownload", false);
bundle.putInt("position", 0);
bundle.putBoolean("canEdit", false);
Expand Down Expand Up @@ -212,7 +211,6 @@ public void onClick(View v) {
if (imagePaths.size()>0) {
Intent intent=new Intent(PhotoPickerActivity.this, ImagePreviewActivity.class);
Bundle bundle=new Bundle();
bundle.putBoolean("canHead", false);
bundle.putBoolean("canDownload", false);
bundle.putInt("position", 0);
bundle.putBoolean("canEdit", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;
import com.renyu.commonlibrary.commonutils.ResourceUtils;
import com.renyu.imagelibrary.R;
import com.renyu.imagelibrary.bean.Photo;

Expand Down Expand Up @@ -89,7 +90,7 @@ public void onClick(View v) {
return;
}
models.get(position).setSelect(!flag);
holder.photopicker_choice.setImageResource(!flag?R.mipmap.ic_choice_select:R.mipmap.ic_choice_normal);
holder.photopicker_choice.setImageResource(!flag? ResourceUtils.getMipmapId(context, "ic_choice_select"):ResourceUtils.getMipmapId(context, "ic_choice_normal"));
if (!flag) {
listener.add(models.get(position).getPath());
}
Expand All @@ -98,7 +99,7 @@ public void onClick(View v) {
}
}
});
holder.photopicker_choice.setImageResource(models.get(position).isSelect()?R.mipmap.ic_choice_select:R.mipmap.ic_choice_normal);
holder.photopicker_choice.setImageResource(models.get(position).isSelect()?ResourceUtils.getMipmapId(context, "ic_choice_select"):ResourceUtils.getMipmapId(context, "ic_choice_normal"));
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions ImageLibrary/src/main/res/layout/adapter_photopicker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_margin="5dip"
android:src="@mipmap/ic_choice_normal"/>
android:layout_margin="5dip"/>
</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.renyu.imagelibrary.commonutils.Utils;

public class MainActivity extends AppCompatActivity {
Expand All @@ -13,7 +14,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);

com.blankj.utilcode.util.Utils.init(this);
Fresco.initialize(this);

Utils.takePicture(this, 1000);
Utils.choicePic(this, 2, 100);
}
}

0 comments on commit 4d6645c

Please sign in to comment.