Compare commits

..

13 Commits
1.1 ... master

Author SHA1 Message Date
Nereo bed718f773 update README 2016-06-30 11:59:23 +08:00
Nereo 706e1c0662 fix MemoryLeak; #74 2016-06-12 18:13:14 +08:00
Nereo 60a75c8028 add private resources support, AS1.3+ 2016-06-12 18:09:40 +08:00
Nereo 6b59e09354 remove declare from app to lib 2016-06-12 17:44:32 +08:00
Nereo 52c52f46cb fix bugs 2016-05-19 10:33:01 +08:00
Nereo dd01018cb3 fix #21 2016-05-19 10:27:13 +08:00
Nereo e5667569a5 fix ignore file 2016-05-18 18:22:20 +08:00
Nereo 69d3c08cc2 fix #28 2016-05-18 17:55:51 +08:00
Nereo 0492dba0f0 README.md 2016-05-18 17:51:09 +08:00
Nereo 1949388159 add JitPack.io support; Update README.md 2016-05-18 17:48:56 +08:00
Nereo f680f83ecf add change log 2016-05-18 15:15:21 +08:00
Nereo 9734e9fc73 fix MultiImageSelectorFragment 2016-05-18 15:11:23 +08:00
Nereo ca83824959 fix README 2016-05-18 14:57:11 +08:00
56 changed files with 229 additions and 570 deletions

2
.gitignore vendored
View File

