update image selector library

This commit is contained in:
xingxing
2018-01-17 00:31:06 +08:00
parent f94fcf0018
commit c0c784c18a
4 changed files with 28 additions and 17 deletions

View File

@@ -94,7 +94,7 @@ dependencies {
compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.1' compile 'jp.wasabeef:glide-transformations:2.0.1'
compile 'com.android.support:support-v13:26.1.0' compile 'com.android.support:support-v13:26.1.0'
compile 'com.yuyh.imgsel:library:1.3.2' compile 'com.yuyh.imgsel:library:2.0.2'
compile 'com.facebook.stetho:stetho:1.4.2' compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.2' compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
compile 'com.github.houxg:FlexLayout:1.2' compile 'com.github.houxg:FlexLayout:1.2'

View File

@@ -78,7 +78,7 @@
<receiver <receiver
android:name=".appwidget.NoteAppWidget" android:name=".appwidget.NoteAppWidget"
android:icon="@drawable/ic_add" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />

View File

@@ -5,7 +5,9 @@ import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.text.TextUtils; import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.elvishew.xlog.LogLevel; import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog; import com.elvishew.xlog.XLog;
import com.facebook.stetho.Stetho; import com.facebook.stetho.Stetho;
@@ -15,6 +17,8 @@ import com.raizlabs.android.dbflow.config.FlowConfig;
import com.raizlabs.android.dbflow.config.FlowManager; import com.raizlabs.android.dbflow.config.FlowManager;
import com.tencent.bugly.Bugly; import com.tencent.bugly.Bugly;
import com.tencent.bugly.beta.Beta; import com.tencent.bugly.beta.Beta;
import com.yuyh.library.imgsel.ISNav;
import com.yuyh.library.imgsel.common.ImageLoader;
import net.danlew.android.joda.JodaTimeAndroid; import net.danlew.android.joda.JodaTimeAndroid;
@@ -48,6 +52,12 @@ public class Leamonax extends Application {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Stetho.initializeWithDefaults(this); Stetho.initializeWithDefaults(this);
} }
ISNav.getInstance().init(new ImageLoader() {
@Override
public void displayImage(Context context, String path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
});
} }
private void initBugly() { private void initBugly() {

View File

@@ -6,6 +6,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@@ -21,14 +22,13 @@ import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.elvishew.xlog.XLog; import com.elvishew.xlog.XLog;
import com.yuyh.library.imgsel.ImgSelActivity; import com.yuyh.library.imgsel.ISNav;
import com.yuyh.library.imgsel.ImgSelConfig; import com.yuyh.library.imgsel.config.ISListConfig;
import com.yuyh.library.imgsel.ui.ISListActivity;
import org.houxg.leamonax.R; import org.houxg.leamonax.R;
import org.houxg.leamonax.editor.Editor; import org.houxg.leamonax.editor.Editor;
@@ -196,21 +196,22 @@ public class EditorFragment extends Fragment implements Editor.EditorListener {
} }
private void openImageSelector(boolean supportSelfie) { private void openImageSelector(boolean supportSelfie) {
ImgSelConfig config = new ImgSelConfig.Builder( ISListConfig config = new ISListConfig.Builder()
getActivity(),
new com.yuyh.library.imgsel.ImageLoader() {
@Override
public void displayImage(Context context, String path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
})
.multiSelect(false) .multiSelect(false)
.rememberSelected(false)
.btnBgColor(Color.GRAY)
.btnTextColor(Color.BLUE)
.statusBarColor(Color.parseColor("#3F51B5"))
.backResId(R.drawable.ic_arrow_back_white) .backResId(R.drawable.ic_arrow_back_white)
.needCrop(true) // .title("选择图片")
.titleColor(Color.WHITE)
.titleBgColor(Color.parseColor("#3F51B5"))
.cropSize(1, 1, 200, 200) .cropSize(1, 1, 200, 200)
.needCrop(true)
.needCamera(supportSelfie) .needCamera(supportSelfie)
.maxNum(9)
.build(); .build();
ImgSelActivity.startActivity(this, config, REQ_SELECT_IMAGE); ISNav.getInstance().toListActivity(this, config, REQ_SELECT_IMAGE);
} }
@OnClick(R.id.btn_link) @OnClick(R.id.btn_link)
@@ -313,7 +314,7 @@ public class EditorFragment extends Fragment implements Editor.EditorListener {
&& resultCode == Activity.RESULT_OK && resultCode == Activity.RESULT_OK
&& data != null && data != null
&& mListener != null) { && mListener != null) {
List<String> pathList = data.getStringArrayListExtra(ImgSelActivity.INTENT_RESULT); List<String> pathList = data.getStringArrayListExtra(ISListActivity.INTENT_RESULT);
if (CollectionUtils.isNotEmpty(pathList)) { if (CollectionUtils.isNotEmpty(pathList)) {
String path = pathList.get(0); String path = pathList.get(0);
XLog.i(TAG + "path=" + path); XLog.i(TAG + "path=" + path);