Commit 096107cd by wjg

v2

parent c2ad23a7
......@@ -31,14 +31,14 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup,android:icon">
<!-- 悬浮窗入口 -->
<meta-data
android:name="LogcatWindowEntrance"
android:value="true" />
<!-- 通知栏入口 -->
<meta-data
android:name="LogcatNotifyEntrance"
android:value="true" />
<!-- &lt;!&ndash; 悬浮窗入口 &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="LogcatWindowEntrance"-->
<!-- android:value="true" />-->
<!-- &lt;!&ndash; 通知栏入口 &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="LogcatNotifyEntrance"-->
<!-- android:value="true" />-->
<activity
android:name=".home.view.LauncherActivity"
android:exported="true"
......
......@@ -62,24 +62,24 @@ public class MachineInfoSocket extends Thread {
public void getMachineCode() {
if (mSocket == null) {
Utils.i("socket未连接");
Utils.i("machine socket未连接");
return;
}
try {
mSocket.emit("notice", "", (Ack) args -> {
if (CollectionUtils.isEmpty(args)) {
Utils.i("notice args empty");
Utils.i("machine notice args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i("notice content empty");
Utils.i("machine notice content empty");
return;
}
MachineInfoMsg msg = JsonUtils.readValue(content, MachineInfoMsg.class);
if (msg == null) {
Utils.i("notice msg empty");
Utils.i("machine notice msg empty");
return;
}
Utils.i("get machine info: " + msg);
......@@ -98,7 +98,7 @@ public class MachineInfoSocket extends Thread {
private void sendMessage(String content) {
if (mSocket == null) {
Utils.i("socket未连接");
Utils.i("machine socket未连接");
return;
}
try {
......
......@@ -39,7 +39,6 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
protected void convert(BaseViewHolder helper, ScrollBean item) {
ScrollBean.ScrollItemBean t = item.t;
ViewGroup layoutItem = helper.getView(R.id.layout_item);
// layoutItem.setForeground(null);
Goods goods = (Goods) t.getObject();
helper.setText(R.id.txt_name, goods.getName());
......@@ -67,9 +66,12 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
}
ImageView imgThumbnail = helper.getView(R.id.img_thumbnail);
// RoundedCorners roundedCorners = new RoundedCorners(5);
// RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
if (goods.getPics() == null) {
imgThumbnail.setImageDrawable(null);
} else {
// Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).apply(options).into(imgThumbnail);
Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).into(imgThumbnail);
}
......@@ -128,7 +130,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
int verPadding = Utils.getDimens(mContext, R.dimen.goods_padding_ver);
// 最后一个商品 并且购物条已经显示
if (getData().indexOf(item) == getItemCount() - 1) {
if (getData().indexOf(item) == getItemCount() - 1 && trolleyState) {
// int padding = Utils.getDimens(mContext, R.dimen.padding10);
int bottomPadding = Utils.getDimens(mContext, R.dimen.goods_last_padding_bottom);
layoutItem.setPadding(0, verPadding, 0, bottomPadding);
......
......@@ -65,20 +65,20 @@ public class InteractionSocket extends Thread {
private void process(String func, Object[] args) {
if (CollectionUtils.isEmpty(args)) {
Utils.i(func + " args empty");
Utils.i("interaction " + func + " args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i(func + " content empty");
Utils.i("interaction " + func + " content empty");
return;
}
InteractionMsg msg = JsonUtils.readValue(content, InteractionMsg.class);
if (msg == null) {
Utils.i(func + " msg empty");
Utils.i("interaction " + func + " msg empty");
return;
}
Utils.i(func + " receive msg: " + content);
Utils.i("interaction " + func + " receive msg: " + content);
Utils.sendInteractionMsgBroadcast(mContext, msg);
}
......@@ -101,7 +101,7 @@ public class InteractionSocket extends Thread {
public void sendMessage(String content) {
if (mSocket == null) {
Utils.i("socket未连接");
Utils.i("interaction socket未连接");
return;
}
try {
......
......@@ -64,6 +64,7 @@ public class KDSSocket extends Thread {
Utils.i("reply msg empty");
return;
}
Utils.i("kds reply: " + content);
Utils.sendKdsMsgBroadcast(mContext, msg);
};
......@@ -86,7 +87,7 @@ public class KDSSocket extends Thread {
public void sendMessage(String content) {
if (mSocket == null) {
Utils.i("socket未连接");
Utils.i("kds socket未连接");
return;
}
try {
......
......@@ -69,7 +69,7 @@ public class KdsPresentation extends Presentation {
setOnDismissListener(dismissListener);
startImagePagerThread();
startTimer();
startSocket();
}
......@@ -125,6 +125,19 @@ public class KdsPresentation extends Presentation {
smoothScroller.setTargetPosition(position);
startSmoothScroll(smoothScroller);
}
long times = 0;
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
if (state == 2) {
times = System.currentTimeMillis();
}
if (state == 0) {
Utils.i("machine state: " + state + ", times: " + (System.currentTimeMillis() - times));
}
}
};
LinearLayoutManager imageLayoutManager = new LinearLayoutManager(getContext()) {
......@@ -134,12 +147,25 @@ public class KdsPresentation extends Presentation {
// 返回:滑过1px时经历的时间(ms)。
@Override
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return 0.3f;
return 0.2f;
}
};
smoothScroller.setTargetPosition(position);
startSmoothScroll(smoothScroller);
}
long times = 0;
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
if (state == 2) {
times = System.currentTimeMillis();
}
if (state == 0) {
Utils.i("image state: " + state + ", times: " + (System.currentTimeMillis() - times));
}
}
};
private void showImages() {
......@@ -147,6 +173,7 @@ public class KdsPresentation extends Presentation {
if (mainData == null || mainData.getImages() == null) {
return;
}
imagePosition = 0;
recyclerImagePager.removeAllViews();
if (CollectionUtils.isEmpty(mainData.getImages().getLeft())) {
return;
......@@ -166,25 +193,23 @@ public class KdsPresentation extends Presentation {
}
}
private ImagePagerThread imagePagerThread;
private ImagePagerHandler imagePagerHandler;
private TimerThread timerThread;
private void startImagePagerThread() {
imagePagerHandler = new ImagePagerHandler();
imagePagerThread = new ImagePagerThread();
imagePagerThread.start();
private void startTimer() {
timerThread = new TimerThread();
timerThread.start();
}
private class ImagePagerThread extends Thread {
private class TimerThread extends Thread {
@Override
public void run() {
try {
while (true) {
// KDSMsg msg = KDSGen.getKdsMsg();
// Utils.sendKdsMsgBroadcast(getContext(), msg);
Thread.sleep(1000 * 5);
imagePagerHandler.sendEmptyMessage(1);
timerHandler.sendEmptyMessage(1);
Thread.sleep(1000 * 5);
timerHandler.sendEmptyMessage(1);
timerHandler.sendEmptyMessage(2);
}
} catch (Exception e) {
e.printStackTrace();
......@@ -192,23 +217,34 @@ public class KdsPresentation extends Presentation {
}
}
private class ImagePagerHandler extends Handler {
@SuppressLint("HandlerLeak")
Handler timerHandler = new Handler() {
@Override
public void handleMessage(@NonNull Message msg) {
setNextImage();
smoothMachineState();
if (msg.what == 1) {
smoothMachineState();
} else if (msg.what == 2) {
setNextImage();
}
}
}
};
private Integer imagePosition = 0;
private Integer statePosition = 3;
private void setNextImage() {
if (imagePagerAdapter == null || imagePagerAdapter.getItemCount() <= 0) {
return;
}
imagePosition++;
Utils.i("showImage: " + imagePosition);
recyclerImagePager.smoothScrollToPosition(imagePosition);
}
private void smoothMachineState() {
if (machineStateAdapter == null || machineStateAdapter.getItemCount() <= 0) {
return;
}
statePosition++;
recyclerMachineState.smoothScrollToPosition(statePosition);
}
......@@ -299,13 +335,13 @@ public class KdsPresentation extends Presentation {
Utils.i("kds present dismiss");
unregistKDSMessageReceiver();
if (imagePagerHandler != null) {
imagePagerHandler.removeCallbacksAndMessages(null);
imagePagerHandler = null;
if (timerHandler != null) {
timerHandler.removeCallbacksAndMessages(null);
timerHandler = null;
}
if (imagePagerThread != null) {
imagePagerThread.interrupt();
imagePagerThread = null;
if (timerThread != null) {
timerThread.interrupt();
timerThread = null;
}
stopSocket();
......
......@@ -51,6 +51,7 @@
android:layout_weight="0.09792"
android:descendantFocusability="afterDescendants"
android:overScrollMode="never"
android:layout_marginTop="@dimen/category_margin"
android:scrollbars="none">
<RelativeLayout
android:layout_width="match_parent"
......@@ -59,7 +60,6 @@
android:id="@+id/group_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/category_margin"
android:gravity="center"
android:orientation="vertical"
android:showDividers="middle" />
......
......@@ -7,6 +7,7 @@
android:foreground="@null"
android:gravity="center"
android:paddingHorizontal="@dimen/category_padding_hor"
android:checked="false"
android:paddingTop="@dimen/category_padding_top_noimg"
android:paddingBottom="@dimen/category_padding_bottom_noimg"
android:text="123123"
......
......@@ -8,21 +8,18 @@
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/image_pager"
android:layout_width="0dp"
android:layout_width="@dimen/menu_left"
android:layout_height="match_parent"
android:layout_weight="0.73125"
android:descendantFocusability="afterDescendants"
android:orientation="horizontal"
android:overScrollMode="never" />
<LinearLayout
android:layout_width="0dp"
android:layout_width="@dimen/menu_right"
android:layout_height="match_parent"
android:layout_weight="0.26875"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.70185"
android:layout_height="@dimen/menu_right_top"
android:background="@color/menu_order_bg"
android:paddingStart="@dimen/menu_content_padding_hor"
android:paddingTop="@dimen/menu_content_padding_top">
......@@ -251,8 +248,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.29815"
android:layout_height="@dimen/menu_right_bottom"
android:background="@color/menu_state_bg"
android:paddingLeft="@dimen/menu_state_padding_hor"
android:paddingTop="@dimen/menu_state_padding_ver"
......
......@@ -12,19 +12,19 @@
<dimen name="recommend_padding">38px</dimen>
<dimen name="recommend_image_height_0">794px</dimen>
<dimen name="recommend_image_height_other">392px</dimen>
<dimen name="recommend_name_margin_top">82px</dimen>
<dimen name="recommend_name_margin_top">40px</dimen>
<dimen name="recommend_name_margin_left">68px</dimen>
<dimen name="recommend_desc_margin_top">18px</dimen>
<dimen name="recommend_desc_margin_left">68px</dimen>
<dimen name="goods_padding_top">30px</dimen>
<dimen name="goods_padding_top">125px</dimen>
<dimen name="goods_padding_ver">30px</dimen>
<dimen name="goods_padding_right">38px</dimen>
<dimen name="goods_last_padding_bottom">300px</dimen>
<dimen name="goods_last_padding_bottom">225px</dimen>
<dimen name="goods_thum_size">174px</dimen>
<dimen name="goods_thum_margin_right">40px</dimen>
<dimen name="goods_recommend_margin">30px</dimen>
<dimen name="goods_category_margin_top">13px</dimen>
<dimen name="goods_category_margin_top">0px</dimen>
<dimen name="goods_tag_margin_top">13px</dimen>
<dimen name="goods_tag_padding_ver">0px</dimen>
<dimen name="goods_tag_padding_hor">5px</dimen>
......@@ -40,7 +40,7 @@
<dimen name="category_drawable_padding">10px</dimen>
<dimen name="category_drawable_width">100px</dimen>
<dimen name="category_drawable_height">75px</dimen>
<dimen name="category_margin">129px</dimen>
<dimen name="category_margin">125px</dimen>
<dimen name="category_divider_padding">0px</dimen>
<dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">33px</dimen>
......
......@@ -12,19 +12,19 @@
<dimen name="recommend_padding">38px</dimen>
<dimen name="recommend_image_height_0">794px</dimen>
<dimen name="recommend_image_height_other">392px</dimen>
<dimen name="recommend_name_margin_top">82px</dimen>
<dimen name="recommend_name_margin_top">40px</dimen>
<dimen name="recommend_name_margin_left">68px</dimen>
<dimen name="recommend_desc_margin_top">18px</dimen>
<dimen name="recommend_desc_margin_left">68px</dimen>
<dimen name="goods_padding_top">30px</dimen>
<dimen name="goods_padding_top">125px</dimen>
<dimen name="goods_padding_ver">30px</dimen>
<dimen name="goods_padding_right">38px</dimen>
<dimen name="goods_last_padding_bottom">300px</dimen>
<dimen name="goods_last_padding_bottom">225px</dimen>
<dimen name="goods_thum_size">174px</dimen>
<dimen name="goods_thum_margin_right">40px</dimen>
<dimen name="goods_recommend_margin">30px</dimen>
<dimen name="goods_category_margin_top">13px</dimen>
<dimen name="goods_category_margin_top">0px</dimen>
<dimen name="goods_tag_margin_top">13px</dimen>
<dimen name="goods_tag_padding_ver">0px</dimen>
<dimen name="goods_tag_padding_hor">5px</dimen>
......@@ -40,7 +40,7 @@
<dimen name="category_drawable_padding">10px</dimen>
<dimen name="category_drawable_width">100px</dimen>
<dimen name="category_drawable_height">75px</dimen>
<dimen name="category_margin">129px</dimen>
<dimen name="category_margin">125px</dimen>
<dimen name="category_divider_padding">0px</dimen>
<dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">33px</dimen>
......
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