“shiyehun” 6 months ago
parent dcd58db5e7
commit c30078f70e

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -0,0 +1 @@
/build

@ -0,0 +1,36 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.flowershop'
compileSdk 34
defaultConfig {
applicationId "com.example.flowershop"
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
implementation "com.github.bumptech.glide:okhttp3-integration:4.16.0"
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="线上花店"
android:supportsRtl="true"
android:theme="@style/Theme.SmallShop">
<activity
android:name=".activity.LoginActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.RegisterActivity"
android:exported="false" />
<activity
android:name=".activity.MainActivity"
android:exported="false" />
<activity
android:name=".activity.DetailActivity"
android:exported="false" />
<activity
android:name=".activity.AboutActivity"
android:exported="false" />
<activity
android:name=".activity.InfoActivity"
android:exported="false" />
<activity
android:name=".activity.RecordActivity"
android:exported="false" />
</application>
</manifest>

@ -0,0 +1,37 @@
package com.example.flowershop;
import android.app.Application;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.sqlite.DBStuff;
import com.example.flowershop.utils.AppUtils;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (AppUtils.isFirstTimeLaunch()) {
Stuff roseWhite = new Stuff("白玫瑰", "清新素雅的白色玫瑰,花瓣洁白如雪,散发着淡淡的清香", "玫瑰系列", "28");
DBStuff.add(roseWhite);
Stuff rosePink = new Stuff("粉玫瑰", "柔美粉色的玫瑰,娇艳欲滴,花语是甜蜜的爱情与温柔的关怀", "玫瑰系列", "22");
DBStuff.add(rosePink);
Stuff carnation = new Stuff("康乃馨", "康乃馨象征着母爱与关怀,花语是无尽的爱与感激,花瓣色彩丰富,芬芳宜人", "母亲节活动", "27");
DBStuff.add(carnation);
Stuff roseBlue = new Stuff("蓝玫瑰", "神秘而罕见的蓝色玫瑰,象征着奇迹与梦想,独特的色彩令人心驰神往", "玫瑰系列", "26");
DBStuff.add(roseBlue);
Stuff sunflower = new Stuff("向日葵", "向日葵是太阳的化身,代表着希望与积极的生命力,金黄色的花朵给人温暖与活力", "热卖款", "30");
DBStuff.add(sunflower);
Stuff tulip = new Stuff("郁金香", "郁金香是春天的使者,花语是美丽的爱情与真挚的情感,多姿多彩的花瓣散发着迷人的芳香", "热卖款", "21");
DBStuff.add(tulip);
AppUtils.setFirstTimeLaunch(false);
}
}
}

@ -0,0 +1,22 @@
package com.example.flowershop.activity;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.example.flowershop.R;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
findViewById(R.id.iv_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
}

@ -0,0 +1,93 @@
package com.example.flowershop.activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.bumptech.glide.Glide;
import com.example.flowershop.R;
import com.example.flowershop.entity.Record;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBCart;
import com.example.flowershop.sqlite.DBRecord;
import com.example.flowershop.sqlite.DBStuff;
import com.example.flowershop.utils.CurrentUserUtils;
public class DetailActivity extends AppCompatActivity {
private TextView tvTitle, tvName, tvPrice, tvKind;
private ImageView ivImage, ivBack;
private Button btnBuy, btnAdd;
private Stuff stuff;
private User user;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Intent intent = getIntent();
String id = intent.getStringExtra("id");
stuff = DBStuff.getById(Integer.parseInt(id));
user = CurrentUserUtils.getCurrentUser();
bindView();
initView();
}
private void bindView() {
tvTitle = findViewById(R.id.tv_title);
tvName = findViewById(R.id.tv_name);
tvPrice = findViewById(R.id.tv_price);
tvKind = findViewById(R.id.tv_kind);
ivImage = findViewById(R.id.iv_image);
btnBuy = findViewById(R.id.btn_buy);
btnAdd = findViewById(R.id.btn_add);
ivBack = findViewById(R.id.iv_back);
}
private void initView() {
tvTitle.setText(stuff.getTitle());
tvName.setText("名称:" + stuff.getName());
tvPrice.setText("价格:¥" + stuff.getPrice());
Glide.with(ivImage).load(stuff.getPic()).into(ivImage);
tvKind.setText("分类:" + stuff.getKind());
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (DBCart.add(stuff.getId(), user.getName())) {
Toast.makeText(DetailActivity.this, "加入购物车成功", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(DetailActivity.this, "加入购物车失败,或已在购物车中", Toast.LENGTH_SHORT).show();
}
}
});
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
btnBuy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Record r = new Record(user.getName(), stuff.getId(), tvName.getText().toString(), stuff.getPrice(), user.getAddress());
if (DBRecord.add(r)) {
Toast.makeText(DetailActivity.this, "价格" + stuff.getPrice() + "元,购买成功!", Toast.LENGTH_SHORT).show();
Log.d("-----", r.toString());
} else {
Toast.makeText(DetailActivity.this, "购买失败!", Toast.LENGTH_SHORT).show();
}
}
});
}
}

@ -0,0 +1,43 @@
package com.example.flowershop.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.flowershop.R;
import com.example.flowershop.entity.User;
import com.example.flowershop.utils.CurrentUserUtils;
public class InfoActivity extends AppCompatActivity {
private TextView tvName, tvAddress;
private ImageView ivBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
bindView();
initView();
}
private void bindView() {
tvName = findViewById(R.id.tv_name);
tvAddress = findViewById(R.id.tv_address);
ivBack = findViewById(R.id.iv_back);
}
private void initView() {
User user = CurrentUserUtils.getCurrentUser();
tvName.setText(user.getName());
tvAddress.setText(user.getAddress());
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
}

