Skip to content

Commit 14be200

Browse files
committed
Merge branch 'dev'
# Conflicts: # app/build.gradle # app/src/main/java/com/werb/pickphotosample/MainActivity.java # app/src/main/java/com/werb/pickphotosample/SampleAdapter.java # build.gradle # gradle/wrapper/gradle-wrapper.properties # pickphotoview/build.gradle
2 parents 94c14e9 + 12367b1 commit 14be200

File tree

86 files changed

+2064
-1579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2064
-1579
lines changed

.gitignore

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
# Built application files
2-
build/*
3-
*/app.iml
1+
# Generated files
2+
bin/
3+
gen/
4+
release/
45

5-
# Crashlytics configuations
6-
com_crashlytics_export_strings.xml
6+
# Gradle files
7+
.gradle/
8+
build/
79

810
# Local configuration file (sdk path, etc)
911
local.properties
1012

11-
# Gradle generated files
12-
.gradle/
13-
14-
# Signing files
15-
.signing/
16-
17-
# User-specific configurations
18-
.idea/*
19-
.idea/libraries/
20-
.idea/workspace.xml
21-
.idea/tasks.xml
22-
.idea/.name
23-
.idea/compiler.xml
24-
.idea/copyright/profiles_settings.xml
25-
.idea/encodings.xml
26-
.idea/misc.xml
27-
.idea/modules.xml
28-
.idea/scopes/scope_settings.xml
29-
.idea/vcs.xml
13+
# IntelliJ project files
3014
*.iml
31-
captures/*
15+
.idea/
16+
17+
# Eclipse project files
18+
.settings/
3219

33-
# OS-specific files
20+
# Misc
3421
.DS_Store
35-
.DS_Store?
36-
._*
37-
.Spotlight-V100
38-
.Trashes
39-
ehthumbs.db
40-
Thumbs.db
22+
23+
.classpath
24+
.project

app/build.gradle

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
23

34
android {
4-
compileSdkVersion 25
5+
compileSdkVersion 26
56
buildToolsVersion '26.0.2'
67
defaultConfig {
78
applicationId "com.werb.pickphotosample"
8-
minSdkVersion 14
9-
targetSdkVersion 25
9+
minSdkVersion 16
10+
targetSdkVersion 26
1011
versionCode 10
1112
versionName "1.3.0"
1213
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -20,12 +21,20 @@ android {
2021
}
2122

2223
dependencies {
23-
compile fileTree(include: ['*.jar'], dir: 'libs')
24+
implementation fileTree(include: ['*.jar'], dir: 'libs')
2425
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2526
exclude group: 'com.android.support', module: 'support-annotations'
2627
})
27-
compile 'com.android.support:appcompat-v7:25.3.1'
28-
testCompile 'junit:junit:4.12'
29-
compile project(':pickphotoview')
30-
compile 'com.werb.permissionschecker:permissionschecker:0.0.1-beta2'
28+
implementation 'com.android.support:appcompat-v7:26.1.0'
29+
testImplementation 'junit:junit:4.12'
30+
implementation project(':pickphotoview')
31+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
32+
implementation 'com.android.support:recyclerview-v7:26.1.0'
33+
implementation ('com.werb.permissionschecker:permissionschecker:0.0.1-beta2', {
34+
exclude group: 'com.android.support'
35+
})
36+
compile 'com.github.bumptech.glide:glide:4.1.1'
37+
}
38+
repositories {
39+
mavenCentral()
3140
}

app/src/main/java/com/werb/pickphotosample/MainActivity.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.Manifest;
44
import android.content.Intent;
5-
import android.net.Uri;
65
import android.os.Bundle;
76
import android.support.annotation.NonNull;
87
import android.support.v7.app.AppCompatActivity;
@@ -33,31 +32,32 @@ protected void onCreate(Bundle savedInstanceState) {
3332
setContentView(R.layout.activity_main);
3433

3534
permissionChecker = new PermissionChecker(this);
36-
if(permissionChecker.isLackPermissions(PERMISSIONS)){
35+
if (permissionChecker.isLackPermissions(PERMISSIONS)) {
3736
permissionChecker.requestPermissions();
3837
}
3938

4039
//Select Single Image - When image is selected, gallery immediately closes and returns image.
41-
CustomButton btn1 = (CustomButton) findViewById(R.id.btn1);
40+
CustomButton btn1 = findViewById(R.id.btn1);
4241
btn1.setOnClickListener(new View.OnClickListener() {
4342
@Override
4443
public void onClick(View view) {
4544
new PickPhotoView.Builder(MainActivity.this)
4645
.setPickPhotoSize(1)
46+
.setClickSelectable(true)
4747
.setShowCamera(true)
4848
.setSpanCount(3)
4949
.setLightStatusBar(true)
50-
.setStatusBarColor("#ffffff")
51-
.setToolbarColor("#ffffff")
52-
.setToolbarIconColor("#000000")
53-
.setClickSelectable(true)
50+
.setStatusBarColor(R.color.white)
51+
.setToolbarColor(R.color.white)
52+
.setToolbarTextColor(R.color.black)
53+
.setSelectIconColor(R.color.pink)
5454
.setShowGif(false)
5555
.start();
5656
}
5757
});
5858

5959
//Select Multiple Images - User can select multiple images and click Select to confirm.
60-
CustomButton btn2 = (CustomButton) findViewById(R.id.btn2);
60+
CustomButton btn2 = findViewById(R.id.btn2);
6161
btn2.setOnClickListener(new View.OnClickListener() {
6262
@Override
6363
public void onClick(View view) {
@@ -66,11 +66,10 @@ public void onClick(View view) {
6666
.setShowCamera(true)
6767
.setSpanCount(4)
6868
.setLightStatusBar(false)
69-
.setStatusBarColor("#0c7e46")
70-
.setToolbarColor("#0f9f58")
71-
.setToolbarIconColor("#000000")
72-
.setSelectIconColor("#00C07F")
73-
.setClickSelectable(true)
69+
.setStatusBarColor(R.color.green_primary_dark)
70+
.setToolbarColor(R.color.green_primary)
71+
.setToolbarTextColor(R.color.white)
72+
.setSelectIconColor(R.color.green_primary)
7473
.start();
7574
}
7675
});
@@ -84,34 +83,34 @@ public void onClick(View view) {
8483
.setPickPhotoSize(6)
8584
.setShowCamera(true)
8685
.setSpanCount(4)
87-
.setLightStatusBar(true)
88-
.setStatusBarColor("#ffffff")
89-
.setToolbarColor("#ffffff")
90-
.setToolbarIconColor("#000000")
91-
.setClickSelectable(false)
86+
.setLightStatusBar(false)
87+
.setStatusBarColor(R.color.blue_primary_dark)
88+
.setToolbarColor(R.color.blue_primary)
89+
.setToolbarTextColor(R.color.white)
90+
.setSelectIconColor(R.color.blue_primary)
9291
.start();
9392
}
9493
});
9594

9695
RecyclerView photoList = (RecyclerView) findViewById(R.id.photo_list);
9796
GridLayoutManager layoutManager = new GridLayoutManager(this, 4);
9897
photoList.setLayoutManager(layoutManager);
99-
photoList.addItemDecoration(new SpaceItemDecoration(PickUtils.getInstance(MainActivity.this).dp2px(PickConfig.ITEM_SPACE), 3));
98+
photoList.addItemDecoration(new SpaceItemDecoration(PickUtils.getInstance(MainActivity.this).dp2px(PickConfig.INSTANCE.getITEM_SPACE()), 3));
10099
adapter = new SampleAdapter(this, null);
101100
photoList.setAdapter(adapter);
102101
}
103102

104103
@Override
105104
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
106105
super.onActivityResult(requestCode, resultCode, data);
107-
if(resultCode == 0){
106+
if (resultCode == 0) {
108107
return;
109108
}
110-
if(data == null){
109+
if (data == null) {
111110
return;
112111
}
113-
if (requestCode == PickConfig.PICK_PHOTO_DATA) {
114-
ArrayList<String> selectPaths = (ArrayList<String>) data.getSerializableExtra(PickConfig.INTENT_IMG_LIST_SELECT);
112+
if (requestCode == PickConfig.INSTANCE.getPICK_PHOTO_DATA()) {
113+
ArrayList<String> selectPaths = (ArrayList<String>) data.getSerializableExtra(PickConfig.INSTANCE.getINTENT_IMG_LIST_SELECT());
115114
adapter.updateData(selectPaths);
116115
}
117116
}

app/src/main/java/com/werb/pickphotosample/SampleAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package com.werb.pickphotosample;import android.content.Context;import android.graphics.BitmapFactory;import android.net.Uri;import android.support.v7.widget.RecyclerView;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ImageView;import android.widget.RelativeLayout;import com.bumptech.glide.Glide;import com.werb.pickphotoview.R;import com.werb.pickphotoview.util.PickConfig;import com.werb.pickphotoview.util.PickUtils;import java.io.File;import java.util.ArrayList;/** * Created by wanbo on 2016/12/31. */public class SampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private ArrayList<String> imagePaths; private Context context; public SampleAdapter(Context c, ArrayList<String> imagePaths) { this.context = c; this.imagePaths = imagePaths; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new GridImageViewHolder(LayoutInflater.from(context).inflate(R.layout.pick_item_grid_layout, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if(imagePaths != null) { String path = imagePaths.get(position); GridImageViewHolder gridImageViewHolder = (GridImageViewHolder) holder; gridImageViewHolder.bindItem(path); } } @Override public int getItemCount() { if(imagePaths != null) { return imagePaths.size(); }else { return 0; } } public void updateData(ArrayList<String> paths) { imagePaths = paths; notifyDataSetChanged(); } // ViewHolder private class GridImageViewHolder extends RecyclerView.ViewHolder { private ImageView gridImage, selectImage; private int scaleSize; GridImageViewHolder(View itemView) { super(itemView); gridImage = (ImageView) itemView.findViewById(R.id.iv_grid); selectImage = (ImageView) itemView.findViewById(R.id.iv_select); selectImage.setVisibility(View.GONE); int screenWidth = PickUtils.getInstance(context).getWidthPixels(); int space = PickUtils.getInstance(context).dp2px(PickConfig.ITEM_SPACE); scaleSize = (screenWidth - (4 + 1) * space) / 4; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) gridImage.getLayoutParams(); params.width = scaleSize; params.height = scaleSize; } void bindItem(final String path) { gridImage.setImageBitmap(BitmapFactory.decodeFile(path)); } }}
1+
package com.werb.pickphotosample;import android.content.Context;import android.graphics.BitmapFactory;import android.support.v7.widget.RecyclerView;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ImageView;import android.widget.RelativeLayout;import com.werb.pickphotoview.util.PickConfig;import com.werb.pickphotoview.util.PickUtils;import java.util.ArrayList;/** * Created by wanbo on 2016/12/31. */public class SampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private ArrayList<String> imagePaths; private Context context; SampleAdapter(Context c, ArrayList<String> imagePaths) { this.context = c; this.imagePaths = imagePaths; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new GridImageViewHolder(LayoutInflater.from(context).inflate(R.layout.item_image, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if(imagePaths != null) { String path = imagePaths.get(position); GridImageViewHolder gridImageViewHolder = (GridImageViewHolder) holder; gridImageViewHolder.bindItem(path); } } @Override public int getItemCount() { if(imagePaths != null) { return imagePaths.size(); }else { return 0; } } public void updateData(ArrayList<String> paths) { imagePaths = paths; notifyDataSetChanged(); } // ViewHolder private class GridImageViewHolder extends RecyclerView.ViewHolder { private ImageView gridImage; private int scaleSize; GridImageViewHolder(View itemView) { super(itemView); gridImage = itemView.findViewById(R.id.image); int screenWidth = PickUtils.getInstance(context).getWidthPixels(); int space = PickUtils.getInstance(context).dp2px(PickConfig.INSTANCE.getITEM_SPACE()); scaleSize = (screenWidth - (4 + 1) * space) / 4; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) gridImage.getLayoutParams(); params.width = scaleSize; params.height = scaleSize; } void bindItem(final String path) { gridImage.setImageBitmap(BitmapFactory.decodeFile(path)); } }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="wrap_content"
6+
android:layout_height="wrap_content">
7+
8+
<ImageView
9+
android:id="@+id/image"
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:scaleType="centerCrop" />
13+
14+
</RelativeLayout>

app/src/main/res/values/colors.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
<!-- Basic Colors -->
88
<color name="white">#FFFFFF</color>
9+
<color name="black">#191919</color>
10+
<color name="pink">#FF0458</color>
911
<color name="white_pressed">#c8ffffff</color>
1012
<color name="transparent">#00FFFFFF</color>
13+
14+
<color name="green_primary">#0f9f58</color>
15+
<color name="green_primary_dark">#0c7e46</color>
16+
<color name="green_accent">#0f9f58</color>
17+
18+
<color name="blue_primary">#4184f3</color>
19+
<color name="blue_primary_dark">#346ac2</color>
20+
<color name="blue_accent">#4184f3</color>
1121
</resources>

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
2+
ext.kotlin_version = '1.1.51'
43
repositories {
54
jcenter()
65
google()
76
}
87
dependencies {
98
classpath 'com.android.tools.build:gradle:3.0.0-beta7'
9+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
10+
classpath 'com.novoda:bintray-release:0.5.0'
1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
12-
classpath 'com.novoda:bintray-release:0.5.0'
1313
}
1414
}
1515

1616
allprojects {
1717
repositories {
1818
jcenter()
1919
google()
20+
mavenCentral()
2021
}
2122
}
2223

2324
task clean(type: Delete) {
2425
delete rootProject.buildDir
2526
}
27+
28+
tasks.getByPath(":pickphotoview:releaseAndroidJavadocs").enabled = false

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Sat Sep 30 15:25:24 CST 2017
1+
#Sat Sep 16 19:47:05 CST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

pickphotoview/build.gradle

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
24

35
android {
4-
compileSdkVersion 25
5-
buildToolsVersion '26.0.2'
6+
compileSdkVersion 26
7+
buildToolsVersion "26.0.2"
68

79
defaultConfig {
8-
minSdkVersion 14
9-
targetSdkVersion 25
10+
minSdkVersion 16
11+
targetSdkVersion 26
1012
versionCode 1
1113
versionName "1.0"
1214

@@ -24,19 +26,34 @@ android {
2426
abortOnError false
2527
disable "ResourceType"
2628
}
29+
androidExtensions {
30+
experimental = true
31+
}
32+
}
33+
34+
repositories {
35+
mavenCentral()
2736
}
2837

38+
2939
dependencies {
3040
compile fileTree(include: ['*.jar'], dir: 'libs')
3141
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
3242
exclude group: 'com.android.support', module: 'support-annotations'
3343
})
34-
compile 'com.android.support:appcompat-v7:25.3.1'
35-
testCompile 'junit:junit:4.12'
36-
compile 'com.android.support:recyclerview-v7:25.3.1'
37-
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
38-
compile 'com.shizhefei:LargeImageView:1.0.9'
39-
compile 'com.google.code.gson:gson:2.8.0'
44+
implementation 'com.android.support:appcompat-v7:26.1.0'
45+
testImplementation 'junit:junit:4.12'
46+
implementation 'com.android.support:recyclerview-v7:26.1.0'
47+
implementation 'com.google.code.gson:gson:2.8.1'
48+
implementation 'com.github.bumptech.glide:glide:4.1.1'
49+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
50+
implementation 'com.android.support:design:26.1.0'
51+
implementation('com.werb.moretype:moretype:0.2.1', {
52+
exclude group: 'com.android.support'
53+
})
54+
implementation('com.werb.eventbuskotlin:eventbuskotlin:0.1.7', {
55+
exclude group: 'com.android.support'
56+
})
4057
}
4158

4259
apply plugin: 'com.novoda.bintray-release'

pickphotoview/src/main/AndroidManifest.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@
1111

1212
<activity android:name="com.werb.pickphotoview.PickPhotoActivity"
1313
android:screenOrientation="portrait"
14-
android:theme="@style/PickAppThemeBottom"/>
15-
16-
<activity android:name=".PickListActivity"
17-
android:screenOrientation="portrait"
18-
android:theme="@style/PickAppThemeRight"/>
14+
android:theme="@style/PickBaseTheme"/>
1915

2016
<activity android:name=".PickPhotoPreviewActivity"
2117
android:screenOrientation="portrait"
22-
android:theme="@style/PickAppThemeRight"/>
18+
android:theme="@style/Full.Theme"/>
2319

2420
</application>
2521

0 commit comments

Comments
 (0)