Browse Source

增加文件上传

tags/old_version_1
fyf 1 year ago
parent
commit
6f1de2d366
10 changed files with 484 additions and 17 deletions
  1. +3
    -0
      app/build.gradle
  2. +36
    -4
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  3. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  4. +13
    -4
      app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java
  5. +2
    -3
      app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java
  6. +16
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/KeyConfig.java
  7. +169
    -0
      app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java
  8. +232
    -0
      app/src/main/java/com/bonait/bnframework/common/oss/OssManager.java
  9. +4
    -5
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java
  10. +4
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java

+ 3
- 0
app/build.gradle View File

@@ -141,4 +141,7 @@ dependencies {

//滑动快
implementation 'io.github.litao0621:nifty-slider:1.4.0'

//阿里云文件上传
implementation 'com.aliyun.dpa:oss-android-sdk:2.5.0'
}

+ 36
- 4
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -6,6 +6,8 @@ import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;

import androidx.annotation.NonNull;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.MessageName;
@@ -20,6 +22,8 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS;
import com.bonait.bnframework.common.helper.ConfigUtil;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IRunT;
import com.bonait.bnframework.common.helper.Json;
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback;
import com.bonait.bnframework.common.image.utils.LocalCacheUtils;
@@ -46,6 +50,7 @@ import com.bonait.bnframework.common.model.mode.ResALLData;
import com.bonait.bnframework.common.model.mode.TechnologyAction;
import com.bonait.bnframework.common.model.mode.UpdateBomInfo;
import com.bonait.bnframework.common.model.mode.UpdateCloudGood;
import com.bonait.bnframework.common.oss.OssHelper;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.GoodEditDialog;
@@ -549,6 +554,7 @@ public class ConfigData {
good.issc = 0;
good.url = cloudGood.goods_ImgUrl;
good.exp = "云端商品";
good.gyid=allDataResAPI.data.bomInfo.get(0).id;
QueryDB.AddGoods(good);
//2.增加配方
if (allDataResAPI.data.bomTechnologyActionInfo != null && allDataResAPI.data.bomTechnologyActionInfo.size() > 0) {
@@ -620,9 +626,33 @@ public class ConfigData {
public void onYesClick(String sp, String dl, String xl, String dw, String fl) {

Boolean isSuceess = false;
BPA_GOODS good = QueryDB.GetGoodsId(goodid);
try
{
final Boolean[] boom = {false};
OssHelper.getInstance().OnCharge=new IRunT() {
@Override
public void Run(Object o) {
ResAPI<String> resAPI=(ResAPI<String>)o;
if(resAPI.succeeded)
{
good.url=resAPI.data;
QueryDB.UpdateGoods(good);
}
boom[0] =true;
}
};
OssHelper.getInstance().UpdataFile(context,good.url);
while (!boom[0])
{
Thread.sleep(100);
}
}catch (Exception ex)
{

}
UpdateCloudGood update = new UpdateCloudGood();
try {
BPA_GOODS good = QueryDB.GetGoodsId(goodid);
update.storeId = ConfigName.getInstance().organizeMode.id;
update.deviceId = ConfigName.getInstance().DeviceId;
update.userId=ConfigName.getInstance().user.name;
@@ -644,7 +674,7 @@ public class ConfigData {

//选择菜谱 大类id 小类id 单位id
update.foodMenuId = sp;
update.goodsInfo.goods_ImgUrl = "";//图片地址
update.goodsInfo.goods_ImgUrl = good.url;//图片地址
update.goodsInfo.parentTypeID = dl;//大类
update.goodsInfo.goods_TypeID = xl;//小类
update.goodsInfo.goodsUintId = dw;//单位
@@ -764,9 +794,11 @@ public class ConfigData {

if (isSuceess) {
try {
//String str=ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods;
String str="http://192.168.1.64:5001/api/CommInteface/SendGoodsInfo";



String str=ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods;
//String str="http://192.168.1.64:5001/api/CommInteface/SendGoodsInfo";
OkGo.<ResAPI<Boolean>>post(str).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<Boolean>>(context) {
@Override
public void onSuccess(Response<ResAPI<Boolean>> response) {


+ 5
- 0
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -838,4 +838,9 @@ public class ConfigName {
*/
public String versionSelectionEnum = "大炒版本";
//endregion

//region 阿里云文件上传地址


//endregion
}

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

@@ -30,7 +30,16 @@ public class MyBitmapUtils {
ivPic.setImageResource(R.mipmap.loading2);
Bitmap bitmap;
//内存缓存
bitmap=mMemoryCacheUtils.getBitmapFromMemory(url);
String name="";
if(url.contains("https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com/"))
{
name=url.substring(url.lastIndexOf('/')+1);
}else
{
name=url;
}

bitmap=mMemoryCacheUtils.getBitmapFromMemory(name);
if (bitmap!=null){
ivPic.setImageBitmap(bitmap);
System.out.println("从内存获取图片啦.....");
@@ -38,16 +47,16 @@ public class MyBitmapUtils {
}

//本地缓存
bitmap = mLocalCacheUtils.getBitmapFromLocal(url);
bitmap = mLocalCacheUtils.getBitmapFromLocal(name);
if(bitmap !=null){
ivPic.setImageBitmap(bitmap);
System.out.println("从本地获取图片啦.....");
//从本地获取图片后,保存至内存中
mMemoryCacheUtils.setBitmapToMemory(url,bitmap);
mMemoryCacheUtils.setBitmapToMemory(name,bitmap);
return;
}
//网络缓存
if(isHttpUrl(url))
if(url.contains("https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com/"))
{
mNetCacheUtils.getBitmapFromNet(ivPic,url);
}


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

@@ -25,7 +25,7 @@ public class LocalCacheUtils {
public Bitmap getBitmapFromLocal(String url){
String fileName = null;//把图片的url当做文件名,并进行MD5加密
try {
fileName = MD5Encoder.encode(url);//AES.Encrypt(url);//MD5Encoder.encode(url);
fileName = url;//MD5Encoder.encode(url);//AES.Encrypt(url);//MD5Encoder.encode(url);
File file=new File(CACHE_PATH,fileName);
Bitmap bitmap=null;
if(file.exists())//
@@ -48,9 +48,8 @@ public class LocalCacheUtils {
public void setBitmapToLocal(String url,Bitmap bitmap){
try {

String fileName = MD5Encoder.encode(url);;//AES.Encrypt(url);//;MD5Encoder.encode(url);//把图片的url当做文件名,并进行MD5加密
String fileName = url.substring(url.lastIndexOf('/')+1);;//MD5Encoder.encode(url);;//AES.Encrypt(url);//;MD5Encoder.encode(url);//把图片的url当做文件名,并进行MD5加密
File file=new File(CACHE_PATH,fileName);

//通过得到文件的父文件,判断父文件是否存在
File parentFile = file.getParentFile();
if (!parentFile.exists()){


+ 16
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/KeyConfig.java View File

@@ -0,0 +1,16 @@
package com.bonait.bnframework.common.model.mode;

/**
* 阿里云文件上传KEY
*/
public class KeyConfig {
//=============================================阿里oss=============================================
//初始化OssService类,参数分别是Content,accessKeyId,accessKeySecret,endpoint,bucketName(后4个参数是您自己阿里云Oss中参数)
public static final String accessKeyId = "AKIDa4KQIvKUP6bw4ye6JI3a8lCPN7cswnV3";
public static final String accessKeySecret = "ObaLtCH9nCNPFrFQO7ex2sTqyxlLgnfJ";
public static final String accessStsToken = "1305371387";
public static final String bucketName = "hbl-test-1305371387";
public static final String endpoint = "ap-chengdu";
//----------TODO 以上数据为了安全直接从后台取 但是也可以直接使用--------------
public static final String osstpdz = "android/image/";//图片统一访问地址 静态地址路径
}

+ 169
- 0
app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java View File

@@ -0,0 +1,169 @@
package com.bonait.bnframework.common.oss;

import android.content.Context;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSS;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSFederationToken;
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IRunT;
import com.bonait.bnframework.common.image.utils.LocalCacheUtils;
import com.bonait.bnframework.common.model.ResAPI;

import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* OSS 上传帮助
*/
public class OssHelper {

//region 私有
private static OssHelper mInstance; //实例变量设置私有,防止直接通过类名访问

public static synchronized OssHelper getInstance() { //静态同步方法作为唯一的实例对象获取方式
if (mInstance == null) {
mInstance = new OssHelper();
}
return mInstance;
}

private OssHelper() { //默认构造函数私有,防止类外直接new创建对象
Init();
}
//endregion

//region 变量
public String AppId = "1305371387";
public String Region = "ap-chengdu";
public String Bucket = "hbl-test-1305371387";
public String SecretId = "AKIDa4KQIvKUP6bw4ye6JI3a8lCPN7cswnV3";
public String SecretKey = "ObaLtCH9nCNPFrFQO7ex2sTqyxlLgnfJ";


//endregion

public void Init() {

}

/**
* 上传完成通知
*/
public IRunT OnCharge;
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblxiaochaodb/WebImage";

/**
* 上传文件
*
* @param context
* @param fileurl
*/
public void UpdataFile(Context context, String fileurl) {
try {
ResAPI<String> res = new ResAPI<String>();
if (isHttpUrl(fileurl)) {
res.succeeded = false;
res.data = fileurl;
if (OnCharge != null)
OnCharge.Run(res);
return;
} else {
File file = new File(CACHE_PATH, fileurl);
String name = "Franchisee/" + ConfigName.getInstance().organizeMode.store_Name + "/goods/android/";
String filename = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com/" + name + file.getName();
// 第一个参数:在【RAM访问控制】创建用户时分配的accessKeyId
// 第二个参数:在【RAM访问控制】创建用户时分配的accessKeySecret
OSSCredentialProvider ossCredentialProvider = new OSSPlainTextAKSKCredentialProvider(SecretId, SecretKey);
// 第一个参数:上下文
// 第二个参数:在OSS控制台创建好Bucket后,会有一个EndPoint(地域节点),比如我这里的节点是:http://oss-cn-shanghai.aliyuncs.com
// 第三个参数:OSSCredentialProvider
OSS oss = new OSSClient(context, "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com", ossCredentialProvider);
// 第二个参数:可以是一个文件路径:比如你在image-header创建了一个文件夹为images,那第二个参数传images/img.jpg
// 第三个参数:是文件的本地路径,比如我这里在本地路径中是姨丈图片,路径是sdcard/img/img.jpg
PutObjectRequest put = new PutObjectRequest(Bucket, name + file.getName(), file.getPath());
// 异步上传时可以设置进度回调。
put.setProgressCallback((request, currentSize, totalSize) -> {
Log.d("currentSize = " + currentSize, "totalSize = " + totalSize);
});
// 此处调用异步上传方法
OSSAsyncTask ossAsyncTask = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
@Override
public void onSuccess(PutObjectRequest request, PutObjectResult result) {
Log.d("PutObject", "UploadSuccess");
Log.d("ETag", result.getETag());
Log.d("RequestId", result.getRequestId());
res.succeeded = true;
res.data = filename;
if (OnCharge != null)
OnCharge.Run(res);
}

@Override
public void onFailure(PutObjectRequest request, ClientException clientException, ServiceException serviceException) {
// 请求异常。
if (clientException != null) {
// 本地异常,如网络异常等。
Log.e("如网络异常等", clientException.getMessage());
res.succeeded = false;
res.data = fileurl;
if (OnCharge != null)
OnCharge.Run(res);
}
if (serviceException != null) {
// 服务异常。
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());
res.succeeded = false;
res.data = fileurl;
if (OnCharge != null)
OnCharge.Run(res);
}
}
});
}

} catch (Exception ex) {

}
}

/**
* 判断字符串是否为URL
*
* @param urls 需要判断的String类型url
* @return true:是URL;false:不是URL
*/
public static boolean isHttpUrl(String urls) {
boolean isurl = false;
//设置正则表达式
String regex = "(((https|http)?://)?([a-z0-9]+[.])|(www.))"
+ "\\w+[.|\\/]([a-z0-9]{0,})?[[.]([a-z0-9]{0,})]+((/[\\S&&[^,;\u4E00-\u9FA5]]+)+)?([.][a-z0-9]{0,}+|/?)";
//对比
Pattern pat = Pattern.compile(regex.trim());
Matcher mat = pat.matcher(urls.trim());
//判断是否匹配
isurl = mat.matches();
if (isurl) {
isurl = true;
}
return isurl;
}
}

+ 232
- 0
app/src/main/java/com/bonait/bnframework/common/oss/OssManager.java View File

@@ -0,0 +1,232 @@
package com.bonait.bnframework.common.oss;


import android.content.Context;
import android.util.Log;

import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSS;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSStsTokenCredentialProvider;
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;

/**
* OSS 文件上传
*/
public class OssManager {
/**
* Context
*/
private Context mContext;
/**
* bucket name
*/
private String mBucketName;
/**
* access key id
*/
private String mAccessKeyId;
/**
* access key secret
*/
private String mAccessKeySecret;
/**
* end point url
*/
private String mEndPoint;
/**
* file name or file dir
*/
private String mObjectKey;
/**
* local file path
*/
private String mLocalFilePath;
/**
* push file progress listener
*/
private OnPushProgressListener onPushProgressListener;
/**
* push file state
*/
private OnPushStateListener onPushStateListener;
/**
* OSS async task
*/
private OSSAsyncTask mOSSAsyncTask;

private OssManager(Context context, String bucketName, String accessKeyId, String accessKeySecret, String endPoint, String objectKey, String localFilePath) {
this.mContext = context;
this.mBucketName = bucketName;
this.mAccessKeyId = accessKeyId;
this.mAccessKeySecret = accessKeySecret;
this.mEndPoint = endPoint;
this.mObjectKey = objectKey;
this.mLocalFilePath = localFilePath;
}

/**
* set push file progress listener,pushing call back onProgress(PutObjectRequest request, long currentSize, long totalSize)
*
* @param listener push file progress listener
*/
public void setPushProgressListener(OnPushProgressListener listener) {
this.onPushProgressListener = listener;
}

/**
* set push file state listener,push success call back onSuccess(PutObjectRequest request, PutObjectResult result)
* push failed call back onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException)
*
* @param listener push file state listener
*/
public void setPushStateListener(OnPushStateListener listener) {
this.onPushStateListener = listener;
}

/**
* push file to oss,this method is async task
*/
public void push() {
OSSCredentialProvider ossCredentialProvider = new OSSPlainTextAKSKCredentialProvider(mAccessKeyId, mAccessKeySecret);
OSS oss = new OSSClient(mContext.getApplicationContext(), mEndPoint, ossCredentialProvider);
onPush(oss);
}

/**
* push file to oss,this method is async task
*/
public void push(String accessKeyId, String accessKeySecret, String securityToken) {
if (accessKeyId == null || accessKeySecret == null || securityToken == null) return;
OSSCredentialProvider credentialProvider = new OSSStsTokenCredentialProvider(accessKeyId, accessKeySecret, securityToken);
OSS oss = new OSSClient(mContext.getApplicationContext(), mEndPoint, credentialProvider);
onPush(oss);
}

/**
* push
* @param oss OSS
*/
private void onPush(OSS oss) {
PutObjectRequest put = new PutObjectRequest(mBucketName, mObjectKey, mLocalFilePath);
// 异步上传时可以设置进度回调。
put.setProgressCallback((request, currentSize, totalSize) -> {
Log.d("currentSize = " + currentSize, "totalSize = " + totalSize);
if (onPushProgressListener != null) {
onPushProgressListener.onProgress(request, currentSize, totalSize);
}
});

mOSSAsyncTask = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
@Override
public void onSuccess(PutObjectRequest request, PutObjectResult result) {
Log.d("PutObject", "UploadSuccess");
Log.d("ETag", result.getETag());
Log.d("RequestId", result.getRequestId());
if (onPushStateListener != null) {
onPushStateListener.onSuccess(request, result);
}
}

@Override
public void onFailure(PutObjectRequest request, ClientException clientException, ServiceException serviceException) {
// 请求异常。
if (clientException != null) {
// 本地异常,如网络异常等。
Log.e("如网络异常等",clientException.getMessage());
}
if (serviceException != null) {
// 服务异常。
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());

}

if (onPushStateListener != null) {
onPushStateListener.onFailure(request, clientException, serviceException);
}
}
});
}

/**
* cancel file push task
*/
public void cancelPush() {
if (mOSSAsyncTask != null && !mOSSAsyncTask.isCanceled() && !mOSSAsyncTask.isCompleted()) {
mOSSAsyncTask.cancel();
}
}

/**
* OssManager builder,init params
*/
public static class Builder {

private Context context;
private String bucketName;
private String accessKeyId;
private String accessKeySecret;
private String endPoint;
private String objectKey;
private String localFilePath;

public Builder(Context context) {
this.context = context;
}

public Builder bucketName(String bucketName) {
this.bucketName = bucketName;
return this;
}

public Builder accessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
return this;
}

public Builder accessKeySecret(String accessKeySecret) {
this.accessKeySecret = accessKeySecret;
return this;
}

public Builder endPoint(String endPint) {
this.endPoint = endPint;
return this;
}

public Builder objectKey(String objectKey) {
this.objectKey = objectKey;
return this;
}

public Builder localFilePath(String localFilePath) {
this.localFilePath = localFilePath;
return this;
}

public OssManager build() {
return new OssManager(context, bucketName, accessKeyId, accessKeySecret, endPoint, objectKey, localFilePath);
}
}

public interface OnPushProgressListener {
void onProgress(PutObjectRequest request, long currentSize, long totalSize);
}

public interface OnPushStateListener {
void onSuccess(PutObjectRequest request, PutObjectResult result);

void onFailure(PutObjectRequest request, ClientException clientException, ServiceException serviceException);
}

}


+ 4
- 5
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java View File

@@ -74,6 +74,7 @@ public class CpActivity extends BaseActivity {
mAdapter.setCallback(new QMUIStickySectionAdapter.Callback<SectionHeader, SectionItem>() {
@Override
public void loadMore(final QMUISection<SectionHeader, SectionItem> section, final boolean loadMoreBefore) {

}

//点击事件
@@ -98,7 +99,7 @@ public class CpActivity extends BaseActivity {
mSectionLayout.setAdapter(mAdapter, true);
ConfigData.getInstance().GetGevGood(this, mHandler);
mAdapter.setData(getList());
mAdapter.toggleFold(0, true);
mAdapter.refreshCustomData();
}

@SuppressLint("HandlerLeak")
@@ -122,8 +123,7 @@ public class CpActivity extends BaseActivity {
SectionItem item = (SectionItem) msg;
QueryDB.DeleteGoodsid(item.getAccount());
QueryDB.DeleteGoodsSrecipeList(item.getAccount());
mAdapter.setData(getList());
mAdapter.toggleFold(0, true);
mAdapter.setDataWithoutDiff(getList(),true);
}
}
});
@@ -136,8 +136,8 @@ public class CpActivity extends BaseActivity {
public void onMessage(Object msg) {
if (msg != null) {
mAdapter.setData(new ArrayList<QMUISection<SectionHeader, SectionItem>>());
//mAdapter.setDataWithoutDiff(getList(),true);
mAdapter.setData(getList());
mAdapter.toggleFold(0, true);
}
}
});
@@ -205,7 +205,6 @@ public class CpActivity extends BaseActivity {
if (item.url == null) {
item.url = "未知";
}
item.exp = item.exp == null ? "" : item.exp;
contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true));
if (item.issc == 1) {
contents_sccp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true));


+ 4
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java View File

@@ -79,7 +79,7 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter {
IsSC=((SectionItem)section.getItemAt(itemIndex)).getIsSC();
String id= ((SectionItem)section.getItemAt(itemIndex)).getAccount();
String url=((SectionItem)section.getItemAt(itemIndex)).getAddress();
Boolean isCloud=((SectionItem)section.getItemAt(itemIndex)).getIsCloud();//是否云端商品
boolean isCloud=((SectionItem)section.getItemAt(itemIndex)).getIsCloud();//是否云端商品
if(isCloud)
{
Sc_text.setText("下载");
@@ -92,6 +92,9 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter {
}else
{
Sc_text.setText("上传");
delete_text.setVisibility(View.VISIBLE);
sc_image.setVisibility(View.VISIBLE);
Sc_text.setVisibility(View.VISIBLE);
}
tvTag.setText(name);
tvNote.setText("时间:"+ ((SectionItem)section.getItemAt(itemIndex)).getNote()+"秒");


Loading…
Cancel
Save