@ -0,0 +1,84 @@
package com.example.flowershop.activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.flowershop.R;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBUser;
import com.example.flowershop.utils.CodeUtils;
import com.example.flowershop.utils.CurrentUserUtils;
public class LoginActivity extends AppCompatActivity {
private Button btnLogin;
private Button btnRegister;
private TextView tvCode;
private EditText etName, etPassword, etCode;
private String code;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
bindView();
initView();
}
private void bindView() {
btnLogin = findViewById(R.id.btn_login);
etPassword = findViewById(R.id.et_password);
tvCode = findViewById(R.id.tv_code);
etName = findViewById(R.id.et_name);
etCode = findViewById(R.id.et_code);
btnRegister = findViewById(R.id.btn_register);
}
private void initView() {
User user = CurrentUserUtils.getCurrentUser();
if (user!=null){
etName.setText(user.getName());
}
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!etCode.getText().toString().equals(code)) {
Toast.makeText(LoginActivity.this, "验证码错误", Toast.LENGTH_SHORT).show();
return;
}
String n = etName.getText().toString();
String p = etPassword.getText().toString();
if (DBUser.check(n, p)) {
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
CurrentUserUtils.setCurrentUser(DBUser.get(n));
Intent intent = new Intent();
intent.setClass(LoginActivity.this, MainActivity.class);
startActivity(intent);
} else {
Toast.makeText(LoginActivity.this, "登录失败,用户名或密码错误", Toast.LENGTH_SHORT).show();
}
}
});
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClass(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
code = CodeUtils.getCode();
tvCode.setText(code);
}
}

@ -0,0 +1,60 @@
package com.example.flowershop.activity;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.example.flowershop.R;
import com.example.flowershop.fragment.CartFragment;
import com.example.flowershop.fragment.MainFragment;
import com.example.flowershop.fragment.MeFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationBarView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<Fragment> fragments = new ArrayList<>();
fragments.add(new MainFragment());
fragments.add(new CartFragment());
fragments.add(new MeFragment());
BottomNavigationView navigation = findViewById(R.id.navigation);
navigation.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.home) {
FragmentTransaction tran3 = getSupportFragmentManager().beginTransaction();
tran3.replace(R.id.main, fragments.get(0));
tran3.commit();
return true;
} else if (itemId == R.id.cart) {
FragmentTransaction tran2 = getSupportFragmentManager().beginTransaction();
tran2.replace(R.id.main, fragments.get(1));
tran2.commit();
return true;
} else if (itemId == R.id.me) {
FragmentTransaction tran1 = getSupportFragmentManager().beginTransaction();
tran1.replace(R.id.main, fragments.get(2));
tran1.commit();
return true;
}
return false;
}
});
navigation.setSelectedItemId(R.id.home);
}
}

@ -0,0 +1,56 @@
package com.example.flowershop.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.flowershop.R;
import com.example.flowershop.adapter.RecordAdapter;
import com.example.flowershop.entity.Record;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBRecord;
import com.example.flowershop.utils.CurrentUserUtils;
import java.util.List;
public class RecordActivity extends AppCompatActivity {
private ListView lvRecord;
private TextView tvEmpty;
private ImageView ivBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record);
bindView();
initView();
}
private void bindView() {
lvRecord = findViewById(R.id.lv_record);
tvEmpty = findViewById(R.id.tv_empty);
ivBack = findViewById(R.id.iv_back);
}
private void initView() {
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
User user = CurrentUserUtils.getCurrentUser();
List<Record> array = DBRecord.getAll(user.getName());
if (array.isEmpty()) {
tvEmpty.setVisibility(View.VISIBLE);
} else {
tvEmpty.setVisibility(View.GONE);
}
RecordAdapter adapter = new RecordAdapter(this, R.layout.item_record, array);
lvRecord.setAdapter(adapter);
}
}

@ -0,0 +1,77 @@
package com.example.flowershop.activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.flowershop.R;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBUser;
public class RegisterActivity extends AppCompatActivity {
private ImageView ivBack;
private EditText etName, etAddress;
private EditText etPassword;
private EditText etPasswordConfirm;
private Button btnRegister;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
bindView();
initView();
}
private void bindView() {
etAddress = findViewById(R.id.et_address);
ivBack = findViewById(R.id.iv_back);
etName = findViewById(R.id.et_name);
etPassword = findViewById(R.id.et_password);
etPasswordConfirm = findViewById(R.id.et_password_confirm);
btnRegister = findViewById(R.id.btn_register);
}
private void initView() {
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (etPassword.getText().toString().isEmpty() || etPasswordConfirm.getText().toString().isEmpty() || etName.getText().toString().isEmpty() || etAddress.getText().toString().isEmpty()) {
Toast.makeText(RegisterActivity.this, "数据不能为空", Toast.LENGTH_SHORT).show();
return;
}
if (!etPassword.getText().toString().equals(etPasswordConfirm.getText().toString())) {
Toast.makeText(RegisterActivity.this, "两次密码不一样", Toast.LENGTH_SHORT).show();
return;
}
User u = new User(etName.getText().toString(), etPassword.getText().toString(), etAddress.getText().toString());
if (!TextUtils.isEmpty(DBUser.get(u.getName()).getName())) {
Toast.makeText(RegisterActivity.this, "用户名已存在", Toast.LENGTH_SHORT).show();
return;
}
if (DBUser.add(u)) {
Toast.makeText(RegisterActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(RegisterActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
}
}
});
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
}

