@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="GitToolBoxProjectSettings"> | |||
<option name="commitMessageIssueKeyValidationOverride"> | |||
<BoolValueOverride> | |||
<option name="enabled" value="true" /> | |||
</BoolValueOverride> | |||
</option> | |||
<option name="commitMessageValidationEnabledOverride"> | |||
<BoolValueOverride> | |||
<option name="enabled" value="true" /> | |||
</BoolValueOverride> | |||
</option> | |||
</component> | |||
</project> |
@@ -1,7 +1,13 @@ | |||
import java.text.DateFormat | |||
import java.text.SimpleDateFormat | |||
apply plugin: 'com.android.application' | |||
//apply plugin: 'com.jakewharton.butterknife' | |||
def releaseTime() { | |||
DateFormat df = new SimpleDateFormat("yyyyMMddHHmm") | |||
return df.format(Calendar.getInstance(Locale.CHINA).getTime()) | |||
} | |||
android { | |||
compileSdk rootProject.ext.compileSdkVersion | |||
@@ -59,6 +65,11 @@ android { | |||
buildFeatures { | |||
viewBinding = true | |||
} | |||
applicationVariants.all { variant -> | |||
variant.outputs.all { | |||
outputFileName = "boluo-v${defaultConfig.versionCode}-${releaseTime()}"+"-unsigned-${variant.name}.apk" | |||
} | |||
} | |||
} | |||
dependencies { | |||
@@ -184,4 +195,7 @@ dependencies { | |||
implementation "com.github.bumptech.glide:okhttp3-integration:4.16.0" | |||
implementation 'com.squareup.retrofit2:converter-gson:2.5.0' | |||
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0' | |||
//leak 内存泄漏检测 | |||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' | |||
} |
@@ -315,7 +315,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
*/ | |||
private void MakeThread() { | |||
LogUtils.d("MakeThread()"); | |||
ExecuteTheRecipe.context = this; | |||
// ExecuteTheRecipe.context = this; | |||
mainTread = new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
@@ -1,22 +1,25 @@ | |||
package com.bonait.bnframework.ViewModel.ActivityViewModel; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.os.Bundle; | |||
import android.os.Environment; | |||
import android.view.View; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.Adapter.image_sp_adapter; | |||
import com.bonait.bnframework.ViewModel.CustomView.image_sp; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.ViewModel.Adapter.image_sp_adapter; | |||
import com.bonait.bnframework.ViewModel.CustomView.image_sp; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -30,7 +33,7 @@ public class ImageChooseActivity extends BaseActivity { | |||
QMUITopBarLayout mTopBar;//顶部标题 | |||
@BindView(R.id.recycler_view) | |||
RecyclerView recyclerView;//image列表 | |||
private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaodb/WebImage"; | |||
public static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaodb/WebImage"; | |||
List<image_sp> data =new ArrayList<>(); | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
@@ -74,6 +77,12 @@ public class ImageChooseActivity extends BaseActivity { | |||
image_sp sp=(image_sp)data; | |||
MessageManager.getInstance().sendMessage(MessageName.ClickImage,sp.url); | |||
finish(); | |||
recyclerView.postDelayed(new Runnable() { | |||
@Override | |||
public void run() { | |||
EventBus.getDefault().post(new ImageSelectEvent(CACHE_PATH+"/"+sp.url)); | |||
} | |||
},500); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
@@ -4,7 +4,6 @@ import android.animation.ObjectAnimator; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import androidx.core.widget.NestedScrollView; | |||
import android.text.Editable; | |||
import android.text.InputType; | |||
import android.text.TextUtils; | |||
@@ -22,9 +21,14 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.RelativeLayout; | |||
import androidx.core.widget.NestedScrollView; | |||
import androidx.lifecycle.LifecycleObserver; | |||
import com.bonait.bnframework.Model.AppLoginPo; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.bg.SnowView; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.Constants; | |||
import com.bonait.bnframework.common.constant.SPConstants; | |||
@@ -38,7 +42,6 @@ import com.bonait.bnframework.common.utils.KeyboardToolUtils; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.Model.AppLoginPo; | |||
import com.bonait.bnframework.test.TestActivity; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpParams; | |||
@@ -92,6 +95,8 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
ImageView imgPass; | |||
@BindView(R.id.rl_title) | |||
RelativeLayout rl_title; | |||
@BindView(R.id.snowView) | |||
SnowView snowView; | |||
private long exitTime = 0; | |||
private int screenHeight = 0;//屏幕高度 | |||
@@ -124,16 +129,9 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
* 对布局进行缩放 | |||
*/ | |||
private void initView(){ | |||
DisplayManager.scaleView(mEtAccount); | |||
DisplayManager.scaleView(mEtPassword); | |||
DisplayManager.scaleView(mCleanPassword); | |||
DisplayManager.scaleView(mIvCleanAccount); | |||
DisplayManager.scaleView(mIvShowPwd); | |||
DisplayManager.scaleView(cbCheckbox); | |||
DisplayManager.scaleView(mContent); | |||
DisplayManager.scaleView(imgAccount); | |||
DisplayManager.scaleView(imgPass); | |||
DisplayManager.scaleView(rl_title); | |||
DisplayManager.scaleViewGroup(findViewById(R.id.root)); | |||
getLifecycle().addObserver((LifecycleObserver) snowView); | |||
} | |||
/** | |||
@@ -544,4 +542,16 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
} | |||
return super.onKeyDown(keyCode, event); | |||
} | |||
@Override | |||
public void onDetachedFromWindow() { | |||
super.onDetachedFromWindow(); | |||
getLifecycle().removeObserver((LifecycleObserver) snowView); | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
super.onDestroy(); | |||
} | |||
} |
@@ -6,14 +6,6 @@ import android.content.Context; | |||
import android.content.Intent; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.core.content.ContextCompat; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.os.CountDownTimer; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
@@ -23,23 +15,30 @@ import android.widget.Button; | |||
import android.widget.ImageView; | |||
import android.widget.RelativeLayout; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.core.content.ContextCompat; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.CpxzActivity; | |||
import com.bonait.bnframework.ViewModel.Adapter.lc_adapter; | |||
import com.bonait.bnframework.ViewModel.CustomView.MyStatus; | |||
import com.bonait.bnframework.ViewModel.CustomView.huoli_control; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebutton_control; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.ViewModel.Adapter.lc_adapter; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.CpxzActivity; | |||
import com.bonait.bnframework.ViewModel.CustomView.MyStatus; | |||
import com.bonait.bnframework.ViewModel.CustomView.huoli_control; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebutton_control; | |||
import com.capton.colorfulprogressbar.ColorfulProgressbar; | |||
import com.litao.slider.NiftySlider; | |||
import com.orhanobut.logger.Logger; | |||
@@ -452,7 +451,7 @@ public class Home1Fragment extends BaseFragment { | |||
* 商品制作线程 | |||
*/ | |||
public void MakeThread() { | |||
ExecuteTheRecipe.context = context; | |||
// ExecuteTheRecipe.context = context; | |||
new Thread(new Runnable() { | |||
@Override | |||
@@ -129,6 +129,7 @@ public class BaseActivity extends QMUIActivity implements EasyPermissions.Permis | |||
@Override | |||
protected void onDestroy() { | |||
ActiveMax.destroy(this); | |||
super.onDestroy(); | |||
LogUtils.d(getClassName()+"生命周期 onDestroy()"); | |||
} | |||
@@ -4,11 +4,14 @@ import android.content.Context; | |||
import android.graphics.Canvas; | |||
import android.graphics.Paint; | |||
import android.util.AttributeSet; | |||
import android.util.Log; | |||
import android.view.GestureDetector; | |||
import android.view.MotionEvent; | |||
import android.widget.RelativeLayout; | |||
import androidx.annotation.NonNull; | |||
import androidx.lifecycle.Lifecycle; | |||
import androidx.lifecycle.LifecycleEventObserver; | |||
import androidx.lifecycle.LifecycleOwner; | |||
import com.bonait.bnframework.common.bg.mode.SnowBean; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
@@ -18,7 +21,7 @@ import java.util.List; | |||
import java.util.Timer; | |||
import java.util.TimerTask; | |||
public class SnowView extends RelativeLayout { | |||
public class SnowView extends RelativeLayout implements LifecycleEventObserver { | |||
// private final String SNOW = "❄"; | |||
// private final String SNOW = "☀❆★❉❈❀✿❃❁"; | |||
private final String SNOW = "❄"; | |||
@@ -173,6 +176,15 @@ public class SnowView extends RelativeLayout { | |||
return detector.onTouchEvent(event); | |||
} | |||
@Override | |||
public void onStateChanged(@NonNull LifecycleOwner source, @NonNull Lifecycle.Event event) { | |||
switch (event) { | |||
case ON_DESTROY: | |||
destroy(); | |||
break; | |||
} | |||
} | |||
private class MyGestureDetector implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener { | |||
@Override | |||
@@ -32,11 +32,6 @@ public class BPA_GOODS extends ModeBase { | |||
*/ | |||
public String classifyId; | |||
/** | |||
* 用来区分是否已下载,本地使用 | |||
*/ | |||
public boolean isLocal; | |||
@Override | |||
public String toString() { | |||
@@ -7,7 +7,7 @@ package com.bonait.bnframework.common.db.mode; | |||
*/ | |||
public class BPA_GOODS_PROCESS_DETAIL extends ModeBase{ | |||
/** | |||
* 商品属性组合id | |||
* 商品属性组合名称 a-b | |||
*/ | |||
public String goodsSubAttributeGroupId; | |||
/** | |||
@@ -11,7 +11,7 @@ public class BPA_GOODS_SUBATTRIBUTE_GROUP extends ModeBase{ | |||
*/ | |||
public String name; | |||
/** | |||
* 子属性id组合 xxx,xxxx,xxx | |||
* 子属性id组合 xxx,xxxx,xxx 暂时不用id匹配 用name匹配 | |||
*/ | |||
public String subAttributeIdList; | |||
/** | |||
@@ -80,15 +80,15 @@ public class GoodsProcessDetailDBUtil { | |||
} | |||
/** | |||
* 根据商品属性组合id查询旗下的工序列表 | |||
* 根据商品属性组合查询旗下的工序列表 | |||
* | |||
* @param goodsSubAttributeGroupId | |||
* @param name | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_GOODS_PROCESS_DETAIL> getByGoodsSubAttributeGroupId(String goodsSubAttributeGroupId) { | |||
public static ArrayList<BPA_GOODS_PROCESS_DETAIL> getByGoodsSubAttributeGroupName(String name) { | |||
String orderby = QueryDB.Desc_Sort_Up + ',' + QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and goodsSubAttributeGroupId=?"; | |||
String[] args = new String[]{"0", goodsSubAttributeGroupId}; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_PROCESS_DETAIL.class, where, args, orderby); | |||
for (Object item : obj) { | |||
@@ -6,7 +6,6 @@ import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import java.util.ArrayList; | |||
@@ -60,7 +59,7 @@ public class SubAttributeGroupDBUtil { | |||
public static boolean deleteByGoodsId(String goodsId) { | |||
boolean result = true; | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
long delete = db.delete(BPA_GOODS_PROCESS_DETAIL.class.getSimpleName(), "goodsId=?", | |||
long delete = db.delete(BPA_GOODS_SUBATTRIBUTE_GROUP.class.getSimpleName(), "goodsId=?", | |||
new String[]{goodsId}); | |||
if(delete <= 0){ | |||
result = false; | |||
@@ -2,14 +2,18 @@ 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.bonait.bnframework.common.utils.DimensUtil; | |||
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; | |||
/** | |||
@@ -25,6 +29,27 @@ public class 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; | |||
@@ -53,4 +78,39 @@ public class GlideUtil { | |||
.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(DimensUtil.getDimens(radius)))) | |||
.into(imageView); | |||
} | |||
private static void setType(ImageView imageView){//硬件加速 | |||
imageView.setLayerType(View.LAYER_TYPE_HARDWARE,null); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -1,18 +1,9 @@ | |||
package com.bonait.bnframework.common.helper; | |||
import android.annotation.SuppressLint; | |||
import android.app.ActionBar; | |||
import android.app.Activity; | |||
import android.os.Build; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.view.View; | |||
import android.view.ViewTreeObserver; | |||
import android.view.WindowInsets; | |||
import android.view.WindowManager; | |||
import com.qmuiteam.qmui.util.QMUINotchHelper; | |||
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -49,6 +40,14 @@ public class ActiveMax { | |||
// activity.getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(setOnSystemUiVisibilityChangeListener); | |||
} | |||
public static void destroy(Activity activity){ | |||
if(activity!=null){ | |||
activities.remove(activity); | |||
activity.getWindow().getDecorView().getViewTreeObserver().removeOnGlobalLayoutListener(keyboardVisibilityListener); | |||
} | |||
} | |||
/** | |||
* 状态栏变化后事件 | |||
*/ | |||
@@ -111,4 +110,5 @@ public class ActiveMax { | |||
// 非全屏显示,显示状态栏和导航栏 | |||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
package com.bonait.bnframework.common.utils; | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
import android.graphics.Rect; | |||
import android.graphics.drawable.AnimationDrawable; | |||
import android.graphics.drawable.Drawable; | |||
import android.graphics.drawable.NinePatchDrawable; | |||
import com.bonait.bnframework.MainApplication; | |||
/** | |||
* @author: HY | |||
* @date: 2022/11/30 | |||
* @description | |||
**/ | |||
public class DimensUtil { | |||
/** | |||
* 正数 | |||
* | |||
* @param px | |||
* @return | |||
*/ | |||
public static int getDimens(int px) { | |||
// LogUtils.d(px + " >>getDimens >>>"); | |||
String paramString = "dp_" + px; | |||
int id = MainApplication.getContext().getResources().getIdentifier(paramString, "dimen", | |||
MainApplication.getContext().getPackageName()); | |||
int result = (int) MainApplication.getContext().getResources().getDimension(id); | |||
// LogUtils.d(px + " >>getDimens >>>" + result); | |||
return result; | |||
} | |||
public static float getDimensSp(int sp) { | |||
String paramString = "sp_" + sp; | |||
int id = MainApplication.getContext().getResources().getIdentifier(paramString, "dimen", | |||
MainApplication.getContext().getPackageName()); | |||
float result_sp = MainApplication.getContext().getResources().getDimension(id); | |||
final float fontScale = MainApplication.getContext().getResources().getDisplayMetrics().scaledDensity; | |||
float result_px = result_sp / fontScale; | |||
// LogUtils.d(sp + " >>getDimensSp >>>" + result_sp + ">>>result_px " + result_px); | |||
return result_px; | |||
} | |||
/** | |||
* 点9 图片需要特殊处理下 | |||
* @return | |||
*/ | |||
public static Drawable getFocusDrawable() { | |||
// BitmapFactory.Options options = new BitmapFactory.Options(); | |||
// options.inDensity = 160;//mdpi -----> 160 | |||
// Bitmap bitmap = BitmapFactory.decodeResource(MainApplication.getContext().getResources(), | |||
// R.drawable.bg_card_focus, options); | |||
// Drawable drawable = new NinePatchDrawable(MainApplication.getContext().getResources(), | |||
// bitmap, bitmap.getNinePatchChunk(), new Rect(), null); | |||
//呼吸灯 | |||
BitmapFactory.Options options = new BitmapFactory.Options(); | |||
options.inDensity = 160; | |||
AnimationDrawable animationDrawable = new AnimationDrawable(); | |||
animationDrawable.setOneShot(false); | |||
int[] drawableIds = new int[]{}; | |||
for (int drawableId : drawableIds) { | |||
Bitmap bitmap = BitmapFactory.decodeResource(MainApplication.getContext().getResources(), drawableId, | |||
options); | |||
animationDrawable.addFrame(new NinePatchDrawable( | |||
MainApplication.getContext().getResources(), bitmap, bitmap.getNinePatchChunk(), new Rect(), | |||
null), 100); | |||
} | |||
return animationDrawable; | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
package com.bonait.bnframework.common.utils; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 16:34. | |||
*/ | |||
public class ProcessValueUtil { | |||
public static HashMap<String,String> dealProcessValue(String value){ | |||
//工序名称和值 | |||
HashMap<String, String> formulation = new HashMap<>(); | |||
if(!value.isEmpty()){ | |||
List<String> data = new ArrayList<>(); | |||
if (value.contains("|")) { | |||
String[] res = value.split("[|]"); | |||
data.addAll(Arrays.asList(res)); | |||
} else { | |||
data.add(value); | |||
} | |||
for (String item : data) { | |||
if (item.contains(",")) { | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
formulation.put(name, val); | |||
} | |||
} | |||
} | |||
} | |||
return formulation; | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.bonait.bnframework.event; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 15:13. | |||
*/ | |||
public class FreshLocalGoodsEvent { | |||
public FreshLocalGoodsEvent(){ | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.bonait.bnframework.event; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 9:12. | |||
*/ | |||
public class ImageSelectEvent { | |||
public String url; | |||
public ImageSelectEvent(String url){ | |||
this.url = url; | |||
} | |||
} |
@@ -190,9 +190,12 @@ public class EditClassifyActivity extends BaseActivity { | |||
}); | |||
} | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_add_attribute,R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()){ | |||
case R.id.btn_add_classify://添加分类 | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
@@ -0,0 +1,9 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 17:26. | |||
*/ | |||
public class EditProcessActivity { | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.bonait.bnframework.ui.adapter; | |||
import android.content.Context; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.BaseAdapter; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 13:45. | |||
*/ | |||
public class ClassifySpinnerAdapter extends BaseAdapter { | |||
private Context context; | |||
private List<String> data; | |||
public ClassifySpinnerAdapter(@NonNull Context context ,List<String> data) { | |||
this.context = context; | |||
this.data = data; | |||
} | |||
@Override | |||
public int getCount() { | |||
return data.size(); | |||
} | |||
@Override | |||
public String getItem(int i) { | |||
return data.get(i); | |||
} | |||
@Override | |||
public long getItemId(int i) { | |||
return 0; | |||
} | |||
@NonNull | |||
@Override | |||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { | |||
if(convertView == null){ | |||
convertView = LayoutInflater.from(context).inflate(R.layout.item_spinner_text, null); | |||
} | |||
TextView textView = convertView.findViewById(R.id.textViewCustom); | |||
textView.setText(getItem(position)); | |||
if(textView.getTextSize()>34||textView.getTextSize()<30){ | |||
DisplayManager.scaleViewGroup(convertView.findViewById(R.id.root)); | |||
} | |||
return convertView; | |||
} | |||
} |
@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
@@ -49,7 +50,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
if(goods.isLocal){ | |||
if(GoodsDBUtil.getByName(goods.name)!=null){ | |||
holder.binding.downLoad.setVisibility(View.GONE); | |||
}else { | |||
holder.binding.downLoad.setVisibility(View.VISIBLE); | |||
@@ -70,7 +71,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if (!goods.isLocal) { | |||
if (GoodsDBUtil.getByName(goods.name)==null) { | |||
ToastUtils.warning("请先下载该商品!"); | |||
} else { | |||
onItemClick(view,position); | |||
@@ -0,0 +1,103 @@ | |||
package com.bonait.bnframework.ui.adapter; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 10:09. | |||
*/ | |||
public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
private List<SelectSubAttributeAdapter> subAttributeAdapters = new ArrayList<>(); | |||
private int resource1; | |||
public List<BPA_ATTRIBUTE> datas; | |||
public SelectAttributeListAdapter(@NonNull Context context, int resource, @NonNull List<BPA_ATTRIBUTE> objects) { | |||
super(context, resource, objects); | |||
subAttributeAdapters.clear(); | |||
this.resource1 = resource; | |||
datas = objects; | |||
} | |||
//每个子项被滚动到屏幕内的时候会被调用 | |||
@SuppressLint("MissingInflatedId") | |||
@NonNull | |||
@Override | |||
public View getView(int position, @Nullable View view, @NonNull ViewGroup parent) { | |||
BPA_ATTRIBUTE bean = (BPA_ATTRIBUTE) datas.get(position);//得到当前项选中item实例 | |||
//为每一个子项加载设定的布局 | |||
if (view == null){ | |||
view = LayoutInflater.from(getContext()).inflate(resource1, parent, false); | |||
//分别获取 image view 和 textview 的实例 | |||
TextView name = view.findViewById(R.id.attribute_name); | |||
RecyclerView recyclerView = view.findViewById(R.id.recycle_sub_attribute); | |||
if(name.getTextSize()>34||name.getTextSize()<30){ | |||
DisplayManager.scaleViewGroup(view.findViewById(R.id.root)); | |||
} | |||
name.setText(bean.name+":"); | |||
if(recyclerView.getAdapter()==null && position == subAttributeAdapters.size()){ | |||
List<BPA_SUBATTRIBUTE> subattributeList = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
SelectSubAttributeAdapter adapter = new SelectSubAttributeAdapter(); | |||
adapter.setNewData(subattributeList); | |||
adapter.setCurrentPosition(-1); | |||
recyclerView.setAdapter(adapter); | |||
LogUtils.d(" SelectAttributeListAdapter getView position="+position); | |||
if(position == subAttributeAdapters.size()){ | |||
subAttributeAdapters.add(adapter); | |||
} | |||
} | |||
} | |||
return view; | |||
} | |||
/** | |||
* 判断是否都选中 | |||
* @return | |||
*/ | |||
public boolean isAllSelected(){ | |||
boolean select = true; | |||
for (SelectSubAttributeAdapter adapter:subAttributeAdapters){ | |||
LogUtils.d(" getSubAttributeList adapter.getCurrentPosition() = "+adapter.getCurrentPosition()); | |||
if(adapter.getCurrentPosition() < 0){ | |||
select = false; | |||
} | |||
} | |||
return select; | |||
} | |||
/** | |||
* 返回选中的子属性组合 “a-b”形式 | |||
*/ | |||
public String getSubAttributeList(){ | |||
StringBuilder list = new StringBuilder(); | |||
for (SelectSubAttributeAdapter adapter:subAttributeAdapters){ | |||
if(adapter.getCurrentPosition() >= 0 && adapter.getData().size()>adapter.getCurrentPosition()){ | |||
list.append(adapter.getData().get(adapter.getCurrentPosition()).name).append("-"); | |||
} | |||
} | |||
String groupName = list.substring(0,list.length()-1); | |||
LogUtils.d(" getSubAttributeList groupName="+groupName); | |||
return groupName; | |||
} | |||
} |
@@ -0,0 +1,69 @@ | |||
package com.bonait.bnframework.ui.adapter; | |||
import android.annotation.SuppressLint; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.common.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ItemSelectSubattributeBinding; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 9:50. | |||
*/ | |||
public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,SelectSubAttributeAdapter.ViewHolder> { | |||
@NonNull | |||
@Override | |||
public SelectSubAttributeAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
return new SelectSubAttributeAdapter.ViewHolder(ItemSelectSubattributeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | |||
} | |||
@Override | |||
public void onBindViewHolder(@NonNull SelectSubAttributeAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
try { | |||
if(holder.binding.name.getTextSize()>34||holder.binding.name.getTextSize()<30){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
BPA_SUBATTRIBUTE subattribute = mData.get(position); | |||
holder.binding.name.setText(subattribute.name+""); | |||
holder.binding.name.setSelected(mCurrentPosition == position); | |||
holder.binding.name.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
int last = mCurrentPosition; | |||
mCurrentPosition = position; | |||
notifyItemChanged(last); | |||
notifyItemChanged(mCurrentPosition); | |||
} | |||
}); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
} | |||
public static class ViewHolder extends RecyclerView.ViewHolder { | |||
private ItemSelectSubattributeBinding binding; | |||
public ViewHolder(ItemSelectSubattributeBinding view) { | |||
super(view.getRoot()); | |||
binding = view; | |||
} | |||
} | |||
} |
@@ -0,0 +1,273 @@ | |||
package com.bonait.bnframework.ui.dialog; | |||
import android.annotation.SuppressLint; | |||
import android.content.DialogInterface; | |||
import android.content.Intent; | |||
import android.graphics.Color; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Bundle; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.AdapterView; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.DialogFragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.ImageChooseActivity; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAddGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.ui.adapter.ClassifySpinnerAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/14 16:10. | |||
*/ | |||
public class AddGoodsDialog extends DialogFragment { | |||
private String TAG = " AddGoodsDialog =>"; | |||
private DialogAddGoodsBinding viewBinding; | |||
private ClassifySpinnerAdapter spinnerAdapter; | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private int classifyPosition = -1; | |||
private String picUrl = ""; | |||
public boolean isDismiss = false; | |||
@Override | |||
public void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogLeft); | |||
if(getArguments()!=null){ | |||
classifyPosition = getArguments().getInt("classifyPosition"); | |||
} | |||
} | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
viewBinding = DialogAddGoodsBinding.inflate(inflater,container,false); | |||
ButterKnife.bind(this, viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
return viewBinding.getRoot(); | |||
} | |||
@Override | |||
public void onStart() { | |||
super.onStart(); | |||
if(getDialog()!=null){ | |||
Window window = getDialog().getWindow(); | |||
assert window != null; | |||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | |||
WindowManager.LayoutParams params = window.getAttributes(); | |||
params.gravity = Gravity.CENTER; | |||
params.width = ViewGroup.LayoutParams.MATCH_PARENT; | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
updateClassifyData(classifyPosition); | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
initView(); | |||
} | |||
private void initView(){ | |||
viewBinding.layoutClassify.spinnerClassify.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
classifyPosition = i; | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
/** | |||
* 点击事件 | |||
* | |||
* @param view | |||
*/ | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_close1, R.id.btn_close2, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_last1, | |||
R.id.good_image,R.id.btn_last2}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.btn_close1: | |||
case R.id.btn_close2: | |||
case R.id.btn_last1: | |||
dismiss(); | |||
break; | |||
case R.id.btn_next1: | |||
changePage(2); | |||
break; | |||
case R.id.btn_next2: | |||
submit(); | |||
break; | |||
case R.id.btn_last2: | |||
changePage(1); | |||
break; | |||
case R.id.good_image: | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
break; | |||
} | |||
} | |||
/** | |||
* 上一步 下一步切换 | |||
* @param pos | |||
*/ | |||
@SuppressLint("SetTextI18n") | |||
public void changePage(int pos){ | |||
switch (pos){ | |||
case 1: | |||
viewBinding.layoutName.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutClassify.getRoot().setVisibility(View.VISIBLE); | |||
break; | |||
case 2: | |||
if(classifyList.isEmpty() || classifyPosition < 0 || classifyPosition>=classifyList.size()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"请选择分类", Toast.LENGTH_SHORT); | |||
} | |||
return; | |||
} | |||
viewBinding.layoutClassify.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutName.getRoot().setVisibility(View.VISIBLE); | |||
viewBinding.layoutName.title2.setText(viewBinding.layoutClassify.spinnerClassify.getSelectedItem().toString()+""); | |||
break; | |||
} | |||
} | |||
/** | |||
* 最后一步提交 | |||
*/ | |||
private void submit(){ | |||
String name = viewBinding.layoutName.editName.getText().toString(); | |||
LogUtils.d(TAG+" name="+name); | |||
if(name.isEmpty()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"名称不能为空", Toast.LENGTH_SHORT); | |||
} | |||
return; | |||
} | |||
if(GoodsDBUtil.getByName(name)!=null){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"已有菜品,请换一个名称", Toast.LENGTH_SHORT); | |||
} | |||
return; | |||
} | |||
BPA_GOODS_CLASSIFY classify = classifyList.get(classifyPosition); | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = name; | |||
goods.classifyId = classify.id; | |||
goods.url = picUrl; | |||
GoodsDBUtil.add(goods); | |||
dismiss(); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
} | |||
/** | |||
* 更新分类数据 | |||
* @param position | |||
*/ | |||
public void updateClassifyData(int position){ | |||
classifyPosition = position; | |||
classifyList.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
List<String> classifyNameList = new ArrayList<>(); | |||
for(BPA_GOODS_CLASSIFY bean: classifyList){ | |||
classifyNameList.add(bean.name); | |||
} | |||
LogUtils.d(" updateClassifyData getContext()="+getContext()); | |||
if(getContext()!=null){ | |||
spinnerAdapter = new ClassifySpinnerAdapter(getContext(), classifyNameList); | |||
// spinnerAdapter.setDropDownViewResource(R.layout.item_h90_spinner_dropdown_text32); | |||
viewBinding.layoutClassify.spinnerClassify.setAdapter(spinnerAdapter); | |||
viewBinding.layoutClassify.spinnerClassify.setSelection(position); | |||
} | |||
} | |||
/** | |||
* 更新图片 | |||
* @param url | |||
*/ | |||
public void updateImage(String url){ | |||
picUrl = url; | |||
LogUtils.d(TAG+" updateCircleImage url="+url); | |||
GlideUtil.showImageWithRadius(getContext(),url,viewBinding.layoutName.goodImage, | |||
R.mipmap.loading123, DimensUtil.getDimens(0)); | |||
} | |||
@Override | |||
public void onDismiss(@NonNull DialogInterface dialog) { | |||
LogUtils.d(TAG+" onDismiss "); | |||
isDismiss = true; | |||
} | |||
@Override | |||
public void onResume() { | |||
super.onResume(); | |||
LogUtils.d(TAG+" onResume "); | |||
EventBus.getDefault().register(this); | |||
isDismiss = false; | |||
} | |||
@Override | |||
public void onPause() { | |||
super.onPause(); | |||
LogUtils.d(TAG+" onPause "); | |||
EventBus.getDefault().unregister(this); | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
LogUtils.d(TAG+" onDestroy "); | |||
} | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onImageSelectEvent(ImageSelectEvent event){ | |||
updateImage(event.url); | |||
} | |||
} |
@@ -0,0 +1,382 @@ | |||
package com.bonait.bnframework.ui.dialog; | |||
import android.annotation.SuppressLint; | |||
import android.content.DialogInterface; | |||
import android.content.Intent; | |||
import android.graphics.Color; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Bundle; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.DialogFragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.DiyUpdate1Activity; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.ImageChooseActivity; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
import com.bonait.bnframework.databinding.DialogEditGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.ui.adapter.SelectAttributeListAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 14:33. | |||
*/ | |||
public class EditGoodsDialog extends DialogFragment { | |||
private String TAG = " EditGoodsDialog =>"; | |||
private DialogEditGoodsBinding viewBinding; | |||
private String picUrl = ""; | |||
private String goodId = ""; | |||
private BPA_GOODS goods; | |||
public boolean isDismiss = false; | |||
/** | |||
* 属性列表 | |||
*/ | |||
private List<BPA_ATTRIBUTE> attributeList = new ArrayList<>(); | |||
/** | |||
* 1-6个主料仓名称 | |||
*/ | |||
ArrayList<String> mainFoods = new ArrayList<>(); | |||
/** | |||
* 属性组合 | |||
*/ | |||
private SelectAttributeListAdapter selectAttributeListAdapter; | |||
@Override | |||
public void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogLeft); | |||
if(getArguments()!=null){ | |||
goodId = getArguments().getString("goodId"); | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
} | |||
} | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
viewBinding = DialogEditGoodsBinding.inflate(inflater,container,false); | |||
ButterKnife.bind(this, viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
return viewBinding.getRoot(); | |||
} | |||
@Override | |||
public void onStart() { | |||
super.onStart(); | |||
if(getDialog()!=null){ | |||
Window window = getDialog().getWindow(); | |||
assert window != null; | |||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | |||
WindowManager.LayoutParams params = window.getAttributes(); | |||
params.gravity = Gravity.CENTER; | |||
params.width = ViewGroup.LayoutParams.MATCH_PARENT; | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
updateNameLayout(); | |||
updateAttributeData(); | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
} | |||
/** | |||
* 点击事件 | |||
* | |||
* @param view | |||
*/ | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_close1, R.id.btn_close2,R.id.btn_close3, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_next3,R.id.btn_last1,R.id.btn_last3, | |||
R.id.good_image,R.id.btn_last2}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.btn_close1: | |||
case R.id.btn_close2: | |||
case R.id.btn_close3: | |||
case R.id.btn_last1: | |||
dismiss(); | |||
break; | |||
case R.id.btn_next1: | |||
String name = viewBinding.layoutName.editName.getText().toString(); | |||
if(name.isEmpty()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"名称不能为空", Toast.LENGTH_SHORT); | |||
} | |||
return; | |||
} | |||
//更新商品名称和图片 | |||
goods.name = viewBinding.layoutName.editName.getText().toString(); | |||
goods.url = picUrl; | |||
GoodsDBUtil.update(goods); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
if(attributeList.isEmpty()){ | |||
changePage(3); | |||
}else { | |||
changePage(2); | |||
} | |||
break; | |||
case R.id.btn_next2: | |||
if(!selectAttributeListAdapter.isAllSelected()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"请选择每行对应的子属性", Toast.LENGTH_SHORT); | |||
} | |||
return; | |||
} | |||
changePage(3); | |||
break; | |||
case R.id.btn_last3: | |||
jumpToCook(); | |||
break; | |||
case R.id.btn_next3: | |||
jumpToEdit(); | |||
break; | |||
case R.id.btn_last2: | |||
changePage(1); | |||
break; | |||
case R.id.good_image: | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
break; | |||
} | |||
} | |||
/** | |||
* 上一步 下一步切换 | |||
* @param pos | |||
*/ | |||
@SuppressLint("SetTextI18n") | |||
public void changePage(int pos){ | |||
switch (pos){ | |||
case 1: | |||
viewBinding.layoutName.getRoot().setVisibility(View.VISIBLE); | |||
viewBinding.layoutMainfoods.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.GONE); | |||
break; | |||
case 2: | |||
viewBinding.layoutName.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutMainfoods.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.VISIBLE); | |||
break; | |||
case 3: | |||
addAttributeGroup(); | |||
updateMainFoodsName(selectAttributeListAdapter.getSubAttributeList()); | |||
LogUtils.d(TAG+" submit mainFoods="+ mainFoods); | |||
viewBinding.layoutName.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutMainfoods.getRoot().setVisibility(View.VISIBLE); | |||
viewBinding.layoutMainfoods.title3.setText(goods.name+"-"+selectAttributeListAdapter.getSubAttributeList()); | |||
break; | |||
} | |||
} | |||
/** | |||
* 添加属性组 | |||
*/ | |||
private void addAttributeGroup(){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
subattributeGroup.goodsId = goods.id; | |||
subattributeGroup.maketime = 0; | |||
subattributeGroup.name = ""; | |||
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){ | |||
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeList(); | |||
} | |||
SubAttributeGroupDBUtil.add(subattributeGroup); | |||
} | |||
/** | |||
* 将工序里的主料名称读出来 | |||
*/ | |||
private void updateMainFoodsName(String groupName){ | |||
viewBinding.layoutMainfoods.editName1.setText(""); | |||
viewBinding.layoutMainfoods.editName2.setText(""); | |||
viewBinding.layoutMainfoods.editName3.setText(""); | |||
viewBinding.layoutMainfoods.editName4.setText(""); | |||
viewBinding.layoutMainfoods.editName5.setText(""); | |||
viewBinding.layoutMainfoods.editName6.setText(""); | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGoodsSubAttributeGroupName(groupName); | |||
for(BPA_GOODS_PROCESS_DETAIL bean:list ){ | |||
String processname = bean.processname; | |||
if(processname.contains("主料")){ | |||
String processvalue = bean.processvalue; | |||
if(!processvalue.isEmpty()){ | |||
HashMap<String,String> params = ProcessValueUtil.dealProcessValue(processvalue); | |||
if(!params.isEmpty()){ | |||
int position = 0;//几号位 | |||
String name = "";//主料名称 | |||
for (HashMap.Entry<String, String> entry : params.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if(key.contains("名称")){ | |||
name = value; | |||
}else if(key.contains("位置")){ | |||
position = Integer.parseInt(value.replace("号位","")); | |||
} | |||
} | |||
updateName(position,name); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* 更新单个主料仓名称 | |||
*/ | |||
private void updateName(int position,String name){ | |||
switch (position){ | |||
case 1: | |||
viewBinding.layoutMainfoods.editName1.setText(name); | |||
break; | |||
case 2: | |||
viewBinding.layoutMainfoods.editName2.setText(name); | |||
break; | |||
case 3: | |||
viewBinding.layoutMainfoods.editName3.setText(name); | |||
break; | |||
case 4: | |||
viewBinding.layoutMainfoods.editName4.setText(name); | |||
break; | |||
case 5: | |||
viewBinding.layoutMainfoods.editName5.setText(name); | |||
break; | |||
case 6: | |||
viewBinding.layoutMainfoods.editName6.setText(name); | |||
break; | |||
} | |||
} | |||
/** | |||
* 跳转去烹饪页面 | |||
*/ | |||
private void jumpToCook(){ | |||
//TODO | |||
dismiss(); | |||
} | |||
/** | |||
* 跳转去编辑页面 | |||
*/ | |||
private void jumpToEdit(){ | |||
mainFoods.clear(); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName1.getText().toString()); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName2.getText().toString()); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName3.getText().toString()); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName4.getText().toString()); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName5.getText().toString()); | |||
mainFoods.add(viewBinding.layoutMainfoods.editName6.getText().toString()); | |||
//TODO | |||
Intent intent = new Intent(getContext(), DiyUpdate1Activity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.putStringArrayListExtra("mainFoods",mainFoods); | |||
intent.putExtra("attributeGroupName",selectAttributeListAdapter.getSubAttributeList()); | |||
startActivity(intent); | |||
dismiss(); | |||
} | |||
/** | |||
* 更新名称 | |||
*/ | |||
private void updateNameLayout(){ | |||
viewBinding.layoutName.editName.setText(Objects.requireNonNull(GoodsDBUtil.getById(goodId)).name); | |||
} | |||
/** | |||
* 刷新属性数据 | |||
*/ | |||
public void updateAttributeData(){ | |||
LogUtils.d(TAG+" updateAttributeData"); | |||
selectAttributeListAdapter = new SelectAttributeListAdapter(getContext(), R.layout.item_select_attribute_list,attributeList); | |||
viewBinding.layoutAttribute.listAttribute.setAdapter(selectAttributeListAdapter); | |||
} | |||
/** | |||
* 更新图片 | |||
* @param url | |||
*/ | |||
public void updateImage(String url){ | |||
picUrl = url; | |||
LogUtils.d(TAG+" updateCircleImage url="+url); | |||
GlideUtil.showImageWithRadius(getContext(),url,viewBinding.layoutName.goodImage, | |||
R.mipmap.loading123, DimensUtil.getDimens(0)); | |||
} | |||
@Override | |||
public void onDismiss(@NonNull DialogInterface dialog) { | |||
LogUtils.d(TAG+" onDismiss "); | |||
isDismiss = true; | |||
} | |||
@Override | |||
public void onResume() { | |||
super.onResume(); | |||
LogUtils.d(TAG+" onResume "); | |||
EventBus.getDefault().register(this); | |||
isDismiss = false; | |||
} | |||
@Override | |||
public void onPause() { | |||
super.onPause(); | |||
LogUtils.d(TAG+" onPause "); | |||
EventBus.getDefault().unregister(this); | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
LogUtils.d(TAG+" onDestroy "); | |||
} | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onImageSelectEvent(ImageSelectEvent event){ | |||
updateImage(event.url); | |||
} | |||
} |
@@ -1,7 +1,6 @@ | |||
package com.bonait.bnframework.ui.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
@@ -11,34 +10,25 @@ import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.lifecycle.ViewModelProvider; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.ProcessValueUtil; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
import com.bonait.bnframework.databinding.FragmentLocalGoodsBinding; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.adapter.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.CloudGoodsAdapter; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* @author: liup | |||
@@ -52,6 +42,13 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private HomeGoodsViewModel viewModel; | |||
public static CloudGoodsFragment newInstance(HomeGoodsViewModel viewModel){ | |||
CloudGoodsFragment fragment = new CloudGoodsFragment(); | |||
fragment.viewModel = viewModel; | |||
return fragment; | |||
}; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
@@ -75,10 +72,18 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
viewModel = new ViewModelProvider(getActivity()).get(HomeGoodsViewModel.class); | |||
initView(); | |||
initData(); | |||
updateData(); | |||
} | |||
private void initData(){ | |||
viewModel.cloudGoodsList.observe(getViewLifecycleOwner(),data->{ | |||
updateData(); | |||
}); | |||
} | |||
@Override | |||
protected int backViewInitOffset() { | |||
return 0; | |||
@@ -123,11 +128,13 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private void dealClassifyData(){ | |||
classifyList.clear(); | |||
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){ | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.id = bean.getGoodsTypeId(); | |||
goodsClassify.name = bean.getGoodsTypeName(); | |||
classifyList.add(goodsClassify); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : Objects.requireNonNull(viewModel.cloudGoodsList.getValue())){ | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.id = bean.getGoodsTypeId(); | |||
goodsClassify.name = bean.getGoodsTypeName(); | |||
classifyList.add(goodsClassify); | |||
} | |||
} | |||
classifyAdapter.setNewData(classifyList); | |||
} | |||
@@ -183,81 +190,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
ToastUtils.warning("请勿重复下载,本地商品已存在!!!"); | |||
return false; | |||
}else { | |||
//商品不存在情况 | |||
//判断分类是否存在 | |||
if(GoodsClassifyDBUtil.getByName(goodsClassify.name)==null){ | |||
GoodsClassifyDBUtil.add(goodsClassify); | |||
} | |||
//添加商品 | |||
GoodsDBUtil.add(goods); | |||
//添加属性 | |||
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){ | |||
if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | |||
//判断是否已有属性 不存在则添加 | |||
if(!AttributeDBUtil.isExist(goodsClassify.id,goodsAttributeListBean.getGoodsAttributeName())){ | |||
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE(); | |||
attribute.name = goodsAttributeListBean.getGoodsAttributeName(); | |||
attribute.id = goodsAttributeListBean.getGoodsAttributeId(); | |||
attribute.classifyId = goodsClassify.id; | |||
AttributeDBUtil.add(attribute); | |||
LogUtils.d(" 添加属性 成功"+goodsAttributeListBean.getGoodsAttributeName()); | |||
}else { | |||
LogUtils.d(" 已存在属性 "+goodsAttributeListBean.getGoodsAttributeName()); | |||
} | |||
//添加子属性 | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean :goodsAttributeListBean.getGoodsAttributeValueList() ){ | |||
//判断是否已有子属性 不存在则添加 | |||
if(!SubAttributeDBUtil.isExist(goodsAttributeListBean.getGoodsAttributeId(),goodsAttributeValueListBean.getAttributeValue())){ | |||
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE(); | |||
subattribute.parentAttributeId = goodsAttributeListBean.getGoodsAttributeId(); | |||
subattribute.name = goodsAttributeValueListBean.getAttributeValue(); | |||
subattribute.id = goodsAttributeValueListBean.getGoodsAttributeValueId(); | |||
SubAttributeDBUtil.add(subattribute); | |||
LogUtils.d(" 添加子属性 成功"+goodsAttributeValueListBean.getAttributeValue()); | |||
}else { | |||
LogUtils.d(" 已存在子属性 "+goodsAttributeValueListBean.getAttributeValue()); | |||
} | |||
} | |||
} | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
if(goodsInfoListBean.getGoodsName().equals(goods.name)){ | |||
List<String> groupList = new ArrayList<>(); | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(goods.id); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodsInfoListBean.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
//TODO 需确定getGoodsAttributeId 是用id列表还是name组合 app上新增的id和云端的肯定不匹配 建议用name组合 | |||
if(!groupList.contains(goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
if(!SubAttributeGroupDBUtil.isExist(goods.id,goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.name = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.id = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.goodsId = goods.id; | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
SubAttributeGroupDBUtil.add(group); | |||
} | |||
} | |||
BPA_GOODS_PROCESS_DETAIL processDetail = new BPA_GOODS_PROCESS_DETAIL(); | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = ""; | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
} | |||
} | |||
break; | |||
} | |||
break; | |||
} | |||
} | |||
//添加所有工序 | |||
viewModel.downLoadCloudGoods(goods,goodsClassify); | |||
} | |||
return true; | |||
} | |||
@@ -13,23 +13,18 @@ import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import androidx.lifecycle.ViewModelProvider; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.model.ResListAPI; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentHomeFoodsBinding; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.orhanobut.logger.Logger; | |||
import butterknife.ButterKnife; | |||
@@ -53,6 +48,8 @@ public class HomeFoodsFragment extends BaseFragment { | |||
public Activity activity = null; | |||
private HomeGoodsViewModel viewModel; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
@@ -83,6 +80,8 @@ public class HomeFoodsFragment extends BaseFragment { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
activity = getActivity(); | |||
viewModel = new ViewModelProvider(getActivity()).get(HomeGoodsViewModel.class); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initTopBar(); | |||
SelectTab(1); | |||
@@ -121,39 +120,9 @@ public class HomeFoodsFragment extends BaseFragment { | |||
private void requestData(){ | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
if(ConfigName.getInstance().cloudGoodsList.isEmpty()){ | |||
//TODO 对接后台接口 | |||
if (ConfigName.getInstance().organizeMode == null) { | |||
return; | |||
} | |||
if(!viewModel.hasData){ | |||
ToastUtils.info("正在请求云端数据"); | |||
OkGo.<ResListAPI<GoodsClassifyBean>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResListAPI<GoodsClassifyBean>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResListAPI<GoodsClassifyBean>> response) { | |||
ResListAPI<GoodsClassifyBean> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) { | |||
ConfigName.getInstance().cloudGoodsList.clear(); | |||
ConfigName.getInstance().cloudGoodsList.addAll(allDataResAPI.data); | |||
} | |||
if(handler!=null){ | |||
handler.post(new Runnable() { | |||
@Override | |||
public void run() { | |||
if(fragment!=null){ | |||
if(fragment instanceof CloudGoodsFragment){ | |||
((CloudGoodsFragment) fragment).updateData(); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
viewModel.fetchCloudData(context); | |||
} | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
@@ -190,7 +159,7 @@ public class HomeFoodsFragment extends BaseFragment { | |||
if(index == 1){ | |||
fragment = new LocalGoodsFragment(); | |||
}else { | |||
fragment = new CloudGoodsFragment(); | |||
fragment = CloudGoodsFragment.newInstance(viewModel); | |||
} | |||
getChildFragmentManager().beginTransaction() | |||
.replace(R.id.frame, fragment) | |||
@@ -29,8 +29,15 @@ import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentLocalGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.LocalGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.AddGoodsDialog; | |||
import com.bonait.bnframework.ui.dialog.EditGoodsDialog; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
@@ -47,6 +54,9 @@ public class LocalGoodsFragment extends BaseFragment { | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private Long FRESH_DELAY_TIME = 200L; | |||
private AddGoodsDialog addGoodsDialog; | |||
private EditGoodsDialog editGoodsDialog; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
@@ -91,7 +101,17 @@ public class LocalGoodsFragment extends BaseFragment { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
if(!ConfigName.getInstance().user.name.equals("一般用户")){ | |||
if(editGoodsDialog == null){ | |||
editGoodsDialog= new EditGoodsDialog(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putString("goodId",mData.get(position).id); | |||
editGoodsDialog.setArguments(bundle); | |||
if(getActivity()!=null){ | |||
editGoodsDialog.show(getActivity().getSupportFragmentManager(),"editGoods"); | |||
} | |||
} | |||
} | |||
@Override | |||
@@ -123,7 +143,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
@Override | |||
protected void addGoods() { | |||
addGoodsDialog(); | |||
} | |||
}; | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
@@ -133,12 +153,30 @@ public class LocalGoodsFragment extends BaseFragment { | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,500L);//避免快速点击 | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
} | |||
}; | |||
classifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
} | |||
/** | |||
* 添加菜品弹窗 | |||
*/ | |||
public void addGoodsDialog(){ | |||
if(!classifyList.isEmpty() && getActivity()!=null){ | |||
LogUtils.d(" addGoodsDialog addGoodsDialog="+addGoodsDialog); | |||
if(addGoodsDialog == null){ | |||
addGoodsDialog = new AddGoodsDialog(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putInt("classifyPosition",classifyAdapter.getCurrentPosition()); | |||
addGoodsDialog.setArguments(bundle); | |||
addGoodsDialog.show(getActivity().getSupportFragmentManager(), "addGoods"); | |||
} | |||
} | |||
/** | |||
* 初始化数据加载 | |||
*/ | |||
@@ -163,13 +201,22 @@ public class LocalGoodsFragment extends BaseFragment { | |||
public void onPause() { | |||
super.onPause(); | |||
LogUtils.d("LocalGoodsFragment onPause"); | |||
EventBus.getDefault().unregister(this); | |||
if(addGoodsDialog!=null && addGoodsDialog.isDismiss){ | |||
addGoodsDialog.onDestroy(); | |||
addGoodsDialog = null; | |||
} | |||
if(editGoodsDialog!=null && editGoodsDialog.isDismiss){ | |||
editGoodsDialog.onDestroy(); | |||
editGoodsDialog = null; | |||
} | |||
} | |||
@Override | |||
public void onResume() { | |||
super.onResume(); | |||
LogUtils.d("LocalGoodsFragment onResume"); | |||
EventBus.getDefault().register(this); | |||
} | |||
@Override | |||
@@ -190,5 +237,22 @@ public class LocalGoodsFragment extends BaseFragment { | |||
handler.removeCallbacksAndMessages(null); | |||
handler = null; | |||
} | |||
if(addGoodsDialog!=null){ | |||
addGoodsDialog.onDestroy(); | |||
addGoodsDialog = null; | |||
} | |||
if(editGoodsDialog!=null){ | |||
editGoodsDialog.onDestroy(); | |||
editGoodsDialog = null; | |||
} | |||
} | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onImageSelectEvent(FreshLocalGoodsEvent event){ | |||
if(handler!=null){ | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
} | |||
} | |||
} |
@@ -0,0 +1,146 @@ | |||
package com.bonait.bnframework.ui.viewmodel; | |||
import android.content.Context; | |||
import androidx.lifecycle.MutableLiveData; | |||
import androidx.lifecycle.ViewModel; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.ProcessValueUtil; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.model.ResListAPI; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/14 9:33. | |||
*/ | |||
public class HomeGoodsViewModel extends ViewModel { | |||
public MutableLiveData<List<GoodsClassifyBean>> cloudGoodsList = new MutableLiveData<>(); | |||
public boolean hasData = false; | |||
public void fetchCloudData(Context context){ | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
if (ConfigName.getInstance().organizeMode == null) { | |||
return; | |||
} | |||
OkGo.<ResListAPI<GoodsClassifyBean>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResListAPI<GoodsClassifyBean>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResListAPI<GoodsClassifyBean>> response) { | |||
ResListAPI<GoodsClassifyBean> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) { | |||
// ConfigName.getInstance().cloudGoodsList.clear(); | |||
// ConfigName.getInstance().cloudGoodsList.addAll(allDataResAPI.data); | |||
cloudGoodsList.setValue(allDataResAPI.data); | |||
hasData = true; | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_GOODS_CLASSIFY goodsClassify){ | |||
//商品不存在情况 | |||
//判断分类是否存在 | |||
if(GoodsClassifyDBUtil.getByName(goodsClassify.name)==null){ | |||
GoodsClassifyDBUtil.add(goodsClassify); | |||
} | |||
//添加商品 | |||
GoodsDBUtil.add(goods); | |||
//添加属性 | |||
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){ | |||
if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | |||
//判断是否已有属性 不存在则添加 | |||
if(!AttributeDBUtil.isExist(goodsClassify.id,goodsAttributeListBean.getGoodsAttributeName())){ | |||
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE(); | |||
attribute.name = goodsAttributeListBean.getGoodsAttributeName(); | |||
attribute.id = goodsAttributeListBean.getGoodsAttributeId(); | |||
attribute.classifyId = goodsClassify.id; | |||
AttributeDBUtil.add(attribute); | |||
LogUtils.d(" 添加属性 成功"+goodsAttributeListBean.getGoodsAttributeName()); | |||
}else { | |||
LogUtils.d(" 已存在属性 "+goodsAttributeListBean.getGoodsAttributeName()); | |||
} | |||
//添加子属性 | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean :goodsAttributeListBean.getGoodsAttributeValueList() ){ | |||
//判断是否已有子属性 不存在则添加 | |||
if(!SubAttributeDBUtil.isExist(goodsAttributeListBean.getGoodsAttributeId(),goodsAttributeValueListBean.getAttributeValue())){ | |||
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE(); | |||
subattribute.parentAttributeId = goodsAttributeListBean.getGoodsAttributeId(); | |||
subattribute.name = goodsAttributeValueListBean.getAttributeValue(); | |||
subattribute.id = goodsAttributeValueListBean.getGoodsAttributeValueId(); | |||
SubAttributeDBUtil.add(subattribute); | |||
LogUtils.d(" 添加子属性 成功"+goodsAttributeValueListBean.getAttributeValue()); | |||
}else { | |||
LogUtils.d(" 已存在子属性 "+goodsAttributeValueListBean.getAttributeValue()); | |||
} | |||
} | |||
} | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
if(goodsInfoListBean.getGoodsName().equals(goods.name)){ | |||
List<String> groupList = new ArrayList<>(); | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(goods.id); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodsInfoListBean.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
//TODO 需确定getGoodsAttributeId 是用id列表还是name组合 app上新增的id和云端的肯定不匹配 建议用name组合 | |||
if(!groupList.contains(goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
if(!SubAttributeGroupDBUtil.isExist(goods.id,goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.name = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.id = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.goodsId = goods.id; | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
SubAttributeGroupDBUtil.add(group); | |||
} | |||
} | |||
//添加所有工序 | |||
BPA_GOODS_PROCESS_DETAIL processDetail = new BPA_GOODS_PROCESS_DETAIL(); | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = ""; | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
} | |||
} | |||
break; | |||
} | |||
break; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,70 @@ | |||
package com.bonait.bnframework.ui.widget; | |||
import android.content.Context; | |||
import android.text.SpannableStringBuilder; | |||
import android.text.Spanned; | |||
import android.text.style.ForegroundColorSpan; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.widget.Toast; | |||
import androidx.core.content.ContextCompat; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ViewLayoutToastBinding; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/15 11:10. | |||
*/ | |||
public class NewToastUtil { | |||
public static void showToast(Context context,String message,int duration){ | |||
Toast toast = new Toast(context); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(context).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(duration); | |||
toast.setView(layout); | |||
toast.show(); | |||
} | |||
/** | |||
* 设置部分字体颜色 | |||
* @param context | |||
* @param message | |||
* @param colorText | |||
* @param duration | |||
*/ | |||
public void showToastTextColor(Context context,String message,String colorText,int color,int duration){ | |||
Toast toast = new Toast(context); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(context).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(content); | |||
int index = content.indexOf(colorText); | |||
if(index>0){ | |||
spannableStringBuilder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, color)),index,index+colorText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); | |||
} | |||
binding.toastText.setText(spannableStringBuilder); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(duration); | |||
toast.setView(layout); | |||
toast.show(); | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<corners android:radius="@dimen/dp_25"/> | |||
<solid android:color="#FF9800"/> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<corners android:radius="@dimen/dp_25"/> | |||
<solid android:color="#567722"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<corners android:topRightRadius="@dimen/dp_25" android:topLeftRadius="25dp"/> | |||
<solid android:color="#BEAA6A"/> | |||
</shape> |
@@ -0,0 +1,19 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" | |||
> | |||
<shape > | |||
<solid android:color="@color/light_blue_primary"/> | |||
<stroke android:width="@dimen/dp_1" android:color="@color/color3"/> | |||
<corners android:radius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
<item > | |||
<shape > | |||
<solid android:color="@color/white"/> | |||
<stroke android:width="@dimen/dp_1" android:color="@color/color3"/> | |||
<corners android:radius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" android:color="@color/white"/> | |||
<item android:color="@color/color4"/> | |||
</selector> |
@@ -616,7 +616,7 @@ | |||
<!-- 不透明蒙版 执行中-->F | |||
<RelativeLayout | |||
android:visibility="gone" | |||
tools:visibility="gone" | |||
tools:visibility="visible" | |||
android:id="@+id/liaohedata" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
@@ -15,6 +15,7 @@ | |||
android:layout_height="match_parent"> | |||
<com.bonait.bnframework.common.bg.SnowView | |||
android:id="@+id/snowView" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/transparent" /> | |||
@@ -0,0 +1,35 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:background="#7F000000" | |||
android:layout_height="match_parent"> | |||
<!--分类选择--> | |||
<include | |||
android:id="@+id/layout_classify" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_350" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
layout="@layout/layout_add_goods_sel_classify" | |||
android:visibility="visible" | |||
/> | |||
<!--名称 图片选择--> | |||
<include | |||
android:id="@+id/layout_name" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_500" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
layout="@layout/layout_add_goods_name" | |||
android:visibility="gone" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -47,9 +47,9 @@ | |||
android:textColor="@color/white" | |||
android:text="确认" | |||
android:background="@drawable/bg_round25_yellow_btn" | |||
android:layout_gravity="bottom|right" | |||
android:layout_gravity="bottom" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginRight="@dimen/dp_40" | |||
android:layout_marginLeft="@dimen/dp_500" | |||
/> | |||
</FrameLayout> | |||
@@ -0,0 +1,60 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:background="#7F000000" | |||
android:layout_height="match_parent"> | |||
<!-- <!–分类选择–>--> | |||
<!-- <include--> | |||
<!-- android:id="@+id/layout_classify"--> | |||
<!-- android:layout_width="@dimen/dp_660"--> | |||
<!-- android:layout_height="@dimen/dp_350"--> | |||
<!-- app:layout_constraintLeft_toLeftOf="parent"--> | |||
<!-- app:layout_constraintRight_toRightOf="parent"--> | |||
<!-- app:layout_constraintTop_toTopOf="parent"--> | |||
<!-- app:layout_constraintBottom_toBottomOf="parent"--> | |||
<!-- layout="@layout/layout_add_goods_sel_classify"--> | |||
<!-- android:visibility="visible"--> | |||
<!-- />--> | |||
<!--名称 图片选择--> | |||
<include | |||
android:id="@+id/layout_name" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_500" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
layout="@layout/layout_edit_goods_name" | |||
android:visibility="visible" | |||
/> | |||
<!--子属性选择--> | |||
<include | |||
android:id="@+id/layout_attribute" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
layout="@layout/layout_edit_goods_sub_attribute" | |||
android:visibility="gone" | |||
/> | |||
<!--主料填写--> | |||
<include | |||
android:id="@+id/layout_mainfoods" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_980" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
layout="@layout/layout_add_goods_mainfood" | |||
android:visibility="gone" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,12 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:id="@+id/checkedTextViewCustom_1" | |||
style="?android:attr/spinnerDropDownItemStyle" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_90" | |||
android:background="@color/activity_background" | |||
android:ellipsize="marquee" | |||
android:singleLine="true" | |||
android:text="11111" | |||
android:textAlignment="inherit" | |||
android:textSize="@dimen/sp_32"/> |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:id="@+id/textViewCustom" | |||
style="?android:attr/spinnerItemStyle" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_90" | |||
android:ellipsize="marquee" | |||
android:singleLine="true" | |||
android:textAlignment="inherit" | |||
android:gravity="center_vertical" | |||
android:text="请选择" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/black"> | |||
</TextView> | |||
@@ -0,0 +1,258 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_980" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title3" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
android:paddingRight="@dimen/dp_80" | |||
android:paddingLeft="@dimen/dp_80" | |||
android:lines="1" | |||
android:singleLine="true" | |||
android:ellipsize="start" | |||
style="@style/TextView_btn" | |||
android:text="按编号填写主料名称" | |||
/> | |||
<ImageView | |||
android:id="@+id/img_mainfood" | |||
android:layout_width="@dimen/dp_400" | |||
android:layout_height="@dimen/dp_400" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/title3" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:src="@mipmap/device_small_cook3" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
android:id="@+id/ll1" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/img_mainfood" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="①" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name1" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="②" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name2" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
android:id="@+id/ll2" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/ll1" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="③" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name3" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="④" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name4" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
android:id="@+id/ll3" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/ll2" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="⑤" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name5" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
style="@style/TextView_desc" | |||
android:text="⑥" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name6" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="未设置" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
</LinearLayout> | |||
<TextView | |||
android:id="@+id/btn_next3" | |||
android:layout_width="@dimen/dp_255" | |||
android:layout_height="@dimen/dp_120" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_350" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_48" | |||
android:textColor="@color/white" | |||
android:background="@drawable/bg_round25_green_btn" | |||
android:text="编辑工艺" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last3" | |||
android:layout_width="@dimen/dp_255" | |||
android:layout_height="@dimen/dp_120" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_48" | |||
android:textColor="@color/white" | |||
android:background="@drawable/bg_round25_yellow_btn" | |||
android:text="去烹饪" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close3" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,110 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_500" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title2" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn" | |||
tools:text="川菜系列" | |||
/> | |||
<TextView | |||
android:id="@+id/desc2" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_150" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toBottomOf="@id/title2" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="选择图片:" | |||
style="@style/TextView_desc" | |||
/> | |||
<ImageView | |||
android:id="@+id/good_image" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_150" | |||
android:layout_centerInParent="true" | |||
android:scaleType="centerCrop" | |||
android:src="@mipmap/loading123" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc2" | |||
app:layout_constraintTop_toTopOf="@id/desc2" | |||
android:layout_marginLeft="@dimen/dp_60" | |||
/> | |||
<TextView | |||
android:id="@+id/desc_name" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toBottomOf="@id/desc2" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="菜品名称:" | |||
style="@style/TextView_desc" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name" | |||
android:layout_width="@dimen/dp_400" | |||
android:layout_height="@dimen/dp_90" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入菜品名称" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:textSize="@dimen/sp_32" /> | |||
<TextView | |||
android:id="@+id/btn_next2" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="确认" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last2" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="上一步" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close2" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,77 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_350" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title1" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn" | |||
android:text="选择分类" | |||
/> | |||
<TextView | |||
android:id="@+id/desc1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="@dimen/dp_130" | |||
android:text="选择分类:" | |||
style="@style/TextView_desc" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_classify" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc1" | |||
app:layout_constraintTop_toTopOf="@id/desc1" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last1" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="取消" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_next1" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="下一步" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,110 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="@dimen/dp_500" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title1" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn" | |||
android:text="编辑菜品" | |||
/> | |||
<TextView | |||
android:id="@+id/desc1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_150" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toBottomOf="@id/title1" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="选择图片:" | |||
style="@style/TextView_desc" | |||
/> | |||
<ImageView | |||
android:id="@+id/good_image" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_150" | |||
android:layout_centerInParent="true" | |||
android:scaleType="centerCrop" | |||
android:src="@mipmap/loading123" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc1" | |||
app:layout_constraintTop_toTopOf="@id/desc1" | |||
android:layout_marginLeft="@dimen/dp_60" | |||
/> | |||
<TextView | |||
android:id="@+id/desc_name" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toBottomOf="@id/desc1" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="菜品名称:" | |||
style="@style/TextView_desc" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_name" | |||
android:layout_width="@dimen/dp_400" | |||
android:layout_height="@dimen/dp_90" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入菜品名称" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
android:maxLength="100" | |||
android:layout_gravity="center" | |||
android:gravity="center_vertical" | |||
app:layout_constraintTop_toTopOf="@+id/desc_name" | |||
app:layout_constraintLeft_toRightOf="@+id/desc_name" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:textSize="@dimen/sp_32" /> | |||
<TextView | |||
android:id="@+id/btn_next1" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="下一步" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last1" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="取消" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,69 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="wrap_content" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title2" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn" | |||
android:text="选择属性" | |||
/> | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_620" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toBottomOf="@id/title2" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_margin="@dimen/dp_20" | |||
android:divider="#00000000" | |||
android:orientation="vertical" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_next2" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
style="@style/TextView_btn" | |||
android:text="下一步" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last2" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn" | |||
android:text="上一步" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close2" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -62,6 +62,7 @@ | |||
app:spanCount="3" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -3,13 +3,12 @@ | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="@dimen/dp_185" | |||
android:layout_height="@dimen/dp_215" | |||
android:paddingBottom="@dimen/dp_30" | |||
android:layout_height="@dimen/dp_185" | |||
> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_width="@dimen/dp_185" | |||
android:layout_height="@dimen/dp_215" | |||
> | |||
<ImageView | |||
@@ -34,6 +33,9 @@ | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_26" | |||
android:textStyle="bold" | |||
android:ellipsize="middle" | |||
android:lines="1" | |||
android:singleLine="true" | |||
android:background="#99FFFFFF" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toTopOf="@id/edit" | |||
@@ -71,11 +73,7 @@ | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_24" /> | |||
</RelativeLayout> | |||
<TextView | |||
android:layout_width="3dp" | |||
android:layout_height="match_parent" | |||
android:background="@color/white" | |||
/> | |||
<RelativeLayout | |||
android:id="@+id/delete" | |||
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_90" | |||
android:id="@+id/root" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
xmlns:app="http://schemas.android.com/apk/res-auto"> | |||
<TextView | |||
android:id="@+id/attribute_name" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
style="@style/TextView_desc" | |||
tools:text="口味:" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:id="@+id/recycle_sub_attribute" | |||
android:orientation="horizontal" | |||
android:layout_gravity="center" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |||
/> | |||
</LinearLayout> |
@@ -0,0 +1,26 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:id="@+id/root" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
tools:text="特辣xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |||
android:textSize="@dimen/sp_32" | |||
android:background="@drawable/selector_select_sub_attribute_bg" | |||
android:textColor="@drawable/selector_select_sub_attribute_color" | |||
android:gravity="center" | |||
android:maxLines="1" | |||
android:maxLength="15" | |||
android:ellipsize="middle" | |||
android:paddingLeft="@dimen/dp_15" | |||
android:paddingRight="@dimen/dp_15" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
</FrameLayout> |
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_90" | |||
android:id="@+id/root" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<CheckedTextView | |||
android:id="@+id/textViewCustom" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_90" | |||
android:ellipsize="marquee" | |||
android:singleLine="true" | |||
android:textAlignment="inherit" | |||
android:gravity="center_vertical" | |||
tools:text="请选择" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/black"> | |||
</CheckedTextView> | |||
</LinearLayout> | |||
@@ -0,0 +1,34 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:id="@+id/toast_root" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
android:layout_marginRight="@dimen/dp_50" | |||
android:background="@drawable/bg_round50_green_btn" | |||
android:orientation="horizontal"> | |||
<ImageView | |||
android:id="@+id/toast_icon" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:src="@mipmap/boluo" | |||
/> | |||
<TextView | |||
android:id="@+id/toast_text" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:layout_toRightOf="@id/toast_icon" | |||
android:paddingLeft="@dimen/dp_15" | |||
android:paddingRight="@dimen/dp_30" | |||
android:gravity="center" | |||
android:layout_centerVertical="true" | |||
tools:text="信息ssss" | |||
/> | |||
</RelativeLayout> |
@@ -135,4 +135,6 @@ | |||
<color name="pro1">#E24CAF50</color> | |||
<color name="pro2">#CCCBCB</color> | |||
<color name="textcolor_subtile">#823E17</color> | |||
<color name="textbg_green">#567722</color> | |||
</resources> |
@@ -309,8 +309,45 @@ | |||
</style> | |||
<style name="TextView_subtitle"> | |||
<item name="android:textColor">@color/white</item> | |||
<item name="android:textSize">@dimen/sp_32</item> | |||
<item name="android:gravity">center</item> | |||
</style> | |||
<style name="TextView_btn"> | |||
<item name="android:textColor">@color/white</item> | |||
<item name="android:textSize">@dimen/sp_32</item> | |||
<item name="android:gravity">center</item> | |||
<item name="android:background">@drawable/bg_round25_yellow_btn</item> | |||
</style> | |||
<style name="TextView_desc"> | |||
<item name="android:textColor">@color/textcolor_subtile</item> | |||
<item name="android:textSize">@dimen/sp_32</item> | |||
<item name="android:gravity">center</item> | |||
</style> | |||
<style name="DialogLeft" parent="@android:style/Theme.Dialog"> | |||
<!-- 背景透明 --> | |||
<item name="android:windowBackground">@android:color/transparent</item> | |||
<item name="android:windowContentOverlay">@null</item> | |||
<!-- 浮于Activity之上 --> | |||
<item name="android:windowIsFloating">true</item> | |||
<!-- 边框 --> | |||
<item name="android:windowFrame">@null</item> | |||
<!-- Dialog以外的区域模糊效果 --> | |||
<item name="android:backgroundDimEnabled">true</item> | |||
<!-- 无标题 --> | |||
<item name="android:windowNoTitle">true</item> | |||
<!-- 半透明 --> | |||
<item name="android:windowIsTranslucent">true</item> | |||
<!--点击dialog以外区域关闭弹窗--> | |||
<item name="android:windowCloseOnTouchOutside">true</item> | |||
<item name="android:windowFullscreen">true</item> | |||
<!-- Dialog进入及退出动画 --> | |||
<!-- <item name="android:windowAnimationStyle">@style/ActionSheetDialogRight</item>--> | |||
</style> | |||
</resources> |