Commit 50bee6e4 by wjg

add release apk

parent c6e0f148
package com.ihaoin.hooloo.device.base;
public class AppConfig {
public static Boolean DEBUG = false; // TODO 编译环境
public static Boolean DEBUG = true; // TODO 编译环境
/** 点单屏编码, 1-菜单屏,2-交互屏 */
public static Integer DEFAULT_SCREEN_NO = 1; // TODO 编译点单屏编码
......
......@@ -5,7 +5,7 @@ import android.view.animation.Interpolator;
import android.widget.Scroller;
public class FixedSpeedScroller extends Scroller {
private int mDuration = 1500;
private int mDuration = 1000;
public FixedSpeedScroller(Context context) {
super(context);
......
......@@ -91,17 +91,17 @@ public class IntroViewPager extends ViewPager {
// }
public int getCount() {
return Integer.MAX_VALUE;
// if (pagerAdapter == null) {
// return 0;
// }
// return pagerAdapter.getCount();
// return Integer.MAX_VALUE;
if (pagerAdapter == null) {
return 0;
}
return pagerAdapter.getCount();
}
private PagerAdapter pagerAdapter = new PagerAdapter() {
@Override
public int getCount() {
return CollectionUtils.isEmpty(introUrls) ? 0 : Integer.MAX_VALUE;
return CollectionUtils.isEmpty(introUrls) ? 0 : introUrls.size();
}
@Override
......@@ -130,7 +130,7 @@ public class IntroViewPager extends ViewPager {
private View getView(Integer position) {
ImageView imageView = (ImageView) LayoutInflater.from(getContext()).inflate(R.layout.intro_image, null);
String url = introUrls.get(position % introUrls.size());
String url = introUrls.get(position);
// Utils.i("getView: " + (position % introUrls.size()));
Utils.getGlide(getContext()).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
return imageView;
......
package com.ihaoin.hooloo.device.data.enums;
public enum ImageState {
IDEL("闲置", "闲置", "闲置.json"),
HOO_THANK("hoo感谢", "hoo感谢", "hoo感谢.json"),
HOO_THANK2("hoo感谢2", "hoo感谢2", "hoo感谢2.json"),
HOO_ENTERTAIN("hoo接待", "hoo接待", "hoo接待.json"),
HOO_CUT("hoo转场", "hoo转场", "hoo转场.json"),
HOO_CUT2("hoo转场2", "hoo转场2", "hoo转场2.json"),
LOO_THANK("loo感谢", "loo感谢", "loo感谢.json"),
LOO_ENTERTAIN("loo接待", "loo接待", "loo接待.json"),
LOO_CUT("loo转场", "loo转场", "loo转场.json"),
LOO_CUT2("loo转场2", "loo转场2", "loo转场2.json");
IDEL("imgs/闲置", "imgs/闲置", "闲置.json"),
HOO_THANK("imgs/hoo感谢", "imgs/hoo感谢", "hoo感谢.json"),
HOO_THANK2("imgs/hoo感谢2", "imgs/hoo感谢2", "hoo感谢2.json"),
HOO_ENTERTAIN("imgs/hoo接待", "imgs/hoo接待", "hoo接待.json"),
HOO_CUT("imgs/hoo转场", "imgs/hoo转场", "hoo转场.json"),
HOO_CUT2("imgs/hoo转场2", "imgs/hoo转场2", "hoo转场2.json"),
LOO_THANK("imgs/loo感谢", "imgs/loo感谢", "loo感谢.json"),
LOO_ENTERTAIN("imgs/loo接待", "imgs/loo接待", "loo接待.json"),
LOO_CUT("imgs/loo转场", "imgs/loo转场", "loo转场.json"),
LOO_CUT2("imgs/loo转场2", "imgs/loo转场2", "loo转场2.json");
private String code;
private String folder;
......
......@@ -25,8 +25,18 @@ public class Goods implements Serializable {
private List<String> tags;
/** SKU */
private List<Sku> skus;
/** 是否是推荐商品 */
/** 是否是特惠商品 */
private Integer isRecommend;
/** 特惠标签 */
private String recommendTag;
public String getRecommendTag() {
return recommendTag;
}
public void setRecommendTag(String recommendTag) {
this.recommendTag = recommendTag;
}
public Integer getIsRecommend() {
return isRecommend;
......
......@@ -52,17 +52,24 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
LinearLayout layoutTag = helper.getView(R.id.layout_tags);
layoutTag.removeAllViews();
if (CollectionUtils.isEmpty(goods.getTags())) {
if (!StringUtils.isEmpty(goods.getRecommendTag())) {
helper.setVisible(R.id.layout_tags, true);
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag_recommend, null);
((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getRecommendTag());
layoutTag.addView(tagView);
}
if (CollectionUtils.isEmpty(goods.getTags()) && StringUtils.isEmpty(goods.getRecommendTag())) {
helper.setVisible(R.id.layout_tags, false);
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
layoutTag.addView(tagView);
} else {
helper.setVisible(R.id.layout_tags, true);
goods.getTags().forEach(x -> {
for (int i = 0; i < goods.getTags().size() && i < 2; i++) {
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
((TextView) tagView.findViewById(R.id.txt_tag)).setText(x);
((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getTags().get(i));
layoutTag.addView(tagView);
});
}
}
ImageView imgThumbnail = helper.getView(R.id.img_thumbnail);
......@@ -111,6 +118,17 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
helper.setGone(R.id.butn_add, false);
layoutItem.setOnClickListener(v -> Utils.showToast(mContext, R.string.all_sku_sellout));
}
// if (true) {
// // TODO
// layoutItem.setOnClickListener(v -> {
// KDSMsg msg = new KDSMsg();
// List<String> list = new ArrayList<>();
// list.add("NUM_" + goods.getGoodsId());
// msg.setCompleteds(list);
// Utils.sendKdsMsgBroadcast(mContext, msg);
// });
// }
// }
// if (Base.TRUE.equals(goods.getIsRecommend())) {
......
......@@ -14,6 +14,7 @@ import android.os.Message;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -31,6 +32,7 @@ import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.base.AppConfig;
import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.component.AutoWrapLayout;
import com.ihaoin.hooloo.device.component.FixedSpeedScroller;
import com.ihaoin.hooloo.device.component.IntroViewPager;
import com.ihaoin.hooloo.device.data.enums.SkuState;
import com.ihaoin.hooloo.device.data.vo.Goods;
......@@ -46,6 +48,7 @@ import com.ihaoin.hooloo.device.util.JsonUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -147,6 +150,14 @@ public class GoodsDetailDialog extends Dialog {
} else {
startPagerThread();
introIndicator.setVisibility(View.VISIBLE);
try {
Field mScroller;
mScroller = ViewPager.class.getDeclaredField("mScroller");
mScroller.setAccessible(true);
FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(), new LinearInterpolator());
mScroller.set(introPager, scroller);
} catch (Exception e) {
}
introPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
......@@ -155,8 +166,8 @@ public class GoodsDetailDialog extends Dialog {
@Override
public void onPageSelected(int position) {
int index = position % introIndicator.getChildCount();
Utils.check(introIndicator, index);
// int index = position % introIndicator.getChildCount();
Utils.check(introIndicator, position);
}
@Override
......@@ -243,7 +254,7 @@ public class GoodsDetailDialog extends Dialog {
public void run() {
try {
while (true) {
Thread.sleep(1000 * 2);
Thread.sleep(1000 * 3);
pagerHandler.sendEmptyMessage(1);
}
} catch (Exception e) {
......@@ -258,6 +269,9 @@ public class GoodsDetailDialog extends Dialog {
@Override
public void handleMessage(@NonNull Message msg) {
introPagerIndex++;
if (introPagerIndex > introPager.getCount()) {
introPagerIndex = 0;
}
introPager.setCurrentItem(introPagerIndex, true);
}
}
......
......@@ -14,6 +14,8 @@ import android.os.Message;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -26,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.component.AnimationListener;
import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.vo.KDSMsg;
import com.ihaoin.hooloo.device.data.vo.KDSOrder;
......@@ -37,7 +40,9 @@ import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.stream.Collectors;
public class KdsPresentation extends Presentation {
......@@ -55,6 +60,9 @@ public class KdsPresentation extends Presentation {
private List<TextView> completedViews = new ArrayList<>();
private KDSSocket kdsSocket = null;
private View viewOrderToaster;
private TextView txtNumber;
public KdsPresentation(Context outerContext, Display display) {
super(outerContext, display);
}
......@@ -71,6 +79,10 @@ public class KdsPresentation extends Presentation {
startTimer();
startSocket();
new OrderToasterThread().start();
// startCompleteAnim("Num0001");
}
private void initViews() {
......@@ -87,6 +99,9 @@ public class KdsPresentation extends Presentation {
recyclerMachineState.setAdapter(machineStateAdapter);
recyclerMachineState.setLayoutManager(stateLayoutManager);
viewOrderToaster = findViewById(R.id.view_order_toaster);
txtNumber = findViewById(R.id.txt_number);
progressViews.add(findViewById(R.id.progress1));
progressViews.add(findViewById(R.id.progress2));
......@@ -263,6 +278,126 @@ public class KdsPresentation extends Presentation {
machineStateAdapter.notifyDataSetChanged();
}
private List<String> mCurrentCompletes;
private Queue<String> mCompleteQueue = new LinkedList<>();
private void newCompleted(List<String> completes) {
List<String> list = copyList(completes);
if (CollectionUtils.isEmpty(list)) {
return;
}
if (CollectionUtils.isEmpty(mCurrentCompletes)) {
mCurrentCompletes = completes;
addToastOrders(list);
return;
}
list.removeAll(mCurrentCompletes);
mCurrentCompletes = completes;
addToastOrders(list);
return;
}
private void addToastOrders(List<String> list) {
if (CollectionUtils.isEmpty(list)) {
return;
}
mCompleteQueue.addAll(list);
}
private List<String> copyList(List<String> list) {
List<String> newList = new ArrayList<>();
if (CollectionUtils.isEmpty(list)) {
return newList;
}
list.forEach(x -> newList.add(x));
return newList;
}
private class OrderToasterThread extends Thread {
@Override
public void run() {
while (true) {
try {
// 显示完成中不处理下一条
while (viewOrderToaster.getVisibility() == View.VISIBLE) {
Thread.sleep(200l);
}
Message msg = Message.obtain();
String orderNum = mCompleteQueue.poll();
if (StringUtils.isEmpty(orderNum)) {
msg.what = 0;
} else {
msg.what = 1;
msg.obj = orderNum;
}
orderToasterHandler.sendMessage(msg);
Thread.sleep(300l);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
@SuppressLint("HandlerLeak")
private Handler orderToasterHandler = new Handler() {
@Override
public void handleMessage(@NonNull Message message) {
if (message.what == 1) {
showOrderToaster(message.obj.toString());
} else {
hideOrderToaster();
}
}
};
private static final String LOCK = "LOCK";
private void showOrderToaster(String orderNum) {
// synchronized (LOCK) {
Utils.i("showOrderToaster start");
startCompleteAnim(orderNum, 0);
Utils.i("showOrderToaster end");
// }
}
private void hideOrderToaster() {
// synchronized (LOCK) {
viewOrderToaster.clearAnimation();
viewOrderToaster.setVisibility(View.GONE);
// }
}
private void startCompleteAnim(String orderNum, Integer count) {
if (count >= 5) {
hideOrderToaster();
return;
}
viewOrderToaster.setVisibility(View.VISIBLE);
float start = 1.0f, end = 1.05f;
long duration = 500l;
txtNumber.setText(orderNum);
ScaleAnimation scaleIn = new ScaleAnimation(start, end, start, end, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleIn.setDuration(duration);
scaleIn.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
ScaleAnimation scaleOut = new ScaleAnimation(end, start, end, start, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleOut.setDuration(duration);
scaleOut.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
startCompleteAnim(orderNum, count + 1);
}
});
viewOrderToaster.startAnimation(scaleOut);
}
});
viewOrderToaster.startAnimation(scaleIn);
}
private void orderDataChanged() {
if (mKdsMsg == null) {
return;
......@@ -275,6 +410,8 @@ public class KdsPresentation extends Presentation {
waitings = CollectionUtils.subList(waitings, 0, 6);
completes = CollectionUtils.subList(completes, 0, 9);
newCompleted(completes);
progressViews.forEach(v -> v.setVisibility(View.INVISIBLE));
waitingViews.forEach(v -> v.setVisibility(View.INVISIBLE));
completedViews.forEach(v -> v.setVisibility(View.INVISIBLE));
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="10px" />
<solid
android:width="1px"
android:color="@color/complete_bg" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="2px" />
<!-- <solid android:color="@color/recommendTag" />-->
<stroke
android:width="1px"
android:color="@color/recommendTag" />
</shape>
</item>
</layer-list>
<?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"
android:paddingRight="@dimen/goods_tag_margin_right">
<TextView
android:id="@+id/txt_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_tag_recommend"
android:paddingVertical="@dimen/goods_tag_padding_ver"
android:paddingHorizontal="@dimen/goods_tag_padding_hor"
android:singleLine="true"
android:textColor="@color/recommendTag"
android:text=""
android:textSize="@dimen/ts_goods_item_tag" />
</FrameLayout>
\ No newline at end of file
<?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="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <TextView-->
<!-- android:layout_width="1000px"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@android:color/holo_red_dark"-->
<!-- android:gravity="center"-->
<!-- android:text="宽度1000px"-->
<!-- android:textColor="@android:color/black"-->
<!-- android:textSize="80px" />-->
<!-- <TextView-->
<!-- android:layout_width="1000px"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@android:color/holo_green_dark"-->
<!-- android:gravity="center"-->
<!-- android:text="宽度1000px"-->
<!-- android:textColor="@android:color/black"-->
<!-- android:textSize="80px" />-->
<!-- <TextView-->
<!-- android:layout_width="560px"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@android:color/holo_blue_dark"-->
<!-- android:gravity="center"-->
<!-- android:text="宽度560px"-->
<!-- android:textColor="@android:color/black"-->
<!-- android:textSize="80px" />-->
<!--</LinearLayout>-->
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -34,13 +6,47 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_pager"
<RelativeLayout
android:layout_width="@dimen/menu_left"
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants"
android:orientation="horizontal"
android:overScrollMode="never" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants"
android:orientation="horizontal"
android:overScrollMode="never" />
<LinearLayout
android:id="@+id/view_order_toaster"
android:layout_width="@dimen/complete_width"
android:layout_height="@dimen/complete_height"
android:layout_centerInParent="true"
android:background="@drawable/bg_complete"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<TextView
android:id="@+id/txt_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1972"
android:textColor="@color/white"
android:textSize="@dimen/ts_complete_number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:text="制作完成"
android:textColor="@color/white"
android:textSize="@dimen/ts_complete_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="中间扫码取杯"
android:textColor="@color/white"
android:textSize="@dimen/ts_complete_text" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="@dimen/menu_right"
android:layout_height="match_parent"
......
......@@ -152,6 +152,9 @@
<dimen name="interaction_goods_icon_width">260px</dimen>
<dimen name="interaction_goods_icon_height">195px</dimen>
<dimen name="complete_width">1500px</dimen>
<dimen name="complete_height">800px</dimen>
<dimen name="ts_interaction_line1">260px</dimen>
<dimen name="ts_interaction_line2">100px</dimen>
<dimen name="ts_interaction_line3">100px</dimen>
......@@ -212,4 +215,6 @@
<dimen name="ts_menu_state">36px</dimen>
<dimen name="ts_setting_name">18sp</dimen>
<dimen name="ts_setting_desc">16sp</dimen>
<dimen name="ts_complete_number">250px</dimen>
<dimen name="ts_complete_text">95px</dimen>
</resources>
......@@ -3,6 +3,7 @@
<color name="colorLogo">#FF006ECF</color>
<color name="colorPrimary">#FF003AE9</color>
<color name="dialog_bg">#99000000</color>
<color name="complete_bg">#DD000000</color>
<color name="textPrimary">#FF333333</color>
<color name="textSecondPrimary">#FF666666</color>
<color name="textDisable">#FF999999</color>
......@@ -16,6 +17,7 @@
<color name="white">#FFFFFFFF</color>
<color name="black">#FF000000</color>
<color name="colorPink">#FFFF72C1</color>
<color name="recommendTag">#FFEA58DD</color>
<color name="recommendPink">#FFFC00CD</color>
<color name="progress">#FFCDE3F6</color>
<color name="menu_order_bg">#FF4A71FF</color>
......
......@@ -168,6 +168,9 @@
<dimen name="interaction_goods_icon_width">260px</dimen>
<dimen name="interaction_goods_icon_height">195px</dimen>
<dimen name="complete_width">1500px</dimen>
<dimen name="complete_height">800px</dimen>
<dimen name="ts_interaction_line1">260px</dimen>
<dimen name="ts_interaction_line2">100px</dimen>
<dimen name="ts_interaction_line3">100px</dimen>
......@@ -228,4 +231,6 @@
<dimen name="ts_menu_state">36px</dimen>
<dimen name="ts_setting_name">18sp</dimen>
<dimen name="ts_setting_desc">16sp</dimen>
<dimen name="ts_complete_number">220px</dimen>
<dimen name="ts_complete_text">80px</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment