@ -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 @@
|
||||
Subproject commit 759ef60a4e1e9b83ba8e8486677ea7c01a1928cb
|
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.test"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 33
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
}
|
@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
|
@ -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,12 @@
|
||||
package com.example.storage;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.storage">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAG" />
|
||||
<uses-permission
|
||||
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/nt1"
|
||||
android:label="盲盒咖啡店"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".UserActivity" ></activity>
|
||||
<activity android:name=".RegisterActivity" android:theme="@style/Theme.Design.NoActionBar" />
|
||||
<activity android:exported="true" android:name=".LoginActivity" android:theme="@style/Theme.Design.NoActionBar" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ShoppingChannelActivity"
|
||||
tools:ignore="Instantiatable" android:theme="@style/Theme.Design.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ShoppingCartActivity"
|
||||
tools:ignore="Instantiatable" android:theme="@style/Theme.Design.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ShoppingDetailActivity"
|
||||
tools:ignore="Instantiatable" android:theme="@style/Theme.Design.NoActionBar" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.storage">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAG" />
|
||||
<uses-permission
|
||||
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".UserActivity"></activity>
|
||||
<activity android:name=".RegisterActivity" />
|
||||
<activity android:name=".LoginActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ShoppingChannelActivity"
|
||||
tools:ignore="Instantiatable" />
|
||||
<activity
|
||||
android:name=".ShoppingCartActivity"
|
||||
tools:ignore="Instantiatable" />
|
||||
<activity
|
||||
android:name=".ShoppingDetailActivity"
|
||||
tools:ignore="Instantiatable" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,40 @@
|
||||
package com.example.storage;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
public class MainApplication extends Application {
|
||||
private final static String TAG = "MainApplication";
|
||||
// 声明一个当前应用的静态实例
|
||||
private static MainApplication mApp;
|
||||
// 声明一个公共的图标映射对象,可当作全局变量使用
|
||||
public HashMap<Long, Bitmap> mIconMap = new HashMap<Long, Bitmap>();
|
||||
|
||||
// 利用单例模式获取当前应用的唯一实例
|
||||
public static MainApplication getInstance() {
|
||||
return mApp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 在打开应用时对静态的应用实例赋值
|
||||
mApp = this;
|
||||
Log.d(TAG, "onCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
Log.d(TAG, "onTerminate");
|
||||
super.onTerminate();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.example.storage;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private String realCode;
|
||||
private DBOpenHelper mDBOpenHelper;
|
||||
private Button mBtRegisteractivityRegister;
|
||||
private RelativeLayout mRlRegisteractivityTop;
|
||||
private ImageView mIvRegisteractivityBack;
|
||||
private LinearLayout mLlRegisteractivityBody;
|
||||
private EditText mEtRegisteractivityUsername;
|
||||
private EditText mEtRegisteractivityPassword1;
|
||||
private EditText mEtRegisteractivityPassword2;
|
||||
private EditText mEtRegisteractivityPhonecodes;
|
||||
private ImageView mIvRegisteractivityShowcode;
|
||||
private RelativeLayout mRlRegisteractivityBottom;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
initView();
|
||||
|
||||
mDBOpenHelper = new DBOpenHelper(this);
|
||||
|
||||
//将验证码用图片的形式显示出来
|
||||
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
|
||||
realCode = Code.getInstance().getCode().toLowerCase();
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
mBtRegisteractivityRegister = findViewById(R.id.bt_registeractivity_register);
|
||||
mRlRegisteractivityTop = findViewById(R.id.rl_registeractivity_top);
|
||||
mIvRegisteractivityBack = findViewById(R.id.iv_registeractivity_back);
|
||||
mLlRegisteractivityBody = findViewById(R.id.ll_registeractivity_body);
|
||||
mEtRegisteractivityUsername = findViewById(R.id.et_registeractivity_username);
|
||||
mEtRegisteractivityPassword1 = findViewById(R.id.et_registeractivity_password1);
|
||||
mEtRegisteractivityPassword2 = findViewById(R.id.et_registeractivity_password2);
|
||||
mEtRegisteractivityPhonecodes = findViewById(R.id.et_registeractivity_phoneCodes);
|
||||
mIvRegisteractivityShowcode = findViewById(R.id.iv_registeractivity_showCode);
|
||||
mRlRegisteractivityBottom = findViewById(R.id.rl_registeractivity_bottom);
|
||||
|
||||
/**
|
||||
* 注册页面能点击的就三个地方
|
||||
* top处返回箭头、刷新验证码图片、注册按钮
|
||||
*/
|
||||
mIvRegisteractivityBack.setOnClickListener(this);
|
||||
mIvRegisteractivityShowcode.setOnClickListener(this);
|
||||
mBtRegisteractivityRegister.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.iv_registeractivity_back: //返回登录页面
|
||||
Intent intent1 = new Intent(this, LoginActivity.class);
|
||||
startActivity(intent1);
|
||||
finish();
|
||||
break;
|
||||
case R.id.iv_registeractivity_showCode: //改变随机验证码的生成
|
||||
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
|
||||
realCode = Code.getInstance().getCode().toLowerCase();
|
||||
break;
|
||||
case R.id.bt_registeractivity_register: //注册按钮
|
||||
//获取用户输入的用户名、密码、验证码
|
||||
String username = mEtRegisteractivityUsername.getText().toString().trim();
|
||||
String password = mEtRegisteractivityPassword2.getText().toString().trim();
|
||||
String phoneCode = mEtRegisteractivityPhonecodes.getText().toString().toLowerCase();
|
||||
//注册验证
|
||||
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(phoneCode) ) {
|
||||
if (phoneCode.equals(realCode)) {
|
||||
//将用户名和密码加入到数据库中
|
||||
mDBOpenHelper.add(username, password);
|
||||
Intent intent2 = new Intent(this, LoginActivity.class);
|
||||
startActivity(intent2);
|
||||
finish();
|
||||
Toast.makeText(this, "验证通过,注册成功", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(this, "验证码错误,注册失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}else {
|
||||
Toast.makeText(this, "未完善信息,注册失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,382 @@
|
||||
package com.example.storage;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.storage.bean.CartInfo;
|
||||
import com.example.storage.bean.GoodsInfo;
|
||||
import com.example.storage.database.CartDBHelper;
|
||||
import com.example.storage.database.GoodsDBHelper;
|
||||
import com.example.storage.util.FileUtil;
|
||||
import com.example.storage.util.SharedUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public class ShoppingCartActivity extends Activity implements OnClickListener {
|
||||
private final static String TAG = "ShoppingCartActivity";
|
||||
private ImageView iv_menu;
|
||||
private TextView tv_count;
|
||||
private TextView tv_total_price;
|
||||
private LinearLayout ll_content;
|
||||
private LinearLayout ll_cart;
|
||||
private LinearLayout ll_empty;
|
||||
private int mCount; // 购物车中的商品数量
|
||||
private GoodsDBHelper mGoodsHelper; // 声明一个商品数据库的帮助器对象
|
||||
private CartDBHelper mCartHelper; // 声明一个购物车数据库的帮助器对象
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_shopping_cart);
|
||||
iv_menu = findViewById(R.id.iv_menu);
|
||||
TextView tv_title = findViewById(R.id.tv_title);
|
||||
tv_count = findViewById(R.id.tv_count);
|
||||
tv_total_price = findViewById(R.id.tv_total_price);
|
||||
ll_content = findViewById(R.id.ll_content);
|
||||
ll_cart = findViewById(R.id.ll_cart);
|
||||
ll_empty = findViewById(R.id.ll_empty);
|
||||
iv_menu.setOnClickListener(this);
|
||||
findViewById(R.id.btn_shopping_channel).setOnClickListener(this);
|
||||
findViewById(R.id.btn_settle).setOnClickListener(this);
|
||||
findViewById(R.id.btn_shopping_grzx).setOnClickListener(this);
|
||||
iv_menu.setVisibility(View.VISIBLE);
|
||||
tv_title.setText("盲盒咖啡店");
|
||||
}
|
||||
|
||||
// 显示购物车图标中的商品数量
|
||||
private void showCount(int count) {
|
||||
mCount = count;
|
||||
tv_count.setText("" + mCount);
|
||||
if (mCount == 0) {
|
||||
ll_content.setVisibility(View.GONE);
|
||||
ll_cart.removeAllViews();
|
||||
ll_empty.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ll_content.setVisibility(View.VISIBLE);
|
||||
ll_empty.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.iv_menu) { // 点击了菜单图标
|
||||
openOptionsMenu();
|
||||
} else if (v.getId() == R.id.btn_shopping_channel) { // 点击了“商场”按钮
|
||||
// 跳转到商场页面
|
||||
Intent intent = new Intent(this, ShoppingChannelActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (v.getId() == R.id.btn_settle) { // 点击了“结算”按钮
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("结算商品");
|
||||
builder.setMessage("支付成功!");
|
||||
builder.setPositiveButton("好的", null);
|
||||
builder.create().show();
|
||||
}
|
||||
else if (v.getId() == R.id.btn_shopping_grzx) {
|
||||
// 跳转到个人中心页面
|
||||
Intent intent = new Intent(this, UserActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// 从menu_cart.xml中构建菜单界面布局
|
||||
getMenuInflater().inflate(R.menu.menu_cart, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.menu_shopping) { // 点击了菜单项“去商场购物”
|
||||
// 跳转到商场页面
|
||||
Intent intent = new Intent(this, ShoppingChannelActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (id == R.id.menu_clear) { // 点击了菜单项“清空购物车”
|
||||
// 清空购物车数据库
|
||||
mCartHelper.deleteAll();
|
||||
ll_cart.removeAllViews();
|
||||
// 把最新的商品数量写入共享参数
|
||||
SharedUtil.getIntance(this).writeShared("count", "0");
|
||||
// 显示最新的商品数量
|
||||
showCount(0);
|
||||
mCartGoods.clear();
|
||||
mGoodsMap.clear();
|
||||
Toast.makeText(this, "购物车已清空", Toast.LENGTH_SHORT).show();
|
||||
} else if (id == R.id.menu_return) { // 点击了菜单项“返回”
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 声明一个根据视图编号查找商品信息的映射
|
||||
private HashMap<Integer, CartInfo> mCartGoods = new HashMap<Integer, CartInfo>();
|
||||
// 声明一个触发上下文菜单的视图对象
|
||||
private View mContextView;
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
// 保存该商品行的视图,以便删除商品时一块从列表移除该行
|
||||
mContextView = v;
|
||||
// 从menu_goods.xml中构建菜单界面布局
|
||||
getMenuInflater().inflate(R.menu.menu_goods, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
CartInfo info = mCartGoods.get(mContextView.getId());
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.menu_detail) { // 点击了菜单项“查看商品详情”
|
||||
// 跳转到查看商品详情页面
|
||||
goDetail(info.goods_id);
|
||||
} else if (id == R.id.menu_delete) { // 点击了菜单项“从购物车删除”
|
||||
long goods_id = info.goods_id;
|
||||
// 从购物车删除商品的数据库操作
|
||||
mCartHelper.delete("goods_id=" + goods_id);
|
||||
// 从购物车列表中删除该商品行
|
||||
ll_cart.removeView(mContextView);
|
||||
// 更新购物车中的商品数量
|
||||
int left_count = mCount - info.count;
|
||||
for (int i = 0; i < mCartArray.size(); i++) {
|
||||
if (goods_id == mCartArray.get(i).goods_id) {
|
||||
left_count = mCount - mCartArray.get(i).count;
|
||||
mCartArray.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 把最新的商品数量写入共享参数
|
||||
SharedUtil.getIntance(this).writeShared("count", "" + left_count);
|
||||
// 显示最新的商品数量
|
||||
showCount(left_count);
|
||||
Toast.makeText(this, "已从购物车删除" + mGoodsMap.get(goods_id).name, Toast.LENGTH_SHORT).show();
|
||||
mGoodsMap.remove(goods_id);
|
||||
refreshTotalPrice();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 跳转到商品详情页面
|
||||
private void goDetail(long rowid) {
|
||||
Intent intent = new Intent(this, ShoppingDetailActivity.class);
|
||||
intent.putExtra("goods_id", rowid);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// 获取共享参数保存的购物车中的商品数量
|
||||
mCount = Integer.parseInt(SharedUtil.getIntance(this).readShared("count", "0"));
|
||||
showCount(mCount);
|
||||
// 获取商品数据库的帮助器对象
|
||||
mGoodsHelper = GoodsDBHelper.getInstance(this, 1);
|
||||
// 打开商品数据库的写连接
|
||||
mGoodsHelper.openWriteLink();
|
||||
// 获取购物车数据库的帮助器对象
|
||||
mCartHelper = CartDBHelper.getInstance(this, 1);
|
||||
// 打开购物车数据库的写连接
|
||||
mCartHelper.openWriteLink();
|
||||
// 模拟从网络下载商品图片
|
||||
downloadGoods();
|
||||
// 展示购物车中的商品列表
|
||||
showCart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// 关闭商品数据库的数据库连接
|
||||
mGoodsHelper.closeLink();
|
||||
// 关闭购物车数据库的数据库连接
|
||||
mCartHelper.closeLink();
|
||||
}
|
||||
|
||||
// 声明一个起始的视图编号
|
||||
private int mBeginViewId = 0x7F24FFF0;
|
||||
// 声明一个购物车中的商品信息队列
|
||||
private ArrayList<CartInfo> mCartArray = new ArrayList<CartInfo>();
|
||||
// 声明一个根据商品编号查找商品信息的映射
|
||||
private HashMap<Long, GoodsInfo> mGoodsMap = new HashMap<Long, GoodsInfo>();
|
||||
|
||||
// 展示购物车中的商品列表
|
||||
private void showCart() {
|
||||
// 查询购物车数据库中所有的商品记录
|
||||
mCartArray = mCartHelper.query("1=1");
|
||||
Log.d(TAG, "mCartArray.size()=" + mCartArray.size());
|
||||
if (mCartArray == null || mCartArray.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
// 移除线性视图ll_cart下面的所有子视图
|
||||
ll_cart.removeAllViews();
|
||||
// 创建一个标题行的线性视图ll_row
|
||||
LinearLayout ll_row = newLinearLayout(LinearLayout.HORIZONTAL, LayoutParams.WRAP_CONTENT);
|
||||
ll_row.addView(newTextView(0, 2, Gravity.CENTER, "图片", Color.BLACK, 15));
|
||||
ll_row.addView(newTextView(0, 3, Gravity.CENTER, "名称", Color.BLACK, 15));
|
||||
ll_row.addView(newTextView(0, 1, Gravity.CENTER, "数量", Color.BLACK, 15));
|
||||
ll_row.addView(newTextView(0, 1, Gravity.CENTER, "单价", Color.BLACK, 15));
|
||||
ll_row.addView(newTextView(0, 1, Gravity.CENTER, "总价", Color.BLACK, 15));
|
||||
// 把标题行添加到购物车列表
|
||||
ll_cart.addView(ll_row);
|
||||
for (int i = 0; i < mCartArray.size(); i++) {
|
||||
final CartInfo info = mCartArray.get(i);
|
||||
// 根据商品编号查询商品数据库中的商品记录
|
||||
GoodsInfo goods = mGoodsHelper.queryById(info.goods_id);
|
||||
Log.d(TAG, "name=" + goods.name + ",price=" + goods.price + ",desc=" + goods.desc);
|
||||
mGoodsMap.put(info.goods_id, goods);
|
||||
// 创建该商品行的水平线性视图,从左到右依次为商品小图、商品名称与描述、商品数量、商品单价、商品总价。
|
||||
ll_row = newLinearLayout(LinearLayout.HORIZONTAL, LayoutParams.WRAP_CONTENT);
|
||||
// 设置该线性视图的编号
|
||||
ll_row.setId(mBeginViewId + i);
|
||||
// 添加商品小图
|
||||
ImageView iv_thumb = new ImageView(this);
|
||||
LinearLayout.LayoutParams iv_params = new LinearLayout.LayoutParams(
|
||||
0, LayoutParams.WRAP_CONTENT, 2);
|
||||
iv_thumb.setLayoutParams(iv_params);
|
||||
iv_thumb.setScaleType(ScaleType.FIT_CENTER);
|
||||
iv_thumb.setImageBitmap(MainApplication.getInstance().mIconMap.get(info.goods_id));
|
||||
ll_row.addView(iv_thumb);
|
||||
// 添加商品名称与描述
|
||||
LinearLayout ll_name = new LinearLayout(this);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
0, LayoutParams.MATCH_PARENT, 3);
|
||||
ll_name.setLayoutParams(params);
|
||||
ll_name.setOrientation(LinearLayout.VERTICAL);
|
||||
ll_name.addView(newTextView(-3, 1, Gravity.LEFT, goods.name, Color.BLACK, 17));
|
||||
ll_name.addView(newTextView(-3, 1, Gravity.LEFT, goods.desc, Color.GRAY, 12));
|
||||
ll_row.addView(ll_name);
|
||||
// 添加商品数量、单价和总价
|
||||
ll_row.addView(newTextView(1, 1, Gravity.CENTER, "" + info.count, Color.BLACK, 17));
|
||||
ll_row.addView(newTextView(1, 1, Gravity.RIGHT, "" + (int) goods.price, Color.BLACK, 15));
|
||||
ll_row.addView(newTextView(1, 1, Gravity.RIGHT, "" + (int) (info.count * goods.price), Color.RED, 17));
|
||||
// 给商品行添加点击事件
|
||||
ll_row.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
goDetail(info.goods_id);
|
||||
}
|
||||
});
|
||||
// 给商品行注册上下文菜单,为防止重复注册,这里先注销再注册
|
||||
unregisterForContextMenu(ll_row);
|
||||
registerForContextMenu(ll_row);
|
||||
mCartGoods.put(ll_row.getId(), info);
|
||||
// 往购物车列表添加该商品行
|
||||
ll_cart.addView(ll_row);
|
||||
}
|
||||
// 重新计算购物车中的商品总金额
|
||||
refreshTotalPrice();
|
||||
}
|
||||
|
||||
// 重新计算购物车中的商品总金额
|
||||
private void refreshTotalPrice() {
|
||||
int total_price = 0;
|
||||
for (CartInfo info : mCartArray) {
|
||||
GoodsInfo goods = mGoodsMap.get(info.goods_id);
|
||||
total_price += goods.price * info.count;
|
||||
}
|
||||
tv_total_price.setText("" + total_price);
|
||||
}
|
||||
|
||||
// 创建一个线性视图的框架
|
||||
private LinearLayout newLinearLayout(int orientation, int height) {
|
||||
LinearLayout ll_new = new LinearLayout(this);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, height);
|
||||
ll_new.setLayoutParams(params);
|
||||
ll_new.setOrientation(orientation);
|
||||
ll_new.setBackgroundColor(Color.WHITE);
|
||||
return ll_new;
|
||||
}
|
||||
|
||||
// 创建一个文本视图的模板
|
||||
private TextView newTextView(int height, float weight, int gravity, String text, int textColor, int textSize) {
|
||||
TextView tv_new = new TextView(this);
|
||||
if (height == -3) { // 垂直排列
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, 0, weight);
|
||||
tv_new.setLayoutParams(params);
|
||||
} else { // 水平排列
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
0, (height == 0) ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT, weight);
|
||||
tv_new.setLayoutParams(params);
|
||||
}
|
||||
tv_new.setText(text);
|
||||
tv_new.setTextColor(textColor);
|
||||
tv_new.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
|
||||
tv_new.setGravity(Gravity.CENTER | gravity);
|
||||
return tv_new;
|
||||
}
|
||||
|
||||
private String mFirst = "true"; // 是否首次打开
|
||||
// 模拟网络数据,初始化数据库中的商品信息
|
||||
private void downloadGoods() {
|
||||
// 获取共享参数保存的是否首次打开参数
|
||||
mFirst = SharedUtil.getIntance(this).readShared("first", "true");
|
||||
// 获取当前App的私有存储路径
|
||||
String path = MainApplication.getInstance().getExternalFilesDir(
|
||||
Environment.DIRECTORY_DOWNLOADS).toString() + "/";
|
||||
if (mFirst.equals("true")) { // 如果是首次打开
|
||||
ArrayList<GoodsInfo> goodsList = GoodsInfo.getDefaultList();
|
||||
for (int i = 0; i < goodsList.size(); i++) {
|
||||
GoodsInfo info = goodsList.get(i);
|
||||
// 往商品数据库插入一条该商品的记录
|
||||
long rowid = mGoodsHelper.insert(info);
|
||||
info.rowid = rowid;
|
||||
// 往全局内存写入商品小图
|
||||
Bitmap thumb = BitmapFactory.decodeResource(getResources(), info.thumb);
|
||||
MainApplication.getInstance().mIconMap.put(rowid, thumb);
|
||||
String thumb_path = path + rowid + "_s.jpg";
|
||||
FileUtil.saveImage(thumb_path, thumb);
|
||||
info.thumb_path = thumb_path; // 往SD卡保存商品大图
|
||||
Bitmap pic = BitmapFactory.decodeResource(getResources(), info.pic);
|
||||
String pic_path = path + rowid + ".jpg";
|
||||
FileUtil.saveImage(pic_path, pic);
|
||||
pic.recycle();
|
||||
info.pic_path = pic_path;
|
||||
// 更新商品数据库中该商品记录的图片路径
|
||||
mGoodsHelper.update(info);
|
||||
}
|
||||
} else { // 不是首次打开
|
||||
// 查询商品数据库中所有商品记录
|
||||
ArrayList<GoodsInfo> goodsArray = mGoodsHelper.query("1=1");
|
||||
for (int i = 0; i < goodsArray.size(); i++) {
|
||||
GoodsInfo info = goodsArray.get(i);
|
||||
// 从指定路径读取图片文件的位图数据
|
||||
Bitmap thumb = BitmapFactory.decodeFile(info.thumb_path);
|
||||
// 把该位图对象保存到应用实例的全局变量中
|
||||
MainApplication.getInstance().mIconMap.put(info.rowid, thumb);
|
||||
}
|
||||
}
|
||||
// 把是否首次打开写入共享参数
|
||||
SharedUtil.getIntance(this).writeShared("first", "false");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.example.storage;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.storage.bean.CartInfo;
|
||||
import com.example.storage.bean.GoodsInfo;
|
||||
import com.example.storage.database.CartDBHelper;
|
||||
import com.example.storage.database.GoodsDBHelper;
|
||||
import com.example.storage.util.DateUtil;
|
||||
import com.example.storage.util.SharedUtil;
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public class ShoppingDetailActivity extends AppCompatActivity implements OnClickListener {
|
||||
private TextView tv_title;
|
||||
private TextView tv_count;
|
||||
private TextView tv_goods_price;
|
||||
private TextView tv_goods_desc;
|
||||
private ImageView iv_goods_pic;
|
||||
private int mCount; // 购物车中的商品数量
|
||||
private long mGoodsId; // 当前商品的商品编号
|
||||
private GoodsDBHelper mGoodsHelper; // 声明一个商品数据库的帮助器对象
|
||||
private CartDBHelper mCartHelper; // 声明一个购物车数据库的帮助器对象
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_shopping_detail);
|
||||
tv_title = findViewById(R.id.tv_title);
|
||||
tv_count = findViewById(R.id.tv_count);
|
||||
tv_goods_price = findViewById(R.id.tv_goods_price);
|
||||
tv_goods_desc = findViewById(R.id.tv_goods_desc);
|
||||
iv_goods_pic = findViewById(R.id.iv_goods_pic);
|
||||
findViewById(R.id.iv_cart).setOnClickListener(this);
|
||||
findViewById(R.id.btn_add_cart).setOnClickListener(this);
|
||||
// 获取共享参数保存的购物车中的商品数量
|
||||
mCount = Integer.parseInt(SharedUtil.getIntance(this).readShared("count", "0"));
|
||||
tv_count.setText("" + mCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.iv_cart) { // 点击了购物车图标
|
||||
// 跳转到购物车页面
|
||||
Intent intent = new Intent(this, ShoppingCartActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (v.getId() == R.id.btn_add_cart) { // 点击了“添加”按钮
|
||||
// 把该商品添加到购物车
|
||||
addToCart(mGoodsId);
|
||||
Toast.makeText(this, "成功添加至购物车", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
// 把指定编号的商品添加到购物车
|
||||
private void addToCart(long goods_id) {
|
||||
mCount++;
|
||||
tv_count.setText("" + mCount);
|
||||
// 把购物车中的商品数量写入共享参数
|
||||
SharedUtil.getIntance(this).writeShared("count", "" + mCount);
|
||||
// 根据商品编号查询购物车中的商品记录
|
||||
CartInfo info = mCartHelper.queryByGoodsId(goods_id);
|
||||
if (info != null) { // 购物车已存在该商品记录
|
||||
info.count++; // 该商品的数量加一
|
||||
info.update_time = DateUtil.getNowDateTime("");
|
||||
// 更新购物车数据库中的商品记录信息
|
||||
mCartHelper.update(info);
|
||||
} else { // 购物车不存在该商品记录
|
||||
info = new CartInfo();
|
||||
info.goods_id = goods_id;
|
||||
info.count = 1;
|
||||
info.update_time = DateUtil.getNowDateTime("");
|
||||
// 往购物车数据库中添加一条新的商品记录
|
||||
mCartHelper.insert(info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// 获取商品数据库的帮助器对象
|
||||
mGoodsHelper = GoodsDBHelper.getInstance(this, 1);
|
||||
// 打开商品数据库的读连接
|
||||
mGoodsHelper.openReadLink();
|
||||
// 获取购物车数据库的帮助器对象
|
||||
mCartHelper = CartDBHelper.getInstance(this, 1);
|
||||
// 打开购物车数据库的写连接
|
||||
mCartHelper.openWriteLink();
|
||||
// 展示商品详情
|
||||
showDetail();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// 关闭商品数据库的数据库连接
|
||||
mGoodsHelper.closeLink();
|
||||
// 关闭购物车数据库的数据库连接
|
||||
mCartHelper.closeLink();
|
||||
}
|
||||
|
||||
private void showDetail() {
|
||||
mGoodsId = getIntent().getLongExtra("goods_id", 0L);
|
||||
if (mGoodsId > 0) {
|
||||
GoodsInfo info = mGoodsHelper.queryById(mGoodsId);
|
||||
tv_title.setText(info.name);
|
||||
tv_goods_desc.setText(info.desc);
|
||||
tv_goods_price.setText("" + info.price);
|
||||
Bitmap pic = BitmapFactory.decodeFile(info.pic_path);
|
||||
iv_goods_pic.setImageBitmap(pic);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.example.storage;
|
||||
/**
|
||||
* Created by littlecurl 2018/6/24
|
||||
*/
|
||||
public class User {
|
||||
private String name; //用户名
|
||||
private String password; //密码
|
||||
public User(String name, String password) {
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"name='" + name + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.example.storage;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
public class UserActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_user);
|
||||
getSupportActionBar().setTitle("个人中心");
|
||||
}
|
||||
|
||||
public void Jumping(View view) {
|
||||
Intent intent = new Intent(UserActivity.this, LoginActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.example.storage.bean;
|
||||
|
||||
public class CartInfo {
|
||||
public long rowid;
|
||||
public int xuhao;
|
||||
public long goods_id;
|
||||
public int count;
|
||||
public String update_time;
|
||||
|
||||
public CartInfo() {
|
||||
rowid = 0L;
|
||||
xuhao = 0;
|
||||
goods_id = 0L;
|
||||
count = 0;
|
||||
update_time = "";
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.example.storage.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public class DateUtil {
|
||||
public static String getNowDateTime(String formatStr) {
|
||||
String format = formatStr;
|
||||
if (TextUtils.isEmpty(format)) {
|
||||
format = "yyyyMMddHHmmss";
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
public static String getNowTime() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
public static String getNowTimeDetail() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
public static String formatDate(long time) {
|
||||
Date date = new Date(time);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package com.example.storage.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
public class FileUtil {
|
||||
|
||||
// 把字符串保存到指定路径的文本文件
|
||||
public static void saveText(String path, String txt) {
|
||||
try {
|
||||
// 根据指定文件路径构建文件输出流对象
|
||||
FileOutputStream fos = new FileOutputStream(path);
|
||||
// 把字符串写入文件输出流
|
||||
fos.write(txt.getBytes());
|
||||
// 关闭文件输出流
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 从指定路径的文本文件中读取内容字符串
|
||||
public static String openText(String path) {
|
||||
String readStr = "";
|
||||
try {
|
||||
// 根据指定文件路径构建文件输入流对象
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
byte[] b = new byte[fis.available()];
|
||||
// 从文件输入流读取字节数组
|
||||
fis.read(b);
|
||||
// 把字节数组转换为字符串
|
||||
readStr = new String(b);
|
||||
// 关闭文件输入流
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 返回文本文件中的文本字符串
|
||||
return readStr;
|
||||
}
|
||||
|
||||
// 把位图数据保存到指定路径的图片文件
|
||||
public static void saveImage(String path, Bitmap bitmap) {
|
||||
try {
|
||||
// 根据指定文件路径构建缓存输出流对象
|
||||
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path));
|
||||
// 把位图数据压缩到缓存输出流中
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos);
|
||||
// 完成缓存输出流的写入动作
|
||||
bos.flush();
|
||||
// 关闭缓存输出流
|
||||
bos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 从指定路径的图片文件中读取位图数据
|
||||
public static Bitmap openImage(String path) {
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
// 根据指定文件路径构建缓存输入流对象
|
||||
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(path));
|
||||
// 从缓存输入流中解码位图数据
|
||||
bitmap = BitmapFactory.decodeStream(bis);
|
||||
bis.close(); // 关闭缓存输入流
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 返回图片文件中的位图数据
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static ArrayList<File> getFileList(String path, String[] extendArray) {
|
||||
ArrayList<File> displayedContent = new ArrayList<File>();
|
||||
File[] files = null;
|
||||
File directory = new File(path);
|
||||
if (extendArray != null && extendArray.length > 0) {
|
||||
FilenameFilter fileFilter = getTypeFilter(extendArray);
|
||||
files = directory.listFiles(fileFilter);
|
||||
} else {
|
||||
files = directory.listFiles();
|
||||
}
|
||||
|
||||
if (files != null) {
|
||||
for (File f : files) {
|
||||
if (!f.isDirectory() && !f.isHidden()) {
|
||||
displayedContent.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return displayedContent;
|
||||
}
|
||||
|
||||
public static FilenameFilter getTypeFilter(String[] extendArray) {
|
||||
final ArrayList<String> fileExtensions = new ArrayList<String>();
|
||||
for (int i = 0; i < extendArray.length; i++) {
|
||||
fileExtensions.add(extendArray[i]);
|
||||
}
|
||||
FilenameFilter fileNameFilter = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File directory, String fileName) {
|
||||
boolean matched = false;
|
||||
File f = new File(String.format("%s/%s",
|
||||
directory.getAbsolutePath(), fileName));
|
||||
matched = f.isDirectory();
|
||||
if (!matched) {
|
||||
for (String s : fileExtensions) {
|
||||
s = String.format(".{0,}\\%s$", s);
|
||||
s = s.toUpperCase(Locale.getDefault());
|
||||
fileName = fileName.toUpperCase(Locale.getDefault());
|
||||
matched = fileName.matches(s);
|
||||
if (matched) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
};
|
||||
return fileNameFilter;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.storage.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
// 这是共享参数的工具类,统一对共享参数的读写操作
|
||||
public class SharedUtil {
|
||||
private static SharedUtil mUtil; // 声明一个共享参数工具类的实例
|
||||
private static SharedPreferences mShared; // 声明一个共享参数的实例
|
||||
|
||||
// 通过单例模式获取共享参数工具类的唯一实例
|
||||
public static SharedUtil getIntance(Context ctx) {
|
||||
if (mUtil == null) {
|
||||
mUtil = new SharedUtil();
|
||||
}
|
||||
// 从share.xml中获取共享参数对象
|
||||
mShared = ctx.getSharedPreferences("share", Context.MODE_PRIVATE);
|
||||
return mUtil;
|
||||
}
|
||||
|
||||
// 把配对信息写入共享参数
|
||||
public void writeShared(String key, String value) {
|
||||
SharedPreferences.Editor editor = mShared.edit(); // 获得编辑器的对象
|
||||
editor.putString(key, value); // 添加一个指定键名的字符串参数
|
||||
editor.commit(); // 提交编辑器中的修改
|
||||
}
|
||||
|
||||
// 根据键名到共享参数中查找对应的值对象
|
||||
public String readShared(String key, String defaultValue) {
|
||||
return mShared.getString(key, defaultValue);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.example.storage.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Utils {
|
||||
// 根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
||||
public static int dip2px(Context context, float dpValue) {
|
||||
// 获取当前手机的像素密度
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f); // 四舍五入取整
|
||||
}
|
||||
|
||||
// 根据手机的分辨率从 px(像素) 的单位 转成为 dp
|
||||
public static int px2dip(Context context, float pxValue) {
|
||||
// 获取当前手机的像素密度
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (pxValue / scale + 0.5f); // 四舍五入取整
|
||||
}
|
||||
|
||||
// 获得屏幕的宽度
|
||||
public static int getScreenWidth(Context ctx) {
|
||||
// 从系统服务中获取窗口管理器
|
||||
WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
// 从默认显示器中获取显示参数保存到dm对象中
|
||||
wm.getDefaultDisplay().getMetrics(dm);
|
||||
return dm.widthPixels; // 返回屏幕的宽度数值
|
||||
}
|
||||
|
||||
// 获得屏幕的高度
|
||||
public static int getScreenHeight(Context ctx) {
|
||||
// 从系统服务中获取窗口管理器
|
||||
WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
// 从默认显示器中获取显示参数保存到dm对象中
|
||||
wm.getDefaultDisplay().getMetrics(dm);
|
||||
return dm.heightPixels; // 返回屏幕的高度数值
|
||||
}
|
||||
|
||||
// 获得屏幕的像素密度
|
||||
public static float getScreenDensity(Context ctx) {
|
||||
// 从系统服务中获取窗口管理器
|
||||
WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
// 从默认显示器中获取显示参数保存到dm对象中
|
||||
wm.getDefaultDisplay().getMetrics(dm);
|
||||
return dm.density; // 返回屏幕的像素密度数值
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.example.storage.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.InputFilter;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ViewUtil {
|
||||
|
||||
// 获取编辑框的最大长度,通过反射机制调用隐藏方法
|
||||
public static int getMaxLength(EditText et) {
|
||||
int length = 0;
|
||||
try {
|
||||
InputFilter[] inputFilters = et.getFilters();
|
||||
for (InputFilter filter : inputFilters) {
|
||||
Class<?> c = filter.getClass();
|
||||
if (c.getName().equals("android.text.InputFilter$LengthFilter")) {
|
||||
Field[] f = c.getDeclaredFields();
|
||||
for (Field field : f) {
|
||||
if (field.getName().equals("mMax")) {
|
||||
field.setAccessible(true);
|
||||
length = (Integer) field.get(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public static void hideAllInputMethod(Activity act) {
|
||||
// 从系统服务中获取输入法管理器
|
||||
InputMethodManager imm = (InputMethodManager) act.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm.isActive()) { // 软键盘如果已经打开则关闭之
|
||||
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideOneInputMethod(Activity act, View v) {
|
||||
// 从系统服务中获取输入法管理器
|
||||
InputMethodManager imm = (InputMethodManager) act.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
// 关闭屏幕上的输入法软键盘
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
}
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 120 B |
@ -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>
|
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 199 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 170 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 384 KiB |
After Width: | Height: | Size: 176 KiB |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:drawable="@drawable/check_choose"/>
|
||||
<item android:drawable="@drawable/check_unchoose"/>
|
||||
</selector>
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
|
||||
<stroke android:width="3dp" android:color="@color/green_500"/>
|
||||
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="true" android:drawable="@drawable/shape_edit_focus"/>
|
||||
<item android:drawable="@drawable/shape_edit_normal"/>
|
||||
</selector>
|
@ -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="#008577"
|
||||
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>
|
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 510 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 522 KiB |
After Width: | Height: | Size: 489 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 442 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 909 KiB |
After Width: | Height: | Size: 312 KiB |
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--默认情况下是一个带圆角,蓝色背景,白色边框的矩形-->
|
||||
<!--第二种方法-->
|
||||
<item android:state_window_focused="false">
|
||||
<shape android:shape="rectangle">
|
||||
<!--圆角-->
|
||||
<corners android:radius="5dp" />
|
||||
<!--填充颜色-->
|
||||
<solid android:color="@color/color_minefragment_top" />
|
||||
<!--描边-->
|
||||
<stroke android:width="1dp" android:color="#fff" />
|
||||
</shape>
|
||||
</item>
|
||||
<!--单击时是一个带圆角,绿色背景,白色边框的矩形-->
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!--圆角-->
|
||||
<corners android:radius="5dp" />
|
||||
<!--填充颜色-->
|
||||
<solid android:color="#008B8B" />
|
||||
<!--描边-->
|
||||
<stroke android:width="1dp" android:color="#fff" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<solid android:color="#ffffff" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#ff0000ff" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="5dp"
|
||||
android:bottomRightRadius="5dp"
|
||||
android:topLeftRadius="5dp"
|
||||
android:topRightRadius="5dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp" />
|
||||
|
||||
</shape>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<solid android:color="#ffffff" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#ffaaaaaa" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="5dp"
|
||||
android:bottomRightRadius="5dp"
|
||||
android:topLeftRadius="5dp"
|
||||
android:topRightRadius="5dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp" />
|
||||
|
||||
</shape>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval" >
|
||||
|
||||
<solid android:color="#ff6666" />
|
||||
|
||||
</shape>
|
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 355 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,202 @@
|
||||
<?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"
|
||||
android:background="@drawable/bg1"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_registeractivity_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/iv_registeractivity_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:background="@drawable/ic_left_back"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:clickable="true"
|
||||
android:onClick="onClick"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_register"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="注册"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20dp"
|
||||
android:layout_toRightOf="@+id/iv_registeractivity_back"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_myname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="230dp"
|
||||
android:layout_toRightOf="@+id/tv_registeractivity_register"
|
||||
android:text="咖啡"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_registeractivity_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_below="@+id/rl_registeractivity_top"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
>
|
||||
<!-- 第一个文本编辑框 输入用户名 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="30dp">
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="用户名:"/>
|
||||
<EditText
|
||||
android:id="@+id/et_registeractivity_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:hint="请输入用户名"
|
||||
android:textColor="@color/black"
|
||||
android:background="#E4E0E0"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<!-- 第二个文本编辑框 输入密码 -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_password1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="密 码:"/>
|
||||
<EditText
|
||||
android:id="@+id/et_registeractivity_password1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="#E4E0E0"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="textPassword"
|
||||
android:hint="请输入密码" />
|
||||
</LinearLayout>
|
||||
<!-- 第三个文本编辑框 再次输入密码 -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_password2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="密 码:"/>
|
||||
<EditText
|
||||
android:id="@+id/et_registeractivity_password2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:hint="请再次输入密码"
|
||||
android:textColor="@color/black"
|
||||
android:gravity="center_vertical"
|
||||
android:background="#E4E0E0"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:inputType="textPassword"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<!-- 验证码部分 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal" >
|
||||
<!-- 第四个文本编辑框 输入验证码 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_registeractivity_phoneCodes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="验证码:"/>
|
||||
<EditText
|
||||
android:id="@+id/et_registeractivity_phoneCodes"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="3"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="#E4E0E0"
|
||||
android:textColor="@color/black"
|
||||
android:hint="请输入4位验证码" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_registeractivity_showCode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_weight="1.5"
|
||||
android:clickable="true"
|
||||
android:onClick="onClick"
|
||||
android:layout_marginTop="-10dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- 注册按钮 -->
|
||||
<Button
|
||||
android:id="@+id/bt_registeractivity_register"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/selector_loginactivity_button"
|
||||
android:textColor="#fff"
|
||||
android:text="注册"
|
||||
android:onClick="onClick"
|
||||
android:layout_marginTop="40dp"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/rl_registeractivity_bottom"
|
||||
android:layout_marginTop="10dp"
|
||||
>
|
||||
<TextView
|
||||
android:layout_centerInParent="true"
|
||||
android:text="注册即代表同意《用户协议》"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,93 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg5"
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/activity_shopping_title"/>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_cart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:orientation="vertical">
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|right"
|
||||
android:text="总金额:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_total_price"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center|left"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="25sp"/>
|
||||
<Button
|
||||
android:id="@+id/btn_settle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="结算"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:gravity="center"
|
||||
android:text="哎呀,购物车空空如也,快去选购商品吧"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp"/>
|
||||
<Button
|
||||
android:id="@+id/btn_shopping_channel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="盲盒咖啡店"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp"/>
|
||||
<Button
|
||||
android:id="@+id/btn_shopping_grzx"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="去个人中心"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
@ -0,0 +1,23 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg5"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/activity_shopping_title" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_channel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:orientation="vertical" >
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,51 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg5"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/activity_shopping_title" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_goods_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add_cart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="加入购物车"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,50 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/bule"
|
||||
>
|
||||
<ImageView android:id="@+id/iv_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/menu"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="购 物 车"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_cart"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/cart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_count"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/iv_cart"
|
||||
android:layout_marginLeft="-20dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_oval_red"
|
||||
android:text="0"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,211 @@
|
||||
<?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:gravity="center"
|
||||
android:background="@drawable/bg1"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/daifukuan" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dfk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="待付款"
|
||||
android:textColor="#050505"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/daishouhuo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dfh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="待发货"
|
||||
android:textColor="#050505"
|
||||
android:textSize="20sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/pingjia" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="待评价"
|
||||
android:textColor="#050505"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/shouhou" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="售后"
|
||||
android:textColor="#050505"
|
||||
android:textSize="20sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="4"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="收货地址"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="账户和安全"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="支付"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button8"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="消息通知"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button9"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="隐私"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:backgroundTint="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:text="通用"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
tools:background="f39ad2"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_tuichu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="30dp"
|
||||
android:layout_weight="1"
|
||||
android:text="退出登录"
|
||||
android:textSize="20sp"
|
||||
android:onClick="Jumping"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,19 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_shopping"
|
||||
android:orderInCategory="1"
|
||||
android:title="去商场购物"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_clear"
|
||||
android:orderInCategory="2"
|
||||
android:title="清空购物车"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_return"
|
||||
android:orderInCategory="9"
|
||||
android:title="返回"/>
|
||||
|
||||
</menu>
|
@ -0,0 +1,13 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_detail"
|
||||
android:orderInCategory="1"
|
||||
android:title="查看商品详情"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete"
|
||||
android:orderInCategory="2"
|
||||
android:title="从购物车删除"/>
|
||||
|
||||
</menu>
|
@ -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>
|