@ -0,0 +1,92 @@
package com.example.flowershop.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.example.flowershop.R;
import com.example.flowershop.entity.Record;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.entity.User;
import com.example.flowershop.fragment.CartFragment;
import com.example.flowershop.utils.CurrentUserUtils;
import java.util.List;
public class CartAdapter extends ArrayAdapter<Stuff> {
private final User user;
public CartAdapter(@NonNull Context context, int resource, @NonNull List<Stuff> objects) {
super(context, resource, objects);
user = CurrentUserUtils.getCurrentUser();
}
//每个子项被滚动到屏幕内的时候会被调用
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
Stuff s = getItem(position);//得到当前项的 Stuff 实例
View view = LayoutInflater.from(getContext()).inflate(R.layout.item_cart, parent, false);
TextView title = view.findViewById(R.id.tv_title);
TextView price = view.findViewById(R.id.tv_price);
ImageView pic = view.findViewById(R.id.iv_pic);
CheckBox box = view.findViewById(R.id.box);
title.setText(s.getTitle());
price.setText("¥" + s.getPrice());
Glide.with(pic).load(s.getPic()).into(pic);
pic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), s.getName(), Toast.LENGTH_SHORT).show();
}
});
/*
total
*/
box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
double total = Double.parseDouble(CartFragment._tvTotal.getText().toString());
if (box.isChecked()) {
//Toast.makeText(getContext(), "选中了", Toast.LENGTH_SHORT).show();
Record r = new Record(user.getName(), s.getId(), s.getName(), s.getPrice(), user.getAddress());
CartFragment.record.add(r);
total += Double.parseDouble(r.getPrice());
} else {
int i = 0;
for (Record r : CartFragment.record) {
if (r.getId().equals(s.getId())) {
total -= Double.parseDouble(r.getPrice());
CartFragment.record.remove(i);
break;
}
i++;
}
}
CartFragment._tvTotal.setText(String.format("%.2f", total));
}
});
return view;
}
}

@ -0,0 +1,55 @@
package com.example.flowershop.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.example.flowershop.R;
import com.example.flowershop.sqlite.DBStuff;
import com.example.flowershop.entity.Record;
import com.example.flowershop.entity.Stuff;
import java.util.ArrayList;
import java.util.List;
public class RecordAdapter extends ArrayAdapter<Record> {
public RecordAdapter(@NonNull Context context, int resource, @NonNull List<Record> objects) {
super(context, resource, objects);
}
//每个子项被滚动到屏幕内的时候会被调用
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
Record r=getItem(position);//得到当前项的 Fruit 实例
View view= LayoutInflater.from(getContext()).inflate(R.layout.item_record,parent,false);
String id=r.getId();
Stuff stuff=DBStuff.getById(Integer.valueOf(id));
TextView title =view.findViewById(R.id.tv_title);
TextView address =view.findViewById(R.id.et_address);
ImageView pic=view.findViewById(R.id.iv_pic);
TextView price =view.findViewById(R.id.tv_price);
price.setText("¥"+r.getPrice());
title.setText(stuff.getTitle());
address.setText("收货地址:"+r.getAddress());
Glide.with(pic).load(stuff.getPic()).into(pic);
return view;
}
}

@ -0,0 +1,64 @@
package com.example.flowershop.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.example.flowershop.R;
import com.example.flowershop.entity.Stuff;
import java.util.List;
public class StuffAdapter extends ArrayAdapter<Stuff> {
public StuffAdapter(@NonNull Context context, int resource, @NonNull List<Stuff> objects) {
super(context, resource, objects);
}
//每个子项被滚动到屏幕内的时候会被调用
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
Stuff s = getItem(position);//得到当前项的 Fruit 实例
View view = LayoutInflater.from(getContext()).inflate(R.layout.item_stuff, parent, false);
TextView kind = view.findViewById(R.id.tv_kind);
TextView title = view.findViewById(R.id.tv_title);
TextView name = view.findViewById(R.id.et_name);
ImageView pic = view.findViewById(R.id.iv_pic);
TextView price = view.findViewById(R.id.tv_price);
price.setText("¥" + s.getPrice());
kind.setText("分类:" + s.getKind());
title.setText(s.getTitle());
name.setText("名称:" + s.getName());
Glide.with(pic).load(s.getPic()).into(pic);
pic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), s.getName(), Toast.LENGTH_SHORT).show();
}
});
return view;
}
public void setData(List<Stuff> stuffList) {
clear();
addAll(stuffList);
notifyDataSetChanged();
}
}

