Commit cfa15a4c by konghaorui

Merge branch 'dev' into feature/im_update

# Conflicts:
#	config.gradle
parents 0d8e4013 8e3569af
......@@ -20,6 +20,7 @@ import com.umeng.socialize.UMShareAPI;
import com.ydl.component.BuildConfig;
import com.ydl.component.MainActivity;
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.delegate.IAppLifecycles;
import com.ydl.ydlcommon.utils.LogUtil;
......@@ -125,10 +126,10 @@ public class DemoAppLifecycles implements IAppLifecycles {
//开启友盟集成测试
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
//数据埋点初始化 (一定要放在主进程中,因为用到了umeng统计,需要放在umeng初始化后)
YdlBuryPointUtil.init(application,true);
HttpConfig.Companion.getInstance().initSocketConfig(() -> {
//数据埋点初始化 (一定要放在主进程中/因为用到了umeng统计,需要放在umeng初始化后)
YdlBuryPointUtil.init(application, true);
});
//安全检测
//YDLAppProtector.init();
......
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -249,13 +249,13 @@ ext {
"ydl-pushagent" : "com.ydl:pushagent:0.1.1",
"ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.1@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",
"arouter-api" : "com.alibaba:arouter-api:1.4.1",
"arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2",
"exoplayer" : "com.google.android.exoplayer:exoplayer:2.9.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",
"ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
......
package com.yidianling.dynamic.adapter;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.widget.RecyclerView;
......@@ -9,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideRoundTransform;
import com.yidianling.dynamic.R;
......@@ -80,6 +82,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
public void onBindViewHolder(PublishTrendImgViewHolder holder, final int position) {
RecommendTrendImage trendImage = mDatas.get(position);
String path = trendImage.getImage_url();
if ("default".equals(path)) {
holder.bg_iv.setVisibility(View.VISIBLE);
holder.item_publish_iv.setVisibility(View.GONE);
......@@ -88,8 +91,9 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
holder.item_publish_cancel_iv.setVisibility(View.VISIBLE);
holder.bg_iv.setVisibility(View.GONE);
holder.item_publish_iv.setVisibility(View.VISIBLE);
Uri uriByPath = FileUtils.INSTANCE.getUriByPath(mContext, path);
GlideApp.with(mContext)
.load(path)
.load(uriByPath)
.error(R.drawable.dynamic_default_img)
.transform(new GlideRoundTransform(mContext, 6))
// .centerCrop()
......
package com.yidianling.dynamic.adapter;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.widget.RecyclerView;
......@@ -9,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.dynamic.R;
import com.yidianling.dynamic.model.RecommendTrendImage;
......@@ -60,8 +62,9 @@ public class RecommendTrendImgAdapter extends RecyclerView.Adapter<RecommendTren
RecommendTrendImage trendImage=mDatas.get(position);
String img_url=trendImage.getImage_url();
if(!"no".equals(img_url)){
Uri uriByPath = FileUtils.INSTANCE.getUriByPath(mContext, img_url);
GlideApp.with(mContext)
.load(img_url)
.load(uriByPath)
// .override(width,width)
.error(R.drawable.dynamic_default_img)
.centerCrop()
......
......@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
......@@ -19,6 +20,7 @@ import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.data.http.RxUtils;
......@@ -111,7 +113,9 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
@Override
public void onClick(View v) {
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
public void onDownLoadSuccess(File file) {
......@@ -314,8 +318,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
// }
@Override
public Object instantiateItem(View container, int position) {
Uri uri = FileUtils.INSTANCE.getUriByPath(container.getContext(), mImages.get(position).getImage_url());
GlideApp.with(mContext)
.load(mImages.get(position).getImage_url())
.load(uri)
.error(R.drawable.dynamic_default_img)
.into(mDatas.get(position));
mDatas.get(position).setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
......
package com.yidianling.dynamic.common.tool;
import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.dynamic.R;
/**
......@@ -24,6 +27,16 @@ public class GlideImageLoader implements ImageLoader {
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){
SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = R.drawable.dynamic_default_img;
......
......@@ -3,8 +3,10 @@ package com.yidianling.dynamic.common.tool;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.yidianling.common.tools.RxFileTool;
import java.io.ByteArrayInputStream;
......@@ -30,9 +32,9 @@ public class ImageCompress {
return image;
}
public static File scal(String path, int size) {
public static File scal(FragmentActivity activity, String path, int size) {
// String path = fileUri.getPath();
File outputFile = new File(path);
File outputFile = FileUtils.INSTANCE.getFileByUri(activity,path);
if (!outputFile.exists()){
return null;
}
......
......@@ -7,13 +7,10 @@ import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
......@@ -687,7 +684,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private synchronized File DealFile2(final String path, int size) {
File deal_file = null;
deal_file = ImageCompress.scal(path, size);
deal_file = ImageCompress.scal(getActivity(),path, size);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
......@@ -786,7 +783,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
return;
}
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
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
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;
import android.util.Log;
import com.lzy.imagepicker.bean.ImageItem;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback;
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker;
......@@ -61,7 +62,7 @@ public abstract class PickImageAction extends BaseAction {
@Override
public void onSuccess(@NotNull ArrayList<ImageItem> images) {
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;
import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp;
/**
* Created by xiongyu on 2017/4/7.
......@@ -23,6 +26,16 @@ public class GlideImageLoader implements ImageLoader {
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){
SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = R.drawable.platform_default_img;
......
......@@ -3,6 +3,7 @@ package com.channel.ydl_flutter_base.plugin
import android.text.TextUtils
import com.channel.ydl_flutter_base.base.BaseFlutterFragment
import com.ydl.burypointlib.BuryPointHelper
import com.ydl.burypointlib.MD5Util
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.data.PlatformDataManager
......@@ -98,13 +99,13 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
field.isAccessible = true
val property = field.get(ownerClass)
if (property is Boolean && property) {
BuryPointHelper.showEditDialog(mActivity, clickPath, null)
BuryPointHelper.showEditDialog(mActivity, MD5Util.md5(clickPath), null)
}
} catch (e: Exception) {
}
YdlBuryPointUtil.sendClick(clickPath)
YdlBuryPointUtil.sendClick(MD5Util.md5(clickPath))
}
}
......
......@@ -82,6 +82,8 @@ dependencies {
}
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-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
......
......@@ -27,6 +27,16 @@ public class YdlImageLoader implements ImageLoader {
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){
GlideApp.with(activity) //配置上下文
.load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
......
......@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import com.facebook.stetho.okhttp3.StethoInterceptor
import com.ydl.pushserver.pushagent.YdlPushAgent
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.bean.AuthBean
import com.ydl.ydlcommon.data.PlatformDataManager
......@@ -20,6 +21,7 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.ToastUtil
import io.reactivex.functions.Action
import okhttp3.*
import okio.Buffer
import okio.BufferedSink
......@@ -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 {
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;
import com.google.gson.Gson;
import com.ydl.ydlcommon.bean.AuthBean;
import com.ydl.ydlcommon.bean.JavaGlobalInfo;
import com.ydl.ydlcommon.bean.MustUP;
import com.ydl.ydlcommon.data.http.BaseAPIResponse;
import com.ydl.ydlcommon.data.http.BaseResponse;
......@@ -49,4 +50,12 @@ public class ApiRequestUtil {
public static Observable<BaseAPIResponse<AuthBean>> 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;
import com.ydl.ydlcommon.bean.AuthBean;
import com.ydl.ydlcommon.bean.JavaGlobalInfo;
import com.ydl.ydlcommon.bean.MustUP;
import com.ydl.ydlcommon.data.http.BaseAPIResponse;
import com.ydl.ydlcommon.data.http.BaseResponse;
......@@ -44,4 +45,8 @@ interface NetApiStore {
@GET("risk/key/info")
Observable<BaseAPIResponse<AuthBean>> getDynamicToken();
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@GET("config/socket-config")
Observable<BaseAPIResponse<JavaGlobalInfo>> getJavaGlobalInfo();
}
package com.ydl.ydlcommon.utils;
import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import com.yidianling.common.tools.LogUtil;
......@@ -23,7 +23,7 @@ public class AppProgressUtils {
* (相应代码也可参考 Demo 的 application),使用 EaseUI 库的就不用理会这个。
* @return
*/
public static boolean isMainProcess(Application application) {
public static boolean isMainProcess(Context application) {
String processAppName = getProcessName(application);
if(TextUtils.isEmpty(processAppName))
return true;
......@@ -37,7 +37,7 @@ public class AppProgressUtils {
return true;
}
private static String getProcessName(Application app) {
private static String getProcessName(Context app) {
String processName = null;
try {
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