@ -13,6 +13,8 @@ bin/
gen/
# Gradle files
*.iml
.idea/
.gradle/
build/
/*/build/

View File

@ -1 +0,0 @@
MultiImageSelector

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/multi-image-selector" />
</set>
</option>
<option name="myModules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/multi-image-selector" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/MultiImageSelector.iml" filepath="$PROJECT_DIR$/MultiImageSelector.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" filepath="$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" />
</modules>
</component>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="MultiImageSelector" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,6 +1,8 @@
# MultiImageSelector
Image selector for Android device. Support single choice and multi-choice.
[![](https://jitpack.io/v/lovetuzitong/MultiImageSelector.svg)](https://jitpack.io/#lovetuzitong/MultiImageSelector)
[中文文档](README_zh.md)
###ART
@ -14,16 +16,32 @@ Image selector for Android device. Support single choice and multi-choice.
###Quick Start
* Step 0
Add module `multi-image-selector` as your dependence.
Add module `multi-image-selector` as your dependence. in your `build.gradle` :
```java
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.lovetuzitong:MultiImageSelector:1.2'
}
```
* Step 1
Declare permission `android.permission.READ_EXTERNAL_STORAGE` in your `AndroidManifest.xml` .
Declare permission `android.permission.WRITE_EXTERNAL_STORAGE` in your `AndroidManifest.xml` .
Declare `MultiImageSelectorActivity` in your `AndroidManifest.xml` .
Set your `AndroidManifest.xml` as below:
```xml
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
...
<!--Image Selector Entry-->
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
</application>
```
* Step 2
@ -32,7 +50,7 @@ Call image selector simplest in your code, eg. ( From `version-1.1` )
``` java
// Multi image selector form an Activity
MultiImageSelector.create(Context)
.start(Activity, REQUEST_CODE);
.start(Activity, REQUEST_IMAGE);
```
Detail Api.
@ -43,7 +61,7 @@ MultiImageSelector.create(Context)
.single() // single mode
.multi() // multi mode, default mode;
.origin(ArrayList<String>) // original select data set, used width #.multi()
.start(Activity/Fragment, REQUEST_CODE);
.start(Activity/Fragment, REQUEST_IMAGE);
```
Also support traditional `Intent` :
@ -124,6 +142,11 @@ class CustomerActivity extends Activity implements MultiImageSelectorFragment.Ca
###Change Log
* 2016-5-18
1. Added. `JitPack` support
2. Added. Convenient way to call image selector. See `Step 2`
3. Fixed. Some NPE.
* 2016-1-19
1. Fixed. cannot load some 0-size image
2. Added. When take a new photo, notify media scanner

View File

@ -1,6 +1,8 @@
# MultiImageSelector
仿微信实现多图选择。支持单选和多选两种模式
[![](https://jitpack.io/v/lovetuzitong/MultiImageSelector.svg)](https://jitpack.io/#lovetuzitong/MultiImageSelector)
[English Doc](README.md)
###截图
@ -14,16 +16,32 @@
###快速开始
* 第0步
把模块 `multi-image-selector` 作为你的项目依赖添加到工程中.
把模块 `multi-image-selector` 作为你的项目依赖添加到工程中. 在项目`build.gradle` 中:
```java
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.lovetuzitong:MultiImageSelector:1.2'
}
```
* 第1步
在你的 `AndroidManifest.xml` 文件中添加权限 `android.permission.READ_EXTERNAL_STORAGE`.
在你的 `AndroidManifest.xml` 文件中添加权限 `android.permission.WRITE_EXTERNAL_STORAGE`.
别忘了同时在 `AndroidManifest.xml` 中声明 `MultiImageSelectorActivity` 这个Activity.
在你的 `AndroidManifest.xml` 中做如下声明:
```xml
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
...
<!--Image Selector Entry-->
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
</application>
```
* 第2步
@ -32,7 +50,7 @@
``` java
// Multi image selector form an Activity
MultiImageSelector.create(Context)
.start(Activity, REQUEST_CODE);
.start(Activity, REQUEST_IMAGE);
```
详细可使用的Api.
@ -43,7 +61,7 @@ MultiImageSelector.create(Context)
.single() // 单选模式
.multi() // 多选模式, 默认模式;
.origin(ArrayList<String>) // 默认已选择图片. 只有在选择模式为多选时有效
.start(Activity/Fragment, REQUEST_CODE);
.start(Activity/Fragment, REQUEST_IMAGE);
```
同样支持老版本的 `Intent` 调用方法:
@ -124,6 +142,11 @@ class CustomerActivity extends Activity implements MultiImageSelectorFragment.Ca
###更新日志
* 2016-5-18
1. 新增. `JitPack` 支持
2. 新增. 简单的调用方式. 详细参见 `第2步`
3. Fixed. 修复某些情况下碰到的空指针异常.
* 2016-1-19
1. 修复. 无法加载大小为0的图片
2. 新增. 拍照后通知媒体扫描,加入图库

1
app/.gitignore vendored
View File

@ -1 +1,2 @@
/build
*.iml

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="MultiImageSelector" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.4.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-23.4.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.4.0" level="project" />
<orderEntry type="library" exported="" name="picasso-2.4.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.4.0" level="project" />
<orderEntry type="module" module-name="multi-image-selector" exported="" />
</component>
</module>

View File

@ -2,9 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.nereo.multiimageselector" >
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@ -20,10 +17,6 @@
</intent-filter>
</activity>
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
</application>
</manifest>

View File

@ -74,7 +74,7 @@ public class MainActivity extends AppCompatActivity {
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
requestPermission(Manifest.permission.READ_EXTERNAL_STORAGE,
getString(R.string.permission_rationale),
getString(R.string.mis_permission_rationale),
REQUEST_STORAGE_READ_ACCESS_PERMISSION);
}else {
boolean showCamera = mShowCamera.getCheckedRadioButtonId() == R.id.show;
@ -103,15 +103,15 @@ public class MainActivity extends AppCompatActivity {
private void requestPermission(final String permission, String rationale, final int requestCode){
if(ActivityCompat.shouldShowRequestPermissionRationale(this, permission)){
new AlertDialog.Builder(this)
.setTitle(R.string.permission_dialog_title)
.setTitle(R.string.mis_permission_dialog_title)
.setMessage(rationale)
.setPositiveButton(R.string.permission_dialog_ok, new DialogInterface.OnClickListener() {
.setPositiveButton(R.string.mis_permission_dialog_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{permission}, requestCode);
}
})
.setNegativeButton(R.string.permission_dialog_cancel, null)
.setNegativeButton(R.string.mis_permission_dialog_cancel, null)
.create().show();
}else{
ActivityCompat.requestPermissions(this, new String[]{permission}, requestCode);

View File

@ -1 +1,2 @@
/build
*.iml

View File

@ -16,6 +16,8 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
resourcePrefix "mis_"
}
dependencies {

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":multi-image-selector" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="MultiImageSelector" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":multi-image-selector" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-23.4.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.4.0" level="project" />
<orderEntry type="library" exported="" name="picasso-2.4.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.4.0" level="project" />
</component>
</module>

View File

@ -1,8 +1,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.nereo.multi_image_selector">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:allowBackup="true">
<activity
android:configChanges="orientation|screenSize"
android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" />
</application>
</manifest>

View File

@ -25,12 +25,15 @@ public class MultiImageSelector {
private int mMode = MultiImageSelectorActivity.MODE_MULTI;
private ArrayList<String> mOriginData;
private static MultiImageSelector sSelector;
private Context mContext;
@Deprecated
private MultiImageSelector(Context context){
mContext = context;
}
private MultiImageSelector(){}
@Deprecated
public static MultiImageSelector create(Context context){
if(sSelector == null){
sSelector = new MultiImageSelector(context);
@ -38,6 +41,13 @@ public class MultiImageSelector {
return sSelector;
}
public static MultiImageSelector create(){
if(sSelector == null){
sSelector = new MultiImageSelector();
}
return sSelector;
}
public MultiImageSelector showCamera(boolean show){
mShowCamera = show;
return sSelector;
@ -64,32 +74,34 @@ public class MultiImageSelector {
}
public void start(Activity activity, int requestCode){
if(hasPermission()) {
activity.startActivityForResult(createIntent(), requestCode);
final Context context = activity;
if(hasPermission(context)) {
activity.startActivityForResult(createIntent(context), requestCode);
}else{
Toast.makeText(mContext, R.string.error_no_permission, Toast.LENGTH_SHORT).show();
Toast.makeText(context, R.string.mis_error_no_permission, Toast.LENGTH_SHORT).show();
}
}
public void start(Fragment fragment, int requestCode){
if(hasPermission()) {
fragment.startActivityForResult(createIntent(), requestCode);
final Context context = fragment.getContext();
if(hasPermission(context)) {
fragment.startActivityForResult(createIntent(context), requestCode);
}else{
Toast.makeText(mContext, R.string.error_no_permission, Toast.LENGTH_SHORT).show();
Toast.makeText(context, R.string.mis_error_no_permission, Toast.LENGTH_SHORT).show();
}
}
private boolean hasPermission(){
private boolean hasPermission(Context context){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
// Permission was added in API Level 16
return ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE)
return ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED;
}
return true;
}
private Intent createIntent(){
Intent intent = new Intent(mContext, MultiImageSelectorActivity.class);
private Intent createIntent(Context context){
Intent intent = new Intent(context, MultiImageSelectorActivity.class);
intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, mShowCamera);
intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_COUNT, mMaxCount);
if(mOriginData != null){

View File

@ -50,8 +50,8 @@ public class MultiImageSelectorActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.NO_ACTIONBAR);
setContentView(R.layout.activity_default);
setTheme(R.style.MIS_NO_ACTIONBAR);
setContentView(R.layout.mis_activity_default);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.BLACK);
@ -129,14 +129,14 @@ public class MultiImageSelectorActivity extends AppCompatActivity
private void updateDoneText(ArrayList<String> resultList){
int size = 0;
if(resultList == null || resultList.size()<=0){
mSubmitButton.setText(R.string.action_done);
mSubmitButton.setText(R.string.mis_action_done);
mSubmitButton.setEnabled(false);
}else{
size = resultList.size();
mSubmitButton.setEnabled(true);
}
mSubmitButton.setText(getString(R.string.action_button_string,
getString(R.string.action_done), size, mDefaultCount));
mSubmitButton.setText(getString(R.string.mis_action_button_string,
getString(R.string.mis_action_done), size, mDefaultCount));
}
@Override

View File

@ -73,8 +73,6 @@ public class MultiImageSelectorFragment extends Fragment {
public static final String EXTRA_SELECT_MODE = "select_count_mode";
/** Whether show cameratrue by default */
public static final String EXTRA_SHOW_CAMERA = "show_camera";
/** Result data setArrayList&lt;String&gt;*/
public static final String EXTRA_RESULT = "select_result";
/** Original data set */
public static final String EXTRA_DEFAULT_SELECTED_LIST = "default_list";
@ -98,10 +96,7 @@ public class MultiImageSelectorFragment extends Fragment {
private TextView mCategoryText;
private View mPopupAnchorView;
private int mDesireImageCount;
private boolean hasFolderGened = false;
private boolean mIsShowCamera = false;
private File mTmpFile;
@ -117,32 +112,27 @@ public class MultiImageSelectorFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_multi_image, container, false);
return inflater.inflate(R.layout.mis_fragment_multi_image, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mDesireImageCount = getArguments().getInt(EXTRA_SELECT_COUNT);
final int mode = getArguments().getInt(EXTRA_SELECT_MODE);
final int mode = selectMode();
if(mode == MODE_MULTI) {
ArrayList<String> tmp = getArguments().getStringArrayList(EXTRA_DEFAULT_SELECTED_LIST);
if(tmp != null && tmp.size()>0) {
resultList = tmp;
}
}
mIsShowCamera = getArguments().getBoolean(EXTRA_SHOW_CAMERA, true);
mImageAdapter = new ImageGridAdapter(getActivity(), mIsShowCamera, 3);
mImageAdapter = new ImageGridAdapter(getActivity(), showCamera(), 3);
mImageAdapter.showSelectIndicator(mode == MODE_MULTI);
mPopupAnchorView = view.findViewById(R.id.footer);
mCategoryText = (TextView) view.findViewById(R.id.category_btn);
mCategoryText.setText(R.string.folder_all);
mCategoryText.setText(R.string.mis_folder_all);
mCategoryText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -230,8 +220,8 @@ public class MultiImageSelectorFragment extends Fragment {
if (index == 0) {
getActivity().getSupportLoaderManager().restartLoader(LOADER_ALL, null, mLoaderCallback);
mCategoryText.setText(R.string.folder_all);
if (mIsShowCamera) {
mCategoryText.setText(R.string.mis_folder_all);
if (showCamera()) {
mImageAdapter.setShowCamera(true);
} else {
mImageAdapter.setShowCamera(false);
@ -288,6 +278,7 @@ public class MultiImageSelectorFragment extends Fragment {
}
}
}else{
// delete tmp file
while (mTmpFile != null && mTmpFile.exists()){
boolean success = mTmpFile.delete();
if(success){
@ -315,7 +306,7 @@ public class MultiImageSelectorFragment extends Fragment {
if(ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED){
requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
getString(R.string.permission_rationale_write_storage),
getString(R.string.mis_permission_rationale_write_storage),
REQUEST_STORAGE_WRITE_ACCESS_PERMISSION);
}else {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
@ -329,10 +320,10 @@ public class MultiImageSelectorFragment extends Fragment {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mTmpFile));
startActivityForResult(intent, REQUEST_CAMERA);
} else {
Toast.makeText(getActivity(), R.string.error_image_not_exist, Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), R.string.mis_error_image_not_exist, Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), R.string.msg_no_camera, Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), R.string.mis_msg_no_camera, Toast.LENGTH_SHORT).show();
}
}
}
@ -340,15 +331,15 @@ public class MultiImageSelectorFragment extends Fragment {
private void requestPermission(final String permission, String rationale, final int requestCode){
if(shouldShowRequestPermissionRationale(permission)){
new AlertDialog.Builder(getContext())
.setTitle(R.string.permission_dialog_title)
.setTitle(R.string.mis_permission_dialog_title)
.setMessage(rationale)
.setPositiveButton(R.string.permission_dialog_ok, new DialogInterface.OnClickListener() {
.setPositiveButton(R.string.mis_permission_dialog_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
requestPermissions(new String[]{permission}, requestCode);
}
})
.setNegativeButton(R.string.permission_dialog_cancel, null)
.setNegativeButton(R.string.mis_permission_dialog_cancel, null)
.create().show();
}else{
requestPermissions(new String[]{permission}, requestCode);
@ -379,8 +370,8 @@ public class MultiImageSelectorFragment extends Fragment {
mCallback.onImageUnselected(image.path);
}
} else {
if(mDesireImageCount == resultList.size()){
Toast.makeText(getActivity(), R.string.msg_amount_limit, Toast.LENGTH_SHORT).show();
if(selectImageCount() == resultList.size()){
Toast.makeText(getActivity(), R.string.mis_msg_amount_limit, Toast.LENGTH_SHORT).show();
return;
}
resultList.add(image.path);
@ -441,12 +432,13 @@ public class MultiImageSelectorFragment extends Fragment {
String path = data.getString(data.getColumnIndexOrThrow(IMAGE_PROJECTION[0]));
String name = data.getString(data.getColumnIndexOrThrow(IMAGE_PROJECTION[1]));
long dateTime = data.getLong(data.getColumnIndexOrThrow(IMAGE_PROJECTION[2]));
if(!fileExist(path)){continue;}
Image image = null;
if (fileExist(path) && !TextUtils.isEmpty(name)) {
if (!TextUtils.isEmpty(name)) {
image = new Image(path, name, dateTime);
images.add(image);
}
if( !hasFolderGened && fileExist(path)) {
if( !hasFolderGened ) {
// get all folder data
File folderFile = new File(path).getParentFile();
if(folderFile != null && folderFile.exists()){
@ -498,6 +490,18 @@ public class MultiImageSelectorFragment extends Fragment {
return null;
}
private boolean showCamera(){
return getArguments() == null || getArguments().getBoolean(EXTRA_SHOW_CAMERA, true);
}
private int selectMode(){
return getArguments() == null ? MODE_MULTI : getArguments().getInt(EXTRA_SELECT_MODE);
}
private int selectImageCount(){
return getArguments() == null ? 9 : getArguments().getInt(EXTRA_SELECT_COUNT);
}
/**
* Callback for host activity
*/

View File

@ -36,7 +36,7 @@ public class FolderAdapter extends BaseAdapter {
public FolderAdapter(Context context){
mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mImageSize = mContext.getResources().getDimensionPixelOffset(R.dimen.folder_cover_size);
mImageSize = mContext.getResources().getDimensionPixelOffset(R.dimen.mis_folder_cover_size);
}
/**
@ -72,28 +72,28 @@ public class FolderAdapter extends BaseAdapter {
public View getView(int i, View view, ViewGroup viewGroup) {
ViewHolder holder;
if(view == null){
view = mInflater.inflate(R.layout.list_item_folder, viewGroup, false);
view = mInflater.inflate(R.layout.mis_list_item_folder, viewGroup, false);
holder = new ViewHolder(view);
}else{
holder = (ViewHolder) view.getTag();
}
if (holder != null) {
if(i == 0){
holder.name.setText(R.string.folder_all);
holder.name.setText(R.string.mis_folder_all);
holder.path.setText("/sdcard");
holder.size.setText(String.format("%d%s",
getTotalImageSize(), mContext.getResources().getString(R.string.photo_unit)));
getTotalImageSize(), mContext.getResources().getString(R.string.mis_photo_unit)));
if(mFolders.size()>0){
Folder f = mFolders.get(0);
if (f != null) {
Picasso.with(mContext)
.load(new File(f.cover.path))
.error(R.drawable.default_error)
.resizeDimen(R.dimen.folder_cover_size, R.dimen.folder_cover_size)
.error(R.drawable.mis_default_error)
.resizeDimen(R.dimen.mis_folder_cover_size, R.dimen.mis_folder_cover_size)
.centerCrop()
.into(holder.cover);
}else{
holder.cover.setImageResource(R.drawable.default_error);
holder.cover.setImageResource(R.drawable.mis_default_error);
}
}
}else {
@ -151,20 +151,20 @@ public class FolderAdapter extends BaseAdapter {
name.setText(data.name);
path.setText(data.path);
if (data.images != null) {
size.setText(String.format("%d%s", data.images.size(), mContext.getResources().getString(R.string.photo_unit)));
size.setText(String.format("%d%s", data.images.size(), mContext.getResources().getString(R.string.mis_photo_unit)));
}else{
size.setText("*"+mContext.getResources().getString(R.string.photo_unit));
size.setText("*"+mContext.getResources().getString(R.string.mis_photo_unit));
}
if (data.cover != null) {
// 显示图片
Picasso.with(mContext)
.load(new File(data.cover.path))
.placeholder(R.drawable.default_error)
.resizeDimen(R.dimen.folder_cover_size, R.dimen.folder_cover_size)
.placeholder(R.drawable.mis_default_error)
.resizeDimen(R.dimen.mis_folder_cover_size, R.dimen.mis_folder_cover_size)
.centerCrop()
.into(cover);
}else{
cover.setImageResource(R.drawable.default_error);
cover.setImageResource(R.drawable.mis_default_error);
}
}
}

View File

@ -170,14 +170,14 @@ public class ImageGridAdapter extends BaseAdapter {
if(isShowCamera()){
if(i == 0){
view = mInflater.inflate(R.layout.list_item_camera, viewGroup, false);
view = mInflater.inflate(R.layout.mis_list_item_camera, viewGroup, false);
return view;
}
}
ViewHolder holder;
if(view == null){
view = mInflater.inflate(R.layout.list_item_image, viewGroup, false);
view = mInflater.inflate(R.layout.mis_list_item_image, viewGroup, false);
holder = new ViewHolder(view);
}else{
holder = (ViewHolder) view.getTag();
@ -209,11 +209,11 @@ public class ImageGridAdapter extends BaseAdapter {
indicator.setVisibility(View.VISIBLE);
if(mSelectedImages.contains(data)){
// 设置选中状态
indicator.setImageResource(R.drawable.btn_selected);
indicator.setImageResource(R.drawable.mis_btn_selected);
mask.setVisibility(View.VISIBLE);
}else{
// 未选择
indicator.setImageResource(R.drawable.btn_unselected);
indicator.setImageResource(R.drawable.mis_btn_unselected);
mask.setVisibility(View.GONE);
}
}else{
@ -224,13 +224,13 @@ public class ImageGridAdapter extends BaseAdapter {
// 显示图片
Picasso.with(mContext)
.load(imageFile)
.placeholder(R.drawable.default_error)
.placeholder(R.drawable.mis_default_error)
.tag(MultiImageSelectorFragment.TAG)
.resize(mGridWidth, mGridWidth)
.centerCrop()
.into(image);
}else{
image.setImageResource(R.drawable.default_error);
image.setImageResource(R.drawable.mis_default_error);
}
}
}

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -9,12 +9,12 @@
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="@dimen/space_size"
android:verticalSpacing="@dimen/space_size"
android:horizontalSpacing="@dimen/mis_space_size"
android:verticalSpacing="@dimen/mis_space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false"
android:numColumns="auto_fit"
android:columnWidth="@dimen/image_size"/>
android:columnWidth="@dimen/mis_image_size"/>
<RelativeLayout
android:clickable="true"
@ -29,11 +29,11 @@
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_centerVertical="true"
android:textColor="@color/folder_text_color"
android:textColor="@color/mis_folder_text_color"
tools:text="所有图片"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/text_indicator"
android:drawableRight="@drawable/mis_text_indicator"
android:drawablePadding="5dp"
android:background="@null"
android:singleLine="true"

View File

@ -10,13 +10,13 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/actionbar_color"
android:background="@color/mis_actionbar_color"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?android:attr/actionBarSize">
<Button
android:id="@+id/commit"
android:background="@drawable/action_btn"
android:background="@drawable/mis_action_btn"
android:minHeight="1dp"
android:minWidth="1dp"
android:layout_marginRight="16dp"
@ -24,7 +24,7 @@
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/default_text_color"
android:textColor="@color/mis_default_text_color"
android:textSize="14sp"
android:layout_gravity="right"
android:layout_width="wrap_content"

View File

@ -6,7 +6,7 @@
<ImageView
android:id="@+id/btn_back"
android:src="@drawable/btn_back"
android:src="@drawable/mis_btn_back"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_centerVertical="true"
@ -24,7 +24,7 @@
<Button
android:id="@+id/commit"
android:background="@drawable/action_btn"
android:background="@drawable/mis_action_btn"
android:minHeight="1dp"
android:minWidth="1dp"
android:text="完成"
@ -33,7 +33,7 @@
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/default_text_color"
android:textColor="@color/mis_default_text_color"
android:textSize="14sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"

View File

@ -9,8 +9,8 @@
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="@dimen/space_size"
android:verticalSpacing="@dimen/space_size"
android:horizontalSpacing="@dimen/mis_space_size"
android:verticalSpacing="@dimen/mis_space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false"
android:numColumns="3"/>
@ -28,11 +28,11 @@
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_centerVertical="true"
android:textColor="@color/folder_text_color"
android:textColor="@color/mis_folder_text_color"
tools:text="所有图片"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/text_indicator"
android:drawableRight="@drawable/mis_text_indicator"
android:drawablePadding="5dp"
android:background="@null"
android:singleLine="true"

View File

@ -4,10 +4,10 @@
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:drawableTop="@drawable/asy"
android:drawableTop="@drawable/mis_asy"
android:drawablePadding="10dp"
android:layout_gravity="center"
android:text="@string/tip_take_photo"
android:text="@string/mis_tip_take_photo"
android:textSize="14sp"
android:textColor="#CDCECE"
android:gravity="center_horizontal"

View File

@ -12,12 +12,12 @@
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:id="@+id/cover"
tools:src="@drawable/btn_back"
tools:src="@drawable/mis_btn_back"
android:layout_gravity="center_vertical"
android:scaleType="centerInside"
android:src="@drawable/default_error"
android:layout_width="@dimen/folder_cover_size"
android:layout_height="@dimen/folder_cover_size" />
android:src="@drawable/mis_default_error"
android:layout_width="@dimen/mis_folder_cover_size"
android:layout_height="@dimen/mis_folder_cover_size" />
<LinearLayout
android:layout_toRightOf="@+id/cover"
@ -66,7 +66,7 @@
android:id="@+id/indicator"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:src="@drawable/default_check"
android:src="@drawable/mis_default_check"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -5,7 +5,7 @@
<me.nereo.multi_image_selector.view.SquaredImageView
android:id="@+id/image"
android:scaleType="centerInside"
android:src="@drawable/default_error"
android:src="@drawable/mis_default_error"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@ -23,6 +23,6 @@
android:layout_marginRight="5.5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_unselected"/>
android:src="@drawable/mis_btn_unselected"/>
</me.nereo.multi_image_selector.view.SquareFrameLayout>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="image_size">96dp</dimen>
<dimen name="space_size">2dp</dimen>
<dimen name="folder_cover_size">72dp</dimen>
<dimen name="mis_image_size">96dp</dimen>
<dimen name="mis_space_size">2dp</dimen>
<dimen name="mis_folder_cover_size">72dp</dimen>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="image_size">100dp</dimen>
<dimen name="space_size">2dp</dimen>
<dimen name="folder_cover_size">72dp</dimen>
<dimen name="mis_image_size">100dp</dimen>
<dimen name="mis_space_size">2dp</dimen>
<dimen name="mis_folder_cover_size">72dp</dimen>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="image_size">120dp</dimen>
<dimen name="space_size">3dp</dimen>
<dimen name="folder_cover_size">82dp</dimen>
<dimen name="mis_image_size">120dp</dimen>
<dimen name="mis_space_size">3dp</dimen>
<dimen name="mis_folder_cover_size">82dp</dimen>
</resources>

View File

@ -1,17 +1,16 @@
<resources>
<string name="app_name">多图选择器</string>
<string name="folder_all">所有照片</string>
<string name="preview">预览</string>
<string name="msg_no_camera">没有系统相机</string>
<string name="msg_amount_limit">已经达到最高选择数量</string>
<string name="action_done">完成</string>
<string name="photo_unit"></string>
<string name="tip_take_photo">拍摄照片</string>
<string name="error_image_not_exist">图片错误</string>
<string name="error_no_permission">无权限</string>
<string name="permission_dialog_title">权限拒绝</string>
<string name="permission_dialog_ok"></string>
<string name="permission_dialog_cancel">拒绝</string>
<string name="permission_rationale">浏览图片需要您提供浏览存储的权限</string>
<string name="permission_rationale_write_storage">保存拍照图片需要您提供写存储权限</string>
<string name="mis_folder_all">所有照片</string>
<string name="mis_preview">预览</string>
<string name="mis_msg_no_camera">没有系统相机</string>
<string name="mis_msg_amount_limit">已经达到最高选择数量</string>
<string name="mis_action_done">完成</string>
<string name="mis_photo_unit"></string>
<string name="mis_tip_take_photo">拍摄照片</string>
<string name="mis_error_image_not_exist">图片错误</string>
<string name="mis_error_no_permission">无权限</string>
<string name="mis_permission_dialog_title">权限拒绝</string>
<string name="mis_permission_dialog_ok"></string>
<string name="mis_permission_dialog_cancel">拒绝</string>
<string name="mis_permission_rationale">浏览图片需要您提供浏览存储的权限</string>
<string name="mis_permission_rationale_write_storage">保存拍照图片需要您提供写存储权限</string>
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="actionbar_color">#21282C</color>
<color name="mis_actionbar_color">#21282C</color>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="image_size">120dp</dimen>
<dimen name="space_size">2dp</dimen>
<dimen name="folder_cover_size">72dp</dimen>
<dimen name="mis_image_size">120dp</dimen>
<dimen name="mis_space_size">2dp</dimen>
<dimen name="mis_folder_cover_size">72dp</dimen>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<public name="mis_asv" type="drawable" />
</resources>

View File

@ -1,18 +1,17 @@
<resources>
<string name="app_name">multi-image-selector</string>
<string name="folder_all">All Images</string>
<string name="preview">Preview</string>
<string name="msg_no_camera">No system camera found</string>
<string name="msg_amount_limit">Select images amount is limit</string>
<string name="action_done">Done</string>
<string name="action_button_string">%1$s(%2$d/%3$d)</string>
<string name="photo_unit">Shot</string>
<string name="tip_take_photo">Take photo</string>
<string name="error_image_not_exist">Image error</string>
<string name="error_no_permission">Has no permission</string>
<string name="permission_dialog_title">Permission Deny</string>
<string name="permission_dialog_ok">OK</string>
<string name="permission_dialog_cancel">CANCEL</string>
<string name="permission_rationale">Storage read permission is needed to pick files.</string>
<string name="permission_rationale_write_storage">Storage write permission is needed to save the image.</string>
<string name="mis_folder_all">All Images</string>
<string name="mis_preview">Preview</string>
<string name="mis_msg_no_camera">No system camera found</string>
<string name="mis_msg_amount_limit">Select images amount is limit</string>
<string name="mis_action_done">Done</string>
<string name="mis_action_button_string">%1$s(%2$d/%3$d)</string>
<string name="mis_photo_unit">Shot</string>
<string name="mis_tip_take_photo">Take photo</string>
<string name="mis_error_image_not_exist">Image error</string>
<string name="mis_error_no_permission">Has no permission</string>
<string name="mis_permission_dialog_title">Permission Deny</string>
<string name="mis_permission_dialog_ok">OK</string>
<string name="mis_permission_dialog_cancel">CANCEL</string>
<string name="mis_permission_rationale">Storage read permission is needed to pick files.</string>
<string name="mis_permission_rationale_write_storage">Storage write permission is needed to save the image.</string>
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="NO_ACTIONBAR" parent="Theme.AppCompat.Light.NoActionBar"></style>
<style name="MIS_NO_ACTIONBAR" parent="Theme.AppCompat.Light.NoActionBar"></style>
</resources>