Browse Source

修改图片上传问题

授权码生成工具
liup 3 months ago
parent
commit
adc876c71e
8 changed files with 28 additions and 11 deletions
  1. +2
    -2
      .idea/deploymentTargetSelector.xml
  2. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java
  3. +4
    -0
      app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java
  4. +10
    -0
      app/src/main/java/com/bonait/bnframework/glide/GlideUtil.java
  5. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java
  6. +3
    -2
      app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java
  7. +3
    -2
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java
  8. +3
    -2
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java

+ 2
- 2
.idea/deploymentTargetSelector.xml View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-09-11T10:44:13.742879300Z">
<DropdownSelection timestamp="2024-09-12T01:29:13.165556500Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=f53c72a8" />
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=9a96684d" />
</handle>
</Target>
</DropdownSelection>


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java View File

@@ -47,7 +47,7 @@ public class MyBitmapUtils {
}

//网络缓存
if(url.contains("http")&&(url.contains("png")||url.contains("jpg")))
if(url.contains("http")&&(url.contains("png")||url.contains("jpg")||url.contains("jpeg")))
{
Log.d("MyBitmapUtils","disPlay getBitmapFromNet url="+url);
mNetCacheUtils.getBitmapFromNet(ivPic,url);


+ 4
- 0
app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java View File

@@ -42,6 +42,10 @@ public class LocalCacheUtils {
* @return
*/
public boolean SetBitmapFile(ImageView ivPic, String name, String url) {
if((!name.contains("png")&&!name.contains("jpg")&&!name.contains("jpeg"))){
ivPic.setImageResource(R.mipmap.loading123);
return true;
}
String CACHE_PATH = ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage";
if(name.contains(CACHE_PATH)){
name = name.replace(CACHE_PATH,"");


+ 10
- 0
app/src/main/java/com/bonait/bnframework/glide/GlideUtil.java View File

@@ -7,6 +7,9 @@ import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.image.utils.FitXYRoundRadiusTransform;
import com.bonait.bnframework.ui.util.DimensUtil;
import com.bumptech.glide.load.DataSource;
@@ -54,6 +57,13 @@ public class GlideUtil {
if (context == null||path==null) {
return;
}
if((!path.contains("png")&&!path.contains("jpg")&&!path.contains("jpeg"))){
imageView.setImageResource(R.mipmap.loading123);
return;
}
if(!path.contains("http")){
path = ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage/"+path;
}
GlideApp.with(context)
.load(path)
.addListener(new RequestListener<Drawable>() {


+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java View File

@@ -66,7 +66,7 @@ public class ImageChooseActivity extends BaseActivity {

private void initData() {
try{
File path = new File(ConfigName.getFileRoot(MainApplication.getContext()));// 获得路径
File path = new File(ConfigName.getFileRoot(MainApplication.getContext())+ ConfigName.dataPath+"/WebImage");// 获得路径
File[] files = path.listFiles();// 读取文件
data.clear();
for (int i = 0; i < files.length; i++) {
@@ -91,7 +91,7 @@ public class ImageChooseActivity extends BaseActivity {
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post(new ImageSelectEvent(ConfigName.getFileRoot(MainApplication.getContext())+"/"+sp.url));
EventBus.getDefault().post(new ImageSelectEvent(sp.url));
}
},500);
}


+ 3
- 2
app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java View File

@@ -22,6 +22,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.RecordManager;
@@ -741,10 +742,10 @@ public class EditGoodsDialog extends DialogFragment {
picUrl= "";
}
LogUtils.d(TAG+" updateCircleImage url="+url);
if(picUrl.isEmpty()){
if(picUrl.isEmpty()||(!picUrl.contains("png")&&!picUrl.contains("jpg")&&!picUrl.contains("jpeg"))){
viewBinding.layoutName.goodImage.setImageResource(R.mipmap.loading123);
}else {
GlideUtil.showImageWithRadius(getContext(),url,viewBinding.layoutName.goodImage,
GlideUtil.showImageWithRadius(getContext(),ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage/"+url,viewBinding.layoutName.goodImage,
R.mipmap.loading123, DimensUtil.getDimens(0));
}
}


+ 3
- 2
app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java View File

@@ -387,8 +387,9 @@ public class UpdateAllDataService {
if(classify!=null){
String imgUrl = "";
if(good.url!=null){
String path = ConfigName.getFileRoot(MainApplication.getContext())+ ConfigName.dataPath+"/WebImage/";
imgUrl = "";//"https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+good.url.replace(path,"");
if((good.url.contains("png")||good.url.contains("jpg")||good.url.contains("jpeg"))){
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+good.url;
}
}
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",imgUrl,"0",false,good.propClassifyId,classify.name));
}


+ 3
- 2
app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java View File

@@ -427,8 +427,9 @@ public class UpdateDataService {

String imgUrl = "";
if(goods.url!=null){
String path = ConfigName.getFileRoot(MainApplication.getContext())+ ConfigName.dataPath+"/WebImage/";
imgUrl = "";//"https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+goods.url.replace(path,"");
if((goods.url.contains("png")||goods.url.contains("jpg")||goods.url.contains("jpeg"))){
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+goods.url;
}
}
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",imgUrl,"0",false,goods.propClassifyId,
classify.name));


Loading…
Cancel
Save