@ -0,0 +1,68 @@
package com.example.flowershop.entity;
public class Record {
private String username;
private String id;//商品id
private String name;//商品名称
private String price;
private String address;
@Override
public String toString() {
return "Record{" +
"username='" + username + '\'' +
", id='" + id + '\'' +
", name='" + name + '\'' +
", price='" + price + '\'' +
", address='" + address + '\'' +
'}';
}
public Record(String username, String id, String name, String price, String address) {
this.username = username;
this.id = id;
this.name = name;
this.price = price;
this.address = address;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}

@ -0,0 +1,117 @@
package com.example.flowershop.entity;
import com.example.flowershop.R;
public class Stuff {
private String id;//id
private String name;//名称
private String title;//标题
private String kind;//分类
private String price;//价格
private int pic;//图片
public Stuff() {
this.id="-1";
}
public Stuff( String name, String title, String kind, String price ) {
this.id = "id";
this.name = name;
this.title = title;
this.kind = kind;
this.price = price;
this.pic = 0;
}
public Stuff(String id, String name, String title, String kind, String price) {
this.id = id;
this.name = name;
this.title = title;
this.kind = kind;
this.price = price;
switch (name){
case "白玫瑰":
this.pic= R.drawable.stuff_bmg;
break;
case "粉玫瑰":
this.pic=R.drawable.stuff_fmg;
break;
case "康乃馨":
this.pic=R.drawable.stuff_knx;
break;
case "蓝玫瑰":
this.pic=R.drawable.stuff_lmg;
break;
case "向日葵":
this.pic=R.drawable.stuff_xrk;
break;
case "郁金香":
this.pic=R.drawable.stuff_yjx;
break;
default:
this.pic=R.drawable.ic_about;
break;
}
}
@Override
public String toString() {
return "Stuff{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", title='" + title + '\'' +
", kind='" + kind + '\'' +
", price='" + price + '\'' +
", pic=" + pic +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public int getPic() {
return pic;
}
public void setPic(int pic) {
this.pic = pic;
}
}

@ -0,0 +1,40 @@
package com.example.flowershop.entity;
public class User {
private String name;
private String psw;
private String address;
public User() {
}
public User(String name, String psw, String address) {
this.name = name;
this.psw = psw;
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPsw() {
return psw;
}
public void setPsw(String psw) {
this.psw = psw;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}

@ -0,0 +1,118 @@
package com.example.flowershop.fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.example.flowershop.R;
import com.example.flowershop.adapter.CartAdapter;
import com.example.flowershop.entity.Record;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBCart;
import com.example.flowershop.sqlite.DBRecord;
import com.example.flowershop.sqlite.DBStuff;
import com.example.flowershop.utils.CurrentUserUtils;
import java.util.ArrayList;
public class CartFragment extends Fragment {
public static ArrayList<Record> record = new ArrayList<>();
public static TextView _tvTotal;
private ListView lvCart;
private Button btnBuy;
private TextView etEmpty;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_cart, container, false);
bindView(v);
initView();
return v;
}
private void bindView(View v) {
lvCart = v.findViewById(R.id.lv_cart);
etEmpty = v.findViewById(R.id.tv_empty);
_tvTotal = v.findViewById(R.id.tv_total);
btnBuy = v.findViewById(R.id.btn_buy);
}
private void initView() {
_tvTotal.setText("0.00");
//点击购买
btnBuy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (CartFragment.record.size() == 0) {
Toast.makeText(getContext(), "你还未选择任何商品", Toast.LENGTH_SHORT).show();
return;
}
double total = 0;
for (Record r : CartFragment.record) {
//添加购买记录到数据库
if (DBRecord.add(r)) {
total += Double.valueOf(r.getPrice());
Log.d("成功添加购买记录-----", r.toString());
//从购物车数据库中删除已经购买的商品
if (DBCart.del(r.getId(), r.getUsername())) {
Log.d("成功从购物车中删除-----", r.toString());
}
} else {
Log.d("失败添加购买记录-----", r.toString());
}
}
record = new ArrayList<>();
_tvTotal.setText("0.00");
Toast.makeText(getContext(), "价格总计" + String.format("%.2f", total) + "元,购买成功!", Toast.LENGTH_SHORT).show();
set();
}
});
set();
}
/**
*
*/
private void set() {
User user = CurrentUserUtils.getCurrentUser();
ArrayList<Stuff> array = new ArrayList<>();
//获取购物车中商品的所有id
ArrayList<String> allId = DBCart.getLikesTitle(user.getName());
if (allId.size() == 0) {
etEmpty.setVisibility(View.VISIBLE);
} else {
etEmpty.setVisibility(View.GONE);
}
//通过id依次获取商品信息
for (String s : allId) {
Stuff stuff = DBStuff.getById(Integer.parseInt(s));
array.add(stuff);
}
for (Stuff t : array) {
Log.d("--------", t.toString());
}
CartAdapter adapter = new CartAdapter(getContext(), R.layout.item_cart, array);
lvCart.setAdapter(adapter);
lvCart.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String s = (array.get(i)).getName();
Toast.makeText(getContext(), "name" + s, Toast.LENGTH_SHORT).show();
}
});
}
}

@ -0,0 +1,94 @@
package com.example.flowershop.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.example.flowershop.R;
import com.example.flowershop.activity.DetailActivity;
import com.example.flowershop.adapter.StuffAdapter;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.sqlite.DBStuff;
import java.util.ArrayList;
import java.util.List;
public class MainFragment extends Fragment {
private ListView lvStuff;
private EditText etSearch;
private ImageView ivSearch;
private List<Stuff> stuffList;
private StuffAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main, container, false);
bindView(v);
initView();
ivSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String str = etSearch.getText().toString();
setSearch(str);
}
});
return v;
}
private void bindView(View v) {
lvStuff = v.findViewById(R.id.lv_stuff);
etSearch = v.findViewById(R.id.et_search);
ivSearch = v.findViewById(R.id.iv_search);
}
private void initView() {
stuffList = DBStuff.getAll();
adapter = new StuffAdapter(getContext(), R.layout.item_stuff, stuffList);
lvStuff.setAdapter(adapter);
lvStuff.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent();
intent.putExtra("id", (stuffList.get(i)).getId());
intent.setClass(getContext(), DetailActivity.class);
startActivity(intent);
}
});
}
private void setSearch(String str) {
List<Stuff> arrayTemp = DBStuff.getAll();
List<Stuff> array = new ArrayList<>();
for (Stuff t : arrayTemp) {
if (t.getName().contains(str) || t.getTitle().contains(str)) {
array.add(t);
}
}
if (array.size() == 0) {
Toast.makeText(getContext(), "未搜索到关键字商品", Toast.LENGTH_SHORT).show();
array = arrayTemp;
}
stuffList = array;
adapter.setData(stuffList);
}
}

