# Conflicts: # app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java调味吧台
@@ -4,6 +4,14 @@ | |||||
<selectionStates> | <selectionStates> | ||||
<SelectionState runConfigName="app"> | <SelectionState runConfigName="app"> | ||||
<option name="selectionMode" value="DROPDOWN" /> | <option name="selectionMode" value="DROPDOWN" /> | ||||
<DropdownSelection timestamp="2024-05-20T08:34:01.979512500Z"> | |||||
<Target type="DEFAULT_BOOT"> | |||||
<handle> | |||||
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\YFB\.android\avd\1208Height.avd" /> | |||||
</handle> | |||||
</Target> | |||||
</DropdownSelection> | |||||
<DialogSelection /> | |||||
</SelectionState> | </SelectionState> | ||||
</selectionStates> | </selectionStates> | ||||
</component> | </component> |
@@ -133,7 +133,7 @@ dependencies { | |||||
//leak 内存泄漏检测 | //leak 内存泄漏检测 | ||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' | |||||
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' | |||||
//Modbus | //Modbus | ||||
implementation 'com.github.licheedev:Modbus4Android:2.0.2' | implementation 'com.github.licheedev:Modbus4Android:2.0.2' | ||||
@@ -181,4 +181,11 @@ dependencies { | |||||
//腾讯bugly | //腾讯bugly | ||||
//sdk地址 https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=1.0.0 | //sdk地址 https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=1.0.0 | ||||
implementation 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如4.0.3 | implementation 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如4.0.3 | ||||
api 'org.greenrobot:eventbus:3.1.1' | |||||
api 'com.github.bumptech.glide:glide:4.16.0' | |||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0' | |||||
api "com.github.bumptech.glide:okhttp3-integration:4.16.0" | |||||
api 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' | |||||
} | } |
@@ -588,6 +588,42 @@ public class APIHelper { | |||||
}).start(); | }).start(); | ||||
} | } | ||||
public static <T> OperateResultT<T> GetT(String path, Map<String,String> params, TypeReference<APIResultT<T>> defaultValue) { | |||||
try { | |||||
String ResponseAdd = BuildUrlWithParams(path,params);//请求地址和参数 | |||||
URL url = new URL(ResponseAdd); | |||||
HttpURLConnection Connection = (HttpURLConnection) url.openConnection(); | |||||
Connection.setRequestMethod("GET"); | |||||
Connection.setConnectTimeout(3000); | |||||
Connection.setReadTimeout(3000); | |||||
int responseCode = Connection.getResponseCode(); | |||||
if (responseCode == Connection.HTTP_OK) { | |||||
InputStream inputStream = Connection.getInputStream(); | |||||
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); | |||||
byte[] bytes = new byte[1024]; | |||||
int length = 0; | |||||
while ((length = inputStream.read(bytes)) != -1) { | |||||
arrayOutputStream.write(bytes, 0, length); | |||||
arrayOutputStream.flush();//强制释放缓冲区 | |||||
} | |||||
String s = arrayOutputStream.toString(); | |||||
APIResultT<T> res = JSON.parseObject(s,defaultValue); | |||||
if(res!=null && res.succeeded.toUpperCase().equals("TRUE")){ | |||||
return OperateResultT.CreateSuccess(res.data); | |||||
}else { | |||||
return OperateResultT.CreateFailed("内容解析失败"); | |||||
} | |||||
} else { | |||||
MessageLog.ShowError("get 请求失败"); | |||||
return OperateResultT.CreateFailed("get 请求失败"); | |||||
} | |||||
} catch (Exception e) { | |||||
MessageLog.ShowError(e); | |||||
return OperateResultT.CreateFailed("POST 请求异常"); | |||||
} | |||||
} | |||||
/** | /** | ||||
* 请求参数拼接 | * 请求参数拼接 | ||||
* @param Url 请求地址 | * @param Url 请求地址 | ||||
@@ -12,6 +12,7 @@ import android.util.Log; | |||||
import androidx.core.content.ContextCompat; | import androidx.core.content.ContextCompat; | ||||
import com.apkfuns.logutils.LogUtils; | |||||
import com.bonait.bnframework.business.ConfigData; | import com.bonait.bnframework.business.ConfigData; | ||||
import com.bonait.bnframework.common.constant.ConfigName; | import com.bonait.bnframework.common.constant.ConfigName; | ||||
import com.bonait.bnframework.common.constant.DataBus; | import com.bonait.bnframework.common.constant.DataBus; | ||||
@@ -29,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||||
import com.bonait.bnframework.common.db.mode.BPA_USER; | import com.bonait.bnframework.common.db.mode.BPA_USER; | ||||
import com.bonait.bnframework.common.db.res.AlertLogEnum; | import com.bonait.bnframework.common.db.res.AlertLogEnum; | ||||
import com.bonait.bnframework.common.db.res.UserLogEnum; | import com.bonait.bnframework.common.db.res.UserLogEnum; | ||||
import com.bonait.bnframework.common.glide.GlideApp; | |||||
import com.bonait.bnframework.common.helper.CrashHandler; | import com.bonait.bnframework.common.helper.CrashHandler; | ||||
import com.bonait.bnframework.common.helper.I.IMessageLogNotify; | import com.bonait.bnframework.common.helper.I.IMessageLogNotify; | ||||
import com.bonait.bnframework.common.helper.MessageLog; | import com.bonait.bnframework.common.helper.MessageLog; | ||||
@@ -92,6 +94,13 @@ public class MainApplication extends Application { | |||||
} | } | ||||
} | } | ||||
@Override | |||||
public void onLowMemory() { | |||||
LogUtils.d("MainApplication onLowMemory"); | |||||
super.onLowMemory(); | |||||
GlideApp.get(this).clearMemory(); | |||||
} | |||||
/** | /** | ||||
* 腾讯bugly 异常检测上班 | * 腾讯bugly 异常检测上班 | ||||
*/ | */ | ||||
@@ -136,4 +145,10 @@ public class MainApplication extends Application { | |||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
@Override | |||||
protected void attachBaseContext(Context base) { | |||||
super.attachBaseContext(base); | |||||
// MultiDex.install(this); | |||||
} | |||||
} | } |
@@ -3583,10 +3583,10 @@ public class QueryDB { | |||||
data = new BPA_SILOS_CALIBRATE(); | data = new BPA_SILOS_CALIBRATE(); | ||||
//私有 | //私有 | ||||
((BPA_SILOS_CALIBRATE) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | ((BPA_SILOS_CALIBRATE) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | ||||
((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getInt((int) cursor.getColumnIndex("inputWightMin")); | |||||
((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getInt((int) cursor.getColumnIndex("inputWightMax")); | |||||
((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getInt((int) cursor.getColumnIndex("outputTimeMin")); | |||||
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getInt((int) cursor.getColumnIndex("outputTimeMax")); | |||||
((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getFloat((int) cursor.getColumnIndex("inputWightMin")); | |||||
((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getFloat((int) cursor.getColumnIndex("inputWightMax")); | |||||
((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMin")); | |||||
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMax")); | |||||
((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num")); | ((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num")); | ||||
break; | break; | ||||
} | } | ||||
@@ -25,4 +25,20 @@ public class BPA_GOODS extends ModeBase { | |||||
public String materialids; | public String materialids; | ||||
//外键集合 | //外键集合 | ||||
public String foreignKeyRe;//商品外键id | public String foreignKeyRe;//商品外键id | ||||
@Override | |||||
public String toString() { | |||||
return "BPA_GOODS{" + | |||||
"name='" + name + '\'' + | |||||
", url='" + url + '\'' + | |||||
", sort=" + sort + | |||||
", status=" + status + | |||||
", maketime=" + maketime + | |||||
", issc=" + issc + | |||||
", gyid='" + gyid + '\'' + | |||||
", goodtype='" + goodtype + '\'' + | |||||
", materialids='" + materialids + '\'' + | |||||
", foreignKeyRe='" + foreignKeyRe + '\'' + | |||||
'}'; | |||||
} | |||||
} | } |
@@ -32,7 +32,6 @@ import java.util.ArrayList; | |||||
public class FilePickerShowAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | public class FilePickerShowAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | ||||
private final LayoutInflater mLayoutInflater; | private final LayoutInflater mLayoutInflater; | ||||
private Context mContext; | |||||
private ArrayList<FileEntity> mDataList; | private ArrayList<FileEntity> mDataList; | ||||
private OnDeleteListener mOnDeleteListener; | private OnDeleteListener mOnDeleteListener; | ||||
private OnFileItemClickListener mOnItemClickListener; | private OnFileItemClickListener mOnItemClickListener; | ||||
@@ -46,7 +45,6 @@ public class FilePickerShowAdapter extends RecyclerView.Adapter<RecyclerView.Vie | |||||
} | } | ||||
public FilePickerShowAdapter(Context context, ArrayList<FileEntity> dataList) { | public FilePickerShowAdapter(Context context, ArrayList<FileEntity> dataList) { | ||||
mContext = context; | |||||
mLayoutInflater = LayoutInflater.from(context); | mLayoutInflater = LayoutInflater.from(context); | ||||
mDataList = dataList; | mDataList = dataList; | ||||
} | } | ||||
@@ -67,7 +65,7 @@ public class FilePickerShowAdapter extends RecyclerView.Adapter<RecyclerView.Vie | |||||
if (fileEntity.getFileType() != null) { | if (fileEntity.getFileType() != null) { | ||||
String title = fileEntity.getFileType().getTitle(); | String title = fileEntity.getFileType().getTitle(); | ||||
if (title.equals("IMG")) { | if (title.equals("IMG")) { | ||||
Glide.with(mContext).load(new File(fileEntity.getPath())).into(holder.mIvType); | |||||
Glide.with(holder.mIvType.getContext()).load(new File(fileEntity.getPath())).into(holder.mIvType); | |||||
} else { | } else { | ||||
holder.mIvType.setImageResource(fileEntity.getFileType().getIconStyle()); | holder.mIvType.setImageResource(fileEntity.getFileType().getIconStyle()); | ||||
} | } | ||||
@@ -0,0 +1,115 @@ | |||||
package com.bonait.bnframework.common.glide; | |||||
import android.content.Context; | |||||
import android.graphics.drawable.Drawable; | |||||
import android.view.View; | |||||
import android.widget.ImageView; | |||||
import androidx.annotation.Nullable; | |||||
import com.bonait.bnframework.common.glide.transform.FitXYRoundRadiusTransform; | |||||
import com.bumptech.glide.load.DataSource; | |||||
import com.bumptech.glide.load.engine.GlideException; | |||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; | |||||
import com.bumptech.glide.request.RequestListener; | |||||
import com.bumptech.glide.request.RequestOptions; | |||||
import com.bumptech.glide.request.target.Target; | |||||
/** | |||||
* @author: liup | |||||
* @description: | |||||
* @date: 2024/5/8 16:45. | |||||
*/ | |||||
public class GlideUtil { | |||||
private static final int CROSS_FADE_DURATION = 100; | |||||
private GlideUtil() { | |||||
throw new AssertionError(); | |||||
} | |||||
// public static String exchangeUrl(String path){ | |||||
// String result=path; | |||||
// if(!TextUtils.isEmpty(PATH_PRE)&&!TextUtils.isEmpty(path)) { | |||||
// if(!path.contains("http:")&&!path.contains("https:")){ | |||||
// if(path.contains(".png")||path.contains(".jpg")||path.contains(".jpeg")||path.contains(".gif")){ | |||||
// if(TEST) { | |||||
// result = PATH_PRE + path.replace("images", "modules"); | |||||
// }else{ | |||||
// result = PATH_PRE + path; | |||||
// } | |||||
// if(first){ | |||||
// LogUtils.d("GlideUtil exchangeUrl result:"+result); | |||||
// first=false; | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
//// LogUtils.i("GlideUtil exchangeUrl"+result); | |||||
// return result; | |||||
// } | |||||
public static void showImage(Context context, String path, ImageView imageView,int placeId) { | |||||
if (context == null||path==null) { | |||||
return; | |||||
} | |||||
GlideApp.with(context) | |||||
.load(path) | |||||
.addListener(new RequestListener<Drawable>() { | |||||
@Override | |||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, | |||||
Target<Drawable> target, boolean isFirstResource) { | |||||
return false; | |||||
} | |||||
@Override | |||||
public boolean onResourceReady(Drawable resource, Object model, | |||||
Target<Drawable> target, DataSource dataSource, | |||||
boolean isFirstResource) { | |||||
if (imageView == null) { | |||||
return false; | |||||
} | |||||
imageView.setBackground(null); | |||||
return false; | |||||
} | |||||
}) | |||||
.placeholder(placeId) | |||||
.transition(DrawableTransitionOptions.withCrossFade(CROSS_FADE_DURATION)) | |||||
.into(imageView); | |||||
} | |||||
public static void showImageWithRadius(Context context, String path, ImageView imageView,int placeId,int radius) { | |||||
if (context == null||path==null) { | |||||
return; | |||||
} | |||||
setType(imageView); | |||||
GlideApp.with(context) | |||||
.load(path) | |||||
.addListener(new RequestListener<Drawable>() { | |||||
@Override | |||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, | |||||
Target<Drawable> target, boolean isFirstResource) { | |||||
return false; | |||||
} | |||||
@Override | |||||
public boolean onResourceReady(Drawable resource, Object model, | |||||
Target<Drawable> target, DataSource dataSource, | |||||
boolean isFirstResource) { | |||||
if (imageView == null) { | |||||
return false; | |||||
} | |||||
imageView.setBackground(null); | |||||
return false; | |||||
} | |||||
}) | |||||
.transition(DrawableTransitionOptions.withCrossFade(CROSS_FADE_DURATION)) | |||||
// .apply(RequestOptions.bitmapTransform(new RoundedCorners(RADIUS))) | |||||
.apply(new RequestOptions().transform(new FitXYRoundRadiusTransform(radius))) | |||||
.into(imageView); | |||||
} | |||||
private static void setType(ImageView imageView){//硬件加速 | |||||
imageView.setLayerType(View.LAYER_TYPE_HARDWARE,null); | |||||
} | |||||
} |
@@ -0,0 +1,50 @@ | |||||
package com.bonait.bnframework.common.glide; | |||||
import android.content.Context; | |||||
import android.util.Log; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.GlideBuilder; | |||||
import com.bumptech.glide.annotation.GlideModule; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool; | |||||
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory; | |||||
import com.bumptech.glide.load.engine.cache.LruResourceCache; | |||||
import com.bumptech.glide.load.engine.cache.MemorySizeCalculator; | |||||
import com.bumptech.glide.module.AppGlideModule; | |||||
/** | |||||
* Glide模块 | |||||
* | |||||
* @author song.zheng@androidmov.com | |||||
*/ | |||||
@GlideModule | |||||
public final class MyAppGlideModule extends AppGlideModule { | |||||
@Override | |||||
public boolean isManifestParsingEnabled() { | |||||
return false; | |||||
} | |||||
@Override | |||||
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) { | |||||
builder.setLogLevel(Log.WARN); | |||||
int cacheSize100MegaBytes = 104857600; | |||||
//应用私有目录 | |||||
builder.setDiskCache( | |||||
new InternalCacheDiskCacheFactory(context, cacheSize100MegaBytes) | |||||
); | |||||
MemorySizeCalculator calculator = new MemorySizeCalculator.Builder(context) | |||||
.setMemoryCacheScreens(2) | |||||
.build(); | |||||
int defaultMemoryCacheSize = calculator.getMemoryCacheSize(); | |||||
int defaultBitmapPoolSize = calculator.getBitmapPoolSize(); | |||||
int customMemoryCacheSize = (int) (1.2 * defaultMemoryCacheSize); | |||||
int customBitmapPoolSize = (int) (1.2 * defaultBitmapPoolSize); | |||||
builder.setMemoryCache( new LruResourceCache( customMemoryCacheSize )); | |||||
builder.setBitmapPool(new LruBitmapPool( customBitmapPoolSize )); | |||||
} | |||||
} |
@@ -0,0 +1,95 @@ | |||||
package com.bonait.bnframework.common.glide.transform; | |||||
import android.graphics.Bitmap; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; | |||||
import com.bumptech.glide.util.Util; | |||||
import java.nio.ByteBuffer; | |||||
import java.security.MessageDigest; | |||||
/** | |||||
* @author: wx | |||||
* @date: 2023/1/29 | |||||
*/ | |||||
public class FitXYRoundRadiusTransform extends BitmapTransformation { | |||||
// 此处用实际类的完整路径 | |||||
private static final String ID = "com.amt.module_common.util.image.FitXYRoundRadiusTransform"; | |||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); | |||||
private final int roundingRadius; | |||||
private boolean isLeftTop = true; | |||||
private boolean isRightTop = true; | |||||
private boolean isLeftBottom = true; | |||||
private boolean isRightBottom = true; | |||||
public FitXYRoundRadiusTransform(int roundingRadius) { | |||||
this.roundingRadius = roundingRadius; | |||||
} | |||||
public FitXYRoundRadiusTransform(int roundingRadius, boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) { | |||||
this.roundingRadius = roundingRadius; | |||||
setNeedCorner(leftTop, rightTop, leftBottom, rightBottom); | |||||
} | |||||
/** | |||||
* 需要设置圆角的部分 | |||||
* | |||||
* @param leftTop 左上角 | |||||
* @param rightTop 右上角 | |||||
* @param leftBottom 左下角 | |||||
* @param rightBottom 右下角 | |||||
*/ | |||||
public void setNeedCorner(boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) { | |||||
isLeftTop = leftTop; | |||||
isRightTop = rightTop; | |||||
isLeftBottom = leftBottom; | |||||
isRightBottom = rightBottom; | |||||
} | |||||
@Override | |||||
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { | |||||
Bitmap bitmap = TransformationFitXYUtils.fitXY(pool, toTransform, outWidth, outHeight); | |||||
return TransformationFitXYUtils.roundCrop(pool, bitmap, | |||||
isLeftTop ? roundingRadius : 0, | |||||
isRightTop ? roundingRadius : 0, | |||||
isRightBottom ? roundingRadius : 0, | |||||
isLeftBottom ? roundingRadius : 0); | |||||
} | |||||
@Override | |||||
public boolean equals(Object o) { | |||||
if (o instanceof FitXYRoundRadiusTransform) { | |||||
FitXYRoundRadiusTransform other = (FitXYRoundRadiusTransform) o; | |||||
return roundingRadius == other.roundingRadius; | |||||
} | |||||
return false; | |||||
} | |||||
@Override | |||||
public int hashCode() { | |||||
return Util.hashCode(ID.hashCode(), Util.hashCode(roundingRadius)); | |||||
} | |||||
@Override | |||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { | |||||
messageDigest.update(ID_BYTES); | |||||
byte[] radiusData = ByteBuffer.allocate(4).putInt(roundingRadius).array(); | |||||
messageDigest.update(radiusData); | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
package com.bonait.bnframework.common.glide.transform; | |||||
import android.graphics.Bitmap; | |||||
import android.graphics.BitmapShader; | |||||
import android.graphics.Canvas; | |||||
import android.graphics.Paint; | |||||
import android.graphics.RectF; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; | |||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils; | |||||
import java.security.MessageDigest; | |||||
/** | |||||
* Glide边框转换 | |||||
* | |||||
* @author song.zheng@androidmov.com | |||||
*/ | |||||
public class GlideBorderTransform extends BitmapTransformation { | |||||
private final float borderWidth; | |||||
private final int borderColor; | |||||
public GlideBorderTransform(float borderWidth, int borderColor) { | |||||
super(); | |||||
this.borderWidth = borderWidth; | |||||
this.borderColor = borderColor; | |||||
} | |||||
@Override | |||||
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, | |||||
int outHeight) { | |||||
Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight); | |||||
return border(pool, bitmap); | |||||
} | |||||
private Bitmap border(BitmapPool pool, Bitmap source) { | |||||
if (source == null) { | |||||
return null; | |||||
} | |||||
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | |||||
Canvas canvas = new Canvas(result); | |||||
Paint paint = new Paint(); | |||||
paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP)); | |||||
paint.setAntiAlias(true); | |||||
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight()); | |||||
canvas.drawRect(rectF, paint); | |||||
paint.reset(); | |||||
paint.setStyle(Paint.Style.STROKE); | |||||
paint.setStrokeWidth(borderWidth); | |||||
paint.setColor(borderColor); | |||||
paint.setAntiAlias(true); | |||||
canvas.drawRect(rectF, paint); | |||||
return result; | |||||
} | |||||
public String getId() { | |||||
return getClass().getName() + Math.round(borderWidth); | |||||
} | |||||
@Override | |||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { | |||||
} | |||||
} |
@@ -0,0 +1,64 @@ | |||||
package com.bonait.bnframework.common.glide.transform; | |||||
import android.content.Context; | |||||
import android.graphics.Bitmap; | |||||
import android.graphics.BitmapShader; | |||||
import android.graphics.Canvas; | |||||
import android.graphics.Paint; | |||||
import android.graphics.RectF; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; | |||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils; | |||||
import java.security.MessageDigest; | |||||
/** | |||||
* Glide圆角转换 | |||||
* | |||||
* @author song.zheng@androidmov.com | |||||
*/ | |||||
public class GlideRoundTransform extends BitmapTransformation { | |||||
private static float radius = 0f; | |||||
public GlideRoundTransform(Context context) { | |||||
this(context, 8); | |||||
} | |||||
public GlideRoundTransform(Context context, int px) { | |||||
super(); | |||||
radius = px; | |||||
} | |||||
@Override | |||||
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, | |||||
int outHeight) { | |||||
Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight); | |||||
return roundCrop(pool, bitmap); | |||||
} | |||||
private static Bitmap roundCrop(BitmapPool pool, Bitmap source) { | |||||
if (source == null) { | |||||
return null; | |||||
} | |||||
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | |||||
Canvas canvas = new Canvas(result); | |||||
Paint paint = new Paint(); | |||||
paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP)); | |||||
paint.setAntiAlias(true); | |||||
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight()); | |||||
canvas.drawRoundRect(rectF, radius, radius, paint); | |||||
return result; | |||||
} | |||||
public String getId() { | |||||
return getClass().getName() + Math.round(radius); | |||||
} | |||||
@Override | |||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { | |||||
} | |||||
} |
@@ -0,0 +1,85 @@ | |||||
package com.bonait.bnframework.common.glide.transform; | |||||
import android.graphics.Bitmap; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; | |||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils; | |||||
import com.bumptech.glide.util.Util; | |||||
import java.nio.ByteBuffer; | |||||
import java.security.MessageDigest; | |||||
/** | |||||
* @author: wx | |||||
* @date: 2023/1/29 | |||||
*/ | |||||
public class RoundRadiusTransform extends BitmapTransformation { | |||||
// 此处用实际类的完整路径 | |||||
private static final String ID = "com.amt.module_common.util.image.RoundRadiusTransform"; | |||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); | |||||
private final int roundingRadius; | |||||
private boolean isLeftTop, isRightTop, isLeftBottom, isRightBottom; | |||||
private static RoundRadiusTransform mInstance; | |||||
public RoundRadiusTransform(int roundingRadius) { | |||||
this.roundingRadius = roundingRadius; | |||||
} | |||||
public RoundRadiusTransform(int roundingRadius,boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) { | |||||
this.roundingRadius = roundingRadius; | |||||
setNeedCorner(leftTop, rightTop, leftBottom, rightBottom); | |||||
} | |||||
/** | |||||
* 需要设置圆角的部分 | |||||
* | |||||
* @param leftTop 左上角 | |||||
* @param rightTop 右上角 | |||||
* @param leftBottom 左下角 | |||||
* @param rightBottom 右下角 | |||||
*/ | |||||
public void setNeedCorner(boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) { | |||||
isLeftTop = leftTop; | |||||
isRightTop = rightTop; | |||||
isLeftBottom = leftBottom; | |||||
isRightBottom = rightBottom; | |||||
} | |||||
@Override | |||||
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { | |||||
return TransformationUtils.roundedCorners(pool, toTransform, | |||||
isLeftTop ? roundingRadius : 0, | |||||
isRightTop ? roundingRadius : 0, | |||||
isRightBottom ? roundingRadius : 0, | |||||
isLeftBottom ? roundingRadius : 0); | |||||
} | |||||
@Override | |||||
public boolean equals(Object o) { | |||||
if (o instanceof RoundRadiusTransform) { | |||||
RoundRadiusTransform other = (RoundRadiusTransform) o; | |||||
return roundingRadius == other.roundingRadius; | |||||
} | |||||
return false; | |||||
} | |||||
@Override | |||||
public int hashCode() { | |||||
return Util.hashCode(ID.hashCode(), Util.hashCode(roundingRadius)); | |||||
} | |||||
@Override | |||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { | |||||
messageDigest.update(ID_BYTES); | |||||
byte[] radiusData = ByteBuffer.allocate(4).putInt(roundingRadius).array(); | |||||
messageDigest.update(radiusData); | |||||
} | |||||
} |
@@ -0,0 +1,155 @@ | |||||
package com.bonait.bnframework.common.glide.transform; | |||||
import android.graphics.Bitmap; | |||||
import android.graphics.BitmapShader; | |||||
import android.graphics.Canvas; | |||||
import android.graphics.Matrix; | |||||
import android.graphics.Paint; | |||||
import android.graphics.Path; | |||||
import android.graphics.RectF; | |||||
import androidx.annotation.NonNull; | |||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils; | |||||
import com.bumptech.glide.util.Synthetic; | |||||
import java.util.concurrent.TimeUnit; | |||||
import java.util.concurrent.locks.Condition; | |||||
import java.util.concurrent.locks.Lock; | |||||
/** | |||||
* @author Nov | |||||
* @date 23.7.11 | |||||
*/ | |||||
public class TransformationFitXYUtils { | |||||
private static final Lock BITMAP_DRAWABLE_LOCK = | |||||
new NoLock(); | |||||
@NonNull | |||||
private static Bitmap.Config getNonNullConfig(@NonNull Bitmap bitmap) { | |||||
return bitmap.getConfig() != null ? bitmap.getConfig() : Bitmap.Config.ARGB_8888; | |||||
} | |||||
private static void applyMatrix( | |||||
@NonNull Bitmap inBitmap, @NonNull Bitmap targetBitmap, Matrix matrix) { | |||||
BITMAP_DRAWABLE_LOCK.lock(); | |||||
try { | |||||
Canvas canvas = new Canvas(targetBitmap); | |||||
canvas.drawBitmap(inBitmap, matrix, DEFAULT_PAINT); | |||||
clear(canvas); | |||||
} finally { | |||||
BITMAP_DRAWABLE_LOCK.unlock(); | |||||
} | |||||
} | |||||
public static final int PAINT_FLAGS = Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG; | |||||
private static final Paint DEFAULT_PAINT = new Paint(PAINT_FLAGS); | |||||
private static final class NoLock implements Lock { | |||||
@Synthetic | |||||
NoLock() { | |||||
} | |||||
@Override | |||||
public void lock() { | |||||
// do nothing | |||||
} | |||||
@Override | |||||
public void lockInterruptibly() throws InterruptedException { | |||||
// do nothing | |||||
} | |||||
@Override | |||||
public boolean tryLock() { | |||||
return true; | |||||
} | |||||
@Override | |||||
public boolean tryLock(long time, @NonNull TimeUnit unit) throws InterruptedException { | |||||
return true; | |||||
} | |||||
@Override | |||||
public void unlock() { | |||||
// do nothing | |||||
} | |||||
@NonNull | |||||
@Override | |||||
public Condition newCondition() { | |||||
throw new UnsupportedOperationException("Should not be called"); | |||||
} | |||||
} | |||||
private static void clear(Canvas canvas) { | |||||
canvas.setBitmap(null); | |||||
} | |||||
public static Bitmap fitXY( | |||||
@NonNull BitmapPool pool, @NonNull Bitmap inBitmap, int width, int height) { | |||||
if (inBitmap.getWidth() == width && inBitmap.getHeight() == height) { | |||||
return inBitmap; | |||||
} | |||||
final float widthPercentage = width / (float) inBitmap.getWidth(); | |||||
final float heightPercentage = height / (float) inBitmap.getHeight(); | |||||
int targetWidth = (int) (widthPercentage * inBitmap.getWidth()); | |||||
int targetHeight = (int) (heightPercentage * inBitmap.getHeight()); | |||||
Bitmap.Config config = getNonNullConfig(inBitmap); | |||||
Bitmap toReuse = pool.get(targetWidth, targetHeight, config); | |||||
TransformationUtils.setAlpha(inBitmap, toReuse); | |||||
Matrix matrix = new Matrix(); | |||||
matrix.setScale(widthPercentage, heightPercentage); | |||||
applyMatrix(inBitmap, toReuse, matrix); | |||||
return toReuse; | |||||
} | |||||
public static Bitmap roundCrop(BitmapPool pool, | |||||
Bitmap source, | |||||
float topLeft, | |||||
float topRight, | |||||
float bottomRight, | |||||
float bottomLeft) { | |||||
if (source == null) return null; | |||||
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | |||||
if (result == null) { | |||||
result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | |||||
} | |||||
BitmapShader shader = | |||||
new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); | |||||
Paint paint = new Paint(); | |||||
paint.setShader(shader); | |||||
paint.setAntiAlias(true); | |||||
RectF rect = new RectF(0f, 0f, source.getWidth(), source.getHeight()); | |||||
BITMAP_DRAWABLE_LOCK.lock(); | |||||
try { | |||||
Canvas canvas = new Canvas(result); | |||||
Path path = new Path(); | |||||
path.addRoundRect( | |||||
rect, | |||||
new float[]{ | |||||
topLeft, | |||||
topLeft, | |||||
topRight, | |||||
topRight, | |||||
bottomRight, | |||||
bottomRight, | |||||
bottomLeft, | |||||
bottomLeft | |||||
}, | |||||
Path.Direction.CW); | |||||
canvas.drawPath(path, paint); | |||||
clear(canvas); | |||||
} finally { | |||||
BITMAP_DRAWABLE_LOCK.unlock(); | |||||
} | |||||
return result; | |||||
} | |||||
} |
@@ -27,12 +27,14 @@ public class GoodLeftAdapter extends BaseQuickAdapter<LinkMode, BaseViewHolder> | |||||
public List<LinkMode> Fdata; | public List<LinkMode> Fdata; | ||||
public Resources resources; | public Resources resources; | ||||
public LinearLayoutManager Manager; | public LinearLayoutManager Manager; | ||||
private CallBack callBack; | |||||
public GoodLeftAdapter(@LayoutRes int layoutResId, @Nullable List<LinkMode> data, Resources _resources, LinearLayoutManager _manager) { | |||||
public GoodLeftAdapter(@LayoutRes int layoutResId, @Nullable List<LinkMode> data, Resources _resources, LinearLayoutManager _manager,CallBack callBack) { | |||||
super(layoutResId, data); | super(layoutResId, data); | ||||
resources = _resources; | resources = _resources; | ||||
Fdata = data; | Fdata = data; | ||||
Manager = _manager; | Manager = _manager; | ||||
this.callBack =callBack; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -117,6 +119,9 @@ public class GoodLeftAdapter extends BaseQuickAdapter<LinkMode, BaseViewHolder> | |||||
public void onClick(QMUIDialog dialog, int index) { | public void onClick(QMUIDialog dialog, int index) { | ||||
Detele(index_d); | Detele(index_d); | ||||
dialog.dismiss(); | dialog.dismiss(); | ||||
if(callBack!=null){ | |||||
callBack.delete(); | |||||
} | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -146,4 +151,8 @@ public class GoodLeftAdapter extends BaseQuickAdapter<LinkMode, BaseViewHolder> | |||||
Fdata.get(position).isChoose = true; | Fdata.get(position).isChoose = true; | ||||
notifyDataSetChanged(); | notifyDataSetChanged(); | ||||
} | } | ||||
public interface CallBack{ | |||||
void delete(); | |||||
} | |||||
} | } |
@@ -29,6 +29,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | ||||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | ||||
import com.bonait.bnframework.common.db.res.ResMaterilas; | import com.bonait.bnframework.common.db.res.ResMaterilas; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.message.MessageLooper; | import com.bonait.bnframework.common.message.MessageLooper; | ||||
import com.bonait.bnframework.common.message.MessageManager; | import com.bonait.bnframework.common.message.MessageManager; | ||||
@@ -198,7 +199,8 @@ public class AddGoodDialog extends Dialog { | |||||
public void onMessage(Object msg) { | public void onMessage(Object msg) { | ||||
if (msg != null) { | if (msg != null) { | ||||
url=(String) msg; | url=(String) msg; | ||||
new MyBitmapUtils().disPlay(cpfm,url); | |||||
GlideUtil.showImage(cpfm.getContext(),url,cpfm,R.mipmap.loading3); | |||||
// new MyBitmapUtils().disPlay(cpfm,url); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
@@ -286,7 +288,8 @@ public class AddGoodDialog extends Dialog { | |||||
{ | { | ||||
edittext.setText(Data.name); | edittext.setText(Data.name); | ||||
edittext1.setText(Data.foreignKeyRe); | edittext1.setText(Data.foreignKeyRe); | ||||
new MyBitmapUtils().disPlay(cpfm,Data.url); | |||||
// new MyBitmapUtils().disPlay(cpfm,Data.url); | |||||
GlideUtil.showImage(cpfm.getContext(),url,cpfm,R.mipmap.loading3); | |||||
int index=0; | int index=0; | ||||
for (Map.Entry<String, String> entry : map_fl.entrySet()) { | for (Map.Entry<String, String> entry : map_fl.entrySet()) { | ||||
String key = entry.getKey(); | String key = entry.getKey(); | ||||
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.common.constant.DataBus; | import com.bonait.bnframework.common.constant.DataBus; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | import com.bonait.bnframework.common.db.mode.BPA_GOODS; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.helper.I.MyClickListener; | import com.bonait.bnframework.common.helper.I.MyClickListener; | ||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
@@ -70,7 +71,8 @@ public class image_sp_adapter extends RecyclerView.Adapter<RecyclerView.ViewHold | |||||
if (holder instanceof MyLCViewHolder1) { | if (holder instanceof MyLCViewHolder1) { | ||||
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | ||||
//设置图片 | //设置图片 | ||||
new MyBitmapUtils().disPlay(myViewHolder.img,goods.get(position).url); | |||||
// new MyBitmapUtils().disPlay(myViewHolder.img,goods.get(position).url); | |||||
GlideUtil.showImage(myViewHolder.img.getContext(),goods.get(position).url,myViewHolder.img,R.mipmap.loading3); | |||||
myViewHolder.img.setOnClickListener(new View.OnClickListener() { | myViewHolder.img.setOnClickListener(new View.OnClickListener() { | ||||
@Override | @Override | ||||
public void onClick(View view) { | public void onClick(View view) { | ||||
@@ -56,6 +56,15 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH | |||||
private final LayoutInflater mLayoutInflater; | private final LayoutInflater mLayoutInflater; | ||||
Handler handler = new Handler(); | Handler handler = new Handler(); | ||||
public void destroy(){ | |||||
if(handler!=null){ | |||||
handler.removeCallbacksAndMessages(null); | |||||
handler = null; | |||||
} | |||||
datas.clear(); | |||||
datas = null; | |||||
mListener = null; | |||||
} | |||||
public loadinggood_adapter(Context context,MyClickListener myClickListener) { | public loadinggood_adapter(Context context,MyClickListener myClickListener) { | ||||
// this.conmain = context; | // this.conmain = context; | ||||
@@ -22,6 +22,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | |||||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | ||||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | ||||
import com.bonait.bnframework.common.db.res.lcMode; | import com.bonait.bnframework.common.db.res.lcMode; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.message.MessageManager; | import com.bonait.bnframework.common.message.MessageManager; | ||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
@@ -75,7 +76,8 @@ public class newgood_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolde | |||||
myViewHolder.Tag_text.setText(goods.name); | myViewHolder.Tag_text.setText(goods.name); | ||||
//设置图片 | //设置图片 | ||||
if (!goods.url.equals("未知") && !goods.url.isEmpty() && !goods.url.equals("")) { | if (!goods.url.equals("未知") && !goods.url.isEmpty() && !goods.url.equals("")) { | ||||
myBitmapUtils.disPlay(myViewHolder.ImageUrl, goods.url); | |||||
// myBitmapUtils.disPlay(myViewHolder.ImageUrl, goods.url); | |||||
GlideUtil.showImage(myViewHolder.ImageUrl.getContext(),goods.url,myViewHolder.ImageUrl,R.mipmap.loading3); | |||||
} | } | ||||
/** | /** | ||||
@@ -12,10 +12,12 @@ import android.widget.TextView; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||
import com.apkfuns.logutils.LogUtils; | |||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.common.constant.MessageName; | import com.bonait.bnframework.common.constant.MessageName; | ||||
import com.bonait.bnframework.common.db.QueryDB; | import com.bonait.bnframework.common.db.QueryDB; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | import com.bonait.bnframework.common.db.mode.BPA_GOODS; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.message.MessageManager; | import com.bonait.bnframework.common.message.MessageManager; | ||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
@@ -47,7 +49,7 @@ public class newmakegood_adapter extends RecyclerView.Adapter<RecyclerView.View | |||||
@Override | @Override | ||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||||
View inflate = mLayoutInflater.inflate(R.layout.newmakegood, parent, false); | View inflate = mLayoutInflater.inflate(R.layout.newmakegood, parent, false); | ||||
return new newgood_adapter.MyLCViewHolder1(inflate); | |||||
return new MyLCViewHolder1(inflate); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -60,15 +62,16 @@ public class newmakegood_adapter extends RecyclerView.Adapter<RecyclerView.View | |||||
@Override | @Override | ||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | ||||
try { | try { | ||||
if (holder instanceof newgood_adapter.MyLCViewHolder1) { | |||||
if (holder instanceof MyLCViewHolder1) { | |||||
BPA_GOODS goods = (BPA_GOODS) Data.get(position); | BPA_GOODS goods = (BPA_GOODS) Data.get(position); | ||||
newgood_adapter.MyLCViewHolder1 myViewHolder = (newgood_adapter.MyLCViewHolder1) holder; | |||||
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | |||||
myViewHolder.Tag_text.setText(goods.name); | myViewHolder.Tag_text.setText(goods.name); | ||||
//设置图片 | //设置图片 | ||||
if (!goods.url.equals("未知") && !goods.url.isEmpty() && !goods.url.equals("")) { | |||||
myBitmapUtils.disPlay(myViewHolder.ImageUrl, goods.url); | |||||
if (goods.url!=null && !goods.url.equals("未知") && !goods.url.isEmpty()) { | |||||
// myBitmapUtils.disPlay(myViewHolder.ImageUrl, goods.url); | |||||
GlideUtil.showImage(myViewHolder.ImageUrl.getContext(),goods.url,myViewHolder.ImageUrl,R.mipmap.loading3); | |||||
} | } | ||||
/** | /** | ||||
@@ -77,6 +80,10 @@ public class newmakegood_adapter extends RecyclerView.Adapter<RecyclerView.View | |||||
myViewHolder.ImageUrl.setOnClickListener(new View.OnClickListener() { | myViewHolder.ImageUrl.setOnClickListener(new View.OnClickListener() { | ||||
@Override | @Override | ||||
public void onClick(View view) { | public void onClick(View view) { | ||||
LogUtils.d(" MessageName.ClickMakeGoodNew sendMessage"); | |||||
if(goods!=null){ | |||||
LogUtils.d(" goods="+goods.toString()); | |||||
} | |||||
MessageManager.getInstance().sendMessage(MessageName.ClickMakeGoodNew,goods); | MessageManager.getInstance().sendMessage(MessageName.ClickMakeGoodNew,goods); | ||||
} | } | ||||
}); | }); | ||||
@@ -10,6 +10,7 @@ import androidx.core.content.ContextCompat; | |||||
import androidx.recyclerview.widget.LinearLayoutManager; | import androidx.recyclerview.widget.LinearLayoutManager; | ||||
import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||
import android.annotation.SuppressLint; | |||||
import android.app.Activity; | import android.app.Activity; | ||||
import android.content.Context; | import android.content.Context; | ||||
import android.content.res.Resources; | import android.content.res.Resources; | ||||
@@ -38,6 +39,7 @@ import android.widget.RelativeLayout; | |||||
import android.widget.TextView; | import android.widget.TextView; | ||||
import android.widget.Toast; | import android.widget.Toast; | ||||
import com.apkfuns.logutils.LogUtils; | |||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.business.ConfigData; | import com.bonait.bnframework.business.ConfigData; | ||||
import com.bonait.bnframework.business.ExecuteTheRecipe; | import com.bonait.bnframework.business.ExecuteTheRecipe; | ||||
@@ -199,7 +201,6 @@ public class MakeGoodFragment extends BaseFragment { | |||||
initTopBar(); | initTopBar(); | ||||
Initdata(); | Initdata(); | ||||
Run(); | Run(); | ||||
/*ShaomaTest.Getinstance().Open(activity,this.context);*/ | /*ShaomaTest.Getinstance().Open(activity,this.context);*/ | ||||
/* SerialManage.GetInstance().init(new SerialInter() { | /* SerialManage.GetInstance().init(new SerialInter() { | ||||
@Override | @Override | ||||
@@ -233,6 +234,8 @@ public class MakeGoodFragment extends BaseFragment { | |||||
} | } | ||||
public List<LinkMode> Fdata = new ArrayList<>(); | public List<LinkMode> Fdata = new ArrayList<>(); | ||||
private boolean isResume = false; | |||||
private boolean destroy = false; | |||||
/** | /** | ||||
* 初始化数据 | * 初始化数据 | ||||
@@ -424,18 +427,19 @@ public class MakeGoodFragment extends BaseFragment { | |||||
mTopBar.setTitle("智慧菠萝点餐系统" + ConfigName.getInstance().Version); | mTopBar.setTitle("智慧菠萝点餐系统" + ConfigName.getInstance().Version); | ||||
mTopBar.addLeftImageButton(R.mipmap.silos1, 1).setOnClickListener(new View.OnClickListener() { | |||||
@Override | |||||
public void onClick(View v) { | |||||
add_manguan.SetData(); | |||||
add_manguan.setVisibility(View.VISIBLE); | |||||
} | |||||
}); | |||||
// mTopBar.addLeftImageButton(R.mipmap.silos1, 1).setOnClickListener(new View.OnClickListener() { | |||||
// @Override | |||||
// public void onClick(View v) { | |||||
// add_manguan.SetData(); | |||||
// add_manguan.setVisibility(View.VISIBLE); | |||||
// } | |||||
// }); | |||||
//打开 | //打开 | ||||
MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.ClickMakeGoodNew, new MessageLooper.OnMessageListener() { | MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.ClickMakeGoodNew, new MessageLooper.OnMessageListener() { | ||||
@Override | @Override | ||||
public void onMessage(Object msg) { | public void onMessage(Object msg) { | ||||
LogUtils.d(" MessageName.ClickMakeGoodNew onMessage"); | |||||
if (msg != null) { | if (msg != null) { | ||||
BPA_GOODS goods = (BPA_GOODS) msg; | BPA_GOODS goods = (BPA_GOODS) msg; | ||||
@@ -506,27 +510,40 @@ public class MakeGoodFragment extends BaseFragment { | |||||
String message = ""; | String message = ""; | ||||
@SuppressLint("HandlerLeak") | |||||
private Handler mHandler = new Handler() { | private Handler mHandler = new Handler() { | ||||
public void handleMessage(Message msg) { | public void handleMessage(Message msg) { | ||||
switch (msg.what) { | |||||
case 0: | |||||
plc_status.setText(ConfigName.getInstance().PlcIsConnect ? "正常" : "异常"); | |||||
plc_status.setTextColor(ConfigName.getInstance().PlcIsConnect ? Color.parseColor("#4CAF50") : Color.parseColor("#D32F2F")); | |||||
if(isResume){ | |||||
switch (msg.what) { | |||||
case 0: | |||||
plc_status.setText(ConfigName.getInstance().PlcIsConnect ? "正常" : "异常"); | |||||
plc_status.setTextColor(ConfigName.getInstance().PlcIsConnect ? Color.parseColor("#4CAF50") : Color.parseColor("#D32F2F")); | |||||
// wendu1.setText(ExecuteTheRecipe.WaterTemp + "°C"); | // wendu1.setText(ExecuteTheRecipe.WaterTemp + "°C"); | ||||
MessageLog.ShowInfo("重量 ExecuteTheRecipe.OutletWeigh="+ExecuteTheRecipe.OutletWeigh); | |||||
dianzichen.setText(String.valueOf((int) ExecuteTheRecipe.OutletWeigh / 10.0) + " g"); | |||||
break; | |||||
case 1: | |||||
ToastUtils.warning(message); | |||||
break; | |||||
case 2: | |||||
ToastUtils.info(message); | |||||
break; | |||||
MessageLog.ShowInfo("重量 ExecuteTheRecipe.OutletWeigh="+ExecuteTheRecipe.OutletWeigh); | |||||
dianzichen.setText(String.valueOf((int) ExecuteTheRecipe.OutletWeigh / 10.0) + " g"); | |||||
break; | |||||
case 1: | |||||
ToastUtils.warning(message); | |||||
break; | |||||
case 2: | |||||
ToastUtils.info(message); | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
@Override | |||||
public void onResume() { | |||||
super.onResume(); | |||||
isResume = true; | |||||
} | |||||
int time=0; | int time=0; | ||||
@@ -632,41 +649,43 @@ public class MakeGoodFragment extends BaseFragment { | |||||
new Thread(new Runnable() { | new Thread(new Runnable() { | ||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (true) { | |||||
try { | |||||
mHandler.sendEmptyMessage(0); | |||||
if(time>=60) //12秒执行一次 | |||||
{ | |||||
ArrayList<lcMode> lcModes = DataBus.getInstance().ResGetLc(); | |||||
String title=""; | |||||
for (lcMode item:lcModes) | |||||
while (true && !destroy) { | |||||
if(mHandler!=null){ | |||||
try { | |||||
mHandler.sendEmptyMessage(0); | |||||
if(time>=60) //12秒执行一次 | |||||
{ | { | ||||
//lcMode.warningValue >= lcMode.silosmargin | |||||
//总量大于0 绑定了物料 告警值设置了 告警大于余量 告警 | |||||
if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin) | |||||
ArrayList<lcMode> lcModes = DataBus.getInstance().ResGetLc(); | |||||
String title=""; | |||||
for (lcMode item:lcModes) | |||||
{ | { | ||||
title+="料仓"+item.num+"-"+item.materialName+"|"; | |||||
//lcMode.warningValue >= lcMode.silosmargin | |||||
//总量大于0 绑定了物料 告警值设置了 告警大于余量 告警 | |||||
if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin) | |||||
{ | |||||
title+="料仓"+item.num+"-"+item.materialName+"|"; | |||||
} | |||||
} | } | ||||
} | |||||
if(!title.isEmpty()) | |||||
{ | |||||
String finalTitle = title; | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
//0.6 --- 0.9 | |||||
CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》"); | |||||
} | |||||
}); | |||||
} | |||||
if(!title.isEmpty()) | |||||
{ | |||||
String finalTitle = title; | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
//0.6 --- 0.9 | |||||
CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》"); | |||||
} | |||||
}); | |||||
} | |||||
time=0; | |||||
time=0; | |||||
} | |||||
Thread.sleep(200); | |||||
time++; | |||||
} catch (Exception ex) { | |||||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||||
} | } | ||||
Thread.sleep(200); | |||||
time++; | |||||
} catch (Exception ex) { | |||||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -676,106 +695,106 @@ public class MakeGoodFragment extends BaseFragment { | |||||
ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT<String>() { | ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT<String>() { | ||||
@Override | @Override | ||||
public void Run(String msg2) { | public void Run(String msg2) { | ||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
String msg = msg2; | |||||
if(activity!=null){ | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
String msg = msg2; | |||||
// if(ConfigName.TEST){ | // if(ConfigName.TEST){ | ||||
// msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | "; | // msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | "; | ||||
// } | // } | ||||
if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) { | |||||
//拿到扫码数据 | |||||
//例如 ORD001|P0003|A001,M002,T001|2 | |||||
// OR001|A001|2,22|1 | |||||
String[] res = ((String) msg).split("[|]"); | |||||
if (res.length >= 4) { | |||||
String orderid = res[0];//ORD001 | |||||
String goodid = res[1];//P0003 商品id | |||||
String ggid = res[2];//A001,M002,T001 配方ids | |||||
String ggids = "";//规格id集合 | |||||
String names = ""; | |||||
if (QueryDB.GetOrderthirdPartyIDIs(orderid)) { | |||||
message = "已有订单,重复扫码!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
return; | |||||
} | |||||
int num = 1; | |||||
try { | |||||
num = Integer.parseInt(res[3]); | |||||
for (String item : ggid.split("[,]")) { | |||||
for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) { | |||||
if (k.child != null && k.child.size() > 0) { | |||||
for (ResGoodProperty chd : k.child) { | |||||
if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) { | |||||
ggids += chd.id + ","; | |||||
names += "/" + chd.name; | |||||
if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) { | |||||
//拿到扫码数据 | |||||
//例如 ORD001|P0003|A001,M002,T001|2 | |||||
// OR001|A001|2,22|1 | |||||
String[] res = ((String) msg).split("[|]"); | |||||
if (res.length >= 4) { | |||||
String orderid = res[0];//ORD001 | |||||
String goodid = res[1];//P0003 商品id | |||||
String ggid = res[2];//A001,M002,T001 配方ids | |||||
String ggids = "";//规格id集合 | |||||
String names = ""; | |||||
if (QueryDB.GetOrderthirdPartyIDIs(orderid)) { | |||||
message = "已有订单,重复扫码!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
return; | |||||
} | |||||
int num = 1; | |||||
try { | |||||
num = Integer.parseInt(res[3]); | |||||
for (String item : ggid.split("[,]")) { | |||||
for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) { | |||||
if (k.child != null && k.child.size() > 0) { | |||||
for (ResGoodProperty chd : k.child) { | |||||
if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) { | |||||
ggids += chd.id + ","; | |||||
names += "/" + chd.name; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | |||||
} | |||||
} | } | ||||
} | |||||
if (!ggids.isEmpty()) { | |||||
ggids = ggids.substring(0, ggids.length() - 1); | |||||
if (!ggids.isEmpty()) { | |||||
ggids = ggids.substring(0, ggids.length() - 1); | |||||
} | |||||
} catch (Exception ex) { | |||||
} | } | ||||
} catch (Exception ex) { | |||||
} | |||||
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid); | |||||
ConfigName.getInstance(); | |||||
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid); | |||||
ConfigName.getInstance(); | |||||
// if(ConfigName.TEST){ | // if(ConfigName.TEST){ | ||||
// good = QueryDB.GetGoodsId(goodid); | // good = QueryDB.GetGoodsId(goodid); | ||||
// } | // } | ||||
if (good == null) { | |||||
message = "没有查询到该商品!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
} else { | |||||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id); | |||||
if (goodsrecipename != null) { | |||||
BPA_ORDER order = new BPA_ORDER(); | |||||
order.thirdPartyID = orderid; | |||||
order.status = 0; | |||||
order.deviceID = ConfigName.getInstance().DeviceId; | |||||
order.userID = ConfigName.getInstance().user.userID; | |||||
QueryDB.AddOrder(order); | |||||
for (int mm = 0; mm < num; mm++) { | |||||
BPA_SUBORDER suborder = new BPA_SUBORDER(); | |||||
suborder.deviceID = ConfigName.getInstance().DeviceId; | |||||
suborder.userID = ConfigName.getInstance().user.userID; | |||||
suborder.orderID = order.id; | |||||
suborder.goodsID = good.id; | |||||
suborder.recipeID = goodsrecipename.id; | |||||
suborder.number = 1; | |||||
suborder.status = 0; | |||||
suborder.exp = names; | |||||
QueryDB.AddSubOrder(suborder); | |||||
DataBus.getInstance().AddGoodsMake(suborder); | |||||
} | |||||
message = "加入订单队列成功!"; | |||||
mHandler.sendEmptyMessage(2); | |||||
} else { | |||||
message = "没有查询到该商品配方信息!"; | |||||
if (good == null) { | |||||
message = "没有查询到该商品!"; | |||||
mHandler.sendEmptyMessage(1); | mHandler.sendEmptyMessage(1); | ||||
} else { | |||||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id); | |||||
if (goodsrecipename != null) { | |||||
BPA_ORDER order = new BPA_ORDER(); | |||||
order.thirdPartyID = orderid; | |||||
order.status = 0; | |||||
order.deviceID = ConfigName.getInstance().DeviceId; | |||||
order.userID = ConfigName.getInstance().user.userID; | |||||
QueryDB.AddOrder(order); | |||||
for (int mm = 0; mm < num; mm++) { | |||||
BPA_SUBORDER suborder = new BPA_SUBORDER(); | |||||
suborder.deviceID = ConfigName.getInstance().DeviceId; | |||||
suborder.userID = ConfigName.getInstance().user.userID; | |||||
suborder.orderID = order.id; | |||||
suborder.goodsID = good.id; | |||||
suborder.recipeID = goodsrecipename.id; | |||||
suborder.number = 1; | |||||
suborder.status = 0; | |||||
suborder.exp = names; | |||||
QueryDB.AddSubOrder(suborder); | |||||
DataBus.getInstance().AddGoodsMake(suborder); | |||||
} | |||||
message = "加入订单队列成功!"; | |||||
mHandler.sendEmptyMessage(2); | |||||
} else { | |||||
message = "没有查询到该商品配方信息!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
} | |||||
} | } | ||||
} | |||||
} else { | |||||
message = "没有查询到该商品!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
} | |||||
} else { | } else { | ||||
message = "没有查询到该商品!"; | |||||
message = "服务器异常,请稍后重试!"; | |||||
mHandler.sendEmptyMessage(1); | mHandler.sendEmptyMessage(1); | ||||
} | } | ||||
} else { | |||||
message = "服务器异常,请稍后重试!"; | |||||
mHandler.sendEmptyMessage(1); | |||||
} | } | ||||
} | |||||
}); | |||||
}); | |||||
} | |||||
} | } | ||||
}; | }; | ||||
@@ -830,10 +849,24 @@ public class MakeGoodFragment extends BaseFragment { | |||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
Logger.d("第一页销毁"); | Logger.d("第一页销毁"); | ||||
destroy = true; | |||||
isResume = false; | |||||
myClickListener = null; | |||||
Fdata.clear(); | |||||
Fdata = null; | |||||
datatab_paiduishangping.setAdapter(null); | |||||
rv_right.setAdapter(null); | rv_right.setAdapter(null); | ||||
if(DataBus.getInstance().loadinggoodAdapter!=null){ | |||||
DataBus.getInstance().loadinggoodAdapter.destroy(); | |||||
} | |||||
Glide.get(getContext()).clearMemory(); | Glide.get(getContext()).clearMemory(); | ||||
ExecuteTheRecipe.OnScanTheCodeInformationT = null; | |||||
MessageManager.getInstance().unRegisterMessageReceiver(getActivity()); | MessageManager.getInstance().unRegisterMessageReceiver(getActivity()); | ||||
if(mHandler!=null){ | |||||
mHandler.removeCallbacksAndMessages(null); | |||||
mHandler = null; | |||||
} | |||||
activity = null; | |||||
} | } | ||||
/** | /** | ||||
@@ -293,6 +293,8 @@ public class GoodPeiFangActivity extends BaseActivity { | |||||
*/ | */ | ||||
ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>(); | ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>(); | ||||
public List<LinkMode> Fdata = new ArrayList<>(); | public List<LinkMode> Fdata = new ArrayList<>(); | ||||
private GoodLeftAdapter leftAdapter; | |||||
private GoodRightAdapter rightAdapter; | |||||
/** | /** | ||||
* 初始化数据 | * 初始化数据 | ||||
@@ -338,8 +340,15 @@ public class GoodPeiFangActivity extends BaseActivity { | |||||
} | } | ||||
LinearLayoutManager manager = (LinearLayoutManager) rv_right.getLayoutManager(); | LinearLayoutManager manager = (LinearLayoutManager) rv_right.getLayoutManager(); | ||||
GoodLeftAdapter leftAdapter = new GoodLeftAdapter(R.layout.item_left_good, Fdata, getResources(), manager); | |||||
GoodRightAdapter rightAdapter = new GoodRightAdapter(R.layout.item_right_lc, Fdata, getResources()); | |||||
leftAdapter = new GoodLeftAdapter(R.layout.item_left_good, Fdata, getResources(), manager, new GoodLeftAdapter.CallBack() { | |||||
@Override | |||||
public void delete() { | |||||
if(rightAdapter!=null){ | |||||
rightAdapter.notifyDataSetChanged(); | |||||
} | |||||
} | |||||
}); | |||||
rightAdapter = new GoodRightAdapter(R.layout.item_right_lc, Fdata, getResources()); | |||||
rv_left.setAdapter(leftAdapter); | rv_left.setAdapter(leftAdapter); | ||||
rv_right.setAdapter(rightAdapter); | rv_right.setAdapter(rightAdapter); | ||||
@@ -422,10 +431,20 @@ public class GoodPeiFangActivity extends BaseActivity { | |||||
public void onDestroy() { | public void onDestroy() { | ||||
add_pf.destroy(); | add_pf.destroy(); | ||||
add_good.destroy(); | add_good.destroy(); | ||||
add_pf_home.destroy(); | |||||
super.onDestroy(); | super.onDestroy(); | ||||
add_good.mListener = null; | |||||
add_pf_home.mListener = null; | |||||
add_pf.mListener = null; | |||||
goodstypes.clear(); | |||||
goodstypes = null; | |||||
rv_right.setAdapter(null); | rv_right.setAdapter(null); | ||||
rv_left.setAdapter(null); | |||||
Glide.get(this).clearMemory(); | Glide.get(this).clearMemory(); | ||||
MessageManager.getInstance().unRegisterMessageReceiver(this); | MessageManager.getInstance().unRegisterMessageReceiver(this); | ||||
context = null; | |||||
activity = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -181,6 +181,10 @@ public class ImageSourceActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
yx_files.clear(); | |||||
yx_files = null; | |||||
mRecyclerView.setAdapter(null); | |||||
rl_yx_file.setAdapter(null); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -109,6 +109,7 @@ public class JcsjglActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
viewpager_wl.setAdapter(null); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -238,6 +238,19 @@ public class LogActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
bpa_logs.clear(); | |||||
bpa_logs = null; | |||||
if(adapter!=null){ | |||||
adapter.clear(); | |||||
adapter = null; | |||||
} | |||||
datatab.setAdapter(null); | |||||
rzlx.setAdapter(null); | |||||
datatab = null; | |||||
lx_map.clear(); | |||||
lx_map = null; | |||||
context = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -95,7 +95,8 @@ public class OrderListActivity extends BaseActivity { | |||||
Spinner rzlx; | Spinner rzlx; | ||||
Map<String,Integer> lx_map = new LinkedHashMap<>(); | Map<String,Integer> lx_map = new LinkedHashMap<>(); | ||||
//endregion | //endregion | ||||
private Context context;private ViewGroup view; | |||||
private Context context; | |||||
private ViewGroup view; | |||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
@@ -234,6 +235,17 @@ public class OrderListActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
if(adapter!=null){ | |||||
adapter.clear(); | |||||
adapter = null; | |||||
} | |||||
subOrders.clear(); | |||||
subOrders = null; | |||||
lx_map.clear(); | |||||
lx_map = null; | |||||
context = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -96,6 +96,7 @@ public class PlcControlActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
viewpager_wl.setAdapter(null); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -42,14 +42,12 @@ public class RealTimeActivity extends BaseActivity { | |||||
QMUITopBarLayout mTopBar; | QMUITopBarLayout mTopBar; | ||||
@BindView(R.id.recycler_view) | @BindView(R.id.recycler_view) | ||||
RecyclerView recycler_view; | RecyclerView recycler_view; | ||||
private Context context; | |||||
Activity activity=null; | Activity activity=null; | ||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
setContentView(R.layout.activity_realtime); | setContentView(R.layout.activity_realtime); | ||||
ButterKnife.bind(this); | ButterKnife.bind(this); | ||||
context=getContext(); | |||||
activity=this; | activity=this; | ||||
initTopBar(); | initTopBar(); | ||||
initFragment(); | initFragment(); | ||||
@@ -250,6 +248,14 @@ public class RealTimeActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
if(adapter != null){ | |||||
adapter.statusModes.clear(); | |||||
adapter.statusModes = null; | |||||
adapter.activity = null; | |||||
adapter = null; | |||||
} | |||||
recycler_view.setAdapter(null); | |||||
activity = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -236,6 +236,16 @@ public class SalesStatisticsActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
subOrders.clear(); | |||||
subOrders = null; | |||||
subOrdersStatic.clear(); | |||||
subOrdersStatic = null; | |||||
if(adapter!=null){ | |||||
adapter.clear(); | |||||
adapter = null; | |||||
} | |||||
context = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -162,7 +162,7 @@ public class SilosNewActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void clickListenerNew(View v, int k, Object data) { | public void clickListenerNew(View v, int k, Object data) { | ||||
if (k == 0) { | if (k == 0) { | ||||
silos_jz.close(); | |||||
silos_jz.destroy(); | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
@@ -228,8 +228,14 @@ public class SilosNewActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
silos_jz.close(); | |||||
MessageManager.getInstance().unRegisterMessageReceiver(this); | MessageManager.getInstance().unRegisterMessageReceiver(this); | ||||
silos_jz.destroy(); | |||||
add_yijian.destroy(); | |||||
add_yijian.mListener = null; | |||||
add_silos.mListener = null; | |||||
silos_jz.mListener = null; | |||||
activity = null; | |||||
context = null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -213,6 +213,17 @@ public class SystemParameterActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
environment.setAdapter(null); | |||||
versionselection.setAdapter(null); | |||||
editTextLists.clear(); | |||||
editTextLists = null; | |||||
material_map.clear(); | |||||
material_map = null; | |||||
material_map_vis.clear(); | |||||
material_map_vis = null; | |||||
bpa_systemsets.clear(); | |||||
bpa_systemsets = null; | |||||
context= null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -36,7 +36,7 @@ import butterknife.BindView; | |||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
import butterknife.OnClick; | import butterknife.OnClick; | ||||
public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListener { | |||||
public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickListener | |||||
@BindView(R.id.datatab_sx) | @BindView(R.id.datatab_sx) | ||||
ListView datatab_sx; | ListView datatab_sx; | ||||
@@ -126,194 +126,206 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||||
} | } | ||||
} | } | ||||
/** | |||||
* 点击事件 | |||||
* | |||||
* @param v | |||||
* @param data | |||||
*/ | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://修改属性名称按钮 | |||||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder.setTitle("属性名称") | |||||
.setPlaceholder("在此输入属性名称") | |||||
.setDefaultText(((BPA_GOODPROPERTY) data).name) | |||||
.setInputType(InputType.TYPE_CLASS_TEXT) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | |||||
} | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
if (QueryDB.GetGoodsPropertyIs(text.toString())) { | |||||
ToastUtils.info("属性名称重复,请重新输入后重试!"); | |||||
return; | |||||
} | |||||
QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString()); | |||||
Initdata_sx(); | |||||
private MyClickListener listener = new MyClickListener() { | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://修改属性名称按钮 | |||||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder.setTitle("属性名称") | |||||
.setPlaceholder("在此输入属性名称") | |||||
.setDefaultText(((BPA_GOODPROPERTY) data).name) | |||||
.setInputType(InputType.TYPE_CLASS_TEXT) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | dialog.dismiss(); | ||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("属性名称不能为空!"); | |||||
} | } | ||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.sort: | |||||
final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder1.setTitle("排序") | |||||
.setPlaceholder("在此输入排序") | |||||
.setDefaultText(((BPA_GOODPROPERTY) data).sort+"") | |||||
.setInputType(InputType.TYPE_CLASS_NUMBER) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | |||||
} | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder1.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); | |||||
Initdata_sx(); | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
if (QueryDB.GetGoodsPropertyIs(text.toString())) { | |||||
ToastUtils.info("属性名称重复,请重新输入后重试!"); | |||||
return; | |||||
} | |||||
QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString()); | |||||
Initdata_sx(); | |||||
dialog.dismiss(); | |||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("属性名称不能为空!"); | |||||
} | |||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.sort: | |||||
final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder1.setTitle("排序") | |||||
.setPlaceholder("在此输入排序") | |||||
.setDefaultText(((BPA_GOODPROPERTY) data).sort+"") | |||||
.setInputType(InputType.TYPE_CLASS_NUMBER) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | dialog.dismiss(); | ||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("排序不能为空!"); | |||||
} | } | ||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.typeS: | |||||
ArrayList<Integer> keys=new ArrayList<Integer>(); | |||||
String[] items = itemstypes.keySet().toArray(new String[itemstypes.keySet().size()]); | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder1.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); | |||||
Initdata_sx(); | |||||
dialog.dismiss(); | |||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("排序不能为空!"); | |||||
} | |||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.typeS: | |||||
ArrayList<Integer> keys=new ArrayList<Integer>(); | |||||
String[] items = itemstypes.keySet().toArray(new String[itemstypes.keySet().size()]); | |||||
if(((BPA_GOODPROPERTY) data).GoodsTypeId!=null && !((BPA_GOODPROPERTY) data).GoodsTypeId.isEmpty()) | |||||
{ | |||||
for (int i=0;i<items.length;i++) | |||||
if(((BPA_GOODPROPERTY) data).GoodsTypeId!=null && !((BPA_GOODPROPERTY) data).GoodsTypeId.isEmpty()) | |||||
{ | { | ||||
if(((BPA_GOODPROPERTY) data).GoodsTypeId.contains(itemstypes.get(items[i]))) | |||||
for (int i=0;i<items.length;i++) | |||||
{ | { | ||||
keys.add(i); | |||||
if(((BPA_GOODPROPERTY) data).GoodsTypeId.contains(itemstypes.get(items[i]))) | |||||
{ | |||||
keys.add(i); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | |||||
int []intarrs=new int[keys.size()]; | |||||
for(int i=0;i<intarrs.length;i++){ | |||||
intarrs[i]=keys.get(i); | |||||
} | |||||
int []intarrs=new int[keys.size()]; | |||||
for(int i=0;i<intarrs.length;i++){ | |||||
intarrs[i]=keys.get(i); | |||||
} | |||||
final QMUIDialog.MultiCheckableDialogBuilder builder3 = new QMUIDialog.MultiCheckableDialogBuilder(context) | |||||
.addItems(items, new DialogInterface.OnClickListener() { | |||||
@Override | |||||
public void onClick(DialogInterface dialog, int which) { | |||||
final QMUIDialog.MultiCheckableDialogBuilder builder3 = new QMUIDialog.MultiCheckableDialogBuilder(context) | |||||
.addItems(items, new DialogInterface.OnClickListener() { | |||||
@Override | |||||
public void onClick(DialogInterface dialog, int which) { | |||||
} | |||||
}) | |||||
.setCheckedItems(intarrs); | |||||
builder3.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
builder3.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
String result=""; | |||||
for(int i=0;i<builder3.getCheckedItemIndexes().length;i++){ | |||||
result+=""+itemstypes.get(items[builder3.getCheckedItemIndexes()[i]])+","; | |||||
} | |||||
}) | |||||
.setCheckedItems(intarrs); | |||||
builder3.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | |||||
} | } | ||||
}); | |||||
builder3.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
String result=""; | |||||
for(int i=0;i<builder3.getCheckedItemIndexes().length;i++){ | |||||
result+=""+itemstypes.get(items[builder3.getCheckedItemIndexes()[i]])+","; | |||||
} | |||||
if(result.isEmpty()) | |||||
{ | |||||
ToastUtils.info("必须选择一个类型!"); | |||||
return; | |||||
} | |||||
if(result.isEmpty()) | |||||
{ | |||||
ToastUtils.info("必须选择一个类型!"); | |||||
return; | |||||
} | |||||
if(!result.isEmpty()) | |||||
{ | |||||
result=result.substring(0, result.length() - 1); | |||||
} | |||||
QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result); | |||||
Initdata_sx(); | |||||
if(!result.isEmpty()) | |||||
{ | |||||
result=result.substring(0, result.length() - 1); | |||||
} | |||||
QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result); | |||||
Initdata_sx(); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
builder3.show(); | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
String title = "温馨提示!"; | |||||
String message = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
ArrayList<BPA_GOODPROPERTY> ddd=QueryDB.GetGoodsPropertyALL(((BPA_GOODPROPERTY) data).id); | |||||
for (BPA_GOODPROPERTY item:ddd) | |||||
{ | |||||
QueryDB.DeleteGoodsProperty(item); | |||||
dialog.dismiss(); | |||||
} | } | ||||
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); | |||||
Initdata_sx(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
}); | |||||
builder3.show(); | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
String title = "温馨提示!"; | |||||
String message = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
ArrayList<BPA_GOODPROPERTY> ddd=QueryDB.GetGoodsPropertyALL(((BPA_GOODPROPERTY) data).id); | |||||
for (BPA_GOODPROPERTY item:ddd) | |||||
{ | |||||
QueryDB.DeleteGoodsProperty(item); | |||||
} | |||||
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); | |||||
Initdata_sx(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
break; | |||||
case R.id.button_add://增加子属性 | |||||
BPA_GOODPROPERTY sx=(BPA_GOODPROPERTY) data; | |||||
BPA_GOODPROPERTY bpa_goodproperty = new BPA_GOODPROPERTY(); | |||||
bpa_goodproperty.name = "子属性示例"; | |||||
bpa_goodproperty.foreignKeyRe = ""; | |||||
bpa_goodproperty.parentid = sx.id; | |||||
bpa_goodproperty.sort=0; | |||||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||||
ToastUtils.info("新增成功"); | |||||
Initdata_sx(); | |||||
break; | |||||
break; | |||||
case R.id.button_add://增加子属性 | |||||
BPA_GOODPROPERTY sx=(BPA_GOODPROPERTY) data; | |||||
BPA_GOODPROPERTY bpa_goodproperty = new BPA_GOODPROPERTY(); | |||||
bpa_goodproperty.name = "子属性示例"; | |||||
bpa_goodproperty.foreignKeyRe = ""; | |||||
bpa_goodproperty.parentid = sx.id; | |||||
bpa_goodproperty.sort=0; | |||||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||||
ToastUtils.info("新增成功"); | |||||
Initdata_sx(); | |||||
break; | |||||
case R.id.save_text://保存属性 | |||||
QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data); | |||||
ToastUtils.info("保存成功"); | |||||
Initdata_sx(); | |||||
break; | |||||
case R.id.delete_text://删除 | |||||
String title1 = "温馨提示!"; | |||||
String message1 = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title1, message1, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); | |||||
Initdata_sx(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
break; | |||||
case R.id.save_text://保存属性 | |||||
QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data); | |||||
ToastUtils.info("保存成功"); | |||||
Initdata_sx(); | |||||
break; | |||||
case R.id.delete_text://删除 | |||||
String title1 = "温馨提示!"; | |||||
String message1 = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title1, message1, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); | |||||
Initdata_sx(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
break; | |||||
} | |||||
} | } | ||||
} | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
} | |||||
} | |||||
}; | |||||
// /** | |||||
// * 点击事件 | |||||
// * | |||||
// * @param v | |||||
// * @param data | |||||
// */ | |||||
// @Override | |||||
// public void clickListener(View v, Object data) { | |||||
// | |||||
// } | |||||
// | |||||
// @Override | |||||
// public void clickListenerNew(View v, int k, Object data) { | |||||
// | |||||
// } | |||||
//region 数据加载 | //region 数据加载 | ||||
/** | /** | ||||
* 初始化数据加载 | * 初始化数据加载 | ||||
@@ -322,7 +334,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||||
try { | try { | ||||
bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0"); | bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0"); | ||||
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,this); | |||||
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener); | |||||
datatab_sx.setAdapter(adapter); | datatab_sx.setAdapter(adapter); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -334,6 +346,15 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
Logger.d("我的fragment销毁"); | Logger.d("我的fragment销毁"); | ||||
bpa_goodproperties.clear(); | |||||
bpa_goodproperties = null; | |||||
bpa_goodstypes.clear(); | |||||
bpa_goodstypes = null; | |||||
itemstypes.clear(); | |||||
itemstypes = null; | |||||
listener = null; | |||||
datatab_sx.setAdapter(null); | |||||
context = null; | |||||
} | } | ||||
/** | /** | ||||
@@ -30,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | ||||
import com.bonait.bnframework.common.db.res.lcMode; | import com.bonait.bnframework.common.db.res.lcMode; | ||||
import com.bonait.bnframework.common.helper.I.MyClickListener; | import com.bonait.bnframework.common.helper.I.MyClickListener; | ||||
import com.bonait.bnframework.common.helper.MY; | |||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
import com.bonait.bnframework.common.utils.NetworkUtils; | import com.bonait.bnframework.common.utils.NetworkUtils; | ||||
import com.bonait.bnframework.common.utils.ToastUtils; | import com.bonait.bnframework.common.utils.ToastUtils; | ||||
@@ -47,7 +48,7 @@ import butterknife.BindView; | |||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
import butterknife.OnClick; | import butterknife.OnClick; | ||||
public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener { | |||||
public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListener | |||||
@BindView(R.id.add_wl) | @BindView(R.id.add_wl) | ||||
Button add_wl; | Button add_wl; | ||||
@BindView(R.id.datatab_wl) | @BindView(R.id.datatab_wl) | ||||
@@ -175,7 +176,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener | |||||
public void Initdata_wl() { | public void Initdata_wl() { | ||||
try { | try { | ||||
bpa_materials = QueryDB.GetMaterialALL(); | bpa_materials = QueryDB.GetMaterialALL(); | ||||
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, this); | |||||
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener); | |||||
datatab_wl.setAdapter(adapter); | datatab_wl.setAdapter(adapter); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -190,6 +191,9 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener | |||||
// DataBus.getInstance().mListener.clickListenerNew(this.getView(), 0, ""); | // DataBus.getInstance().mListener.clickListenerNew(this.getView(), 0, ""); | ||||
// } | // } | ||||
Logger.d("我的fragment销毁"); | Logger.d("我的fragment销毁"); | ||||
listener = null; | |||||
datatab_wl.setAdapter(null); | |||||
context = null; | |||||
} | } | ||||
/** | /** | ||||
@@ -206,68 +210,79 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener | |||||
return false; | return false; | ||||
} | } | ||||
/** | |||||
* 点击事件 | |||||
* | |||||
* @param v | |||||
* @param data | |||||
*/ | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://修改物料名称按钮 | |||||
case R.id.button_update://修改物料名称按钮 | |||||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder.setTitle("物料名称") | |||||
.setPlaceholder("在此输入物料名称") | |||||
.setDefaultText(((BPA_MATERIAL) data).name) | |||||
.setInputType(InputType.TYPE_CLASS_TEXT) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | |||||
} | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
if (QueryDB.GetMaterialIs(text.toString())) { | |||||
ToastUtils.info("物料名称重复,请重新输入后重试!"); | |||||
return; | |||||
} | |||||
QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); | |||||
Initdata_wl(); | |||||
ToastUtils.info("修改成功"); | |||||
private MyClickListener listener = new MyClickListener() { | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://修改物料名称按钮 | |||||
case R.id.button_update://修改物料名称按钮 | |||||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||||
builder.setTitle("物料名称") | |||||
.setPlaceholder("在此输入物料名称") | |||||
.setDefaultText(((BPA_MATERIAL) data).name) | |||||
.setInputType(InputType.TYPE_CLASS_TEXT) | |||||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
dialog.dismiss(); | dialog.dismiss(); | ||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("物料名称不能为空!"); | |||||
} | } | ||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
String title = "温馨提示!"; | |||||
String message = "客官确定要删除物料【"+((BPA_MATERIAL) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
QueryDB.DeleteMaterial((BPA_MATERIAL) data); | |||||
Initdata_wl(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
break; | |||||
}) | |||||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
CharSequence text = builder.getEditText().getText(); | |||||
if (text != null && text.length() > 0) { | |||||
if (QueryDB.GetMaterialIs(text.toString())) { | |||||
ToastUtils.info("物料名称重复,请重新输入后重试!"); | |||||
return; | |||||
} | |||||
QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); | |||||
Initdata_wl(); | |||||
ToastUtils.info("修改成功"); | |||||
dialog.dismiss(); | |||||
} else { | |||||
//请填入昵称 | |||||
ToastUtils.info("物料名称不能为空!"); | |||||
} | |||||
} | |||||
}) | |||||
.show(); | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
String title = "温馨提示!"; | |||||
String message = "客官确定要删除物料【"+((BPA_MATERIAL) data).name+"】吗?"; | |||||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
QueryDB.DeleteMaterial((BPA_MATERIAL) data); | |||||
Initdata_wl(); | |||||
ToastUtils.info("删除成功"); | |||||
dialog.dismiss(); | |||||
} | |||||
}); | |||||
break; | |||||
} | |||||
} | } | ||||
} | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
} | |||||
} | |||||
}; | |||||
// /** | |||||
// * 点击事件 | |||||
// * | |||||
// * @param v | |||||
// * @param data | |||||
// */ | |||||
// @Override | |||||
// public void clickListener(View v, Object data) { | |||||
// | |||||
// } | |||||
// | |||||
// @Override | |||||
// public void clickListenerNew(View v, int k, Object data) { | |||||
// | |||||
// } | |||||
} | } |
@@ -34,6 +34,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||||
import com.bonait.bnframework.common.db.res.ResGoodProperty; | import com.bonait.bnframework.common.db.res.ResGoodProperty; | ||||
import com.bonait.bnframework.common.db.res.ResGoodsRecipe; | import com.bonait.bnframework.common.db.res.ResGoodsRecipe; | ||||
import com.bonait.bnframework.common.db.res.ResMaterilas; | import com.bonait.bnframework.common.db.res.ResMaterilas; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.helper.I.MyClickListener; | import com.bonait.bnframework.common.helper.I.MyClickListener; | ||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.message.MessageLooper; | import com.bonait.bnframework.common.message.MessageLooper; | ||||
@@ -344,7 +345,8 @@ public class GoodInformation extends LinearLayout implements MyClickListener { | |||||
if (Data != null) { | if (Data != null) { | ||||
edittext.setText(Data.name); | edittext.setText(Data.name); | ||||
edittext1.setText(Data.foreignKeyRe); | edittext1.setText(Data.foreignKeyRe); | ||||
new MyBitmapUtils().disPlay(cpfm, Data.url); | |||||
// new MyBitmapUtils().disPlay(cpfm, Data.url); | |||||
GlideUtil.showImage(cpfm.getContext(),Data.url,cpfm,R.mipmap.loading3); | |||||
url = Data.url; | url = Data.url; | ||||
int index = 0; | int index = 0; | ||||
for (Map.Entry<String, String> entry : map_fl.entrySet()) { | for (Map.Entry<String, String> entry : map_fl.entrySet()) { | ||||
@@ -358,7 +360,8 @@ public class GoodInformation extends LinearLayout implements MyClickListener { | |||||
} else { | } else { | ||||
edittext.setText(""); | edittext.setText(""); | ||||
edittext1.setText(""); | edittext1.setText(""); | ||||
new MyBitmapUtils().disPlay(cpfm, ""); | |||||
// new MyBitmapUtils().disPlay(cpfm, ""); | |||||
GlideUtil.showImage(cpfm.getContext(),"",cpfm,R.mipmap.loading3); | |||||
url = ""; | url = ""; | ||||
} | } | ||||
@@ -644,7 +647,8 @@ public class GoodInformation extends LinearLayout implements MyClickListener { | |||||
public void onMessage(Object msg) { | public void onMessage(Object msg) { | ||||
if (msg != null) { | if (msg != null) { | ||||
url = (String) msg; | url = (String) msg; | ||||
new MyBitmapUtils().disPlay(cpfm, url); | |||||
// new MyBitmapUtils().disPlay(cpfm, url); | |||||
GlideUtil.showImage(cpfm.getContext(),url,cpfm,R.mipmap.loading3); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
@@ -23,6 +23,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | ||||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | ||||
import com.bonait.bnframework.common.db.res.ResMaterilas; | import com.bonait.bnframework.common.db.res.ResMaterilas; | ||||
import com.bonait.bnframework.common.glide.GlideUtil; | |||||
import com.bonait.bnframework.common.helper.I.MyClickListener; | import com.bonait.bnframework.common.helper.I.MyClickListener; | ||||
import com.bonait.bnframework.common.image.MyBitmapUtils; | import com.bonait.bnframework.common.image.MyBitmapUtils; | ||||
import com.bonait.bnframework.common.message.MessageLooper; | import com.bonait.bnframework.common.message.MessageLooper; | ||||
@@ -221,7 +222,8 @@ public class add_good_control extends LinearLayout { | |||||
public void onMessage(Object msg) { | public void onMessage(Object msg) { | ||||
if (msg != null) { | if (msg != null) { | ||||
url=(String) msg; | url=(String) msg; | ||||
new MyBitmapUtils().disPlay(cpfm,url); | |||||
// new MyBitmapUtils().disPlay(cpfm,url); | |||||
GlideUtil.showImage(cpfm.getContext(),url,cpfm,R.mipmap.loading3); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
@@ -229,6 +231,20 @@ public class add_good_control extends LinearLayout { | |||||
public void destroy(){ | public void destroy(){ | ||||
MessageManager.getInstance().unRegisterMessageReceiver(activity_ma); | MessageManager.getInstance().unRegisterMessageReceiver(activity_ma); | ||||
Data = null; | |||||
mListener = null; | |||||
Types.clear(); | |||||
Types = null; | |||||
resMaterilas.clear(); | |||||
resMaterilas = null; | |||||
map_fl.clear(); | |||||
map_fl = null; | |||||
yesStr = null; | |||||
url = null; | |||||
if(recycler_view_wl!=null){ | |||||
recycler_view_wl.setAdapter(null); | |||||
} | |||||
activity_ma = null; | |||||
} | } | ||||
public String ids=""; | public String ids=""; | ||||
@@ -315,7 +331,8 @@ public class add_good_control extends LinearLayout { | |||||
{ | { | ||||
edittext.setText(Data.name); | edittext.setText(Data.name); | ||||
edittext1.setText(Data.foreignKeyRe); | edittext1.setText(Data.foreignKeyRe); | ||||
new MyBitmapUtils().disPlay(cpfm,Data.url); | |||||
// new MyBitmapUtils().disPlay(cpfm,Data.url); | |||||
GlideUtil.showImage(cpfm.getContext(),url,cpfm,R.mipmap.loading3); | |||||
url=Data.url; | url=Data.url; | ||||
int index=0; | int index=0; | ||||
for (Map.Entry<String, String> entry : map_fl.entrySet()) { | for (Map.Entry<String, String> entry : map_fl.entrySet()) { | ||||
@@ -331,7 +348,8 @@ public class add_good_control extends LinearLayout { | |||||
{ | { | ||||
edittext.setText(""); | edittext.setText(""); | ||||
edittext1.setText(""); | edittext1.setText(""); | ||||
new MyBitmapUtils().disPlay(cpfm,""); | |||||
// new MyBitmapUtils().disPlay(cpfm,""); | |||||
GlideUtil.showImage(cpfm.getContext(),"",cpfm,R.mipmap.loading3); | |||||
url=""; | url=""; | ||||
} | } | ||||
@@ -47,7 +47,7 @@ import java.util.ArrayList; | |||||
import butterknife.BindView; | import butterknife.BindView; | ||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
public class add_pf_control extends LinearLayout implements MyClickListener { | |||||
public class add_pf_control extends LinearLayout {// implements MyClickListener | |||||
@BindView(R.id.peifang_queren) | @BindView(R.id.peifang_queren) | ||||
@@ -202,7 +202,7 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||||
{ | { | ||||
DataBus.getInstance().Recipe=new ArrayList<>(); | DataBus.getInstance().Recipe=new ArrayList<>(); | ||||
} | } | ||||
adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,this); | |||||
adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,listener); | |||||
datatab_pf.setAdapter(adapter4); | datatab_pf.setAdapter(adapter4); | ||||
} | } | ||||
@@ -322,6 +322,25 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||||
if (activity != null) { | if (activity != null) { | ||||
MessageManager.getInstance().unRegisterMessageReceiver(activity); | MessageManager.getInstance().unRegisterMessageReceiver(activity); | ||||
} | } | ||||
listener = null; | |||||
resMaterilas.clear(); | |||||
bpa_goodproperties.clear(); | |||||
resMaterilas = null; | |||||
bpa_goodproperties = null; | |||||
if(adapter4!=null){ | |||||
adapter4.clear(); | |||||
adapter4 = null; | |||||
} | |||||
mListener = null; | |||||
if(datatab_sx!=null){ | |||||
datatab_sx.setAdapter(null); | |||||
datatab_pf.setAdapter(null); | |||||
} | |||||
acontext = null; | |||||
pfname = null; | |||||
ggids = null; | |||||
} | } | ||||
/** | /** | ||||
@@ -453,27 +472,39 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||||
return true; | return true; | ||||
} | } | ||||
private MyClickListener listener = new MyClickListener() { | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://点击 修改 | |||||
/** | |||||
* 点击事件 | |||||
* | |||||
* @param v | |||||
* @param data | |||||
*/ | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.name://点击 修改 | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
break; | |||||
break; | |||||
} | |||||
} | } | ||||
} | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
} | |||||
} | |||||
}; | |||||
// /** | |||||
// * 点击事件 | |||||
// * | |||||
// * @param v | |||||
// * @param data | |||||
// */ | |||||
// @Override | |||||
// public void clickListener(View v, Object data) { | |||||
// | |||||
// } | |||||
// | |||||
// @Override | |||||
// public void clickListenerNew(View v, int k, Object data) { | |||||
// | |||||
// } | |||||
} | } |
@@ -32,7 +32,7 @@ import java.util.ArrayList; | |||||
import butterknife.BindView; | import butterknife.BindView; | ||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
public class add_pf_home_control extends LinearLayout implements MyClickListener { | |||||
public class add_pf_home_control extends LinearLayout {//implements MyClickListener | |||||
@BindView(R.id.title) | @BindView(R.id.title) | ||||
TextView title; | TextView title; | ||||
@@ -120,46 +120,65 @@ public class add_pf_home_control extends LinearLayout implements MyClickListene | |||||
{ | { | ||||
//根据商品查询配方 | //根据商品查询配方 | ||||
ArrayList<BPA_GOODSRECIPENAME> goodsrecipenames=QueryDB.GetGoodsRecipeNameGoodId(good.id); | ArrayList<BPA_GOODSRECIPENAME> goodsrecipenames=QueryDB.GetGoodsRecipeNameGoodId(good.id); | ||||
goodpf_apapter adapter = new goodpf_apapter(getContext(), R.layout.wl_item, goodsrecipenames, this); | |||||
goodpf_apapter adapter = new goodpf_apapter(getContext(), R.layout.wl_item, goodsrecipenames, listener); | |||||
datatab_pf.setAdapter(adapter); | datatab_pf.setAdapter(adapter); | ||||
} | } | ||||
} | } | ||||
private MyClickListener listener = new MyClickListener() { | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.button_update://点击 修改 | |||||
SelectData =(BPA_GOODSRECIPENAME)data; | |||||
if (mListener != null) { | |||||
mListener.clickListenerNew(v,2,good); | |||||
} | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(((BPA_GOODSRECIPENAME) data).id); | |||||
for(ResGoodsRecipe item:re) | |||||
{ | |||||
QueryDB.DeleteGoodsSrecipe(item); | |||||
} | |||||
QueryDB.DeleteGoodsRecipeName((BPA_GOODSRECIPENAME) data); | |||||
Initdata_pf(); | |||||
ToastUtils.info("删除成功"); | |||||
break; | |||||
} | |||||
} | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
public BPA_GOODSRECIPENAME SelectData; | |||||
/** | |||||
* 点击事件 | |||||
* | |||||
* @param v | |||||
* @param data | |||||
*/ | |||||
@Override | |||||
public void clickListener(View v, Object data) { | |||||
switch (v.getId()) { | |||||
case R.id.button_update://点击 修改 | |||||
SelectData =(BPA_GOODSRECIPENAME)data; | |||||
if (mListener != null) { | |||||
mListener.clickListenerNew(v,2,good); | |||||
} | |||||
break; | |||||
case R.id.button_item://删除按钮 | |||||
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(((BPA_GOODSRECIPENAME) data).id); | |||||
for(ResGoodsRecipe item:re) | |||||
{ | |||||
QueryDB.DeleteGoodsSrecipe(item); | |||||
} | |||||
QueryDB.DeleteGoodsRecipeName((BPA_GOODSRECIPENAME) data); | |||||
Initdata_pf(); | |||||
ToastUtils.info("删除成功"); | |||||
break; | |||||
} | } | ||||
} | |||||
@Override | |||||
public void clickListenerNew(View v, int k, Object data) { | |||||
}; | |||||
public BPA_GOODSRECIPENAME SelectData; | |||||
// /** | |||||
// * 点击事件 | |||||
// * | |||||
// * @param v | |||||
// * @param data | |||||
// */ | |||||
// @Override | |||||
// public void clickListener(View v, Object data) { | |||||
// | |||||
// } | |||||
// | |||||
// @Override | |||||
// public void clickListenerNew(View v, int k, Object data) { | |||||
// | |||||
// } | |||||
public void destroy(){ | |||||
datatab_pf.setAdapter(null); | |||||
datatab_pf = null; | |||||
good = null; | |||||
SelectData = null; | |||||
mListener = null; | |||||
listener = null; | |||||
} | } | ||||
} | } |
@@ -393,4 +393,16 @@ public class add_yijian_controlextends extends LinearLayout { | |||||
} | } | ||||
//endregion | //endregion | ||||
public void destroy(){ | |||||
if(mHandler!=null){ | |||||
mHandler.removeCallbacksAndMessages(null); | |||||
mHandler = null; | |||||
} | |||||
siloslist.clear(); | |||||
siloslist = null; | |||||
mListener = null; | |||||
map_fl.clear(); | |||||
map_fl = null; | |||||
editsp_fl = null; | |||||
} | |||||
} | } |
@@ -16,6 +16,7 @@ import android.widget.TextView; | |||||
import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
import androidx.fragment.app.FragmentManager; | import androidx.fragment.app.FragmentManager; | ||||
import com.apkfuns.logutils.LogUtils; | |||||
import com.bonait.bnframework.HBL.Dialog.AlertDialogButton; | import com.bonait.bnframework.HBL.Dialog.AlertDialogButton; | ||||
import com.bonait.bnframework.HBL.Dialog.DialogManager; | import com.bonait.bnframework.HBL.Dialog.DialogManager; | ||||
import com.bonait.bnframework.HBL.Dialog.WaitDialog; | import com.bonait.bnframework.HBL.Dialog.WaitDialog; | ||||
@@ -141,8 +142,9 @@ public class silos_jiaoyan extends LinearLayout { | |||||
BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(lcMode.num); | BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(lcMode.num); | ||||
if(res!=null){ | if(res!=null){ | ||||
min_time.setText(String.valueOf(res.outputTimeMin)); | |||||
max_time.setText(String.valueOf(res.outputTimeMax)); | |||||
LogUtils.d(" BPA_SILOS_CALIBRATE res.outputTimeMin="+res.toString()); | |||||
min_time.setText(res.outputTimeMin+""); | |||||
max_time.setText(res.outputTimeMax+""); | |||||
min_weight.setText(res.inputWightMin+""); | min_weight.setText(res.inputWightMin+""); | ||||
max_weight.setText(res.inputWightMax+""); | max_weight.setText(res.inputWightMax+""); | ||||
}else{ | }else{ | ||||
@@ -241,7 +243,14 @@ public class silos_jiaoyan extends LinearLayout { | |||||
private TimerTask timerTask; | private TimerTask timerTask; | ||||
public void show(){ | public void show(){ | ||||
close(); | |||||
if(timer!=null){ | |||||
timer.cancel(); | |||||
timer = null; | |||||
} | |||||
if(timerTask!=null){ | |||||
timerTask.cancel(); | |||||
timerTask = null; | |||||
} | |||||
setVisibility(VISIBLE); | setVisibility(VISIBLE); | ||||
timer = new Timer(); | timer = new Timer(); | ||||
timerTask = new TimerTask() { | timerTask = new TimerTask() { | ||||
@@ -256,7 +265,7 @@ public class silos_jiaoyan extends LinearLayout { | |||||
timer.schedule(timerTask,500,500); | timer.schedule(timerTask,500,500); | ||||
} | } | ||||
public void close(){ | |||||
public void destroy(){ | |||||
setVisibility(GONE); | setVisibility(GONE); | ||||
if(mHandler!=null){ | if(mHandler!=null){ | ||||
mHandler.removeCallbacksAndMessages(null); | mHandler.removeCallbacksAndMessages(null); | ||||
@@ -16,6 +16,7 @@ import com.bonait.bnframework.business.MainInit; | |||||
import com.bonait.bnframework.common.base.BaseActivity; | import com.bonait.bnframework.common.base.BaseActivity; | ||||
import com.bonait.bnframework.common.constant.ConfigName; | import com.bonait.bnframework.common.constant.ConfigName; | ||||
import com.bonait.bnframework.common.constant.Constants; | import com.bonait.bnframework.common.constant.Constants; | ||||
import com.bonait.bnframework.common.utils.DisplayManager; | |||||
import com.bonait.bnframework.common.utils.ScreenUtils; | import com.bonait.bnframework.common.utils.ScreenUtils; | ||||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | import com.bonait.bnframework.manager.ActivityLifecycleManager; | ||||
import com.lzy.okgo.OkGo; | import com.lzy.okgo.OkGo; | ||||
@@ -40,6 +41,8 @@ public class WelcomeActivity extends BaseActivity { | |||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
setContentView(R.layout.activity_welcome); | setContentView(R.layout.activity_welcome); | ||||
initWelcome(); | initWelcome(); | ||||
DisplayManager.setReferenceMaxWidthHeight(800, 1208); | |||||
DisplayManager.updateDisplayInfo(this); | |||||
} | } | ||||
private void initWelcome() { | private void initWelcome() { | ||||
@@ -118,6 +118,7 @@ | |||||
android:layout_height="100dp" | android:layout_height="100dp" | ||||
app:imagesrc="@mipmap/silos1" | app:imagesrc="@mipmap/silos1" | ||||
android:tag="一键满管" | android:tag="一键满管" | ||||
android:visibility="gone" | |||||
/> | /> | ||||
<com.bonait.bnframework.modules.home.fragment.mode.ImageButtonControl | <com.bonait.bnframework.modules.home.fragment.mode.ImageButtonControl | ||||
@@ -134,6 +135,7 @@ | |||||
android:layout_height="100dp" | android:layout_height="100dp" | ||||
app:imagesrc="@mipmap/silos3" | app:imagesrc="@mipmap/silos3" | ||||
android:tag="一键清洗" | android:tag="一键清洗" | ||||
android:visibility="gone" | |||||
android:layout_marginTop="20dp"/> | android:layout_marginTop="20dp"/> | ||||
<com.bonait.bnframework.modules.home.fragment.mode.ImageButtonControl | <com.bonait.bnframework.modules.home.fragment.mode.ImageButtonControl | ||||
@@ -22,8 +22,8 @@ | |||||
android:layout_alignParentRight="true" | android:layout_alignParentRight="true" | ||||
android:layout_marginRight="@dimen/dp_10" | android:layout_marginRight="@dimen/dp_10" | ||||
android:text="回锅" | android:text="回锅" | ||||
android:textAlignment="textEnd" | |||||
android:textSize="19dp" /> | |||||
android:gravity="center" | |||||
android:textSize="18sp" /> | |||||
</RelativeLayout> | </RelativeLayout> | ||||
@@ -32,7 +32,7 @@ | |||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:layout_centerInParent="true" | android:layout_centerInParent="true" | ||||
android:layout_marginLeft="5dp" | android:layout_marginLeft="5dp" | ||||
android:text="清炒三月瓜" | |||||
tools:text="清炒三月瓜" | |||||
android:textColor="@color/black" | android:textColor="@color/black" | ||||
android:textSize="20sp" | android:textSize="20sp" | ||||
tools:ignore="MissingConstraints" /> | tools:ignore="MissingConstraints" /> | ||||