Commit 9de0287e by 徐健

Merge branch 'feature/im_update' of…

Merge branch 'feature/im_update' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/im_update
parents 90a7b17a cfa15a4c
...@@ -20,6 +20,7 @@ import com.umeng.socialize.UMShareAPI; ...@@ -20,6 +20,7 @@ import com.umeng.socialize.UMShareAPI;
import com.ydl.component.BuildConfig; import com.ydl.component.BuildConfig;
import com.ydl.component.MainActivity; import com.ydl.component.MainActivity;
import com.ydl.media.audio.PlayService; import com.ydl.media.audio.PlayService;
import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.base.config.YDLConstants; import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles; import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.utils.LogUtil; import com.ydl.ydlcommon.utils.LogUtil;
...@@ -125,10 +126,10 @@ public class DemoAppLifecycles implements IAppLifecycles { ...@@ -125,10 +126,10 @@ public class DemoAppLifecycles implements IAppLifecycles {
//开启友盟集成测试 //开启友盟集成测试
UMConfigure.setLogEnabled(BuildConfig.DEBUG); UMConfigure.setLogEnabled(BuildConfig.DEBUG);
HttpConfig.Companion.getInstance().initSocketConfig(() -> {
//数据埋点初始化 (一定要放在主进程中,因为用到了umeng统计,需要放在umeng初始化后) //数据埋点初始化 (一定要放在主进程中/因为用到了umeng统计,需要放在umeng初始化后)
YdlBuryPointUtil.init(application,true); YdlBuryPointUtil.init(application, true);
});
//安全检测 //安全检测
//YDLAppProtector.init(); //YDLAppProtector.init();
......
...@@ -20,8 +20,8 @@ import java.util.List; ...@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST; public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD; // public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
...@@ -249,13 +249,13 @@ ext { ...@@ -249,13 +249,13 @@ ext {
"ydl-pushagent" : "com.ydl:pushagent:0.1.1", "ydl-pushagent" : "com.ydl:pushagent:0.1.1",
"ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.1@aar", "ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.1@aar",
"ydl-js" : "com.ydl:ydl-js:1.0.7-SNAPSHOT@aar", "ydl-js" : "com.ydl:ydl-js:1.0.7-SNAPSHOT@aar",
"ydl-router" : "com.ydl:ydl-router:1.3.7-SNAPSHOT@aar", "ydl-router" : "com.ydl:ydl-router:1.3.9-SNAPSHOT@aar",
"xrecyclerview" : "com.ydl:xrecyclerview:1.0.0-SNAPSHOT@aar", "xrecyclerview" : "com.ydl:xrecyclerview:1.0.0-SNAPSHOT@aar",
"arouter-api" : "com.alibaba:arouter-api:1.4.1", "arouter-api" : "com.alibaba:arouter-api:1.4.1",
"arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2", "arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2",
"exoplayer" : "com.google.android.exoplayer:exoplayer:2.9.0", "exoplayer" : "com.google.android.exoplayer:exoplayer:2.9.0",
"free_reflection" : "me.weishu:free_reflection:2.0.0", "free_reflection" : "me.weishu:free_reflection:2.0.0",
"imagepicker" : "com.ydl:imagepicker:1.0.7", "imagepicker" : "com.ydl:imagepicker:1.0.8.1",
"protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar", "protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar",
"ydl-hnet" : "com.ydl:h-net:0.0.8", "ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar", "ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
......
package com.yidianling.dynamic.adapter; package com.yidianling.dynamic.adapter;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi; import android.support.annotation.RequiresApi;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -9,6 +10,7 @@ import android.view.View; ...@@ -9,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideRoundTransform; import com.ydl.ydl_image.transform.GlideRoundTransform;
import com.yidianling.dynamic.R; import com.yidianling.dynamic.R;
...@@ -80,6 +82,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg ...@@ -80,6 +82,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
public void onBindViewHolder(PublishTrendImgViewHolder holder, final int position) { public void onBindViewHolder(PublishTrendImgViewHolder holder, final int position) {
RecommendTrendImage trendImage = mDatas.get(position); RecommendTrendImage trendImage = mDatas.get(position);
String path = trendImage.getImage_url(); String path = trendImage.getImage_url();
if ("default".equals(path)) { if ("default".equals(path)) {
holder.bg_iv.setVisibility(View.VISIBLE); holder.bg_iv.setVisibility(View.VISIBLE);
holder.item_publish_iv.setVisibility(View.GONE); holder.item_publish_iv.setVisibility(View.GONE);
...@@ -88,8 +91,9 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg ...@@ -88,8 +91,9 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
holder.item_publish_cancel_iv.setVisibility(View.VISIBLE); holder.item_publish_cancel_iv.setVisibility(View.VISIBLE);
holder.bg_iv.setVisibility(View.GONE); holder.bg_iv.setVisibility(View.GONE);
holder.item_publish_iv.setVisibility(View.VISIBLE); holder.item_publish_iv.setVisibility(View.VISIBLE);
Uri uriByPath = FileUtils.INSTANCE.getUriByPath(mContext, path);
GlideApp.with(mContext) GlideApp.with(mContext)
.load(path) .load(uriByPath)
.error(R.drawable.dynamic_default_img) .error(R.drawable.dynamic_default_img)
.transform(new GlideRoundTransform(mContext, 6)) .transform(new GlideRoundTransform(mContext, 6))
// .centerCrop() // .centerCrop()
......
package com.yidianling.dynamic.adapter; package com.yidianling.dynamic.adapter;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi; import android.support.annotation.RequiresApi;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -9,6 +10,7 @@ import android.view.View; ...@@ -9,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.dynamic.R; import com.yidianling.dynamic.R;
import com.yidianling.dynamic.model.RecommendTrendImage; import com.yidianling.dynamic.model.RecommendTrendImage;
...@@ -60,8 +62,9 @@ public class RecommendTrendImgAdapter extends RecyclerView.Adapter<RecommendTren ...@@ -60,8 +62,9 @@ public class RecommendTrendImgAdapter extends RecyclerView.Adapter<RecommendTren
RecommendTrendImage trendImage=mDatas.get(position); RecommendTrendImage trendImage=mDatas.get(position);
String img_url=trendImage.getImage_url(); String img_url=trendImage.getImage_url();
if(!"no".equals(img_url)){ if(!"no".equals(img_url)){
Uri uriByPath = FileUtils.INSTANCE.getUriByPath(mContext, img_url);
GlideApp.with(mContext) GlideApp.with(mContext)
.load(img_url) .load(uriByPath)
// .override(width,width) // .override(width,width)
.error(R.drawable.dynamic_default_img) .error(R.drawable.dynamic_default_img)
.centerCrop() .centerCrop()
......
...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint; ...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
...@@ -19,6 +20,7 @@ import android.view.WindowManager; ...@@ -19,6 +20,7 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.data.http.RxUtils; import com.ydl.ydlcommon.data.http.RxUtils;
...@@ -111,7 +113,9 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On ...@@ -111,7 +113,9 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if ("browse".equals(browse_type)) {//保存 if ("browse".equals(browse_type)) {//保存
DownLoadImageService downloadService = new DownLoadImageService(BrowsePicturesActivity.this, trendImages.get(iposition).getImage_url(), new ImageDownLoadCallBack() { DownLoadImageService downloadService = new DownLoadImageService(BrowsePicturesActivity.this,
trendImages.get(iposition).getImage_url(),
new ImageDownLoadCallBack() {
@Override @Override
public void onDownLoadSuccess(File file) { public void onDownLoadSuccess(File file) {
...@@ -314,8 +318,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On ...@@ -314,8 +318,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
// } // }
@Override @Override
public Object instantiateItem(View container, int position) { public Object instantiateItem(View container, int position) {
Uri uri = FileUtils.INSTANCE.getUriByPath(container.getContext(), mImages.get(position).getImage_url());
GlideApp.with(mContext) GlideApp.with(mContext)
.load(mImages.get(position).getImage_url()) .load(uri)
.error(R.drawable.dynamic_default_img) .error(R.drawable.dynamic_default_img)
.into(mDatas.get(position)); .into(mDatas.get(position));
mDatas.get(position).setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { mDatas.get(position).setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
......
package com.yidianling.dynamic.common.tool; package com.yidianling.dynamic.common.tool;
import android.app.Activity; import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader; import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig; import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger; import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager; import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.dynamic.R; import com.yidianling.dynamic.R;
/** /**
...@@ -24,6 +27,16 @@ public class GlideImageLoader implements ImageLoader { ...@@ -24,6 +27,16 @@ public class GlideImageLoader implements ImageLoader {
showImage(activity,path,imageView,width,height); showImage(activity,path,imageView,width,height);
} }
@Override
public void displayImage(Activity activity, Uri uri, ImageView imageView, int width, int i1) {
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置错误图片
.placeholder(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){ private void showImage(Activity activity, String path, ImageView imageView, int width, int height){
SimpleImageOpConfiger sp = new SimpleImageOpConfiger(); SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = R.drawable.dynamic_default_img; sp.loadingPic = R.drawable.dynamic_default_img;
......
...@@ -3,8 +3,10 @@ package com.yidianling.dynamic.common.tool; ...@@ -3,8 +3,10 @@ package com.yidianling.dynamic.common.tool;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Environment; import android.os.Environment;
import android.support.v4.app.FragmentActivity;
import android.util.Log; import android.util.Log;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.yidianling.common.tools.RxFileTool; import com.yidianling.common.tools.RxFileTool;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
...@@ -30,9 +32,9 @@ public class ImageCompress { ...@@ -30,9 +32,9 @@ public class ImageCompress {
return image; return image;
} }
public static File scal(String path, int size) { public static File scal(FragmentActivity activity, String path, int size) {
// String path = fileUri.getPath(); // String path = fileUri.getPath();
File outputFile = new File(path); File outputFile = FileUtils.INSTANCE.getFileByUri(activity,path);
if (!outputFile.exists()){ if (!outputFile.exists()){
return null; return null;
} }
......
...@@ -7,13 +7,10 @@ import android.app.Activity; ...@@ -7,13 +7,10 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor;
import android.graphics.Point; import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Parcelable; import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
...@@ -687,7 +684,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie ...@@ -687,7 +684,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private synchronized File DealFile2(final String path, int size) { private synchronized File DealFile2(final String path, int size) {
File deal_file = null; File deal_file = null;
deal_file = ImageCompress.scal(path, size); deal_file = ImageCompress.scal(getActivity(),path, size);
try { try {
Thread.sleep(100); Thread.sleep(100);
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -786,7 +783,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie ...@@ -786,7 +783,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
return; return;
} }
for (int i = 0; i < images.size(); i++) { for (int i = 0; i < images.size(); i++) {
AddImag(images.get(i).path); AddImag(images.get(i).uri.toString());
} }
} }
...@@ -858,30 +855,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie ...@@ -858,30 +855,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
} }
break; break;
case DynamicConstants.REQUEST_CODE_CAMER_TREND:
String hand_carmer_path = head_path;
AddImag(hand_carmer_path);
break;
case DynamicConstants.REQUEST_CODE_GALLERY_TREN:
if (data != null) {
String picturePath = "";
Uri selectedImage = data.getData();
// File file=new File(imgUri);
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getActivity().getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
//picturePath就是图片在储存卡所在的位置
picturePath = cursor.getString(columnIndex);
cursor.close();
} else {
picturePath = selectedImage.getPath();
}
AddImag(picturePath);
}
break;
} }
} }
} }
......
...@@ -5,6 +5,7 @@ import android.support.v7.app.AppCompatActivity; ...@@ -5,6 +5,7 @@ import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import com.lzy.imagepicker.bean.ImageItem; import com.lzy.imagepicker.bean.ImageItem;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback; import com.ydl.ydlcommon.actions.imagepicker.PickerCallback;
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker; import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker;
...@@ -61,7 +62,7 @@ public abstract class PickImageAction extends BaseAction { ...@@ -61,7 +62,7 @@ public abstract class PickImageAction extends BaseAction {
@Override @Override
public void onSuccess(@NotNull ArrayList<ImageItem> images) { public void onSuccess(@NotNull ArrayList<ImageItem> images) {
for (int i = 0; i < images.size(); i++) { for (int i = 0; i < images.size(); i++) {
onPicked(new File(images.get(i).path)); onPicked(FileUtils.INSTANCE.getFileByUri(getActivity(),images.get(i).uri.toString()));
} }
} }
......
package com.yidianling.user; package com.yidianling.user;
import android.app.Activity; import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader; import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig; import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger; import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager; import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp;
/** /**
* Created by xiongyu on 2017/4/7. * Created by xiongyu on 2017/4/7.
...@@ -23,6 +26,16 @@ public class GlideImageLoader implements ImageLoader { ...@@ -23,6 +26,16 @@ public class GlideImageLoader implements ImageLoader {
showImage(activity,path,imageView,width,height); showImage(activity,path,imageView,width,height);
} }
@Override
public void displayImage(Activity activity, Uri uri, ImageView imageView, int i, int i1) {
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置错误图片
.placeholder(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){ private void showImage(Activity activity, String path, ImageView imageView, int width, int height){
SimpleImageOpConfiger sp = new SimpleImageOpConfiger(); SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = R.drawable.platform_default_img; sp.loadingPic = R.drawable.platform_default_img;
......
...@@ -3,6 +3,7 @@ package com.channel.ydl_flutter_base.plugin ...@@ -3,6 +3,7 @@ package com.channel.ydl_flutter_base.plugin
import android.text.TextUtils import android.text.TextUtils
import com.channel.ydl_flutter_base.base.BaseFlutterFragment import com.channel.ydl_flutter_base.base.BaseFlutterFragment
import com.ydl.burypointlib.BuryPointHelper import com.ydl.burypointlib.BuryPointHelper
import com.ydl.burypointlib.MD5Util
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
...@@ -98,13 +99,13 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler { ...@@ -98,13 +99,13 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
field.isAccessible = true field.isAccessible = true
val property = field.get(ownerClass) val property = field.get(ownerClass)
if (property is Boolean && property) { if (property is Boolean && property) {
BuryPointHelper.showEditDialog(mActivity, clickPath, null) BuryPointHelper.showEditDialog(mActivity, MD5Util.md5(clickPath), null)
} }
} catch (e: Exception) { } catch (e: Exception) {
} }
YdlBuryPointUtil.sendClick(clickPath) YdlBuryPointUtil.sendClick(MD5Util.md5(clickPath))
} }
} }
......
...@@ -82,6 +82,8 @@ dependencies { ...@@ -82,6 +82,8 @@ dependencies {
} }
api(rootProject.ext.dependencies["imagepicker"]) { api(rootProject.ext.dependencies["imagepicker"]) {
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib' exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7' exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common' exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
......
...@@ -27,6 +27,16 @@ public class YdlImageLoader implements ImageLoader { ...@@ -27,6 +27,16 @@ public class YdlImageLoader implements ImageLoader {
showImage(activity,path,imageView,width,height); showImage(activity,path,imageView,width,height);
} }
@Override
public void displayImage(Activity activity, Uri uri, ImageView imageView, int i, int i1) {
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(R.drawable.platform_default_img) //设置错误图片
.placeholder(R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){ private void showImage(Activity activity, String path, ImageView imageView, int width, int height){
GlideApp.with(activity) //配置上下文 GlideApp.with(activity) //配置上下文
.load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示) .load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
......
...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint ...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.text.TextUtils import android.text.TextUtils
import com.facebook.stetho.okhttp3.StethoInterceptor import com.facebook.stetho.okhttp3.StethoInterceptor
import com.ydl.pushserver.pushagent.YdlPushAgent
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.bean.AuthBean import com.ydl.ydlcommon.bean.AuthBean
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
...@@ -20,6 +21,7 @@ import com.yidianling.common.tools.LogUtil ...@@ -20,6 +21,7 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import io.reactivex.functions.Action
import okhttp3.* import okhttp3.*
import okio.Buffer import okio.Buffer
import okio.BufferedSink import okio.BufferedSink
...@@ -379,6 +381,21 @@ class HttpConfig { ...@@ -379,6 +381,21 @@ class HttpConfig {
} }
} }
@SuppressLint("CheckResult")
fun initSocketConfig(finallyAction:Action) {
ApiRequestUtil.getJavaGlobalInfo()
.compose(RxUtils.applySchedulers())
.compose(RxUtils.resultJavaData())
.doFinally(finallyAction)
.subscribe({
if (it!=null&&!TextUtils.isEmpty(it.ip)){
YdlPushAgent.setDebugAdree(it.ip,it.port.toInt())
}
}) {
LogUtil.i("HttpConfig", it.toString())
}
}
private object Holder { private object Holder {
val INSTANCE = HttpConfig() val INSTANCE = HttpConfig()
} }
......
package com.ydl.ydlcommon.bean;
/**
* Created by haorui on 2020-01-13.
* Des:
*/
public class JavaGlobalInfo {
private String ip ;
private String port;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
}
...@@ -2,6 +2,7 @@ package com.ydl.ydlcommon.data.http.api; ...@@ -2,6 +2,7 @@ package com.ydl.ydlcommon.data.http.api;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.ydl.ydlcommon.bean.AuthBean; import com.ydl.ydlcommon.bean.AuthBean;
import com.ydl.ydlcommon.bean.JavaGlobalInfo;
import com.ydl.ydlcommon.bean.MustUP; import com.ydl.ydlcommon.bean.MustUP;
import com.ydl.ydlcommon.data.http.BaseAPIResponse; import com.ydl.ydlcommon.data.http.BaseAPIResponse;
import com.ydl.ydlcommon.data.http.BaseResponse; import com.ydl.ydlcommon.data.http.BaseResponse;
...@@ -49,4 +50,12 @@ public class ApiRequestUtil { ...@@ -49,4 +50,12 @@ public class ApiRequestUtil {
public static Observable<BaseAPIResponse<AuthBean>> getDynamicToken() { public static Observable<BaseAPIResponse<AuthBean>> getDynamicToken() {
return YDLHttpUtils.Companion.obtainApi(NetApiStore.class).getDynamicToken(); return YDLHttpUtils.Companion.obtainApi(NetApiStore.class).getDynamicToken();
} }
/**
* 获取java全局参数接口
* @return
*/
public static Observable<BaseAPIResponse<JavaGlobalInfo>> getJavaGlobalInfo() {
return YDLHttpUtils.Companion.obtainApi(NetApiStore.class).getJavaGlobalInfo();
}
} }
package com.ydl.ydlcommon.data.http.api; package com.ydl.ydlcommon.data.http.api;
import com.ydl.ydlcommon.bean.AuthBean; import com.ydl.ydlcommon.bean.AuthBean;
import com.ydl.ydlcommon.bean.JavaGlobalInfo;
import com.ydl.ydlcommon.bean.MustUP; import com.ydl.ydlcommon.bean.MustUP;
import com.ydl.ydlcommon.data.http.BaseAPIResponse; import com.ydl.ydlcommon.data.http.BaseAPIResponse;
import com.ydl.ydlcommon.data.http.BaseResponse; import com.ydl.ydlcommon.data.http.BaseResponse;
...@@ -44,4 +45,8 @@ interface NetApiStore { ...@@ -44,4 +45,8 @@ interface NetApiStore {
@GET("risk/key/info") @GET("risk/key/info")
Observable<BaseAPIResponse<AuthBean>> getDynamicToken(); Observable<BaseAPIResponse<AuthBean>> getDynamicToken();
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@GET("config/socket-config")
Observable<BaseAPIResponse<JavaGlobalInfo>> getJavaGlobalInfo();
} }
package com.ydl.ydlcommon.utils; package com.ydl.ydlcommon.utils;
import android.app.Application; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.yidianling.common.tools.LogUtil; import com.yidianling.common.tools.LogUtil;
...@@ -23,7 +23,7 @@ public class AppProgressUtils { ...@@ -23,7 +23,7 @@ public class AppProgressUtils {
* (相应代码也可参考 Demo 的 application),使用 EaseUI 库的就不用理会这个。 * (相应代码也可参考 Demo 的 application),使用 EaseUI 库的就不用理会这个。
* @return * @return
*/ */
public static boolean isMainProcess(Application application) { public static boolean isMainProcess(Context application) {
String processAppName = getProcessName(application); String processAppName = getProcessName(application);
if(TextUtils.isEmpty(processAppName)) if(TextUtils.isEmpty(processAppName))
return true; return true;
...@@ -37,7 +37,7 @@ public class AppProgressUtils { ...@@ -37,7 +37,7 @@ public class AppProgressUtils {
return true; return true;
} }
private static String getProcessName(Application app) { private static String getProcessName(Context app) {
String processName = null; String processName = null;
try { try {
Field loadedApkField = app.getClass().getField("mLoadedApk"); Field loadedApkField = app.getClass().getField("mLoadedApk");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment