Commit 82155f36 by wjg

添加控件点击水波纹

parent 8097f831
......@@ -9,7 +9,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
......@@ -69,7 +68,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
if (goods.getPics() == null) {
imgThumbnail.setImageDrawable(null);
} else {
Glide.with(mContext).load(goods.getPics().getThumbnail()).apply(options).into(imgThumbnail);
Utils.getGlide(mContext).load(goods.getPics().getThumbnail()).apply(options).into(imgThumbnail);
}
Sku sku = Utils.getDefaultSku(goods.getSkus());
......@@ -116,7 +115,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
// 最后一个商品 并且购物条已经显示
if (getData().indexOf(item) == getItemCount() - 1 && trolleyState) {
int bottomPadding = Utils.getDimens(mContext, R.dimen.trolley_bar_height);
int bottomPadding = Utils.getDimens(mContext, R.dimen.trolley_bar_goods_margin);
layoutItem.setPadding(padding, padding, padding, bottomPadding);
}
}
......
......@@ -4,15 +4,14 @@ import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.SettingsQueue;
import com.ihaoin.hooloo.device.data.vo.Recommend;
import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.data.vo.Recommend;
import com.ihaoin.hooloo.device.util.Utils;
public class RecommendAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> {
......@@ -40,7 +39,7 @@ public class RecommendAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseVi
RoundedCorners roundedCorners = new RoundedCorners(5);
RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
Glide.with(mContext).load(recommend.getPic()).apply(options).into(imgRecommend);
Utils.getGlide(mContext).load(recommend.getPic()).apply(options).into(imgRecommend);
View layoutItem = helper.getView(R.id.layout_item);
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, recommend.getGoods()));
......
......@@ -10,7 +10,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.bumptech.glide.Glide;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.util.CollectionUtils;
......@@ -75,7 +74,7 @@ public class TrolleyAdapter extends BaseAdapter {
txtCount.setText(goods.getCount().toString());
butnSubtract.setOnClickListener(v -> trolleyView.subtractGoods(position));
butnAdd.setOnClickListener(v -> trolleyView.addGoods(position));
Glide.with(mContext).load(goods.getPics().getThumbnail()).into(imgThumbnail);
Utils.getGlide(mContext).load(goods.getPics().getThumbnail()).into(imgThumbnail);
ViewGroup layoutItem = convertView.findViewById(R.id.layout_item);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd, butnSubtract));
......
......@@ -4,6 +4,7 @@ public class AppConfig {
public static Boolean DEBUG = true; // TODO false
public static String DEBUG_TAG = "HL_TEST";
public static String DEFAULT_SCREEN_NO = "A";
/** 机器编码 */
public static String MACHINE_CODE = "";
/** 打开微信网址 */
......
......@@ -3,6 +3,7 @@ package com.ihaoin.hooloo.device.util;
import android.content.Context;
import android.content.SharedPreferences;
import com.ihaoin.hooloo.device.config.AppConfig;
import com.ihaoin.hooloo.device.network.HttpUtil;
public class SharedPreferencesUtils {
......@@ -14,7 +15,7 @@ public class SharedPreferencesUtils {
public static String getScreenNo(Context context) {
SharedPreferences sp = getSharedPreferences(context);
return sp.getString(KEY_SCREEN_NO, "A");
return sp.getString(KEY_SCREEN_NO, AppConfig.DEFAULT_SCREEN_NO);
}
public static void setScreenNo(Context context, String val) {
......@@ -34,7 +35,7 @@ public class SharedPreferencesUtils {
public static Boolean getShowMenu(Context context) {
SharedPreferences sp = getSharedPreferences(context);
return sp.getBoolean(KEY_SHOW_MENU, false);
return sp.getBoolean(KEY_SHOW_MENU, getScreenNo(context).equals(AppConfig.DEFAULT_SCREEN_NO));
}
public static void setShowMenu(Context context, Boolean val) {
......
......@@ -12,6 +12,9 @@ import android.widget.RadioGroup;
import androidx.coordinatorlayout.widget.ViewGroupUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.TouchDelegateComposite;
import com.ihaoin.hooloo.device.config.Base;
......@@ -162,4 +165,9 @@ public class Utils {
}
group.check(v.getId());
}
public static RequestManager getGlide(Context context) {
RequestOptions options = new RequestOptions().placeholder(R.mipmap.placeholder);
return Glide.with(context).setDefaultRequestOptions(options);
}
}
......@@ -2,6 +2,7 @@ package com.ihaoin.hooloo.device.view;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
......@@ -19,8 +20,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.IntroViewPager;
......@@ -155,13 +154,22 @@ public class GoodsDetailDialog extends Dialog {
Utils.setTouchDelegate(findViewById(R.id.layout_root), Arrays.asList(butnClose));
setOnDismissListener(dialog -> {
setOnDismissListener(dismissListener);
}
OnDismissListener dismissListener = new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (pagerHandler != null) {
pagerHandler.removeCallbacksAndMessages(null);
pagerHandler = null;
}
});
if (pagerThread != null) {
pagerThread.interrupt();
pagerThread = null;
}
}
};
private void startPageThread() {
pagerHandler = new PagerHandler();
......@@ -216,12 +224,11 @@ public class GoodsDetailDialog extends Dialog {
}
private ImageView getIntroImage(String url) {
RequestOptions options = new RequestOptions().placeholder(R.drawable.bg_image_placeholder);
ImageView imgIntro = new ImageView(getContext());
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imgIntro.setLayoutParams(layoutParams);
imgIntro.setAdjustViewBounds(true);
Glide.with(getContext()).setDefaultRequestOptions(options).load(url).into(imgIntro);
Utils.getGlide(getContext()).load(url).into(imgIntro);
return imgIntro;
}
......@@ -386,7 +393,7 @@ public class GoodsDetailDialog extends Dialog {
imageView.setAdjustViewBounds(true);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.bottomMargin = Utils.getDimens(getContext(), R.dimen.padding5);
Glide.with(getContext()).load(url).into(imageView);
Utils.getGlide(getContext()).load(url).into(imageView);
layoutImages.addView(imageView, layoutParams);
});
}
......
......@@ -97,7 +97,7 @@ public class LauncherActivity extends Activity {
registTrolleyGoodsChangedReceiver();
registTrolleyStateChangedReceiver();
registSettingChangedReceiver();
showMenuView();
prepareMenuView();
startLoadDataThread();
}
......@@ -474,6 +474,14 @@ public class LauncherActivity extends Activity {
}
}
/** 显示菜单屏KDS */
private void prepareMenuView() {
if (SharedPreferencesUtils.getShowMenu(LauncherActivity.this)) {
showMenuView();
}
}
/** 显示菜单屏KDS */
private void showMenuView() {
if (AppConfig.DEBUG) {
......
......@@ -11,7 +11,6 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.fasterxml.jackson.core.type.TypeReference;
import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R;
......@@ -28,6 +27,7 @@ import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.JsonUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.util.ArrayList;
import java.util.List;
......@@ -101,17 +101,17 @@ public class MenuPresentation extends Presentation {
return;
}
if (!StringUtils.isEmpty(mainData.getImages().getLeft())) {
Glide.with(getContext()).load(mainData.getImages().getLeft()).into(imgLeft);
Utils.getGlide(getContext()).load(mainData.getImages().getLeft()).into(imgLeft);
}
if (mainData.getShopState().equals(0)) {
Glide.with(getContext()).load(getRightImage(ImageState.CLOSED.getCode())).into(imgRight);
Utils.getGlide(getContext()).load(getRightImage(ImageState.CLOSED.getCode())).into(imgRight);
} else if (!CollectionUtils.isEmpty(cookingOrders)) {
Glide.with(getContext()).load(getRightImage(ImageState.COOKING.getCode())).into(imgRight);
Utils.getGlide(getContext()).load(getRightImage(ImageState.COOKING.getCode())).into(imgRight);
} else if (!CollectionUtils.isEmpty(completedOrders)) {
Glide.with(getContext()).load(getRightImage(ImageState.COMPLETED.getCode())).into(imgRight);
Utils.getGlide(getContext()).load(getRightImage(ImageState.COMPLETED.getCode())).into(imgRight);
} else {
Glide.with(getContext()).load(getRightImage(ImageState.NOT_COMPLETED.getCode())).into(imgRight);
Utils.getGlide(getContext()).load(getRightImage(ImageState.NOT_COMPLETED.getCode())).into(imgRight);
}
}
......
<?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="2dp" />-->
<solid
android:width="1dp"
android:color="@color/textSecondPrimary" />
</shape>
</item>
<!-- <item-->
<!-- android:bottom="10dp"-->
<!-- android:left="10dp"-->
<!-- android:right="10dp"-->
<!-- android:top="10dp">-->
<!-- <bitmap-->
<!-- android:gravity="center"-->
<!-- android:src="@mipmap/jiahao_2x" />-->
<!-- </item>-->
</layer-list>
......@@ -18,6 +18,7 @@
android:id="@+id/layout_sys_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -39,6 +40,7 @@
android:id="@+id/layout_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -63,6 +65,7 @@
android:id="@+id/layout_machine_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -92,6 +95,7 @@
android:id="@+id/layout_screen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -121,6 +125,7 @@
android:id="@+id/layout_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -135,13 +140,15 @@
android:id="@+id/butn_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10" />
android:layout_marginEnd="@dimen/padding10"
android:foreground="?selectableItemBackground" />
</LinearLayout>
<include layout="@layout/view_line" />
<LinearLayout
android:id="@+id/layout_logcat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -156,7 +163,8 @@
android:id="@+id/butn_logcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10" />
android:layout_marginEnd="@dimen/padding10"
android:foreground="?selectableItemBackground" />
</LinearLayout>
</LinearLayout>
</ScrollView>
......
......@@ -4,11 +4,12 @@
android:layout_height="wrap_content"
android:background="@drawable/sel_category_label"
android:button="@null"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:paddingTop="@dimen/category_padding"
android:paddingBottom="@dimen/category_padding"
android:paddingStart="@dimen/padding10"
android:paddingTop="@dimen/category_padding"
android:paddingEnd="@dimen/padding10"
android:paddingBottom="@dimen/category_padding"
android:textColor="@drawable/sel_category_color"
android:textSize="@dimen/ts_category_radio" />
......@@ -3,7 +3,7 @@
android:id="@+id/layout_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/padding10">
......@@ -118,7 +118,8 @@
android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size"
android:layout_alignParentEnd="true"
android:background="@mipmap/jiahao_2x" />
android:background="@mipmap/jiahao_2x"
android:foreground="?selectableItemBackground" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_item"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground">
<ImageView
android:id="@+id/img_recommend"
android:layout_width="match_parent"
......
......@@ -14,6 +14,7 @@
android:paddingVertical="@dimen/rule_vertical_padding"
android:singleLine="true"
android:text="加糖"
android:foreground="?selectableItemBackground"
android:textColor="@drawable/sel_spec_color"
android:textSize="@dimen/ts_detail_rule"
app:layout_constraintLeft_toLeftOf="parent"
......
......@@ -4,6 +4,7 @@
android:layout_height="wrap_content"
android:button="@null"
android:drawableEnd="@drawable/ic_baseline_chevron_right_24"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:padding="@dimen/padding10"
android:text="温馨提示"
......
......@@ -13,6 +13,7 @@
android:layout_height="@dimen/ic_checkbox"
android:background="@drawable/sel_butn_check"
android:checked="true"
android:foreground="?selectableItemBackground"
android:textOff=""
android:textOn="" />
<ImageView
......@@ -93,7 +94,8 @@
style="@style/button_style"
android:layout_width="@dimen/ic_subtract_size"
android:layout_height="@dimen/ic_subtract_size"
android:background="@mipmap/jianhao_2x" />
android:background="@mipmap/jianhao_2x"
android:foreground="?selectableItemBackground" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
......@@ -109,6 +111,7 @@
style="@style/button_style"
android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size"
android:background="@mipmap/jiahao_2x" />
android:background="@mipmap/jiahao_2x"
android:foreground="?selectableItemBackground" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/layout_root"
android:background="@color/white"
android:padding="@dimen/padding15">
<TextView
......@@ -107,5 +107,6 @@
android:layout_width="@dimen/ic_dialog_close"
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:foreground="?selectableItemBackground"
android:src="@mipmap/chahao_2x" />
</RelativeLayout>
\ No newline at end of file
......@@ -140,6 +140,7 @@
style="@style/button_style"
android:layout_width="@dimen/ic_detail_add_size"
android:layout_height="@dimen/ic_detail_add_size"
android:foreground="?selectableItemBackground"
android:background="@mipmap/jianhao_2x" />
<TextView
android:id="@+id/txt_count"
......@@ -154,6 +155,7 @@
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="@dimen/ic_detail_add_size"
android:foreground="?selectableItemBackground"
android:layout_height="@dimen/ic_detail_add_size"
android:background="@mipmap/jiahao_2x" />
</LinearLayout>
......@@ -179,6 +181,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/bg_button"
android:foreground="?selectableItemBackground"
android:padding="@dimen/padding10"
android:text="加入购物袋"
android:textColor="@color/colorPrimary"
......@@ -190,6 +193,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:foreground="?selectableItemBackground"
android:padding="@dimen/padding10"
android:text="立即购买"
android:textColor="@color/white"
......@@ -205,5 +209,6 @@
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/padding15"
android:foreground="?selectableItemBackground"
android:src="@mipmap/chahao_2x" />
</RelativeLayout>
\ No newline at end of file
......@@ -12,6 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:foreground="?selectableItemBackground"
android:padding="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_left_24" />
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dialog_tip_width"
android:id="@+id/layout_root"
android:layout_width="@dimen/dialog_tip_width"
android:layout_height="match_parent">
<WebView
android:id="@+id/web_view"
......@@ -14,5 +14,6 @@
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/padding15"
android:foreground="?selectableItemBackground"
android:src="@mipmap/chahao_2x" />
</RelativeLayout>
\ No newline at end of file
......@@ -21,8 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/padding10">
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -32,21 +31,27 @@
android:textColor="@android:color/black"
android:textSize="@dimen/ts_trolley_name"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/butn_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:padding="@dimen/padding20">
<ImageView
android:layout_width="@dimen/ic_clear_size"
android:layout_height="@dimen/ic_clear_size"
android:layout_marginStart="@dimen/padding5"
android:src="@mipmap/lajitong_2x" />
<Button
android:id="@+id/butn_clear"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10"
android:background="@null"
android:layout_marginStart="@dimen/padding5"
android:text="清空购物袋"
android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_trolley_clear" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="0.5dp"
......@@ -69,6 +74,7 @@
android:layout_height="@dimen/trolley_bar_height"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout
......@@ -118,6 +124,7 @@
android:layout_width="@dimen/trolley_pay_width"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:foreground="?selectableItemBackground"
android:text="付款"
android:textColor="@color/white"
android:textSize="@dimen/ts_trolley_pay"
......
......@@ -23,6 +23,7 @@
<dimen name="trolley_width">800dp</dimen>
<dimen name="trolley_item_height">200dp</dimen>
<dimen name="trolley_bar_height">120dp</dimen>
<dimen name="trolley_bar_goods_margin">150dp</dimen>
<dimen name="trolley_pay_width">300dp</dimen>
<dimen name="trolley_ic_size">80dp</dimen>
<dimen name="trolley_ic_border_size">120dp</dimen>
......
......@@ -23,6 +23,7 @@
<dimen name="trolley_width">400dp</dimen>
<dimen name="trolley_item_height">100dp</dimen>
<dimen name="trolley_bar_height">60dp</dimen>
<dimen name="trolley_bar_goods_margin">80dp</dimen>
<dimen name="trolley_pay_width">150dp</dimen>
<dimen name="trolley_ic_size">40dp</dimen>
<dimen name="trolley_ic_border_size">50dp</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