@ -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,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1 @@
|
||||
RF_Week02
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,43 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.animee.rf_week02'
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.animee.rf_week02"
|
||||
minSdk 28
|
||||
targetSdk 32
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.5.2'
|
||||
}
|
@ -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,26 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.animee.rf_week02", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".UniteApp"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.RF_Week02"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".AddressActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".PayActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".CartActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".DetailTypeActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,135 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.animee.rf_week02.adapter.AddressAdapter;
|
||||
import com.animee.rf_week02.databinding.ActivityAddressBinding;
|
||||
import com.animee.rf_week02.db.AddressDao;
|
||||
import com.animee.rf_week02.db.DBManager;
|
||||
import com.animee.rf_week02.view.SaveAddressDialog;
|
||||
import com.animee.rf_week02.view.TitleView;
|
||||
import com.animee.rf_week02.view.ToastUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AddressActivity extends AppCompatActivity {
|
||||
|
||||
ActivityAddressBinding binding;
|
||||
List<AddressDao> mDatas;
|
||||
private AddressAdapter adapter;
|
||||
SharedPreferences preferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityAddressBinding.inflate(getLayoutInflater());
|
||||
LinearLayout root = binding.getRoot();
|
||||
setContentView(root);
|
||||
setTitleView();
|
||||
preferences = getSharedPreferences("address_pref", MODE_PRIVATE);
|
||||
|
||||
mDatas = new ArrayList<>();
|
||||
// 设置适配器
|
||||
adapter = new AddressAdapter(this, mDatas);
|
||||
binding.addressLv.setAdapter(adapter);
|
||||
// 加载数据库内容
|
||||
loadDBDatas();
|
||||
// 设置ListView的单项点击监听事件
|
||||
binding.addressLv.setOnItemClickListener((parent, view, position, id) -> {
|
||||
AddressDao dao = mDatas.get(position);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("ads", dao);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
});
|
||||
// 添加底部布局
|
||||
addFooterView();
|
||||
}
|
||||
|
||||
private void addFooterView() {
|
||||
View footerView = getLayoutInflater().inflate(R.layout.item_ads_footer, null);
|
||||
Button addBtn = footerView.findViewById(R.id.item_ads_btn_add);
|
||||
|
||||
binding.addressLv.addFooterView(footerView);
|
||||
addBtn.setOnClickListener(view -> {
|
||||
// 弹出添加收货人地址对话框
|
||||
showAdsDialog();
|
||||
});
|
||||
}
|
||||
|
||||
/** 显示保存地址对话框*/
|
||||
private void showAdsDialog() {
|
||||
SaveAddressDialog dialog = new SaveAddressDialog(this);
|
||||
dialog.show();
|
||||
dialog.setOnUpdateAddressListener(dao -> {
|
||||
boolean exist = DBManager.existAddressInDB(dao);
|
||||
if (exist) {
|
||||
ToastUtils.showToast(AddressActivity.this, "收货地址已存在");
|
||||
} else {
|
||||
long l = DBManager.insertAddressToDB(dao);
|
||||
if (l>0) {
|
||||
ToastUtils.showToast(AddressActivity.this, "保存成功");
|
||||
dao.setId((int) l);
|
||||
mDatas.add(dao);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setTitleView() {
|
||||
binding.addressTitle.setTitle(R.string.address);
|
||||
binding.addressTitle.setVisibleImg(View.VISIBLE, View.GONE);
|
||||
binding.addressTitle.setOnClickLeftImgListener(view -> finish());
|
||||
}
|
||||
|
||||
/** 加载数据库数据, 通知适配器更新*/
|
||||
private void loadDBDatas() {
|
||||
mDatas.clear();
|
||||
List<AddressDao> list = DBManager.queryAllAddressFromDB();
|
||||
mDatas.addAll(list);
|
||||
// 读取共享参数的置顶信息
|
||||
int topId = preferences.getInt("top", -1);
|
||||
int defaultId = preferences.getInt("default", -1);
|
||||
|
||||
if (topId != -1 || defaultId != -1) {
|
||||
for (int i = 0; i < mDatas.size(); i++) {
|
||||
AddressDao dao = mDatas.get(i);
|
||||
if (dao.getId() == topId) {
|
||||
mDatas.remove(dao);
|
||||
mDatas.add(0, dao);
|
||||
}
|
||||
if (dao.getId() == defaultId) {
|
||||
dao.setDefault(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前页面被销毁时, 会调用的方法
|
||||
*/
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// 获取需要置顶的数据
|
||||
int topId = mDatas.get(0).getId();
|
||||
// 获取默认的地址的id
|
||||
int defaultId = adapter.getDefaultId();
|
||||
// 写入到共享参数当中
|
||||
SharedPreferences.Editor edit = preferences.edit();
|
||||
edit.putInt("top", topId);
|
||||
edit.putInt("default", defaultId);
|
||||
edit.apply();
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.adapter.CartAdapter;
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.bean.InfoBean;
|
||||
import com.animee.rf_week02.view.TitleView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CartActivity extends AppCompatActivity {
|
||||
TitleView titleView;
|
||||
ListView cartLv;
|
||||
Button payBtn;
|
||||
TextView totalTv;
|
||||
List<InfoBean> mDatas;
|
||||
private CartAdapter adapter;
|
||||
|
||||
private double total; // 总金额
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_cart);
|
||||
initView();
|
||||
setTitleView();
|
||||
loadDatas();
|
||||
|
||||
// 设置适配器
|
||||
adapter = new CartAdapter(this, mDatas);
|
||||
cartLv.setAdapter(adapter);
|
||||
calculateTotalToTv();
|
||||
}
|
||||
|
||||
// 计算购物车总价格, 显示在TextView上
|
||||
public void calculateTotalToTv() {
|
||||
total = 0;
|
||||
for (InfoBean bean : mDatas) {
|
||||
total += bean.getBuycount() * bean.getPrice();
|
||||
}
|
||||
totalTv.setText("¥ " + ((double)Math.round(total*100))/100);
|
||||
}
|
||||
|
||||
private void loadDatas() {
|
||||
mDatas = new ArrayList<>();
|
||||
mDatas.addAll(ContentDatas.getBuyGoodsList());
|
||||
}
|
||||
|
||||
/* 在此处针对页面标题进行设置*/
|
||||
private void setTitleView() {
|
||||
titleView.setTitle(R.string.cart);
|
||||
titleView.setVisibleImg(View.VISIBLE, View.GONE);
|
||||
titleView.setOnClickLeftImgListener(view -> finish());
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
titleView = findViewById(R.id.cart_titleview);
|
||||
cartLv = findViewById(R.id.cart_lv);
|
||||
payBtn = findViewById(R.id.cart_btn_buy);
|
||||
totalTv = findViewById(R.id.cart_tv_total);
|
||||
payBtn.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(CartActivity.this, PayActivity.class);
|
||||
intent.putExtra("total", total);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.animee.rf_week02.adapter.DetailGVAdapter;
|
||||
import com.animee.rf_week02.adapter.DetailLVAdapter;
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.bean.InfoBean;
|
||||
import com.animee.rf_week02.view.TitleView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class DetailTypeActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private String type;
|
||||
TitleView titleView;
|
||||
Button sortBtn, searchBtn;
|
||||
Spinner spinner;
|
||||
ListView goodsLv;
|
||||
GridView goodsGv;
|
||||
List<InfoBean> mDatas; // 列表和网格视图的数据源
|
||||
private DetailLVAdapter lvAdapter;
|
||||
private DetailGVAdapter gvAdapter;
|
||||
private boolean isAscPrice = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_detail_type);
|
||||
// 接收数据
|
||||
type = getIntent().getStringExtra("type");
|
||||
// 初始化view
|
||||
initView();
|
||||
setTitleView();
|
||||
// 设置ListView的内容
|
||||
mDatas = new ArrayList<>();
|
||||
|
||||
// 设置适配器ListView, GridView
|
||||
lvAdapter = new DetailLVAdapter(this, mDatas);
|
||||
goodsLv.setAdapter(lvAdapter);
|
||||
|
||||
gvAdapter = new DetailGVAdapter(this, mDatas);
|
||||
goodsGv.setAdapter(gvAdapter);
|
||||
// 加载数据
|
||||
loadDatas();
|
||||
// 设置spinner的显示
|
||||
String[] arr = {"列表显示", "网格显示"};
|
||||
ArrayAdapter<String> spAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, arr);
|
||||
spinner.setAdapter(spAdapter);
|
||||
// 切换页面的样式
|
||||
changePageStyle();
|
||||
// 设定监听器 搜索, 排序
|
||||
setEvent();
|
||||
}
|
||||
|
||||
private void setEvent() {
|
||||
sortBtn.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/** 通过设置spinner的选中监听器切换页面显示*/
|
||||
private void changePageStyle() {
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long l) {
|
||||
switch (pos) {
|
||||
case 0:
|
||||
goodsLv.setVisibility(View.VISIBLE);
|
||||
goodsGv.setVisibility(View.GONE);
|
||||
break;
|
||||
case 1:
|
||||
goodsLv.setVisibility(View.GONE);
|
||||
goodsGv.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 第一次加载数据*/
|
||||
private void loadDatas() {
|
||||
for (InfoBean bean : ContentDatas.shopList) {
|
||||
if (bean.getKind().equals(type)) {
|
||||
mDatas.add(bean);
|
||||
}
|
||||
}
|
||||
// 数据源内容发生改变, 提示适配器更新
|
||||
lvAdapter.notifyDataSetChanged();
|
||||
gvAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
private void setTitleView() {
|
||||
titleView.setTitle(type);
|
||||
titleView.setTitleColor(Color.WHITE);
|
||||
titleView.setRightImgResource(R.mipmap.icon_gwc);
|
||||
titleView.setOnClickLeftImgListener(view -> finish());
|
||||
titleView.setOnClickRightImgListener(view -> {
|
||||
// 跳转到购物车页面
|
||||
startActivity(new Intent(DetailTypeActivity.this, CartActivity.class));
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
titleView = findViewById(R.id.detail_titleview);
|
||||
sortBtn = findViewById(R.id.detail_btn_sort);
|
||||
// searchBtn = findViewById(R.id.detail_btn_search);
|
||||
spinner = findViewById(R.id.detail_sp);
|
||||
goodsLv = findViewById(R.id.detail_lv);
|
||||
goodsGv = findViewById(R.id.detail_gv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
// case R.id.detail_btn_search:
|
||||
// break;
|
||||
case R.id.detail_btn_sort:
|
||||
// 对于数据源当中的价格进行排序 从低到高
|
||||
sortGoodsList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 对于商品列表进行排序的方法*/
|
||||
private void sortGoodsList() {
|
||||
if (isAscPrice) {
|
||||
mDatas.sort(Comparator.comparingDouble(InfoBean::getPrice));
|
||||
} else {
|
||||
mDatas.sort((o1, o2) -> Double.compare(o2.getPrice(), o1.getPrice()));
|
||||
}
|
||||
isAscPrice = !isAscPrice;
|
||||
// 提示适配器更新
|
||||
lvAdapter.notifyDataSetChanged();
|
||||
gvAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.view.TitleView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
ListView typleLv;
|
||||
TitleView titleView;
|
||||
List<String> mDatas;
|
||||
private ArrayAdapter<String> adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
initView();
|
||||
// 初始化数据源
|
||||
mDatas = new ArrayList<>();
|
||||
// 设置适配器
|
||||
adapter = new ArrayAdapter<>(this, R.layout.item_mainlv,
|
||||
R.id.item_main_tv, mDatas);
|
||||
typleLv.setAdapter(adapter);
|
||||
// 获取数据
|
||||
loadDatas();
|
||||
|
||||
setEvent();
|
||||
}
|
||||
|
||||
private void setEvent() {
|
||||
typleLv.setOnItemClickListener((adapterView, view, position, l) -> {
|
||||
Intent intent = new Intent(MainActivity.this, DetailTypeActivity.class);
|
||||
intent.putExtra("type", mDatas.get(position));
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取并解析网络数据, 将数据放入mDatas数据源当中*/
|
||||
private void loadDatas() {
|
||||
mDatas.addAll(ContentDatas.dailyKindList);
|
||||
// 数据源信息发生改变, 提示适配器再刷新一下
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
typleLv = findViewById(R.id.main_lv);
|
||||
titleView = findViewById(R.id.main_titleview);
|
||||
// 设置标题栏内容
|
||||
titleView.setBgResource(R.color.red);
|
||||
titleView.setTitle(R.string.main_title);
|
||||
titleView.setTitleColor(Color.WHITE);
|
||||
titleView.setVisibleImg(View.VISIBLE, View.INVISIBLE);
|
||||
titleView.setOnClickLeftImgListener(view -> finish());
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.animee.rf_week02.databinding.ActivityPayBinding;
|
||||
import com.animee.rf_week02.db.AddressDao;
|
||||
import com.animee.rf_week02.db.DBManager;
|
||||
import com.animee.rf_week02.view.ToastUtils;
|
||||
|
||||
public class PayActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
ActivityPayBinding binding;
|
||||
SharedPreferences preferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPayBinding.inflate(getLayoutInflater());
|
||||
LinearLayout root = binding.getRoot();
|
||||
setContentView(root);
|
||||
|
||||
setTitleView();
|
||||
|
||||
double total = getIntent().getDoubleExtra("total", 0);
|
||||
binding.payEtTotal.setText(((double)Math.round(total*100))/100 + "");
|
||||
|
||||
// 获取默认的收货地址的id
|
||||
preferences = getSharedPreferences("address_pref", MODE_PRIVATE);
|
||||
int defaultId = preferences.getInt("default", -1);
|
||||
AddressDao dao = DBManager.queryAddressById(defaultId);
|
||||
if (dao != null) {
|
||||
binding.payEtShr.setText(dao.getName());
|
||||
binding.payEtTel.setText(dao.getTel());
|
||||
binding.payEtAddress.setText(dao.getCity() + "|" + dao.getStreet());
|
||||
}
|
||||
// 设置取消订单
|
||||
binding.payBtnCancel.setOnClickListener(view -> finish());
|
||||
}
|
||||
|
||||
private void setTitleView() {
|
||||
binding.payTitleview.setTitle("订单");
|
||||
binding.payTitleview.setVisibleImg(View.VISIBLE, View.GONE);
|
||||
binding.payTitleview.setOnClickLeftImgListener(view -> finish());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view.getId() == R.id.pay_iv_write) {
|
||||
Intent intent = new Intent(PayActivity.this, AddressActivity.class);
|
||||
startActivityIfNeeded(intent, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收返回数据显示收货人信息
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||
AddressDao dao = (AddressDao) data.getSerializableExtra("ads");
|
||||
binding.payEtShr.setText(dao.getName());
|
||||
binding.payEtTel.setText(dao.getTel());
|
||||
binding.payEtAddress.setText(dao.getCity() + " | " + dao.getStreet());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.animee.rf_week02.db.DBManager;
|
||||
|
||||
/**
|
||||
* Application
|
||||
* 一个项目可能由多个activity对象, 但是只有一个application对象
|
||||
* 这是个全局对象,一旦项目被启动,这个对象会被创建, 项目光比, 被内存回收, 这个对象才会被回收.
|
||||
* 如何使用自己创建的Application对象
|
||||
* 1. 创建一个类, 继承Application
|
||||
* 2. 重构onCreate
|
||||
* 3. zaiAndroidManifest文件当中, 对于application标签, 进行name属性设置
|
||||
*/
|
||||
public class UniteApp extends Application {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 进行项目整体的初始化工作
|
||||
DBManager.initDB(getApplicationContext());
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package com.animee.rf_week02.adapter;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.R;
|
||||
import com.animee.rf_week02.databinding.ItemAddressBinding;
|
||||
import com.animee.rf_week02.db.AddressDao;
|
||||
import com.animee.rf_week02.db.DBManager;
|
||||
import com.animee.rf_week02.view.AlertDialogUtils;
|
||||
import com.animee.rf_week02.view.SaveAddressDialog;
|
||||
import com.animee.rf_week02.view.ToastUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AddressAdapter extends BaseAdapter {
|
||||
|
||||
Context context;
|
||||
List<AddressDao> mDatas;
|
||||
int defaultId;
|
||||
|
||||
public int getDefaultId() {
|
||||
return defaultId;
|
||||
}
|
||||
|
||||
public AddressAdapter(Context context, List<AddressDao> mDatas) {
|
||||
this.context = context;
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return mDatas.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
VHolder holder = null;
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_address, viewGroup, false);
|
||||
holder = new VHolder(view);
|
||||
view.setTag(holder);
|
||||
} else {
|
||||
holder = (VHolder) view.getTag();
|
||||
}
|
||||
AddressDao dao = mDatas.get(i);
|
||||
holder.binding.itemAdsTvName.setText(dao.getName());
|
||||
holder.binding.itemAdsTvTel.setText(dao.getTel());
|
||||
holder.binding.itemAdsTvCity.setText(dao.getCity());
|
||||
holder.binding.itemAdsTvStreet.setText(dao.getStreet());
|
||||
// 点击事件
|
||||
// 编写修改地址的点击事件
|
||||
updateAddressClick(holder.binding.itemAdsTvModify, dao);
|
||||
// 删除地址的点击事件
|
||||
deleteAddressClick(holder.binding.itemAdsTvDelete, dao);
|
||||
// 复制地址的点击事件
|
||||
copyAddressClick(holder.binding.itemAdsTvCopy, dao);
|
||||
// 置顶的点击事件
|
||||
setTopClick(holder.binding.itemAdsTvTop, dao);
|
||||
// 设置默认的点击事件
|
||||
holder.binding.itemAdsRbDefault.setChecked(dao.isDefault());
|
||||
if (dao.isDefault()) {
|
||||
defaultId = dao.getId();
|
||||
} else {
|
||||
setDefaultClick(holder.binding.itemAdsRbDefault, dao);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认选中的点击事件
|
||||
* @param rb
|
||||
* @param dao
|
||||
*/
|
||||
private void setDefaultClick(RadioButton rb, AddressDao dao) {
|
||||
rb.setOnClickListener(view -> {
|
||||
for (AddressDao mData : mDatas) {
|
||||
mData.setDefault(false);
|
||||
}
|
||||
dao.setDefault(true);
|
||||
defaultId = dao.getId();
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
private void setTopClick(TextView view, AddressDao dao) {
|
||||
view.setOnClickListener(view1 -> {
|
||||
// 移除数据源当中这个数据, 放在第一个位置
|
||||
mDatas.remove(dao);
|
||||
mDatas.add(0, dao);
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制地址到复制版当中
|
||||
*/
|
||||
private void copyAddressClick(TextView view, AddressDao dao) {
|
||||
view.setOnClickListener(view1 -> {
|
||||
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
|
||||
ClipData clipData = ClipData.newPlainText("Label", dao.toString());
|
||||
cm.setPrimaryClip(clipData);
|
||||
ToastUtils.showToast(context, "复制成功");
|
||||
});
|
||||
}
|
||||
|
||||
private void deleteAddressClick(TextView view, AddressDao dao) {
|
||||
view.setOnClickListener(view1 -> AlertDialogUtils.showNormalDialog(
|
||||
context, "提示信息", "您确定要删除这条收货地址吗?",
|
||||
"取消", "确定", null, () -> {
|
||||
// 删除数据库当中的这条信息
|
||||
DBManager.deleteAddressById(dao.getId());
|
||||
// 删除数据源记录, 通知适配器更新
|
||||
mDatas.remove(dao);
|
||||
notifyDataSetChanged();
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地址功能
|
||||
*/
|
||||
private void updateAddressClick(TextView view, AddressDao dao) {
|
||||
view.setOnClickListener(view1 -> {
|
||||
SaveAddressDialog dialog = new SaveAddressDialog(context);
|
||||
dialog.show();
|
||||
dialog.setTitle("修改收获地址");
|
||||
dialog.setAddressDao(dao);
|
||||
dialog.setOnUpdateAddressListener(dao1 -> {
|
||||
// 修改数据库地址
|
||||
DBManager.modifyAddressById(dao1);
|
||||
// 更新数据, 提示适配器更新
|
||||
dao.clone(dao1);
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class VHolder {
|
||||
ItemAddressBinding binding;
|
||||
|
||||
public VHolder(View view) {
|
||||
binding = ItemAddressBinding.bind(view);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.animee.rf_week02.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.CartActivity;
|
||||
import com.animee.rf_week02.R;
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.bean.InfoBean;
|
||||
import com.animee.rf_week02.view.AmountView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CartAdapter extends BaseAdapter {
|
||||
|
||||
Context context;
|
||||
List<InfoBean> mDatas;
|
||||
|
||||
public CartAdapter(Context context, List<InfoBean> mDatas) {
|
||||
this.context = context;
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return mDatas.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
VHolder holder = null;
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_detaillv, viewGroup, false);
|
||||
holder = new VHolder(view);
|
||||
view.setTag(holder);
|
||||
} else {
|
||||
holder = (VHolder) view.getTag();
|
||||
}
|
||||
InfoBean bean = mDatas.get(i);
|
||||
|
||||
|
||||
holder.titleTv.setText(bean.getTitle());
|
||||
holder.priceTv.setText("¥ " + bean.getPrice());
|
||||
holder.typeTv.setText("日常用品 - " + bean.getKind());
|
||||
// 使用picasso加载网络图片加载到本地上
|
||||
Picasso.with(context).load(bean.getPic()).into(holder.iv);
|
||||
// 设置数量选择器
|
||||
holder.amountView.setStorage(bean.getCount());
|
||||
// =============================================================
|
||||
holder.amountView.setShowCount(bean.getBuycount());
|
||||
// 设置按钮的监听事件
|
||||
|
||||
// 设置数量调节器的监听事件
|
||||
holder.amountView.setOnAmountListener(num -> {
|
||||
bean.setBuycount(num);
|
||||
// 重新计算总价格
|
||||
((CartActivity) context).calculateTotalToTv();
|
||||
});
|
||||
// 设定删除按钮点击事件
|
||||
holder.delIv.setOnClickListener(view1 -> {
|
||||
mDatas.remove(bean);
|
||||
ContentDatas.remove(bean);
|
||||
notifyDataSetChanged();
|
||||
((CartActivity) context).calculateTotalToTv();
|
||||
});
|
||||
return view;
|
||||
}
|
||||
class VHolder {
|
||||
ImageView iv, delIv;
|
||||
TextView titleTv, priceTv, typeTv;
|
||||
AmountView amountView;
|
||||
Button buyBtn;
|
||||
|
||||
public VHolder(View v) {
|
||||
iv = v.findViewById(R.id.item_dl_iv);
|
||||
delIv = v.findViewById(R.id.item_dl_iv_del);
|
||||
titleTv = v.findViewById(R.id.item_dl_tv_title);
|
||||
priceTv = v.findViewById(R.id.item_dl_tv_price);
|
||||
typeTv = v.findViewById(R.id.item_dl_tv_type);
|
||||
amountView = v.findViewById(R.id.item_dl_av);
|
||||
buyBtn = v.findViewById(R.id.item_dl_btn_buy);
|
||||
buyBtn.setVisibility(View.GONE);
|
||||
delIv.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.animee.rf_week02.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.R;
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.bean.InfoBean;
|
||||
import com.animee.rf_week02.view.AmountView;
|
||||
import com.animee.rf_week02.view.ToastUtils;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DetailGVAdapter extends BaseAdapter {
|
||||
Context context;
|
||||
List<InfoBean> mDatas;
|
||||
|
||||
public DetailGVAdapter(Context context, List<InfoBean> mDatas) {
|
||||
this.context = context;
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return mDatas.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
VHolder holder = null;
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_detailgv, viewGroup, false);
|
||||
holder = new VHolder(view);
|
||||
view.setTag(holder);
|
||||
} else {
|
||||
holder = (VHolder) view.getTag();
|
||||
}
|
||||
InfoBean bean = mDatas.get(i);
|
||||
|
||||
holder.titleTv.setText(bean.getTitle());
|
||||
holder.priceTv.setText("¥ " + bean.getPrice());
|
||||
// 使用picasso加载网络图片到本地上
|
||||
Picasso.with(context).load(bean.getPic()).into(holder.iv);
|
||||
// 设置按钮的监听事件
|
||||
holder.buyBtn.setOnClickListener(view1 -> {
|
||||
InfoBean newBean = InfoBean.copy(bean);
|
||||
newBean.setBuycount(1);
|
||||
ContentDatas.addGoodsToBuyList(newBean);
|
||||
ToastUtils.showToast(context, "添加成功");
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
class VHolder {
|
||||
TextView titleTv, priceTv;
|
||||
ImageView iv;
|
||||
Button buyBtn;
|
||||
|
||||
public VHolder(View v) {
|
||||
titleTv = v.findViewById(R.id.item_dg_tv_title);
|
||||
priceTv = v.findViewById(R.id.item_dg_tv_price);
|
||||
iv = v.findViewById(R.id.item_dg_iv);
|
||||
buyBtn = v.findViewById(R.id.item_dg_btn_buy);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.animee.rf_week02.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.DetailTypeActivity;
|
||||
import com.animee.rf_week02.R;
|
||||
import com.animee.rf_week02.bean.ContentDatas;
|
||||
import com.animee.rf_week02.bean.InfoBean;
|
||||
import com.animee.rf_week02.view.AmountView;
|
||||
import com.animee.rf_week02.view.ToastUtils;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DetailLVAdapter extends BaseAdapter {
|
||||
Context context;
|
||||
List<InfoBean> mDatas;
|
||||
|
||||
public DetailLVAdapter(Context context, List<InfoBean> mDatas) {
|
||||
this.context = context;
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return mDatas.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
VHolder holder = null;
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_detaillv, viewGroup, false);
|
||||
holder = new VHolder(view);
|
||||
view.setTag(holder);
|
||||
} else {
|
||||
holder = (VHolder) view.getTag();
|
||||
}
|
||||
InfoBean bean = mDatas.get(i);
|
||||
|
||||
holder.titleTv.setText(bean.getTitle());
|
||||
holder.priceTv.setText("¥ " + bean.getPrice());
|
||||
holder.typeTv.setText("日常用品 - " + bean.getKind());
|
||||
// 使用picasso加载网络图片加载到本地上
|
||||
Picasso.with(context).load(bean.getPic()).into(holder.iv);
|
||||
// 设置数量选择器
|
||||
holder.amountView.setStorage(bean.getCount());
|
||||
holder.amountView.setShowCount(1);
|
||||
// 设置按钮的监听事件
|
||||
VHolder finalHolder = holder;
|
||||
holder.buyBtn.setOnClickListener(view1 -> {
|
||||
int amountNum = finalHolder.amountView.getAmountNum();
|
||||
InfoBean newBean = InfoBean.copy(bean);
|
||||
newBean.setBuycount(amountNum);
|
||||
ContentDatas.addGoodsToBuyList(newBean);
|
||||
ToastUtils.showToast(context, "添加成功");
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
class VHolder {
|
||||
ImageView iv, delIv;
|
||||
TextView titleTv, priceTv, typeTv;
|
||||
AmountView amountView;
|
||||
Button buyBtn;
|
||||
|
||||
public VHolder(View v) {
|
||||
iv = v.findViewById(R.id.item_dl_iv);
|
||||
delIv = v.findViewById(R.id.item_dl_iv_del);
|
||||
titleTv = v.findViewById(R.id.item_dl_tv_title);
|
||||
priceTv = v.findViewById(R.id.item_dl_tv_price);
|
||||
typeTv = v.findViewById(R.id.item_dl_tv_type);
|
||||
amountView = v.findViewById(R.id.item_dl_av);
|
||||
buyBtn = v.findViewById(R.id.item_dl_btn_buy);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.animee.rf_week02.bean;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ContentDatas {
|
||||
public static List<String> dailyKindList = Arrays.asList("调料干货", "零食", "饮料", "烟酒", "厨房用品", "日用品", "清洁用品", "洗化用品");
|
||||
// 商品集合
|
||||
public static List<InfoBean> shopList
|
||||
= Arrays.asList(new InfoBean("http://t15.baidu.com/it/u=1118848058,701532755&fm=224&app=112&f=JPEG?w=500&h=500", "低钠盐", "调料干货", 100, 14.00),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg5.21food.cn%2Fimg%2Falbum%2F2017%2F9%2F19%2Ffood13536331244047X7.jpg&refer=http%3A%2F%2Fimg5.21food.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639486346&t=b7aca0e8238f6db68babcda8508f4be7", "优质白砂糖", "调料干货", 350, 16.50),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage3.suning.cn%2Fuimg%2Fb2c%2Fnewcatentries%2F0070118418-000000000147925824_5_800x800.jpg&refer=http%3A%2F%2Fimage3.suning.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg", "老姜红糖", "调料干货", 350, 24.50),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fn.sinaimg.cn%2Fsinakd202121s%2F419%2Fw700h519%2F20210201%2F709d-kiksqxh4937217.jpg&refer=http%3A%2F%2Fn.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670152659&t=8cce7563a9923ca345c64337eb53f84e", "太太乐鸡精", "调料干货", 350, 18.50),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqny.smzdm.com%2F202105%2F16%2F60a0b3bb8b63c5683.jpg_d250.jpg&refer=http%3A%2F%2Fqny.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg", "金龙鱼实用调和油", "调料干货", 350, 41.00),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage.suning.cn%2Fcontent%2Fcatentries%2F00000000010690%2F000000000106903642%2Ffullimage%2F000000000106903642_1f.jpg&refer=http%3A%2F%2Fimage.suning.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg", "福临门实用调和油", "调料干货", 250, 46.50),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.51yuansu.com%2Fpic3%2Fcover%2F00%2F79%2F64%2F58c73bcac0cd4_610.jpg&refer=http%3A%2F%2Fbpic.51yuansu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670152759&t=cbdaba0ecad2fe0e895066f8d9f3cb17", "旺旺维粒多", "零食", 200, 3.5),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fduolimi.cn%2FUpLoad%2F2014-8-12%2F20140812142292129212.jpg&refer=http%3A%2F%2Fduolimi.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670152790&t=8982b4fbbc1ac0935daa927334854cf8", "鱿鱼卷", "零食", 200, 14.3),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqny.smzdm.com%2F202109%2F08%2F61382ef72bdc72248.jpg&refer=http%3A%2F%2Fqny.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670152819&t=d2416411f1f0de8130f5b10dd4b3e556", "乐事分享装", "零食", 200, 22.9),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fimgextra%2Fi2%2F1588913126%2FO1CN01e2GB3u1YxkpEJPS8s_%21%210-item_pic.jpg_400x400.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670152846&t=b8c50e183bdd5d7f8539d366dd635cd8", "旺旺大礼包", "零食", 200, 40.50),
|
||||
new InfoBean("https://img2.baidu.com/it/u=926088687,2201683876&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=332", "旺仔小馒头", "零食", 200, 8.5),
|
||||
new InfoBean("https://img1.baidu.com/it/u=710704254,2877306920&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500", "景田饮用纯净水", "饮料", 120, 5.00),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgservice.suning.cn%2Fuimg1%2Fb2c%2Fimage%2FKxljet_TrpJGpkdwxe3jhw.jpg_800w_800h_4e&refer=http%3A%2F%2Fimgservice.suning.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153220&t=6f149b65d4af1845759c08687c146c30", "可口可乐", "饮料", 120, 3.00),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp1.meituan.net%2Fwmproduct%2F6f611ad7b70a501af6a93cb3dc72da1f215283.jpg%2540249w_249h_1e_1c_1l%7Cwatermark%253D1%2526%2526r%253D1%2526p%253D9%2526x%253D2%2526y%253D2%2526relative%253D1%2526o%253D20&refer=http%3A%2F%2Fp1.meituan.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153253&t=0e2e40824f97eb5519fce2c1920af3a3", "雪碧", "饮料", 120, 3.00),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.yzcdn.cn%2Fupload_files%2F2015%2F04%2F18%2FFq1guyExiPbuPIUKFepobzEGs9o4.jpg%3FimageView2%2F2%2Fw%2F580%2Fh%2F580%2Fq%2F75%2Fformat%2Fjpg&refer=http%3A%2F%2Fimg.yzcdn.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639378582&t=7b34c9c92980e316d3877f2cdbd8781a", "中华(盒)", "烟酒", 500, 50),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.cnxiangyan.com%2Fuploads%2Fallimg%2F200720%2F2706-200H0111242509.jpg&refer=http%3A%2F%2Fwww.cnxiangyan.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639466559&t=70d7d55a334067ed99a8e374b890a1a6", "黄鹤楼(盒)", "烟酒", 200, 20),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.baike.soso.com%2Fugc%2Fbaikepic2%2F31517%2F20170202092126-1334117041.jpg%2F0&refer=http%3A%2F%2Fpic.baike.soso.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639466743&t=02cb2f0e804897fcb72a472942582990", "万宝路(盒)", "烟酒", 300, 22),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.yzcdn.cn%2Fupload_files%2F2017%2F06%2F30%2FFpwlPLqdyp7MWU0e0NaeZMQ_7E4T.jpg%3FimageView2%2F2%2Fw%2F580%2Fh%2F580%2Fq%2F75%2Fformat%2Fjpg&refer=http%3A%2F%2Fimg.yzcdn.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639466857&t=90649667928871a0514c991401665cf1", "玉溪(盒)", "烟酒", 180, 40),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.lingshimiyu.com%2Fuploadfile%2F2018100213565617523.jpg&refer=http%3A%2F%2Fwww.lingshimiyu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153035&t=3273677af8506c05dc8985a0d8168d6d", "旺旺仙贝", "零食", 3000, 6.8),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.yzcdn.cn%2Fupload_files%2F2018%2F07%2F13%2FFkB7uynmnBbpZg--ghsgDEDEbJ4V.jpg%3FimageView2%2F2%2Fw%2F580%2Fh%2F580%2Fq%2F75%2Fformat%2Fjpg&refer=http%3A%2F%2Fimg.yzcdn.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639382650&t=235174b3d2f9687201935b064ec4e179", "好丽友派", "零食", 200, 12.5),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbkimg.cdn.bcebos.com%2Fpic%2Fac4bd11373f082025aaf523eabb2ecedab64034fadd2&refer=http%3A%2F%2Fbkimg.cdn.bcebos.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153102&t=714a2a9cade82a58c7ae9ab38fe4886b", "奥利奥", "零食", 300, 10.5),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqny.smzdm.com%2F202011%2F10%2F5faa0467505085888.jpg_d250.jpg&refer=http%3A%2F%2Fqny.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153135&t=abcdb78d911c690796967c32b8a76424", "趣多多", "零食", 300, 8.8),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.xplian.net%2FtuxpJDEwLmFsaWNkbi5jb20vaTIvMjMwMjMwMjE0Mi9UQjIwT2UxYjlDV0J1Tmp5MEZoWFhiNkVWWGFfISEyMzAyMzAyMTQyJDk.jpg&refer=http%3A%2F%2Fwww.xplian.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639457310&t=98957bf46afc7f2b9c75829bc3423587", "可比克薯片", "零食", 300, 8.5),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgaitaobao3.alicdn.com%2Ftfscom%2Fi1%2FTB16iWoSpXXXXXMXFXXXXXXXXXX_%21%210-item_pic.jpg_300x300.jpg&refer=http%3A%2F%2Fgaitaobao3.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639457890&t=cdfdd11e021783ae4f4435c25b97ae6e", "盼盼膨化饼干", "零食", 300, 13),
|
||||
new InfoBean("http://pic1.zhimg.com/v2-4985e07fa1218110910af1faf3dd1c69_hd.jpg", "蟹黄瓜子", "零食", 230, 9.5),
|
||||
new InfoBean("http://img04.taobaocdn.com/bao/uploaded/i4/T1rWANFrJcXXXXXXXX_!!0-item_pic.jpg", "士力架", "零食", 300, 12),
|
||||
new InfoBean("http://pic4.zhimg.com/v2-dabe30c4df18502b1bf4aa6fa2b1bc31_hd.jpg", "酸奶草莓", "零食", 210, 8.5),
|
||||
new InfoBean("https://gd3.alicdn.com/imgextra/i4/409015871/O1CN01RGzuCI1tExyD6nIGP_!!409015871.jpg", "康师傅方便面/箱", "零食", 400, 60),
|
||||
new InfoBean("https://gd2.alicdn.com/imgextra/i2/760015/O1CN01td3xdm1Byubg6aqY0_!!760015.jpg", "老北京方便面36袋/箱", "零食", 300, 35),
|
||||
new InfoBean("https://gd4.alicdn.com/imgextra/i4/2209812732121/O1CN014Dv4qO1RXSguXewby_!!2209812732121.jpg", "卫龙魔芋爽丝500g", "零食", 200, 1),
|
||||
new InfoBean("https://gd2.alicdn.com/imgextra/i4/2209812732121/O1CN01d4Qosc1RXSk3jCfFr_!!2209812732121.jpg", "卫龙辣条小面筋18g", "零食", 200, 0.5),
|
||||
new InfoBean("https://g-search1.alicdn.com/img/bao/uploaded/i4/i4/1741393998/O1CN01rdupuA1fP8BlsOAQc_!!0-item_pic.jpg_460x460Q90.jpg", "电饭锅支架", "厨房用品", 60, 59.5),
|
||||
new InfoBean("https://g-search1.alicdn.com/img/bao/uploaded/i4/i2/3284480025/O1CN01b0oXkh1C3UXOY59vU_!!0-item_pic.jpg_460x460Q90.jpg", "九阳刀具套装", "厨房用品", 100, 89),
|
||||
new InfoBean("https://g-search2.alicdn.com/img/bao/uploaded/i4/i2/2889308890/O1CN01wBkyqQ2FXfk9Ic9N9_!!0-item_pic.jpg_460x460Q90.jpg", "苏泊尔刀具套装", "厨房用品", 100, 229),
|
||||
new InfoBean("https://g-search3.alicdn.com/img/bao/uploaded/i4/i3/3284480025/O1CN01vZSpsx1C3UcWqtknh_!!0-item_pic.jpg_460x460Q90.jpg_.webp", "九阳油壶", "厨房用品", 200, 29),
|
||||
new InfoBean("https://img.alicdn.com/imgextra/i4/2549841410/O1CN01Fe8qlY1MHp5jCnEf7_!!2549841410.jpg_430x430q90.jpg", "双立人菜刀", "厨房用品", 200, 69),
|
||||
new InfoBean("https://imgservice.suning.cn/uimg1/b2c/image/HrO-XQi8_3SXFkxghHWdtQ.jpg_800w_800h_4e", "飘柔洗发水", "洗化用品", 200, 18),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fi4%2F2211100827839%2FO1CN01ftONwa27mJSPX5i8b_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153334&t=5b7bba59ea84a9066037bc2685e06f71", "潘婷洗发水", "洗化用品", 200, 33),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi2%2FTB10EsBGXXXXXb9XpXXXXXXXXXX_%21%210-item_pic.jpg_400x400q90.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153369&t=fe68fe4bd5092ed34eba0198f26cdc67", "海飞丝洗发水", "洗化用品", 200, 19),
|
||||
new InfoBean("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqna.smzdm.com%2F202108%2F31%2F612e31a879ee68678.jpg_e600.jpg&refer=http%3A%2F%2Fqna.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670153418&t=05beed362c43a4ff16828a4d1153a296", "清扬洗发水", "洗化用品", 200, 31));
|
||||
|
||||
/**
|
||||
* 购买商品列表
|
||||
*/
|
||||
private static List<InfoBean> buyGoodsList = new ArrayList<>();
|
||||
|
||||
public static List<InfoBean> getBuyGoodsList() {
|
||||
return buyGoodsList;
|
||||
}
|
||||
|
||||
public static void addGoodsToBuyList(InfoBean bean) {
|
||||
boolean flag = true;
|
||||
for (InfoBean buyBean : buyGoodsList) {
|
||||
if (buyBean.getTitle().equals(bean.getTitle())) {
|
||||
int buycount = bean.getBuycount();
|
||||
buyBean.setBuycount(buyBean.getBuycount() + buycount);
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
buyGoodsList.add(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printBuyList() {
|
||||
Log.i("lsh", "printBuyList: size====" + buyGoodsList.size());
|
||||
String msg = "";
|
||||
for (InfoBean bean : buyGoodsList) {
|
||||
msg = bean.getTitle() + ":" + bean.getBuycount();
|
||||
Log.i("lsh", "printBuyList: goods=~~~" + msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove(InfoBean bean) {
|
||||
buyGoodsList.remove(bean);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.animee.rf_week02.bean;
|
||||
/* 表示每一个用品对象*/
|
||||
public class InfoBean {
|
||||
private String pic; //图片地址
|
||||
private String title; //标题
|
||||
private String kind; //种类
|
||||
private int count; //库存
|
||||
private double price; //价格
|
||||
private int buycount = 0; //购买数量
|
||||
|
||||
public InfoBean() {}
|
||||
public InfoBean(String pic, String title, String kind, int count, double price, int buycount) {
|
||||
this.pic = pic;
|
||||
this.title = title;
|
||||
this.kind = kind;
|
||||
this.count = count;
|
||||
this.price = price;
|
||||
this.buycount = buycount;
|
||||
}
|
||||
public int getBuycount() {
|
||||
return buycount;
|
||||
}
|
||||
public void setBuycount(int buycount) {
|
||||
this.buycount = buycount;
|
||||
}
|
||||
public String getPic() {
|
||||
return pic;
|
||||
}
|
||||
public void setPic(String pic) {
|
||||
this.pic = pic;
|
||||
}
|
||||
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 int getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
public InfoBean(String pic, String title, String kind, int count, double price) {
|
||||
this.pic = pic;
|
||||
this.title = title;
|
||||
this.kind = kind;
|
||||
this.count = count;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public static InfoBean copy(InfoBean oldBean){
|
||||
return new InfoBean(oldBean.getPic(),oldBean.getTitle(),oldBean.getKind(),
|
||||
oldBean.getCount(),oldBean.getPrice());
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.animee.rf_week02.db;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*/
|
||||
public class AddressDao implements Serializable {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String tel;
|
||||
private String city;
|
||||
private String street;
|
||||
private Boolean isDefault;
|
||||
private Boolean isTop;
|
||||
|
||||
public AddressDao() {
|
||||
}
|
||||
|
||||
public AddressDao(int id, String name, String tel, String city, String street) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.tel = tel;
|
||||
this.city = city;
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public AddressDao(int id, String name, String tel, String city, String street, Boolean isDefault, Boolean isTop) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.tel = tel;
|
||||
this.city = city;
|
||||
this.street = street;
|
||||
this.isDefault = isDefault;
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
AddressDao dao = (AddressDao) o;
|
||||
return Objects.equals(name, dao.name) && Objects.equals(tel, dao.tel) && Objects.equals(city, dao.city) && Objects.equals(street, dao.street);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, tel, city, street);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTel() {
|
||||
return tel;
|
||||
}
|
||||
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public Boolean getDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
if (isDefault == null) {
|
||||
return false;
|
||||
}
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public void setDefault(Boolean aDefault) {
|
||||
isDefault = aDefault;
|
||||
}
|
||||
|
||||
public Boolean getTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setTop(Boolean top) {
|
||||
isTop = top;
|
||||
}
|
||||
|
||||
public void clone(AddressDao dao) {
|
||||
this.setName(dao.getName());
|
||||
this.setCity(dao.getCity());
|
||||
this.setTel(dao.getTel());
|
||||
this.setStreet(dao.getStreet());
|
||||
this.setId(dao.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "姓名:" + name +
|
||||
", 电话:" + tel +
|
||||
", 地址:" + city + street;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package com.animee.rf_week02.db;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据库管理工具
|
||||
*/
|
||||
public class DBManager {
|
||||
|
||||
private static SQLiteDatabase db;
|
||||
|
||||
public static void initDB(Context context) {
|
||||
DBOpenHelper helper = new DBOpenHelper(context);
|
||||
db = helper.getWritableDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户地址信息表全部内容
|
||||
*/
|
||||
@SuppressLint({"Recycle", "Range"})
|
||||
public static List<AddressDao> queryAllAddressFromDB() {
|
||||
List<AddressDao> list = new ArrayList<>();
|
||||
String sql = "select * from addresstb";
|
||||
Cursor cursor = db.rawQuery(sql, null);
|
||||
while (cursor.moveToNext()) {
|
||||
int id = cursor.getInt(cursor.getColumnIndex("id"));
|
||||
String name = cursor.getString(cursor.getColumnIndex("name"));
|
||||
String tel = cursor.getString(cursor.getColumnIndex("tel"));
|
||||
String city = cursor.getString(cursor.getColumnIndex("city"));
|
||||
String street = cursor.getString(cursor.getColumnIndex("street"));
|
||||
AddressDao dao = new AddressDao(id, name, tel, city, street);
|
||||
list.add(dao);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询address是否存在
|
||||
*
|
||||
* @param dao
|
||||
* @return
|
||||
*/
|
||||
public static boolean existAddressInDB(AddressDao dao) {
|
||||
String sql = "select * from addresstb" +
|
||||
" where name = '" + dao.getName() + "'" +
|
||||
" and tel = '" + dao.getTel() + "'" +
|
||||
" and city = '" + dao.getCity() + "'" +
|
||||
" and street = '" + dao.getStreet() + "'";
|
||||
Cursor cursor = db.rawQuery(sql, null);
|
||||
int count = cursor.getCount();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入地址到数据库当中
|
||||
*/
|
||||
public static long insertAddressToDB(AddressDao dao) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("name", dao.getName());
|
||||
values.put("tel", dao.getTel());
|
||||
values.put("city", dao.getCity());
|
||||
values.put("street", dao.getStreet());
|
||||
|
||||
return db.insert("addresstb", null, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id修改该数据库内容
|
||||
* @param dao
|
||||
*/
|
||||
public static int modifyAddressById(AddressDao dao) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("name", dao.getName());
|
||||
values.put("tel", dao.getTel());
|
||||
values.put("city", dao.getCity());
|
||||
values.put("street", dao.getStreet());
|
||||
|
||||
return db.update("addresstb", values, "id = " + dao.getId(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除数据库的地址
|
||||
* @param id
|
||||
*/
|
||||
public static int deleteAddressById(int id) {
|
||||
int i = db.delete("addresstb", "id = " + id, null);
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
public static AddressDao queryAddressById(int defaultId) {
|
||||
Cursor cursor= db.query("addresstb", null, "id = " + defaultId, null, null, null, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
int id = cursor.getInt(cursor.getColumnIndex("id"));
|
||||
String name = cursor.getString(cursor.getColumnIndex("name"));
|
||||
String tel = cursor.getString(cursor.getColumnIndex("tel"));
|
||||
String city = cursor.getString(cursor.getColumnIndex("city"));
|
||||
String street = cursor.getString(cursor.getColumnIndex("street"));
|
||||
return new AddressDao(id, name, tel, city, street);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.animee.rf_week02.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DatabaseErrorHandler;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class DBOpenHelper extends SQLiteOpenHelper {
|
||||
public DBOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
|
||||
super(context, name, factory, version);
|
||||
}
|
||||
|
||||
public DBOpenHelper(@Nullable Context context) {
|
||||
super(context, "heartgo.db", null, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
String sql =
|
||||
"create table addresstb(" +
|
||||
"id integer primary key autoincrement," +
|
||||
"name varchar(30) not null," +
|
||||
"tel varchar(20) not null," +
|
||||
"city varchar(50)," +
|
||||
"street varchar(255)" +
|
||||
")";
|
||||
db.execSQL(sql);
|
||||
|
||||
// 测试添加一条记录
|
||||
sql = "insert into addresstb values (1, '张三', '12345678912', '四川', '天府新区1号楼')";
|
||||
db.execSQL(sql);
|
||||
|
||||
sql = "insert into addresstb values (2, '李四', '13549846515', '重庆', '阳关小区1号楼')";
|
||||
db.execSQL(sql);
|
||||
|
||||
sql = "insert into addresstb values (3, '王五', '15916549163', '杭州', '翻斗花园1号楼')";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.animee.rf_week02.view;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
public class AlertDialogUtils {
|
||||
public interface OnBtnClickListener {
|
||||
public void onBtnClick();
|
||||
}
|
||||
|
||||
public static void showNormalDialog(Context context, String title, String msg,
|
||||
String lInfo, String rInfo,
|
||||
OnBtnClickListener lListener, OnBtnClickListener rListener) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(title)
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(rInfo, (dialog, i) -> {
|
||||
if (rListener != null) {
|
||||
rListener.onBtnClick();
|
||||
}
|
||||
dialog.cancel();
|
||||
}).setNegativeButton(lInfo, (dialog, i) -> {
|
||||
if (lListener != null) {
|
||||
lListener.onBtnClick();
|
||||
}
|
||||
dialog.cancel();
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.animee.rf_week02.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.TestLooperManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.animee.rf_week02.R;
|
||||
import com.google.android.material.internal.TextWatcherAdapter;
|
||||
|
||||
public class AmountView extends LinearLayout implements View.OnClickListener {
|
||||
private Button subBtn, addBtn;
|
||||
private EditText numEt;
|
||||
private int storage = 100;
|
||||
private int showCount = 1;
|
||||
|
||||
// 设置产品库存
|
||||
public void setStorage(int storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
// 设置显示数量
|
||||
public void setShowCount(int count) {
|
||||
this.showCount = count;
|
||||
numEt.setText("" + showCount);
|
||||
}
|
||||
|
||||
// 将这个view当中的数量传递出去
|
||||
public interface OnAmountListener {
|
||||
public void onAmount(int num);
|
||||
}
|
||||
|
||||
OnAmountListener onAmountListener;
|
||||
|
||||
public void setOnAmountListener(OnAmountListener onAmountListener) {
|
||||
this.onAmountListener = onAmountListener;
|
||||
}
|
||||
|
||||
public AmountView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AmountView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.amount_view, this);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
subBtn = findViewById(R.id.amount_btn_sub);
|
||||
addBtn = findViewById(R.id.amount_btn_plus);
|
||||
numEt = findViewById(R.id.amount_et);
|
||||
subBtn.setOnClickListener(this);
|
||||
addBtn.setOnClickListener(this);
|
||||
// 设置输入框的监听器
|
||||
numEt.addTextChangedListener(watcher);
|
||||
}
|
||||
// 返回输入框当中的数据
|
||||
public int getAmountNum() {
|
||||
String after = numEt.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(after)) {
|
||||
return 1;
|
||||
}
|
||||
return Integer.parseInt(after);
|
||||
}
|
||||
TextWatcher watcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
// Log.d("beforeTextChanged : ", charSequence.toString()
|
||||
// + ", " + i + ", " + i1 + ", " + i2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
// Log.d("onTextChanged : ", charSequence.toString()
|
||||
// + ", " + i + ", " + i1 + ", " + i2);
|
||||
// System.out.println();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
String after = editable.toString().trim();
|
||||
if (TextUtils.isEmpty(after)) {
|
||||
showCount = 1;
|
||||
numEt.setText("1");
|
||||
return;
|
||||
}
|
||||
showCount = Integer.parseInt(after);
|
||||
if (showCount < 1) {
|
||||
showCount = 1;
|
||||
numEt.setText(showCount + "");
|
||||
} else if (showCount > storage) {
|
||||
showCount = storage;
|
||||
numEt.setText(showCount + "");
|
||||
}
|
||||
|
||||
if (onAmountListener != null) {
|
||||
onAmountListener.onAmount(showCount);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String numstr = numEt.getText().toString().trim();
|
||||
int num = Integer.parseInt(numstr);
|
||||
switch (view.getId()) {
|
||||
case R.id.amount_btn_sub:
|
||||
if (num > 1) {
|
||||
num--;
|
||||
}
|
||||
break;
|
||||
case R.id.amount_btn_plus:
|
||||
if (num < storage) {
|
||||
num++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
numEt.clearFocus(); // 失去焦点
|
||||
numEt.setText(num + "");
|
||||
if (onAmountListener != null) {
|
||||
onAmountListener.onAmount(showCount);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.animee.rf_week02.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.animee.rf_week02.R;
|
||||
import com.animee.rf_week02.databinding.DialogAddressBinding;
|
||||
import com.animee.rf_week02.db.AddressDao;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SaveAddressDialog extends Dialog implements View.OnClickListener {
|
||||
DialogAddressBinding binding;
|
||||
AddressDao addressDao; // 修改地址会传入地址内容
|
||||
|
||||
public SaveAddressDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public interface OnUpdateAddressListener {
|
||||
public void onUpdateAddress(AddressDao dao);
|
||||
}
|
||||
|
||||
private OnUpdateAddressListener onUpdateAddressListener;
|
||||
|
||||
public void setOnUpdateAddressListener(OnUpdateAddressListener onUpdateAddressListener) {
|
||||
this.onUpdateAddressListener = onUpdateAddressListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = DialogAddressBinding.inflate(getLayoutInflater());
|
||||
RelativeLayout root = binding.getRoot();
|
||||
setContentView(root);
|
||||
setEvent();
|
||||
}
|
||||
|
||||
private void setEvent() {
|
||||
binding.dgAdsBtn.setOnClickListener(this);
|
||||
binding.dgAdsIvCancel.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对话框标题方法
|
||||
*/
|
||||
public void setTitle(String msg) {
|
||||
binding.dgAdsTvTitle.setText(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置对话框中输入框的显示
|
||||
*/
|
||||
public void setAddressDao(AddressDao dao) {
|
||||
this.addressDao = dao;
|
||||
binding.dgAdsEtShr.setText(dao.getName());
|
||||
binding.dgAdsEtTel.setText(dao.getTel());
|
||||
binding.dgAdsEtCity.setText(dao.getCity());
|
||||
binding.dgAdsEtStreet.setText(dao.getStreet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.dg_ads_btn:
|
||||
AddressDao dao = judgeInputMsg();
|
||||
// 添加新地址逻辑: 如果这个地址没有一摸一样的就添加数据库, 如果有一样的就不添加, 提示用户
|
||||
if (dao != null) {
|
||||
// 判断是否传入了原来的地址, 没有传入说明是添加地址, 否则为修改地址
|
||||
if (this.addressDao == null) {
|
||||
if (onUpdateAddressListener != null) { // 增加地址的判断
|
||||
onUpdateAddressListener.onUpdateAddress(dao);
|
||||
}
|
||||
} else { // 修改地址的判断
|
||||
// 1. 判断修改该内容和原来内容是否一致, 完全一致, 不修改, 提示用户
|
||||
if (dao.equals(this.addressDao)) {
|
||||
ToastUtils.showToast(getContext(), "未进行修改该, 于原内容一致! ");
|
||||
} else {
|
||||
// 2. 不一致, 将修改该后的数据回调回去, 在回调之前设置id, 在适配器更新地址
|
||||
dao.setId(addressDao.getId());
|
||||
if (onUpdateAddressListener != null) { // 增加地址的判断
|
||||
onUpdateAddressListener.onUpdateAddress(dao);
|
||||
}
|
||||
}
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
break;
|
||||
case R.id.dg_ads_iv_cancel:
|
||||
cancel();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private AddressDao judgeInputMsg() {
|
||||
String name = binding.dgAdsEtShr.getText().toString().trim();
|
||||
String tel = binding.dgAdsEtTel.getText().toString().trim();
|
||||
String city = binding.dgAdsEtCity.getText().toString().trim();
|
||||
String street = binding.dgAdsEtStreet.getText().toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(tel) || TextUtils.isEmpty(city) || TextUtils.isEmpty(street)) {
|
||||
ToastUtils.showToast(getContext(), "输入信息不能为空");
|
||||
return null;
|
||||
}
|
||||
// 手机号的正则表达式
|
||||
if (!Pattern.matches("^1[3-9]\\d{9}$", tel)) {
|
||||
ToastUtils.showToast(getContext(), "输入手机号不符合规则");
|
||||
return null;
|
||||
}
|
||||
return new AddressDao(0, name, tel, city, street);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.animee.rf_week02.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.animee.rf_week02.R;
|
||||
|
||||
/**
|
||||
* 接口回调:
|
||||
* 当这个类的某项事件由他触发, 但是功能不是由他决定, 就可以用接口回调解决
|
||||
* 1. 创建接口, 编写回调方法
|
||||
* 2. 在这个类中, 将接口设置为成员变量, 然后通过set方法对其进行赋值
|
||||
* 2. 在被触发的地方调用这个接口的方法
|
||||
*/
|
||||
public class TitleView extends RelativeLayout implements View.OnClickListener {
|
||||
private ImageView leftIv, rightIv;
|
||||
private TextView titleTv;
|
||||
private RelativeLayout layout;
|
||||
|
||||
public interface OnclickImgListener {
|
||||
public void onClick(View view);
|
||||
}
|
||||
|
||||
OnclickImgListener leftListener, rightListener;
|
||||
|
||||
public void setOnClickLeftImgListener(OnclickImgListener leftListener) {
|
||||
this.leftListener = leftListener;
|
||||
}
|
||||
|
||||
public void setOnClickRightImgListener(OnclickImgListener rightListener) {
|
||||
this.rightListener = rightListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.title_iv_left:
|
||||
// ((Activity)getContext()).finish();
|
||||
if (leftListener != null) {
|
||||
leftListener.onClick(view);
|
||||
}
|
||||
break;
|
||||
case R.id.title_iv_right:
|
||||
if (rightListener != null) {
|
||||
rightListener.onClick(view);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 在代码当中创建view对象时, 会调用的构造方法
|
||||
public TitleView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
// 在布局当中些view对象时, 会调用的构造方法
|
||||
public TitleView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.title_layout, this);
|
||||
initView();
|
||||
setEvent();
|
||||
}
|
||||
|
||||
private void setEvent() {
|
||||
leftIv.setOnClickListener(this);
|
||||
rightIv.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
leftIv = findViewById(R.id.title_iv_left);
|
||||
rightIv = findViewById(R.id.title_iv_right);
|
||||
titleTv = findViewById(R.id.title_tv);
|
||||
layout = findViewById(R.id.title_view);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标题
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
titleTv.setText(title);
|
||||
}
|
||||
|
||||
public void setTitle(int titleId) {
|
||||
titleTv.setText(titleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标题颜色
|
||||
*/
|
||||
public void setTitleColor(int color) {
|
||||
titleTv.setTextColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置背景颜色
|
||||
*/
|
||||
public void setBgResource(int color) {
|
||||
layout.setBackgroundResource(color);
|
||||
}
|
||||
|
||||
public void setBdColor(int color) {
|
||||
layout.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示左右图片
|
||||
*/
|
||||
public void setVisibleImg(int left, int right) {
|
||||
leftIv.setVisibility(left);
|
||||
rightIv.setVisibility(right);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改左边显示图片
|
||||
*/
|
||||
public void setLeftImgResource(int resId) {
|
||||
leftIv.setImageResource(resId);
|
||||
}
|
||||
|
||||
public void setRightImgResource(int resId) {
|
||||
rightIv.setImageResource(resId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.animee.rf_week02.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ToastUtils {
|
||||
|
||||
public static void showToast(Context context, String msg) {
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/black" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/red"/>
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/purple_700"/>
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/black" />
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="5dp" />
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:top="2dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"/>
|
||||
</shape>
|
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
@ -0,0 +1,22 @@
|
||||
<?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=".AddressActivity">
|
||||
<com.animee.rf_week02.view.TitleView
|
||||
android:id="@+id/address_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/address_lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@color/grey"
|
||||
android:dividerHeight="4dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
tools:context=".CartActivity">
|
||||
|
||||
<com.animee.rf_week02.view.TitleView
|
||||
android:id="@+id/cart_titleview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/cart_bottomlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="right"
|
||||
android:padding="5dp">
|
||||
<TextView
|
||||
android:id="@+id/cart_tv1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="总计 :"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/cart_tv_total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="$ 100"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/red"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
/>
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/cart_btn_buy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/buy" />
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/cart_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black"
|
||||
android:layout_above="@id/cart_bottomlayout" />
|
||||
<ListView
|
||||
android:id="@+id/cart_lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/cart_titleview"
|
||||
android:layout_above="@id/cart_line" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,58 @@
|
||||
<?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=".DetailTypeActivity">
|
||||
|
||||
<com.animee.rf_week02.view.TitleView
|
||||
android:id="@+id/detail_titleview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/detail_btn_sort"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_detailbtn"
|
||||
android:drawableLeft="@mipmap/icon_money"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/dt_sort" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/detail_sp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_detailbtn"
|
||||
android:dropDownWidth="match_parent"
|
||||
android:overlapAnchor="false"
|
||||
android:spinnerMode="dropdown" />
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/detail_lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/detail_gv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:numColumns="2"
|
||||
android:visibility="gone" />
|
||||
</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=".MainActivity">
|
||||
|
||||
<com.animee.rf_week02.view.TitleView
|
||||
android:id="@+id/main_titleview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/main_lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerHeight="1dp"
|
||||
android:divider="@color/black" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,214 @@
|
||||
<?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=".PayActivity">
|
||||
|
||||
<com.animee.rf_week02.view.TitleView
|
||||
android:id="@+id/pay_titleview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:focusable="true"
|
||||
android:text="支付宝支付" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:focusable="false"
|
||||
android:text="货到付款" />
|
||||
</RadioGroup>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20sp"
|
||||
android:background="@color/grey"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pay_tv1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="收货人:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pay_et_shr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10sp"
|
||||
android:layout_marginTop="2sp"
|
||||
android:layout_toEndOf="@id/pay_tv1"
|
||||
android:background="@color/white"
|
||||
android:text=""
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pay_tv2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/pay_et_shr"
|
||||
android:layout_marginTop="15sp"
|
||||
android:text="手机号:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pay_et_tel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/pay_tv2"
|
||||
android:layout_marginStart="10sp"
|
||||
android:layout_marginTop="2sp"
|
||||
android:layout_toEndOf="@id/pay_tv2"
|
||||
android:background="@color/white"
|
||||
android:text=""
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="17sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5sp"
|
||||
android:background="@color/grey"
|
||||
tools:ignore="SmallSp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pay_tv3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="收货地址:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pay_iv_write"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:onClick="onClick"
|
||||
android:src="@mipmap/icon_write"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pay_et_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10sp"
|
||||
android:layout_marginTop="2sp"
|
||||
android:layout_toEndOf="@id/pay_tv3"
|
||||
android:background="@color/white"
|
||||
android:text=""
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="17sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5sp"
|
||||
android:background="@color/grey"
|
||||
tools:ignore="SmallSp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pay_tv4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="跑腿费:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pay_et_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10sp"
|
||||
android:layout_marginTop="2sp"
|
||||
android:layout_toEndOf="@id/pay_tv4"
|
||||
android:background="@color/white"
|
||||
android:text=""
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pay_tv5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="100sp"
|
||||
android:layout_toEndOf="@id/pay_et_tip"
|
||||
android:text="总计:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pay_et_total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10sp"
|
||||
android:layout_marginTop="2sp"
|
||||
android:layout_toEndOf="@id/pay_tv5"
|
||||
android:background="@color/white"
|
||||
android:text=""
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="17sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5sp"
|
||||
android:background="@color/grey"
|
||||
tools:ignore="SmallSp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/pay_btn_cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="取消订单"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/pay_btn_ok"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="确认支付"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,37 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:showDividers="none">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/amount_btn_sub"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/amount_btn"
|
||||
android:text="-"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp"/>
|
||||
<EditText
|
||||
android:id="@+id/amount_et"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:inputType="number"
|
||||
android:textAlignment="center"
|
||||
android:background="@drawable/amount_btn"
|
||||
tools:ignore="SpeakableTextPresentCheck"/>
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/amount_btn_plus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/amount_btn"
|
||||
android:text="+"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp"/>
|
||||
</LinearLayout>
|
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_detailbtn"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/addaddress"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dg_ads_iv_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@mipmap/icon_close" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/dg_ads_tv_title"
|
||||
android:layout_margin="10dp"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_tv_shr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line1"
|
||||
android:text="@string/shr"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dg_ads_et_shr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line1"
|
||||
android:layout_alignBaseline="@id/dg_ads_tv_shr"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/dg_ads_tv_shr"
|
||||
android:background="@null"
|
||||
android:hint="@string/shr_name"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/dg_ads_tv_shr"
|
||||
android:layout_margin="10dp"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_tv_tel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line2"
|
||||
android:text="@string/tel"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dg_ads_et_tel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line2"
|
||||
android:layout_alignBaseline="@id/dg_ads_tv_tel"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/dg_ads_tv_tel"
|
||||
android:background="@null"
|
||||
android:hint="@string/shr_tel"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/dg_ads_tv_tel"
|
||||
android:layout_margin="10dp"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_tv_city"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line3"
|
||||
android:text="@string/loc"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dg_ads_et_city"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line3"
|
||||
android:layout_alignBaseline="@id/dg_ads_tv_city"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/dg_ads_tv_city"
|
||||
android:background="@null"
|
||||
android:hint="@string/shr_loc"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_line4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/dg_ads_tv_city"
|
||||
android:layout_margin="10dp"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_tv_street"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line4"
|
||||
android:text="@string/street"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dg_ads_et_street"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line4"
|
||||
android:layout_alignBaseline="@id/dg_ads_tv_street"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/dg_ads_tv_street"
|
||||
android:background="@null"
|
||||
android:hint="@string/shr_datails"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dg_ads_line5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/dg_ads_tv_street"
|
||||
android:layout_margin="10dp"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/dg_ads_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/dg_ads_line5"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:padding="10dp">
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black"
|
||||
android:text="孙尚香"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_tel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_toEndOf="@id/item_ads_tv_name"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="19150932003"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_city"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/item_ads_tv_name"
|
||||
android:textColor="@color/black"
|
||||
android:text="四川成都市"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_line1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/item_ads_tv_city"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_alignBottom="@id/item_ads_tv_city"
|
||||
android:text="|"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_street"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/item_ads_tv_name"
|
||||
android:layout_toEndOf="@id/item_ads_tv_line1"
|
||||
android:textColor="@color/black"
|
||||
android:text="莲花小区"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_below="@id/item_ads_tv_city"
|
||||
android:background="@color/grey"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/item_ads_rb_default"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/item_ads_tv_line2"
|
||||
android:focusable="false"
|
||||
android:text="@string/unsetdefault" />
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_modify"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignBaseline="@id/item_ads_rb_default"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:text="@string/update"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignBaseline="@id/item_ads_rb_default"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:text="@string/delete"
|
||||
android:layout_toStartOf="@id/item_ads_tv_modify"
|
||||
android:layout_marginEnd="20dp"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_copy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignBaseline="@id/item_ads_rb_default"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:text="@string/copy"
|
||||
android:layout_toStartOf="@id/item_ads_tv_delete"
|
||||
android:layout_marginEnd="20dp"/>
|
||||
<TextView
|
||||
android:id="@+id/item_ads_tv_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignBaseline="@id/item_ads_rb_default"
|
||||
android:textColor="@color/darkgrey"
|
||||
android:text="@string/settop"
|
||||
android:layout_toStartOf="@id/item_ads_tv_copy"
|
||||
android:layout_marginEnd="20dp"/>
|
||||
</RelativeLayout>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/item_ads_btn_add"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="@string/addaddress"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
<ImageView
|
||||
android:id="@+id/item_dg_iv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:src="@mipmap/icon_laji"
|
||||
android:scaleType="fitCenter" />
|
||||
<TextView
|
||||
android:id="@+id/item_dg_tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/item_dg_iv"
|
||||
android:text="可口可乐"
|
||||
android:textStyle="bold"
|
||||
android:textSize="22sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/item_dg_tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_below="@id/item_dg_tv_title"
|
||||
android:layout_alignStart="@id/item_dg_tv_title"
|
||||
android:text="$ 18" />
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/item_dg_btn_buy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="@string/addcart"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignTop="@id/item_dg_tv_price"/>
|
||||
</RelativeLayout>
|
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/item_dl_iv"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
android:src="@mipmap/icon_money"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_dl_tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="可口可乐"
|
||||
android:layout_alignTop="@id/item_dl_iv"
|
||||
android:layout_toRightOf="@id/item_dl_iv"
|
||||
android:textStyle="bold"
|
||||
android:textSize="22sp"
|
||||
android:layout_marginLeft="20dp" />
|
||||
<TextView
|
||||
android:id="@+id/item_dl_tv_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="饮料"
|
||||
android:layout_below="@id/item_dl_tv_title"
|
||||
android:layout_alignLeft="@id/item_dl_tv_title"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
<com.animee.rf_week02.view.AmountView
|
||||
android:id="@+id/item_dl_av"
|
||||
android:layout_width="110sp"
|
||||
android:layout_height="40sp"
|
||||
android:layout_below="@id/item_dl_tv_type"
|
||||
android:layout_alignStart="@id/item_dl_tv_title"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_dl_tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="$12"
|
||||
android:layout_below="@id/item_dl_av"
|
||||
android:layout_alignStart="@id/item_dl_tv_title"
|
||||
android:textColor="@color/red"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/item_dl_btn_buy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/addcart"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:layout_alignBottom="@id/item_dl_iv" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_dl_iv_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/icon_laji"
|
||||
android:visibility="gone"
|
||||
|
||||
/>
|
||||
</RelativeLayout>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp">
|
||||
<TextView
|
||||
android:id="@+id/item_main_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="日常用品"
|
||||
android:textSize="18sp"
|
||||
android:layout_centerVertical="true"
|
||||
android:textStyle="bold" />
|
||||
<ImageView
|
||||
android:id="@+id/item_main_iv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@mipmap/icon_nt" />
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/red">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/title_iv_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@mipmap/icon_back" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/title_iv_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@mipmap/icon_setting" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="标题"
|
||||
android:textColor="@color/white"
|
||||
android:layout_centerInParent="true"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 982 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.RF_Week02" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</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,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</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="red">#FFFF0000</color>
|
||||
<color name="grey">#DCDCDC</color>
|
||||
<color name="darkgrey">#808080</color>
|
||||
</resources>
|
@ -0,0 +1,28 @@
|
||||
<resources>
|
||||
<string name="app_name">RF_Week02</string>
|
||||
<string name="main_title">安心Go</string>
|
||||
<string name="dt_search">点击搜索</string>
|
||||
<string name="dt_sort">价格排序</string>
|
||||
<string name="dt_list">列表展示</string>
|
||||
<string name="dt_grid">网格展示</string>
|
||||
<string name="buy">购买</string>
|
||||
<string name="unsetdefault">设定为默认</string>
|
||||
<string name="setdefault">已设定为默认</string>
|
||||
<string name="update">修改</string>
|
||||
<string name="delete">删除</string>
|
||||
<string name="settop">置顶</string>
|
||||
<string name="copy">复制</string>
|
||||
<string name="addaddress">添加收货地址</string>
|
||||
<string name="address">收货地址</string>
|
||||
<string name="cart">购物车</string>
|
||||
<string name="shr">收货人:</string>
|
||||
<string name="shr_name">收货人姓名</string>
|
||||
<string name="shr_tel">收货人手机号</string>
|
||||
<string name="tel">手机号:</string>
|
||||
<string name="loc">地 区:</string>
|
||||
<string name="street">地 址:</string>
|
||||
<string name="shr_loc">地区省市</string>
|
||||
<string name="shr_datails">如街道, 门牌号, 小区, 村镇等</string>
|
||||
<string name="save">保存</string>
|
||||
<string name="addcart">加入购物车</string>
|
||||
</resources>
|
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.RF_Week02" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/red</item>
|
||||
<item name="colorPrimaryVariant">@color/red</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,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
@ -0,0 +1,17 @@
|
||||
package com.animee.rf_week02;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.4.1' apply false
|
||||
id 'com.android.library' version '7.4.1' apply false
|
||||
}
|
@ -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
|
@ -0,0 +1,6 @@
|
||||
#Sat Apr 15 17:38:59 CST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
@ -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,16 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "RF_Week02"
|
||||
include ':app'
|