@ -0,0 +1,120 @@
package com.example.flowershop.fragment;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.example.flowershop.R;
import com.example.flowershop.activity.AboutActivity;
import com.example.flowershop.activity.InfoActivity;
import com.example.flowershop.activity.RecordActivity;
import com.example.flowershop.entity.User;
import com.example.flowershop.sqlite.DBUser;
import com.example.flowershop.utils.CurrentUserUtils;
public class MeFragment extends Fragment {
private TextView tvName;
private LinearLayout llRecord, llChangeAddress, llInfo, llAbout, llContact;
private User user;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
user = CurrentUserUtils.getCurrentUser();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_me, container, false);
bindView(v);
initView();
return v;
}
private void bindView(View v) {
llRecord = v.findViewById(R.id.myrecord);
tvName = v.findViewById(R.id.tv_name);
llChangeAddress = v.findViewById(R.id.ll_change_address);
llInfo = v.findViewById(R.id.ll_info);
llAbout = v.findViewById(R.id.ll_about);
llContact = v.findViewById(R.id.ll_contact);
}
private void initView() {
tvName.setText("欢迎您,亲爱的" + user.getName());
llAbout.setOnClickListener(this::onClick);
llChangeAddress.setOnClickListener(this::onClick);
llRecord.setOnClickListener(this::onClick);
llContact.setOnClickListener(this::onClick);
llInfo.setOnClickListener(this::onClick);
}
void onClick(View v) {
int id = v.getId();
if (id == R.id.myrecord) {//Toast.makeText(getContext(), "record", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), RecordActivity.class);
startActivity(intent);
} else if (id == R.id.ll_contact) {
joinPhone();
} else if (id == R.id.ll_info) {
Intent intent1 = new Intent(getActivity(), InfoActivity.class);
startActivity(intent1);
} else if (id == R.id.ll_change_address) {
changeAddress();
} else if (id == R.id.ll_about) {
Intent intent3 = new Intent(getActivity(), AboutActivity.class);
startActivity(intent3);
}
}
//修改收货地址
void changeAddress() {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_change_address, null);
AlertDialog.Builder customBuilder = new AlertDialog.Builder(getContext()).setTitle("修改收货地址").setView(view);
AlertDialog dialog = customBuilder.create();
dialog.show();
//自定义按钮并注册监听器
EditText ed_number = view.findViewById(R.id.et_address);
ed_number.setHint(user.getAddress());
Button btn_ok = view.findViewById(R.id.btn_confirm);
Button btn_cancel = view.findViewById(R.id.btn_cancel);
btn_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Toast.makeText(getActivity(), ed_number.getText().toString(), Toast.LENGTH_LONG).show();
user.setAddress(ed_number.getText().toString());
if (DBUser.change(user)) {
CurrentUserUtils.setCurrentUser(user);
Toast.makeText(getContext(), "修改成功!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getContext(), "修改失败!", Toast.LENGTH_SHORT).show();
}
dialog.dismiss();
}
});
btn_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
void joinPhone() {
Toast.makeText(getContext(), "请联系18888888888", Toast.LENGTH_SHORT).show();
}
}

@ -0,0 +1,52 @@
package com.example.flowershop.sqlite;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import androidx.annotation.Nullable;
import com.example.flowershop.utils.SqliteUtils;
import java.util.ArrayList;
public class DBCart {
public static boolean add(String id,String username){
ContentValues values=new ContentValues();
values.put("id",id);
values.put("username",username);
long i= SqliteUtils.getInstance().getWritableDatabase().insert("cart",null,values);
if(i>0){
Log.d("","插入成功");
return true;
}
return false;
}
public static boolean del(String id,String username){
long i=SqliteUtils.getInstance().getWritableDatabase().delete("cart","id=? and username=?",new String[]{id,username});
if(i>0){
Log.d("","删除成功");
return true;
}
return false;
}
public static ArrayList<String> getLikesTitle(String username){
ArrayList<String> array=new ArrayList();
Cursor cursor=SqliteUtils.getInstance().getReadableDatabase().query("cart",null,null,null,null,null,null);
while(cursor.moveToNext()){
@SuppressLint("Range") String id=cursor.getString( cursor.getColumnIndex("id"));
@SuppressLint("Range") String name=cursor.getString( cursor.getColumnIndex("username"));
if(name.equals(username)){
array.add(id );
}
}
return array;
}
}

@ -0,0 +1,54 @@
package com.example.flowershop.sqlite;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import androidx.annotation.Nullable;
import com.example.flowershop.entity.Record;
import com.example.flowershop.utils.SqliteUtils;
import java.util.ArrayList;
import java.util.List;
public class DBRecord {
public static boolean add(Record s){
ContentValues values=new ContentValues();
values.put("username",s.getUsername());
values.put("id",s.getId());
values.put("name",s.getName());
values.put("price",s.getPrice());
values.put("address",s.getAddress());
long i= SqliteUtils.getInstance().getWritableDatabase().insert("record",null,values);
if(i>0){
Log.d("","插入成功");
return true;
}
Log.d("","插入失败");
return false;
}
public static List<Record> getAll(String user){
List<Record> array=new ArrayList<>();
Cursor cursor=SqliteUtils.getInstance().getReadableDatabase().query("record",null,null,null,null,null,null);
while(cursor.moveToNext()){
@SuppressLint("Range") String username=cursor.getString( cursor.getColumnIndex("username"));
@SuppressLint("Range") String id=cursor.getString( cursor.getColumnIndex("id"));
@SuppressLint("Range") String name=cursor.getString( cursor.getColumnIndex("name"));
@SuppressLint("Range") String address=cursor.getString( cursor.getColumnIndex("address"));
@SuppressLint("Range") String price=cursor.getString( cursor.getColumnIndex("price"));
if(user.equals(username)){
Record u=new Record(username,id,name ,price,address);
array.add(u);
}
}
return array;
}
}

