Commit 02b964e1 by wjg

添加控件点击水波纹

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