Commit 02b964e1 by wjg

添加控件点击水波纹

parent 82155f36
......@@ -17,7 +17,6 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -53,7 +52,8 @@ public class LauncherActivity extends Activity {
private RadioGroup groupCategory;
private RecyclerView recGoods;
private RecyclerView recRecommends;
// private TextView rightTitle;
// private TextView rightTitle;
private View layoutTips;
private List<ScrollBean> scrollRecommends;
private List<ScrollBean> scrollGoods;
......@@ -85,6 +85,8 @@ public class LauncherActivity extends Activity {
groupCategory = findViewById(R.id.group_category);
recGoods = findViewById(R.id.rec_right);
recRecommends = findViewById(R.id.rec_recommend);
layoutTips = findViewById(R.id.layout_tips);
layoutTips.setOnClickListener(v -> Utils.showTips(LauncherActivity.this));
initRecommends();
setRecommendsData();
......@@ -225,7 +227,7 @@ public class LauncherActivity extends Activity {
for (int i = 0; i < categorys.size(); i++) {
Category category = categorys.get(i);
if (CollectionUtils.isEmpty(category.getGoods())) {
return;
continue;
}
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
RadioButton view = (RadioButton) this.getLayoutInflater().inflate(R.layout.item_category, null);
......@@ -259,12 +261,6 @@ public class LauncherActivity extends Activity {
}
}
});
// 添加温馨提示
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
TextView view = (TextView) this.getLayoutInflater().inflate(R.layout.item_tips, null);
groupCategory.addView(view, layoutParams);
view.setOnClickListener(v -> Utils.showTips(LauncherActivity.this));
}
private void setGoodsData() {
......@@ -279,9 +275,7 @@ public class LauncherActivity extends Activity {
return;
}
scrollGoods.add(new ScrollBean(true, category.getName()));
category.getGoods().forEach(goods -> {
scrollGoods.add(new ScrollBean(new ScrollBean.ScrollItemBean(goods, category.getName())));
});
category.getGoods().forEach(goods -> scrollGoods.add(new ScrollBean(new ScrollBean.ScrollItemBean(goods, category.getName()))));
});
for (int i = 0; i < scrollGoods.size(); i++) {
......
......@@ -30,16 +30,27 @@
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants"
android:scrollbars="none">
<RadioGroup
android:id="@+id/group_category"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/category_margin"
android:divider="@color/line"
android:dividerPadding="@dimen/category_divider_padding"
android:gravity="center"
android:orientation="vertical"
android:showDividers="middle" />
android:gravity="center_horizontal"
android:orientation="vertical">
<RadioGroup
android:id="@+id/group_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/category_margin"
android:divider="@color/line"
android:dividerPadding="@dimen/category_divider_padding"
android:gravity="center"
android:orientation="vertical"
android:showDividers="middle" />
<include
android:id="@+id/layout_tips"
layout="@layout/item_tips"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:drawableEnd="@drawable/ic_baseline_chevron_right_24"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:lines="1"
android:padding="@dimen/padding10"
android:text="温馨提示"
android:textColor="@color/colorPrimary"
......
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