@ -0,0 +1,75 @@
package com.example.flowershop.sqlite;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.database.Cursor;
import android.util.Log;
import com.example.flowershop.entity.Stuff;
import com.example.flowershop.utils.SqliteUtils;
import java.util.ArrayList;
import java.util.List;
public class DBStuff {
public static boolean add(Stuff s) {
ContentValues values = new ContentValues();
Log.d("", "插入 ");
values.put("name", s.getName());
values.put("title", s.getTitle());
values.put("kind", s.getKind());
values.put("price", s.getPrice());
long i = SqliteUtils.getInstance().getWritableDatabase().insert("stuff", null, values);
if (i > 0) {
Log.d("", "插入成功");
return true;
}
Log.d("", "插入失败");
return false;
}
public static void deleteAll() {
List<Stuff> all = getAll();
for (int i = 0; i < all.size(); i++) {
String sqlStr = "id" + "=?";
String[] contentValuesArray = new String[]{all.get(i).getId()};
SqliteUtils.getInstance().getWritableDatabase().delete("stuff", sqlStr, contentValuesArray);
}
}
public static List<Stuff> getAll() {
List<Stuff> array = new ArrayList<>();
Cursor cursor = SqliteUtils.getInstance().getReadableDatabase().query("stuff", null, null, null, null, null, null);
while (cursor.moveToNext()) {
@SuppressLint("Range") int id = cursor.getInt(cursor.getColumnIndex("id"));
@SuppressLint("Range") String name = cursor.getString(cursor.getColumnIndex("name"));
@SuppressLint("Range") String title = cursor.getString(cursor.getColumnIndex("title"));
@SuppressLint("Range") String kind = cursor.getString(cursor.getColumnIndex("kind"));
@SuppressLint("Range") String price = cursor.getString(cursor.getColumnIndex("price"));
Stuff u = new Stuff(String.valueOf(id), name, title, kind, price);
array.add(u);
}
return array;
}
public static Stuff getById(int _id) {
Stuff s = new Stuff();
Cursor cursor = SqliteUtils.getInstance().getReadableDatabase().query("stuff", null, null, null, null, null, null);
while (cursor.moveToNext()) {
@SuppressLint("Range") int id = cursor.getInt(cursor.getColumnIndex("id"));
@SuppressLint("Range") String name = cursor.getString(cursor.getColumnIndex("name"));
@SuppressLint("Range") String title = cursor.getString(cursor.getColumnIndex("title"));
@SuppressLint("Range") String kind = cursor.getString(cursor.getColumnIndex("kind"));
@SuppressLint("Range") String price = cursor.getString(cursor.getColumnIndex("price"));
if (id == _id) {
s = new Stuff(String.valueOf(id), name, title, kind, price);
break;
}
}
return s;
}
}

@ -0,0 +1,64 @@
package com.example.flowershop.sqlite;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import com.example.flowershop.entity.User;
import com.example.flowershop.utils.SqliteUtils;
public class DBUser {
public static boolean add(User u) {
ContentValues values = new ContentValues();
values.put("name", u.getName());
values.put("psw", u.getPsw());
values.put("address", u.getAddress());
long i = SqliteUtils.getInstance().getWritableDatabase().insert("user", null, values);
if (i > 0) {
Log.d("", "插入成功");
return true;
}
return false;
}
public static boolean change(User u) {
ContentValues values = new ContentValues();
values.put("address", u.getAddress());
long i = SqliteUtils.getInstance().getWritableDatabase().update("user", values, "name=?", new String[]{u.getName()});
if (i > 0) {
Log.d("", "修改成功");
return true;
}
return false;
}
public static boolean check(String n, String p) {
Cursor cursor = SqliteUtils.getInstance().getReadableDatabase().query("user", null, null, null, null, null, null);
while (cursor.moveToNext()) {
@SuppressLint("Range") String name = cursor.getString(cursor.getColumnIndex("name"));
@SuppressLint("Range") String psw = cursor.getString(cursor.getColumnIndex("psw"));
if (n.equals(name) && p.equals(psw)) {
return true;
}
}
return false;
}
public static User get(String n) {
User u = new User();
Cursor cursor = SqliteUtils.getInstance().getReadableDatabase().query("user", null, null, null, null, null, null);
while (cursor.moveToNext()) {
@SuppressLint("Range") String name = cursor.getString(cursor.getColumnIndex("name"));
@SuppressLint("Range") String psw = cursor.getString(cursor.getColumnIndex("psw"));
@SuppressLint("Range") String address = cursor.getString(cursor.getColumnIndex("address"));
if (n.equals(name)) {
u = new User(name, psw, address);
break;
}
}
return u;
}
}

@ -0,0 +1,58 @@
package com.example.flowershop.utils;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
public class AppUtils {
private static final String PREF_NAME = "app_pref";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
private final SharedPreferences pref;
private final SharedPreferences.Editor editor;
private Application application;
public AppUtils() {
try {
Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);
application = (Application) activityThreadClass.getMethod("getApplication").invoke(activityThread);
} catch (Exception e) {
e.printStackTrace();
}
pref = application.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
editor = pref.edit();
}
/**
*
*/
private static AppUtils getInstance() {
return InstanceHolder.instance;
}
public static boolean isFirstTimeLaunch() {
return getInstance().pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
public static void setFirstTimeLaunch(boolean isFirstTime) {
getInstance().editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
getInstance().editor.commit();
}
/**
* Application
*/
public static Application getApplication() {
return getInstance().application;
}
private static final class InstanceHolder {
/**
*
*/
static final AppUtils instance = new AppUtils();
}
}

@ -0,0 +1,16 @@
package com.example.flowershop.utils;
import java.util.Random;
public class CodeUtils {
public static String getCode(){
String str="abcdefghijklmnopqrstuvwxyz0123456789";
Random random=new Random();
StringBuffer sb=new StringBuffer();
for(int i=0;i<4;i++){
int number=random.nextInt(36);
sb.append(str.charAt(number));
}
return sb.toString();
}
}

@ -0,0 +1,49 @@
package com.example.flowershop.utils;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.flowershop.entity.User;
public class CurrentUserUtils {
private static final String CURRENT_USER = "CURRENT_USER";
private final SharedPreferences sp;
/**
*
*/
public static CurrentUserUtils getInstance() {
return CurrentUserUtils.InstanceHolder.instance;
}
public CurrentUserUtils() {
sp = AppUtils.getApplication().getSharedPreferences(CURRENT_USER, Context.MODE_PRIVATE);
}
public static User getCurrentUser() {
String username = getInstance().sp.getString("username", null);
String address = getInstance().sp.getString("address", null);
if (username == null) {
return null;
}
User user = new User();
user.setName(username);
user.setAddress(address);
return user;
}
public static void setCurrentUser(User user) {
SharedPreferences.Editor editor = getInstance().sp.edit();
editor.putString("username", user.getName());
editor.putString("address", user.getAddress());
editor.apply();
}
private static final class InstanceHolder {
/**
*
*/
static final CurrentUserUtils instance = new CurrentUserUtils();
}
}

