Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复拼写错误,冗余的修饰符,升级gradle版本到2.0正式版 #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,17 @@ public void onOtherButtonClick(ActionSheet actionSheet, int index) {
x.Ext.init(getApplication());
}

private GalleryFinal.OnHanlderResultCallback mOnHanlderResultCallback = new GalleryFinal.OnHanlderResultCallback() {
private GalleryFinal.OnHandlerResultCallback mOnHanlderResultCallback = new GalleryFinal.OnHandlerResultCallback() {
@Override
public void onHanlderSuccess(int reqeustCode, List<PhotoInfo> resultList) {
public void onHandlerSuccess(int requestCode, List<PhotoInfo> resultList) {
if (resultList != null) {
mPhotoList.addAll(resultList);
mChoosePhotoListAdapter.notifyDataSetChanged();
}
}

@Override
public void onHanlderFailure(int requestCode, String errorMsg) {
public void onHandlerFailure(int requestCode, String errorMsg) {
Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_SHORT).show();
}
};
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class GalleryFinal {
private static ThemeConfig mThemeConfig;
private static CoreConfig mCoreConfig;

private static OnHanlderResultCallback mCallback;
private static OnHandlerResultCallback mCallback;
private static int mRequestCode;

public static void init(CoreConfig coreConfig) {
Expand All @@ -55,7 +55,7 @@ public static void init(CoreConfig coreConfig) {
mGlobalFunctionConfig = coreConfig.getFunctionConfig();
}

public static FunctionConfig copyGlobalFuncationConfig() {
public static FunctionConfig copyGlobalFunctionConfig() {
if ( mGlobalFunctionConfig != null ) {
return mGlobalFunctionConfig.clone();
}
Expand Down Expand Up @@ -83,13 +83,13 @@ public static ThemeConfig getGalleryTheme() {
* @param requestCode
* @param callback
*/
public static void openGallerySingle(int requestCode, OnHanlderResultCallback callback) {
FunctionConfig config = copyGlobalFuncationConfig();
public static void openGallerySingle(int requestCode, OnHandlerResultCallback callback) {
FunctionConfig config = copyGlobalFunctionConfig();
if (config != null) {
openGallerySingle(requestCode, config, callback);
} else {
if(callback != null) {
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
ILogger.e("FunctionConfig null");
}
Expand All @@ -101,18 +101,18 @@ public static void openGallerySingle(int requestCode, OnHanlderResultCallback ca
* @param config
* @param callback
*/
public static void openGallerySingle(int requestCode, FunctionConfig config, OnHanlderResultCallback callback) {
public static void openGallerySingle(int requestCode, FunctionConfig config, OnHandlerResultCallback callback) {
if ( mCoreConfig.getImageLoader() == null ) {
ILogger.e("Please init GalleryFinal.");
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config == null && mGlobalFunctionConfig == null) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}
Expand All @@ -137,14 +137,14 @@ public static void openGallerySingle(int requestCode, FunctionConfig config, OnH
* @param maxSize
* @param callback
*/
public static void openGalleryMuti(int requestCode, int maxSize, OnHanlderResultCallback callback) {
FunctionConfig config = copyGlobalFuncationConfig();
public static void openGalleryMuti(int requestCode, int maxSize, OnHandlerResultCallback callback) {
FunctionConfig config = copyGlobalFunctionConfig();
if (config != null) {
config.maxSize = maxSize;
openGalleryMuti(requestCode, config, callback);
} else {
if(callback != null) {
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
ILogger.e("Please init GalleryFinal.");
}
Expand All @@ -156,32 +156,32 @@ public static void openGalleryMuti(int requestCode, int maxSize, OnHanlderResult
* @param config
* @param callback
*/
public static void openGalleryMuti(int requestCode, FunctionConfig config, OnHanlderResultCallback callback) {
if ( mCoreConfig.getImageLoader() == null ) {
public static void openGalleryMuti(int requestCode, FunctionConfig config, OnHandlerResultCallback callback) {
if (mCoreConfig.getImageLoader() == null ) {
ILogger.e("Please init GalleryFinal.");
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config == null && mGlobalFunctionConfig == null) {
if (config == null && mGlobalFunctionConfig == null) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config.getMaxSize() <= 0) {
if (config.getMaxSize() <= 0) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.maxsize_zero_tip));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.maxsize_zero_tip));
}
return;
}

if (config.getSelectedList() != null && config.getSelectedList().size() > config.getMaxSize()) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.select_max_tips));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.select_max_tips));
}
return;
}
Expand All @@ -208,13 +208,13 @@ public static void openGalleryMuti(int requestCode, FunctionConfig config, OnHan
* @param requestCode
* @param callback
*/
public static void openCamera(int requestCode, OnHanlderResultCallback callback) {
FunctionConfig config = copyGlobalFuncationConfig();
public static void openCamera(int requestCode, OnHandlerResultCallback callback) {
FunctionConfig config = copyGlobalFunctionConfig();
if (config != null) {
openCamera(requestCode, config, callback);
} else {
if(callback != null) {
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
ILogger.e("Please init GalleryFinal.");
}
Expand All @@ -225,18 +225,18 @@ public static void openCamera(int requestCode, OnHanlderResultCallback callback)
* @param config
* @param callback
*/
public static void openCamera(int requestCode, FunctionConfig config, OnHanlderResultCallback callback) {
public static void openCamera(int requestCode, FunctionConfig config, OnHandlerResultCallback callback) {
if ( mCoreConfig.getImageLoader() == null ) {
ILogger.e("Please init GalleryFinal.");
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config == null && mGlobalFunctionConfig == null) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}
Expand Down Expand Up @@ -264,13 +264,13 @@ public static void openCamera(int requestCode, FunctionConfig config, OnHanlderR
* @param photoPath
* @param callback
*/
public static void openCrop(int requestCode, String photoPath, OnHanlderResultCallback callback) {
FunctionConfig config = copyGlobalFuncationConfig();
public static void openCrop(int requestCode, String photoPath, OnHandlerResultCallback callback) {
FunctionConfig config = copyGlobalFunctionConfig();
if (config != null) {
openCrop(requestCode, config, photoPath, callback);
} else {
if(callback != null) {
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
ILogger.e("Please init GalleryFinal.");
}
Expand All @@ -283,18 +283,18 @@ public static void openCrop(int requestCode, String photoPath, OnHanlderResultCa
* @param photoPath
* @param callback
*/
public static void openCrop(int requestCode, FunctionConfig config, String photoPath, OnHanlderResultCallback callback) {
public static void openCrop(int requestCode, FunctionConfig config, String photoPath, OnHandlerResultCallback callback) {
if ( mCoreConfig.getImageLoader() == null ) {
ILogger.e("Please init GalleryFinal.");
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config == null && mGlobalFunctionConfig == null) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}
Expand Down Expand Up @@ -335,13 +335,13 @@ public static void openCrop(int requestCode, FunctionConfig config, String photo
* @param photoPath
* @param callback
*/
public static void openEdit(int requestCode, String photoPath, OnHanlderResultCallback callback) {
FunctionConfig config = copyGlobalFuncationConfig();
public static void openEdit(int requestCode, String photoPath, OnHandlerResultCallback callback) {
FunctionConfig config = copyGlobalFunctionConfig();
if (config != null) {
openEdit(requestCode, config, photoPath, callback);
} else {
if(callback != null) {
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
ILogger.e("Please init GalleryFinal.");
}
Expand All @@ -354,18 +354,18 @@ public static void openEdit(int requestCode, String photoPath, OnHanlderResultCa
* @param photoPath
* @param callback
*/
public static void openEdit(int requestCode, FunctionConfig config, String photoPath, OnHanlderResultCallback callback) {
public static void openEdit(int requestCode, FunctionConfig config, String photoPath, OnHandlerResultCallback callback) {
if ( mCoreConfig.getImageLoader() == null ) {
ILogger.e("Please init GalleryFinal.");
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}

if ( config == null && mGlobalFunctionConfig == null) {
if(callback != null){
callback.onHanlderFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
callback.onHandlerFailure(requestCode, mCoreConfig.getContext().getString(R.string.open_gallery_fail));
}
return;
}
Expand Down Expand Up @@ -421,26 +421,26 @@ public static int getRequestCode() {
return mRequestCode;
}

public static OnHanlderResultCallback getCallback() {
public static OnHandlerResultCallback getCallback() {
return mCallback;
}

/**
* 处理结果
*/
public static interface OnHanlderResultCallback {
public interface OnHandlerResultCallback {
/**
* 处理成功
* @param reqeustCode
* @param requestCode
* @param resultList
*/
public void onHanlderSuccess(int reqeustCode, List<PhotoInfo> resultList);
void onHandlerSuccess(int requestCode, List<PhotoInfo> resultList);

/**
* 处理失败或异常
* @param requestCode
* @param errorMsg
*/
public void onHanlderFailure(int requestCode, String errorMsg);
void onHandlerFailure(int requestCode, String errorMsg);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ private void updateGallery(String filePath) {
}

protected void resultData(ArrayList<PhotoInfo> photoList) {
GalleryFinal.OnHanlderResultCallback callback = GalleryFinal.getCallback();
GalleryFinal.OnHandlerResultCallback callback = GalleryFinal.getCallback();
int requestCode = GalleryFinal.getRequestCode();
if (callback != null) {
if ( photoList != null && photoList.size() > 0 ) {
callback.onHanlderSuccess(requestCode, photoList);
callback.onHandlerSuccess(requestCode, photoList);
} else {
callback.onHanlderFailure(requestCode, getString(R.string.photo_list_empty));
callback.onHandlerFailure(requestCode, getString(R.string.photo_list_empty));
}
}
finishGalleryFinalPage();
}

protected void resultFailureDelayed(String errormsg, boolean delayFinish) {
GalleryFinal.OnHanlderResultCallback callback = GalleryFinal.getCallback();
GalleryFinal.OnHandlerResultCallback callback = GalleryFinal.getCallback();
int requestCode = GalleryFinal.getRequestCode();
if ( callback != null ) {
callback.onHanlderFailure(requestCode, errormsg);
callback.onHandlerFailure(requestCode, errormsg);
}
if(delayFinish) {
mFinishHanlder.sendEmptyMessageDelayed(0, 500);
Expand All @@ -205,10 +205,10 @@ protected void resultFailureDelayed(String errormsg, boolean delayFinish) {
}

protected void resultFailure(String errormsg, boolean delayFinish) {
GalleryFinal.OnHanlderResultCallback callback = GalleryFinal.getCallback();
GalleryFinal.OnHandlerResultCallback callback = GalleryFinal.getCallback();
int requestCode = GalleryFinal.getRequestCode();
if ( callback != null ) {
callback.onHanlderFailure(requestCode, errormsg);
callback.onHandlerFailure(requestCode, errormsg);
}
if(delayFinish) {
finishGalleryFinalPage();
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Oct 10 10:03:53 CST 2015
#Fri Apr 08 21:41:17 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip