期末作业

master
lkw 2 years ago
parent b6ca945d89
commit e943bacca2

@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 31
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.shuyue.snack"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 30
versionCode 2
versionName '1.1'

@ -11,7 +11,7 @@ import java.util.List;
public class TaobaoLeftAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
public TaobaoLeftAdapter(List<String> types) {
super(R.layout.item_taobao_left, types);
super(R.layout.item_jingdong_left, types);
}
/**

@ -12,7 +12,7 @@ import java.util.List;
public class TaobaoRightAdapter extends BaseQuickAdapter<JD, BaseViewHolder> {
public TaobaoRightAdapter(List<JD> JDS) {
super(R.layout.item_taobao_right, JDS);
super(R.layout.item_jingdong_right, JDS);
}
@Override

@ -37,12 +37,13 @@ public class DataServer {
public static List<JD> getHomeList() {
if (homeList == null) {
homeList = new ArrayList<JD>() {{
add(new JD("苹果13", 5999, R.mipmap.sp1, "苹果13一般指iPhone 13。 iPhone 13是美国苹果公司于北京时间2021年9月15日凌晨1点在Apple Park发布的iPhone手机。"));
add(new JD("华为mate40", 5888, R.mipmap.sp2, "华为Mate40一般指HUAWEI Mate 40。 HUAWEI Mate 40是华为公司于2020年10月22日发布的手机于2020年12月21日上市。"));
add(new JD("苹果14", 10999, R.mipmap.sp1, "iPhone 14是苹果公司Apple于2022年9月8日发布的手机产品。\n"));
add(new JD("华为mate40pro", 5888, R.mipmap.sp2, "华为Mate40pro一般指HUAWEI Mate 40pro。 HUAWEI Mate 40pro是华为公司于2020年10月22日发布的手机于2020年12月21日上市。"));
add(new JD("联想Y9000P", 8999, R.mipmap.sp3, "联想Y9000P采用了双面金属设计搭载16英寸四边窄边框屏2560*1600 分辨率165Hz刷新率500nit亮度100%sRGB色域HDR400认证支持杜比视界。"));
add(new JD("暗影精灵8", 8699, R.mipmap.sp4, "暗影精灵8 Plus搭载全新i7处理器全系标配DDR5 4800MHz双通道内存还有游戏级PCle 4.0 SSD加持游戏载入少等待、尽情存储少焦虑。"));
add(new JD("海盗船K100", 1299, R.mipmap.sp5, "海盗船K100键盘采用的是悬浮式按键设计搭配高品质精密二色注塑PBT透光键帽1.5mm的厚度超耐用,防滑性能很好,使用手感非常赞。"));
add(new JD("罗技G502", 229, R.mipmap.sp6, "罗技G502游戏鼠标在配重平衡及追踪表面的适应性需要有更好的提升尽可能满足每一位玩家的精确需求。"));
add(new JD("海蓝之谜", 3099, R.mipmap.sp5, "海蓝之谜LA MER保湿修护套装(精萃水+面霜)护肤品套装化妆品礼盒生日礼物女预售"));
add(new JD("雅诗兰黛", 2685, R.mipmap.sp6, "雅诗兰黛修护礼盒(棕瓶50ml+樱花水200ml+胶原霜50ml)护肤品化妆品套装\n"));
add(new JD("SK-II", 2685, R.mipmap.sp7, "SK-II神仙水75ml精华液sk2全明星晶透礼盒护肤品套装生日礼物女skii\n"));
}};
}
@ -57,7 +58,7 @@ public class DataServer {
snackOrderList = new ArrayList<String>() {{
add("手机");
add("电脑");
add("电子配件");
add("美妆");
// add("鼠标");
// add("耳机");
}};
@ -71,8 +72,8 @@ public class DataServer {
public static List<JD> getFujianList() {
if (fujianList == null) {
fujianList = new ArrayList<JD>() {{
add(new JD("苹果13", 5999, R.mipmap.sp1, "苹果13一般指iPhone 13。 iPhone 13是美国苹果公司于北京时间2021年9月15日凌晨1点在Apple Park发布的iPhone手机。"));
add(new JD("华为mate40", 5888, R.mipmap.sp2, "华为Mate40一般指HUAWEI Mate 40。 HUAWEI Mate 40是华为公司于2020年10月22日发布的手机于2020年12月21日上市。"));
add(new JD("苹果14", 10999, R.mipmap.sp1, "iPhone 14是苹果公司Apple于2022年9月8日发布的手机产品。\n"));
add(new JD("华为mate40pro", 5888, R.mipmap.sp2, "华为Mate40pro一般指HUAWEI Mate 40pro。 HUAWEI Mate 40pro是华为公司于2020年10月22日发布的手机于2020年12月21日上市。"));
}};
}
@ -98,8 +99,10 @@ public class DataServer {
public static List<JD> getGuangzhouList() {
if (guangzhouList == null) {
guangzhouList = new ArrayList<JD>() {{
add(new JD("海盗船K100", 1299, R.mipmap.sp5, "海盗船K100键盘采用的是悬浮式按键设计搭配高品质精密二色注塑PBT透光键帽1.5mm的厚度超耐用,防滑性能很好,使用手感非常赞。"));
add(new JD("罗技G502", 229, R.mipmap.sp6, "罗技G502游戏鼠标在配重平衡及追踪表面的适应性需要有更好的提升尽可能满足每一位玩家的精确需求。"));
add(new JD("海蓝之谜", 3099, R.mipmap.sp5, "海蓝之谜LA MER保湿修护套装(精萃水+面霜)护肤品套装化妆品礼盒生日礼物女预售"));
add(new JD("雅诗兰黛", 2685, R.mipmap.sp6, "雅诗兰黛修护礼盒(棕瓶50ml+樱花水200ml+胶原霜50ml)护肤品化妆品套装\n"));
add(new JD("SK-II", 2685, R.mipmap.sp7, "SK-II神仙水75ml精华液sk2全明星晶透礼盒护肤品套装生日礼物女skii\n"));
}};
}
return guangzhouList;
@ -135,7 +138,7 @@ public class DataServer {
public static List<User> getAccountList() {
if (accountList == null) {
accountList = new ArrayList<User>() {{
add(new User("123456", "123", "小新", R.drawable.one4));
add(new User("luokaiwen", "123456", "帅哥", R.drawable.one4));
}};
}
return accountList;

@ -29,9 +29,9 @@ import java.util.Objects;
import butterknife.BindView;
import butterknife.ButterKnife;
public class TaobaoFragment extends Fragment {
public class JingDongFragment extends Fragment {
private TaobaoViewModel taobaoViewModel;
private JingDongViewModel jingDongViewModel;
// 乐器页面左边列表已选择的Position
private int leftSelectPosition = 0;
@ -45,14 +45,14 @@ public class TaobaoFragment extends Fragment {
// 右边适配器
private TaobaoRightAdapter rightAdapter;
public static TaobaoFragment newInstance() {
return new TaobaoFragment();
public static JingDongFragment newInstance() {
return new JingDongFragment();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
taobaoViewModel = ViewModelProviders.of(this).get(TaobaoViewModel.class);
jingDongViewModel = ViewModelProviders.of(this).get(JingDongViewModel.class);
View root = inflater.inflate(R.layout.fragment_snack, container, false);
// 绑定资源
ButterKnife.bind(this, root);

@ -4,11 +4,11 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.ViewModel;
public class TaobaoViewModel extends ViewModel {
public class JingDongViewModel extends ViewModel {
private MediatorLiveData<String> mText;
public TaobaoViewModel() {
public JingDongViewModel() {
mText = new MediatorLiveData<>();
mText.setValue("点单页面");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 64 KiB

@ -31,7 +31,7 @@
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="淘宝"
android:text="京东"
android:textSize="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

@ -259,182 +259,238 @@
android:textSize="18sp"
tools:ignore="RtlSymmetry" />
<LinearLayout
android:id="@+id/myGeneralView"
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_general_setting"
android:orientation="vertical"
android:visibility="gone">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="不要葱"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要香菜"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要蒜"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要动物油"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox4" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="12dp"
android:text="不要肉"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox5" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintEnd_toStartOf="@+id/guideline4"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/radioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="不辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:visibility="gone"
android:text="微辣" />
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="中辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="特辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="麻辣"
android:visibility="gone"
/>
</RadioGroup>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15" />
android:layout_height="1dp"
android:background="#EEEEEE" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.8" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="隐私设置"
android:textSize="18sp"
tools:ignore="RtlSymmetry" />
<Button
android:id="@+id/myGeneralBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="32sp"
android:layout_marginBottom="12sp"
android:text="确定" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#EEEEEE" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="消息通知设置"
android:textSize="18sp"
tools:ignore="RtlSymmetry" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/radius_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#EEEEEE" />
<TextView
android:id="@+id/logoutBtn"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="退出账号"
android:textSize="16sp"
android:text="功能反馈"
android:textSize="18sp"
tools:ignore="RtlSymmetry" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#EEEEEE" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="个人权限说明"
android:textSize="18sp"
tools:ignore="RtlSymmetry" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/myGeneralView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_general_setting"
android:orientation="vertical"
android:visibility="gone">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="不要葱"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要香菜"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要蒜"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不要动物油"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox4" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="12dp"
android:text="不要肉"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/checkBox5" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintEnd_toStartOf="@+id/guideline4"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/radioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="不辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:visibility="gone"
android:text="微辣" />
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="中辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8sp"
android:text="特辣"
android:visibility="gone"
/>
<RadioButton
android:id="@+id/radioButton5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="麻辣"
android:visibility="gone"
/>
</RadioGroup>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.8" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="@+id/myGeneralBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="32sp"
android:layout_marginBottom="12sp"
android:text="确定" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/radius_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<TextView
android:id="@+id/logoutBtn"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:paddingStart="16dp"
android:text="退出账号"
android:textSize="16sp"
tools:ignore="RtlSymmetry" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="10"
tools:context=".ui.JD.TaobaoFragment">
tools:context=".ui.JD.JingDongFragment">
<LinearLayout
android:layout_width="0dp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

@ -13,7 +13,7 @@
<fragment
android:id="@+id/navigation_snack"
android:name="com.android.jingdong.ui.JD.TaobaoFragment"
android:name="com.android.jingdong.ui.JD.JingDongFragment"
android:label="商店"
tools:layout="@layout/fragment_snack" />

Loading…
Cancel
Save