@ -0,0 +1,24 @@
package com.example.flowershop.utils;
import android.content.Context;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import java.io.InputStream;
@GlideModule
public class MyGlideModule extends AppGlideModule {
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
}

@ -0,0 +1,46 @@
package com.example.flowershop.utils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class SqliteUtils extends SQLiteOpenHelper {
public SqliteUtils() {
super(AppUtils.getApplication(), "flower_shop.db", null, 1);
}
/**
*
*/
public static SqliteUtils getInstance() {
return InstanceHolder.instance;
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table user(name text primary key,psw text not null,address text not null)");
db.execSQL("create table stuff(id INTEGER primary key AUTOINCREMENT,name text not null,title text not null,kind text not null,price text not null)");
db.execSQL("create table record(username text not null,id text not null,name text not null,price text not null,address text not null)");
db.execSQL("create table cart(id text not null,username text not null,PRIMARY KEY(id,username))");
}
@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1) {
//删除表
db.execSQL("DROP TABLE IF EXISTS user");
db.execSQL("DROP TABLE IF EXISTS stuff");
db.execSQL("DROP TABLE IF EXISTS record");
db.execSQL("DROP TABLE IF EXISTS cart");
//重新创建表
onCreate(db);
}
private static final class InstanceHolder {
/**
*
*/
static final SqliteUtils instance = new SqliteUtils();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#8a8a8a" />
<padding
android:bottom="0dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners android:radius="20dp"/>
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/main" />
<corners android:radius="8dp"/>
</shape>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/main" />
<corners android:radius="8dp"/>
</shape>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_common"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".activity.AboutActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@color/main">
<ImageView
android:id="@+id/iv_back"
android:layout_width="54dp"
android:layout_height="54dp"
android:padding="8dp"
android:src="@drawable/ic_back"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="关于"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:text="线上花店"
android:textColor="@color/main"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="软件版本1.0"
android:textColor="@color/black"
android:textSize="14sp" />
</LinearLayout>

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.DetailActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@color/main">
<ImageView
android:id="@+id/iv_back"
android:layout_width="54dp"
android:layout_height="54dp"
android:padding="8dp"
android:src="@drawable/ic_back"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="详情"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp">
<ImageView
android:id="@+id/iv_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="标题:"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="价格:"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="名称:"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_kind"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="分类:"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="1"
android:textColor="@color/white"
android:background="@drawable/bg_btn_common"
android:text="加入购物车" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_buy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="1"
android:textColor="@color/white"
android:background="@drawable/bg_btn_common"
android:text="立即购买" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.InfoActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@color/main">
<ImageView
android:id="@+id/iv_back"
android:layout_width="54dp"
android:layout_height="54dp"
android:padding="8dp"
android:src="@drawable/ic_back"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="个人信息"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp">
<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="用户名"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="用户名"
android:textColor="@color/main"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp">
<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="收货地址"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="收货地址"
android:textColor="@color/main"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_common"
android:gravity="center"
android:orientation="vertical"
tools:context=".activity.LoginActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="欢迎登录\n线上花店"
android:textAlignment="center"
android:textColor="@color/main"
android:textSize="40sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_name"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="48dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bg_et_border"
android:hint="用户名"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<EditText
android:id="@+id/et_password"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_et_border"
android:hint="密码"
android:inputType="textPassword"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<LinearLayout
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/bg_et_border"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp">
<EditText
android:id="@+id/et_code"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@null"
android:hint="输入验证码"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="验证码"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_register"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_common"
android:text="注册"
android:textColor="@color/white"
android:textSize="16sp" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_login"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_common"
android:text="登录"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.MainActivity">
<FrameLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:labelVisibilityMode="labeled"
app:menu="@menu/navigation" />
</LinearLayout>

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context=".activity.RecordActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@color/main">
<ImageView
android:id="@+id/iv_back"
android:layout_width="54dp"
android:layout_height="54dp"
android:padding="8dp"
android:src="@drawable/ic_back"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="订单记录"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<TextView
android:id="@+id/tv_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:text="暂无订单记录~"
android:textAlignment="center"
android:textColor="@color/main"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone" />
<ListView
android:id="@+id/lv_record"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_common"
android:orientation="vertical"
tools:context=".activity.RegisterActivity">
<FrameLayout
android:layout_width="match_parent"
android:background="@color/main"
android:layout_height="54dp">
<ImageView
android:id="@+id/iv_back"
android:layout_width="54dp"
android:layout_height="54dp"
android:padding="8dp"
android:src="@drawable/ic_back"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="注册"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<EditText
android:id="@+id/et_name"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="48dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bg_et_border"
android:hint="用户名"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<EditText
android:id="@+id/et_password"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_et_border"
android:hint="密码"
android:inputType="textPassword"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<EditText
android:id="@+id/et_password_confirm"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_et_border"
android:hint="确认密码"
android:inputType="textPassword"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<EditText
android:id="@+id/et_address"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="@drawable/bg_et_border"
android:hint="收货地址"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_register"
android:layout_width="250dp"
android:layout_height="42dp"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="@drawable/bg_btn_common"
android:text="注册"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<EditText
android:id="@+id/et_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_et_border"
android:hint="请输入购物地址"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_cancel"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_margin="8dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_common"
android:text="取消"
android:textColor="@color/white" />
<Button
android:id="@+id/btn_confirm"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_margin="8dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_common"
android:text="确定"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_common"
android:orientation="vertical"
tools:context=".fragment.CartFragment">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@color/main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="购物车"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<TextView
android:id="@+id/tv_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:text="您的购物车空空如也~"
android:textAlignment="center"
android:textColor="@color/main"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone" />
<ListView
android:id="@+id/lv_cart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥ "
android:textColor="@color/main"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textStyle="bold"
android:textColor="@color/main"
android:textSize="20sp" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_buy"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_marginStart="16dp"
android:background="@drawable/bg_btn_common"
android:text="结算"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".fragment.MainFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_et_border"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="@+id/et_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:background="@null"
android:hint="请输入搜索内容"
android:textSize="14sp" />
<ImageView
android:id="@+id/iv_search"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_search" />
</LinearLayout>
<ListView
android:id="@+id/lv_stuff"
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/ic_rightols"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.MeFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/main"
android:gravity="center"
android:orientation="vertical"
android:padding="48dp">
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="2dp"
android:src="@drawable/icon"
app:shapeAppearanceOverlay="@style/circleImageStyle"
app:strokeColor="#FFFFFF"
app:strokeWidth="2dp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="欢迎您,亲爱的user"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="520都没人买花给你"
android:textColor="@color/main"
android:textSize="18sp" />
<TextView
android:id="@+id/sentence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="不如自己买束花奖励自己!"
android:textColor="@color/main"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/bg_border"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<LinearLayout
android:id="@+id/myrecord"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="8dp"
android:foregroundGravity="left"
android:src="@drawable/ic_order" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="我的订单"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:foregroundGravity="left"
android:src="@drawable/ic_right" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#8a8a8a" />
<LinearLayout
android:id="@+id/ll_change_address"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="8dp"
android:foregroundGravity="left"
android:src="@drawable/ic_change" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="修改收货地址"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:foregroundGravity="left"
android:src="@drawable/ic_right" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#8a8a8a" />
<LinearLayout
android:id="@+id/ll_info"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="8dp"
android:foregroundGravity="left"
android:src="@drawable/ic_me" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="个人信息"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:foregroundGravity="left"
android:src="@drawable/ic_right" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#8a8a8a" />
<LinearLayout
android:id="@+id/ll_contact"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="8dp"
android:foregroundGravity="left"
android:src="@drawable/ic_contact" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="联系客服"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:foregroundGravity="left"
android:src="@drawable/ic_right" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#8a8a8a" />
<LinearLayout
android:id="@+id/ll_about"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="8dp"
android:foregroundGravity="left"
android:src="@drawable/ic_about" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="关于商店"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:foregroundGravity="left"
android:src="@drawable/ic_right" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<CheckBox
android:id="@+id/box"
android:layout_width="40dp"
android:layout_height="40dp" />
<ImageView
android:id="@+id/iv_pic"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@color/main"
android:scaleType="centerCrop" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="标题"
android:textColor="@color/main"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="¥100"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_pic"
android:layout_width="90dp"
android:layout_height="90dp"
android:background="@color/main"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:text="¥28"
android:textColor="@color/main"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="标题"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/et_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="收货地址"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_pic"
android:layout_width="90dp"
android:layout_height="90dp"
android:background="@color/main"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:text="¥28"
android:textColor="@color/main"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="标题"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_kind"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="4dp"
android:text="分类"
android:textSize="14sp" />
<TextView
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="名称"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="首页"
android:icon="@drawable/ic_home"/>
<item
android:id="@+id/cart"
android:title="购物车"
android:icon="@drawable/ic_cart"/>
<item
android:id="@+id/me"
android:title="我的"
android:icon="@drawable/ic_me"/>
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#D9BAFF</color>
<color name="purple_500">#FBC679</color>
<color name="purple_700">#FFB59E</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="main">#006400</color>
</resources>

@ -0,0 +1,5 @@
<resources>
<string name="app_name">SmallShop</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 圆形图片 -->
<style name="circleImageStyle">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">50%</item>
</style>
<!-- 切角图片 -->
<style name="cutImageStyle">
<item name="cornerFamily">cut</item>
<item name="cornerSize">15dp</item>
</style>
<!-- 菱形图片 -->
<style name="diamondImageStyle">
<item name="cornerFamily">cut</item>
<item name="cornerSize">50%</item>
</style>
<!-- 左上角90度扇形图片 -->
<style name="topLeftRoundImageStyle">
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerSizeTopLeft">100%</item>
</style>
<!-- 火箭头图片 -->
<style name="rocketImageStyle">
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerFamilyTopRight">rounded</item>
<item name="cornerSizeTopLeft">70%</item>
<item name="cornerSizeTopRight">70%</item>
</style>
<!-- 水滴 -->
<style name="waterImageStyle">
<item name="cornerFamilyBottomLeft">rounded</item>
<item name="cornerFamilyBottomRight">rounded</item>
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerFamilyTopRight">rounded</item>
<item name="cornerSizeBottomLeft">25dp</item>
<item name="cornerSizeBottomRight">25dp</item>
<item name="cornerSizeTopLeft">70%</item>
<item name="cornerSizeTopRight">70%</item>
</style>
<!-- 叶子图片 -->
<style name="leafImageStyle">
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerFamilyBottomRight">rounded</item>
<item name="cornerSizeTopLeft">50%</item>
<item name="cornerSizeBottomRight">50%</item>
</style>
<!-- tip图片 -->
<style name="tipImageStyle">
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerSizeTopLeft">50%</item>
<item name="cornerFamilyBottomLeft">rounded</item>
<item name="cornerSizeBottomLeft">50%</item>
<item name="cornerFamilyTopRight">cut</item>
<item name="cornerSizeTopRight">50%</item>
<item name="cornerFamilyBottomRight">cut</item>
<item name="cornerSizeBottomRight">50%</item>
</style>
</resources>

@ -0,0 +1,17 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.SmallShop" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/main</item>
<item name="colorPrimaryVariant">@color/main</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" >?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.2.2' apply false
}

Binary file not shown.

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

Binary file not shown.

@ -0,0 +1,6 @@
#Sun Dec 22 21:40:32 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
flower-shop/gradlew vendored

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,35 @@
pluginManagement {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
mavenCentral()
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
maven { url "https://jitpack.io" }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
mavenCentral()
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
maven { url "https://jitpack.io" }
}
}
rootProject.name = "flower-shop"
include ':app'
Loading…
Cancel
Save