橙一色底部导航栏设计

master
tc 3 years ago
parent 5df39e67f1
commit 2fee0df2dc

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.orangesale_0401">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.RegisterActivity"></activity>
<activity android:name=".activity.UserActivity" />
<activity android:name=".activity.CategoryActivity" />
<activity android:name=".activity.IndexActivity" />
</application>
</manifest>

@ -0,0 +1,79 @@
package com.example.orangesale_0401;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.orangesale_0401.activity.CategoryActivity;
import com.example.orangesale_0401.activity.IndexActivity;
import com.example.orangesale_0401.activity.RegisterActivity;
import com.example.orangesale_0401.activity.UserActivity;
import com.example.orangesale_0401.dataoperation.OrangeDatabase;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button registerButton, loginButton;
private EditText usernameText, paswdEdit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_login);
init();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.register:
Intent intent = new Intent(MainActivity.this, RegisterActivity.class);
startActivity(intent);
break;
case R.id.login:
//注册时,我们引入了数据库,登录这里可以通过数据库进行验证,验证跳转到首页,不通过进行提示
if (validateLogin()) {
Intent intent1 = new Intent(MainActivity.this, IndexActivity.class);
Bundle bundle = new Bundle();
OrangeDatabase orangeDatabase = new OrangeDatabase(MainActivity.this);
bundle.putString("username", usernameText.getText().toString());
bundle = orangeDatabase.queryUserInfo(orangeDatabase.getReadableDatabase(), bundle);
intent1.putExtras(bundle);
startActivity(intent1);
} else {
Toast.makeText(MainActivity.this, "账号或者密码错误", Toast.LENGTH_SHORT).show();
}
break;
}
}
//界面组件初始化
private void init() {
usernameText = findViewById(R.id.username);
paswdEdit = findViewById(R.id.password);
loginButton = findViewById(R.id.login);
loginButton.setOnClickListener(this);
registerButton = findViewById(R.id.register);
registerButton.setOnClickListener(this);
}
private boolean validateLogin() {
String username = usernameText.getText().toString();
String password = paswdEdit.getText().toString();
OrangeDatabase orangeDatabase = new OrangeDatabase(MainActivity.this);
SQLiteDatabase sqLiteDatabase = orangeDatabase.getReadableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery("select * from orange_user where username=? and password=?", new String[]{username, password});
if (cursor.getCount() > 0) {
return true;
}
return false;
}
}

@ -0,0 +1,190 @@
package com.example.orangesale_0401.activity;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.adapter.Adapter;
import com.example.orangesale_0401.entity.Product;
import com.example.orangesale_0401.fragment.SetDetailFragment;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class CategoryActivity extends Activity {
public OnChangeListener onchangedListener;
private List<Product> productList;
private List<String> productCategory = new ArrayList<>();
private ListView titleList;
private Adapter adapter;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_category);
initData();
init();
SetDetailFragment fragment = new SetDetailFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.category_detail, fragment);
transaction.commit();
/* titleList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.setSelectedPosition(position);
adapter.notifyDataSetInvalidated();
if (onchangedListener != null) {
onchangedListener.changeText(productList.get(position));
}
}
});*/
titleList.setOnItemClickListener((parent, view, position, id) -> {
adapter.setSelectedPosition(position);
adapter.notifyDataSetInvalidated();
if (onchangedListener != null) {
onchangedListener.changeText(productList.get(position));
}
});
}
public void setOnChangeListener(OnChangeListener onChangeListener) {
this.onchangedListener = onChangeListener;
}
public interface OnChangeListener {
void changeText(Product product);
}
/**
*
*/
private void initData() {
productList = new ArrayList<>();
productCategory.add("菠萝");
productCategory.add("草莓");
productCategory.add("橙子");
productCategory.add("火龙果");
productCategory.add("榴莲");
productCategory.add("蓝莓");
productCategory.add("猕猴桃");
productCategory.add("牛油果");
productCategory.add("柿子");
productCategory.add("西瓜");
productCategory.add("香蕉");
Product product = new Product();
product.setImageUrlId(R.drawable.bl);
product.setProductName("菠萝");
product.setProductPrice(new BigDecimal("9.9"));
product.setProductBrief("凤梨,是凤梨科凤梨属的一种陆生草本植物,其茎部较短;叶多数,有莲座般的外观,形状为剑形,生于花序顶部的叶变小,常呈红色;花瓣长椭圆形,端尖,上部紫红色,下部白色;花期夏季至冬季。 [7] 据《台湾府志》记载:“果生于叶丛中,果皮似菠萝蜜而色黄,液甜而酸,因尖端有绿叶似凤尾,故名凤梨。”\n" +
"凤梨原产南美洲热带地18世纪初传遍欧洲各国中国引种栽培凤梨植物已有300年悠久历史。 [8] 大部分凤梨喜阳、耐旱、喜高温、高湿的环境,夏季喜凉爽、通风。凤梨用种子繁殖、无性繁殖和分株繁殖。 [9] \n" +
"凤梨滋味香甜可口,富含维生素。凤梨除供制造食品罐头以外,还可以作菜肴,果汁可以制糖、酿酒或制醋,残渣可以作为肥料或家畜的饲料。而且叶片坚实耐久,农民称为“波罗麻”,从前农民用来织布,凉爽耐用,也可利用为制结和造纸的原料。");
Product product1 = new Product();
product1.setImageUrlId(R.drawable.cm);
product1.setProductName("草莓");
product1.setProductBrief("草莓学名Fragaria × ananassa Duch.是蔷薇科草莓属多年生草本植物。草莓根系较浅茎可根分为新茎、根状茎和匍匐茎。草莓叶为基生三出复叶具长叶柄花绝大多数为两性花花序为有限聚伞花序。草莓的果实由花托膨大发育而成果实生长曲线呈典型的S形。草莓种子是受精后的子房膨大形成的瘦果附着在膨大花托的表面。 [6] \n" +
"野生草莓起源于欧洲、美洲和亚洲现代大果型栽培草莓则起源于法国。1915年中国最早引入的现代草莓是俄罗斯侨民自莫斯科引入黑龙江亮子坡种植的“维多利亚”品种。中国范围内均有草莓的商业化生产其草莓栽培面积和产量均居世界第一位。草莓根系较浅具有喜光耐阴、喜水怕涝等特点。 [6] \n" +
"草莓具有较高的营养价值、医疗价值和生态价值。草莓浆果芳香多汁,营养丰富,素有“水果皇后”的美称,又是果树中上市最早的鲜果,素有“早春第一果”的美称。草莓含有较高的维生素、钙、磷、铁等营养物质, [6] 且草莓中含有众多活性物质,可清凉止渴,健胃消食的功效,具有一定的医疗价值,在书籍如《台湾药用植物志》有体现。 [7] 草莓也可作为观赏、绿化植物,已成为中国西部地区农民脱贫致富的首选作物。");
product1.setProductPrice(new BigDecimal("29.9"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.cz);
product2.setProductName("橙子");
product2.setProductBrief("橙子学名Citrus sinensis 英语orange是芸香科柑橘属植物橙树的果实亦称为黄果、柑子、金环、柳丁。\n" +
"橙树属小乔木。果实可以剥皮鲜食其果肉,果肉可以用作其他食物的调料或附加物。");
product2.setProductPrice(new BigDecimal("19.9"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.hlg);
product3.setProductName("火龙果");
product3.setProductBrief("火龙果,仙人掌科量天尺属攀援肉质灌木的果实,其分枝多数呈边缘波状或圆齿状,颜色为深绿色至淡蓝绿色;无毛,骨质;刺锥形;浆果为红色长球形,果脐小,果肉呈现白色;种子是黑色倒卵形, [5] 花期是夏季和秋季。因为它拥有红色的外衣,外衣上的突起像是火焰,也让人想起龙鳞,故取名火龙果。 [6] \n" +
"火龙果分布中美洲至南美洲北部世界各地广泛栽培在夏威夷、澳大利亚东部逸为野生中国于1645年引种各地常见栽培在福建、广东、海南、台湾以及广西逸为野生藉气根攀援于树干、岩石或墙上常生于海拔3—300米。 [5] 火龙果喜光耐阴,耐热耐旱,喜肥耐瘠, [7] 适于生长在热带区域, [8] 其繁殖方法为扦插法。 [5] \n" +
"火龙果分为白色和红色,白色口感一般,红色较甜。据古籍《普济方》记载,火龙果营养丰富,有预防便秘、促进眼睛保健、降血糖、降血脂、降血压的作用,因为含有一种特殊的成分——花青素,它还具有促进肠胃消化、预防贫血、美白皮肤防黑斑的功效。火龙果集水果、花卉、蔬菜、保健、医药于一体。 [9-10] 火龙果不仅是“花果兼赏,赏食兼用”的园林绿化植物,有很大的观赏价值,还是亚热带、热带水果之一。");
product3.setProductPrice(new BigDecimal("29.9"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.ll);
product4.setProductName("榴莲");
product4.setProductBrief("榴梿学名Durio zibethinus也做“榴莲”。是一种锦葵目、锦葵科 [11] 巨型的热带常绿乔木,叶片长圆,顶端较尖,聚伞花序,花色淡黄,果实足球大小,果皮坚实,密生三角形刺,果肉是由假种皮的肉包组成,肉色淡黄,粘性多汁,是一种极具经济价值的水果。\n" +
"榴梿是热带著名水果之一,原产马来西亚。东南亚一些国家种植较多, 其中以泰国种植最多。中国广东﹑海南也有种植。榴梿在泰国负有盛名,被誉为“水果之王”。它的气味浓烈、爱之者赞其香,厌之者怨其臭。\n" +
"有个附会传说,中国古代明朝的时期,航海舰队到达今东南亚,品尝当地特产果实时,郑和对这种水果大为赞赏,然而果实只能一年一熟,故命名留恋,后人取其谐音,称作榴梿。");
product4.setProductPrice(new BigDecimal("19.9"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lm);
product5.setProductName("蓝莓");
product5.setProductBrief("蓝莓是杜鹃花科、越橘属的落叶灌木,小枝绿色,具棱或圆柱形,通常具成行的柔毛;叶片近革质,卵形至椭圆形,先端急尖,基部樱形至近圆形,边缘具锯齿至全缘,暗绿色,上面无毛,下面有毛;总状花序,生于去年生枝上,花尊绿色,无毛;花冠白色到粉红色,近圆筒形;花丝通常具柔毛。浆果圆球形,暗蓝色,无毛,被白粉; [26] 花期6~7月果期8~9月。 [27] 蓝莓的名称源自英语“blueberry”的直译意为蓝色浆果。\n" +
"蓝莓原产于加拿大东部和美国东部及南部,在日本、中国、新西兰及欧洲等地都有引种。 [28] 蓝莓喜温暖气候,较耐高温,喜半日照环境、喜湿润环境、耐旱及耐涝性均一般,宜用肥沃疏松、富含有机质的酸性土壤种植。 [29] 蓝莓的繁殖方式主要以插条或扦插。 [30] \n" +
"蓝莓的味道酸甜可口,含有丰富的营养成分、具有防止脑神经老化、保护视力、强心、抗癌、软化血管、增强人体免疫功能。 [31] 蓝莓作为一种具有较高经济价值和广阔开发前景的小浆果树种在英国权威营养学家列出的全球15种健康食品中居于首位并在2017年国际粮农组织列为人类五大健康食品之一被誉为“浆果之王”。");
product5.setProductPrice(new BigDecimal("19.9"));
Product product6 = new Product();
product6.setImageUrlId(R.drawable.mht);
product6.setProductName("猕猴桃");
product6.setProductBrief("中华猕猴桃是猕猴桃科猕猴桃属的多年生木本植物幼枝有白色绒毛叶纸质呈倒阔卵形聚伞花序花片小卵形果黄褐色球形或倒卵形花期4-5月果期8-10月。 [13] “猕猴桃”最早由李时珍命名:“其形如梨,其色如桃,而猕猴喜食,故有诸名。”又因各地都是从中国引种的,所以中外统称“中华猕猴桃”。 [14] \n" +
"中华猕猴桃原产于中国,现分布于中国长江流域的各省区。中华猕猴桃喜光但怕暴晒,喜温暖湿润的环境,不耐涝,多在背风向阳环境,一般多出现于高草灌丛、灌木林或次生疏林中,喜欢土层深厚、腐植质丰富、排水良好的土壤。中华猕猴桃的繁殖方式包括嫁接繁殖、扦插繁殖、压条繁殖及播种繁殖。 [15] \n" +
"《本草纲目》中记载中华猕猴桃果实:“止暴渴,解烦热,压丹石,下石淋。” [21] 它的整个植株均可用药,具有活血化瘀、清热解毒、利湿驱风的功效。 [16] 中华猕猴桃的口感甜酸可口,含有丰富的维生素C、氨基酸和多种矿物质,可加工成各种食品和饮料,具有滋补强身等功效,享有“世界珍果”之美称。 [17] 中国猕猴桃的产量及栽种面积均居世界第一位,中华猕猴桃果实是猕猴桃属中最大的一种,也是同属中经济价值较高的一种。");
product6.setProductPrice(new BigDecimal("19.9"));
Product product7 = new Product();
product7.setImageUrlId(R.drawable.nyg);
product7.setProductName("牛油果");
product7.setProductBrief("鳄梨樟科鳄梨属的常绿乔木株高达10米树皮灰绿色呈长椭圆形、卵形或倒卵形前端骤尖基部稍圆幼叶覆盖有黄褐色柔毛上疏下密老时上面无毛下面有稀疏柔毛花序长8—14厘米花序梗覆盖有黄褐色柔毛果呈梨形或球形为黄绿或红褐色外果皮木栓质中果皮肉质花期2—3月果期8—9月。鳄梨的外果皮凹凸不平非常粗糙像鳄鱼的表皮由此而得名。 [9-10] \n" +
"鳄梨原产哥伦比亚、厄瓜多尔至墨西哥南部一带现主要分布在南纬30°至北纬30°的热带、亚热带地区在中国云南、广东、广西、台湾等省区均有栽培。鳄梨喜光幼树较耐阴喜温暖至高温、多湿耐干旱。鳄梨繁殖方式主要是播种繁殖。 [11-12] \n" +
"鳄梨树的多个部位在草药医学中有一定的用处叶和皮可助消化治咳嗽果实营养丰富营养价值很高危地马拉居民用鳄梨果汁来刺激头发生长用果皮驱虫用种子治腹泻。鳄梨果仁含油量较高乳化后可长久保存除食用外还可作高级化妆品、机械润滑和医药上的润肤用油及软膏原料。据联合国粮农组织统计2000年全世界鳄梨产量已达2336万吨以上在水果生产中已跃居第11位栽培国家已有30多个由于其营养丰富世界各地栽培面积逐年增加成为热带、亚热带很有发展前景的新兴果品。");
product7.setProductPrice(new BigDecimal("19.9"));
Product product8 = new Product();
product8.setImageUrlId(R.drawable.sz);
product8.setProductName("柿子");
product8.setProductBrief("柿是柿科柿属乔木植物。其叶呈椭圆形或近圆形新叶稀疏且有柔毛老叶上面是深绿色有光泽下面绿色有柔毛或无毛花雌雄蕊异株稀雄株有少数雌花雌株有少数雄花果形多种有球形扁球形果肉较脆硬老熟时果肉变成柔软多汁呈橙红色或大红色等。柿花期5-6月果9-10月。 [3] \n" +
"柿子原产于中国长江流域,现在各省、区多有栽培,同时朝鲜、日本、法国、苏联、美国等国均有栽培。柿子喜温暖气候,充足阳光和深厚、肥沃、湿润、排水良好的土壤,适中性土壤,较能耐寒,较能耐瘠薄,抗旱性强,但不耐盐碱土。柿树的繁殖主要用嫁接法;通常用栽培的柿子或野柿作砧木。 [3] \n" +
"柿子最早记载见于《礼记》,《本草纲目》《本草再新》中记载:“可入心肺、大肠经,”是中国传统的药食兼用的药材。柿可清热解毒,润肺止咳,消肿软坚,健脾益气,养胃和中,涩肠止血。 [15] 在绿化方面柿树寿命长可达300年以上叶大荫浓秋末冬初霜叶染成红色冬月落叶后柿实殷红不落一树满挂累累红果增添优美景色是优良的风景树。 [3] 果实常经脱涩后作水果,经过适当处理,可贮存数月,柿子亦可加工制成柿饼,将柿饼上的白霜扫下,可作为白糖的代用品。");
product8.setProductPrice(new BigDecimal("19.9"));
Product product9 = new Product();
product9.setImageUrlId(R.drawable.xg);
product9.setProductName("西瓜");
product9.setProductBrief("西瓜,是葫芦科西瓜属一年生蔓生藤本植物 [26] 形态一般近似于球形或椭圆形颜色有深绿、浅绿或带有黑绿条带或斑纹瓜籽多为黑色呈椭圆形头尖茎枝粗壮有淡黄褐色的柔毛叶片如纸呈三角状卵形边缘呈波状。花果期5—6月。 [27] 因9世纪自西域传入中国故名西瓜。 [28] \n" +
"西瓜的原产地是在非洲热带的干旱沙漠地带,主要种植在热带地区, [29] 在南疆和中亚地区已有1000多年的栽培历史。 [28] 西瓜喜温暖干燥的气候,不耐寒,耐旱、不耐湿,喜光照,需肥量大,以土质疏松、土层深厚、排水良好的砂质土最佳, [30] 繁殖方式有嫁接繁殖和种子繁殖,主要是通过种子繁殖,借助外力者或人工栽培,就会长出新的西瓜苗。 [31] \n" +
"《日用本草》记载西瓜富含多种维生素,具有平衡血压、调节心脏功能的作用。 [32] 西瓜号称夏季瓜果之王,“夏日吃西瓜,药物不用抓”,民间这句俗语反映了西瓜的药用价值。 [28] 史料记载:西瓜在明清时被列为太庙果品之首,人们把西瓜叫做“贡瓜”。清朝南苑辟有瓜园,慈禧、嘉靖皇帝爱吃西瓜,皇帝为此令人专门给他开辟了一个小瓜园。 [33] 王祯在《农书》中说西瓜“食之如醍醐灌顶,甘露沁心”,表达了西瓜清爽解渴、甘甜润肺的价值。");
product9.setProductPrice(new BigDecimal("19.9"));
Product product10 = new Product();
product10.setImageUrlId(R.drawable.xj);
product10.setProductName("香蕉");
product10.setProductBrief("香蕉,芭蕉科芭蕉属一年生草本植物,植株丛生,有匐匍茎;假茎浓绿有黑色斑点;叶片长圆形,上面为深绿色,无白粉,下面浅绿色;花朵为乳白色或淡紫色;果实呈弯曲的弓状,有棱,果皮为青绿色,成熟后变黄;果肉松软,黄白色,味甜香味浓,无种子。 [23] \n" +
"香蕉原产印度在中国有2000多年的历史19世纪初传入中美洲中美洲是当今世界主要的香蕉产区南美洲的厄瓜多尔有“香蕉国”之称。中国香蕉的主产地分布在两广、福建、台湾等地优良品种有广东和福建的“龙牙蕉”“香牙蕉”以及台湾的“北蕉”等。 [24] 香蕉喜温暖、湿润的环境,喜光照、耐热不耐寒,要求土层深厚、疏松肥沃、排水良好的微酸性土壤。 [25] 种子逐渐退化,单性结实,没有种子的香蕉,把叶子、枝条等营养器官插在土壤里,用托插、压条等方法进行繁殖。 [26] \n" +
"香蕉在中国历代本草书籍中均有记载,如《日用本草》中记载了香蕉具有治疗热病烦渴、肺燥咳嗽、便秘、痔疮的药用价值。 [27] 同时,香蕉为世界四大水果之一,产量高分布广、果肉营养丰富、香甜软糯, [28] 而且香蕉具有很高的经济价值,除了供应中国国内市场外,香蕉在国际水果进出口贸易中占据重要地位。");
product10.setProductPrice(new BigDecimal("19.9"));
productList.add(product);
productList.add(product1);
productList.add(product2);
productList.add(product3);
productList.add(product4);
productList.add(product5);
productList.add(product6);
productList.add(product7);
productList.add(product8);
productList.add(product9);
productList.add(product10);
}
/**
*
*/
private void init() {
titleList = findViewById(R.id.category_title_list);
adapter = new Adapter(productCategory, CategoryActivity.this);
titleList.setAdapter(adapter);
}
}

@ -0,0 +1,127 @@
package com.example.orangesale_0401.activity;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.fragment.IndexFragment;
import com.example.orangesale_0401.fragment.PearsonFragment;
import com.example.orangesale_0401.fragment.ProductFragment;
import com.example.orangesale_0401.fragment.ShoppingCartFragment;
public class IndexActivity extends Activity implements View.OnClickListener {
private IndexFragment indexFragment;
private ProductFragment productFragment;
private ShoppingCartFragment shoppingCartFragment;
private PearsonFragment pearsonFragment;
private LinearLayout indexLine, productLine, shoppingCartLine, pearsonLine;
private Bundle savedInstanceState1;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
initIndexFragment();
}
/**
*
*/
private void init() {
indexLine = findViewById(R.id.content_index);
indexLine.setOnClickListener(this);
productLine = findViewById(R.id.content_product);
productLine.setOnClickListener(this);
shoppingCartLine = findViewById(R.id.content_cart);
shoppingCartLine.setOnClickListener(this);
pearsonLine = findViewById(R.id.content_pearson);
pearsonLine.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.content_index:
initIndexFragment();
break;
case R.id.content_product:
initproductFragment();
break;
case R.id.content_cart:
initshoppingCartFragment();
break;
case R.id.content_pearson:
initpearsonFragment();
break;
}
}
/**
* Fragment
*/
private void initIndexFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (indexFragment == null) {
indexFragment = new IndexFragment();
}
transaction.replace(R.id.main_content, indexFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initproductFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (productFragment == null) {
productFragment = new ProductFragment();
}
transaction.replace(R.id.main_content, productFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initshoppingCartFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (shoppingCartFragment == null) {
shoppingCartFragment = new ShoppingCartFragment();
}
transaction.replace(R.id.main_content, shoppingCartFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initpearsonFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (pearsonFragment == null) {
Intent intent = IndexActivity.this.getIntent();
Bundle bundle = intent.getExtras();
pearsonFragment = new PearsonFragment();
pearsonFragment.setArguments(bundle);
}
transaction.replace(R.id.main_content, pearsonFragment);
transaction.commit();
}
}

@ -0,0 +1,175 @@
package com.example.orangesale_0401.activity;
import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.orangesale_0401.MainActivity;
import com.example.orangesale_0401.dataoperation.OrangeDatabase;
import com.lljjcoder.citypickerview.widget.CityPicker;
import com.example.orangesale_0401.R;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
private EditText usernameEdit, passwordEdit, surePasswordEdit,phoneEdit,ageEdit;
private TextView cityText;
private CityPicker cityPicker;
private Button regButton;
private RadioGroup sexGroup;
private String sexStr="女";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_register);
init();
}
/**
*
*/
private void init() {
cityText = findViewById(R.id.reg_province);
cityText.setOnClickListener(this);
phoneEdit = findViewById(R.id.reg_phone);
ageEdit = findViewById(R.id.reg_age);
usernameEdit = findViewById(R.id.reg_username);
passwordEdit = findViewById(R.id.reg_password);
surePasswordEdit = findViewById(R.id.reg_sure_password);
regButton = findViewById(R.id.reg_register);
regButton.setOnClickListener(this);
sexGroup = findViewById(R.id.sex);
sexGroup.setOnCheckedChangeListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.reg_province:
initCityPicker();
cityPicker.show();
break;
case R.id.reg_register:
//注册验证方法
validateRegister();
break;
}
}
/**
*
*/
public void initCityPicker() {
cityPicker = new CityPicker.Builder(RegisterActivity.this)
.textSize(16)
.title("地址选择")
.backgroundPop(0xa0000000)
.titleBackgroundColor("#EFB81C")
.titleTextColor("#000000")
.backgroundPop(0xa0000000)
.confirTextColor("#000000")
.cancelTextColor("#000000")
.province("湖南省")
.city("常德市")
.district("武陵区")
.textColor(Color.parseColor("#000000"))
.provinceCyclic(true)
.cityCyclic(false)
.districtCyclic(false)
.visibleItemsCount(7)
.itemPadding(10)
.onlyShowProvinceAndCity(false)
.build();
cityPicker.setOnCityItemClickListener(new CityPicker.OnCityItemClickListener() {
@Override
public void onSelected(String... strings) {
String province = strings[0];
String city = strings[1];
String district = strings[2];
cityText.setText(String.format("%s %s %s", province, city, district));
}
@Override
public void onCancel() {
}
});
}
/**
*
*/
public void validateRegister() {
//Intent intent = new Intent(RegisterActivity.this, UserActivity.class);
String phone = phoneEdit.getText().toString();
String age = ageEdit.getText().toString();
String username = usernameEdit.getText().toString();
String password = passwordEdit.getText().toString();
String surePassword = surePasswordEdit.getText().toString();
String city = cityText.getText().toString();
//判断两次密码是否输入一致
if (password.equals(surePassword)) {
//这里也可以再进行其它的验证,如是否符合要求等,符合就进行插入数据库操作
if (!username.equals("") || !password.equals("")) {
if (!city.equals("")) {
Bundle bundle = new Bundle();
bundle.putString("phone", phone);
bundle.putString("age", age);
bundle.putString("username", username);
bundle.putString("password", password);
bundle.putString("sex", sexStr);
bundle.putString("city", city);
//本节将使用安卓自身带的SQLite数据库的方式存储注册的信息之前直接传输显示在界面是的方式
OrangeDatabase orangeDatabase = new OrangeDatabase(RegisterActivity.this);
SQLiteDatabase sqLiteDatabase = orangeDatabase.getWritableDatabase();
insertData(sqLiteDatabase,bundle);
Intent intent = new Intent(RegisterActivity.this, IndexActivity.class);
intent.putExtras(bundle);
startActivity(intent);
} else {
Toast.makeText(RegisterActivity.this, "请选择地址", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(RegisterActivity.this, "账号或密码未填写", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(RegisterActivity.this, "两次密码输入不一致", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
//根据用户选择来改变sex的值
sexStr = checkedId == R.id.reg_man ? "女" : "男";
}
private void insertData(SQLiteDatabase sqLiteDatabase, Bundle bundle) {
ContentValues contentValues = new ContentValues();
contentValues.put("phone", bundle.getString("phone"));
contentValues.put("age", bundle.getString("age"));
contentValues.put("username", bundle.getString("username"));
contentValues.put("password", bundle.getString("password"));
contentValues.put("sex", bundle.getString("sex"));
contentValues.put("city", bundle.getString("city"));
sqLiteDatabase.insert("orange_user", null, contentValues);
sqLiteDatabase.close();
}
}

@ -0,0 +1,72 @@
package com.example.orangesale_0401.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
public class UserActivity extends Activity implements View.OnClickListener {
private ImageView userIconImage;
private TextView userPhoneText, userAgeText, usernameText, userSexText, userCityText;
private LinearLayout userPhoneLine, userAgeLine, usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine, userSearchProductLine;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_user);
init();
}
/**
*
*/
private void init() {
userIconImage = findViewById(R.id.user_icon);
userPhoneText = findViewById(R.id.user_phone);
userAgeText = findViewById(R.id.user_age);
usernameText = findViewById(R.id.user_username);
userSexText = findViewById(R.id.user_sex);
userCityText = findViewById(R.id.user_city);
// userPhoneLine = findViewById(R.id.user_phone_line);
// userAgeLine = findViewById(R.id.user_age_line);
usernameLine = findViewById(R.id.user_username_line);
userSexline = findViewById(R.id.user_sex_line);
userCityLine = findViewById(R.id.user_city_line);
userPayLine = findViewById(R.id.user_pay);
userSettingLine = findViewById(R.id.user_setting);
userGeneralLine = findViewById(R.id.user_general);
userSearchProductLine = findViewById(R.id.user_searchProduct);
userSearchProductLine.setOnClickListener(this);
setData();
}
/**
*
*/
private void setData() {
Intent intent = UserActivity.this.getIntent();
Bundle bundle = intent.getExtras();
userPhoneText.setText(String.format("手机号码:%s", bundle.getString("phone")));
userAgeText.setText(String.format("年龄:%s", bundle.getString("age")));
usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
userSexText.setText(String.format("性别:%s", bundle.getString("sex")));
userCityText.setText(String.format("城市:%s", bundle.getString("city")));
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.user_searchProduct:
Intent intent1 = new Intent(UserActivity.this, CategoryActivity.class);
startActivity(intent1);
break;
}
}
}

@ -0,0 +1,69 @@
package com.example.orangesale_0401.adapter;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.orangesale_0401.R;
import java.util.List;
public class Adapter extends BaseAdapter {
private List<String> productCategory;
private LayoutInflater layoutInflater;
private int selectionPosition = -1;
public Adapter(List<String> productCategory, Context context) {
this.productCategory = productCategory;
this.layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return productCategory.size();
}
@Override
public Object getItem(int position) {
return productCategory.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = layoutInflater.inflate(R.layout.category_list_item, null);
Log.i("adapts", "getView: " + convertView);
viewHolder.tv = convertView.findViewById(R.id.categor_titles);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.tv.setText(productCategory.get(position));
if (selectionPosition == position) {
viewHolder.tv.setBackgroundColor(Color.YELLOW);
} else {
viewHolder.tv.setBackgroundColor(Color.WHITE);
}
return convertView;
}
public void setSelectedPosition(int position) {
this.selectionPosition = position;
}
class ViewHolder {
TextView tv;
}
}

@ -0,0 +1,68 @@
package com.example.orangesale_0401.adapter;
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.ImageView;
import android.widget.TextView;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.entity.Product;
import java.util.List;
public class ProductAdapter extends BaseAdapter {
private List<Product> productList;
private LayoutInflater layoutInflater;
public ProductAdapter(Context context, List<Product> productList) {
this.productList = productList;
this.layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return productList.size();
}
@Override
public Object getItem(int position) {
return productList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.categoty_detail_content, null);
viewHolder = new ViewHolder();
viewHolder.productImage = convertView.findViewById(R.id.category_product_image);
viewHolder.productName = convertView.findViewById(R.id.category_product_name);
viewHolder.productPrice = convertView.findViewById(R.id.category_product_price);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Product product = productList.get(position);
Log.i("product", "getView: "+product.toString());
if (product != null) {
viewHolder.productImage.setBackgroundResource(product.getImageUrlId());
viewHolder.productName.setText(product.getProductName());
viewHolder.productPrice.setText(String.valueOf(product.getProductPrice()));
}
return convertView;
}
class ViewHolder {
ImageView productImage;
TextView productName, productPrice;
}
}

@ -0,0 +1,72 @@
package com.example.orangesale_0401.dataoperation;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import androidx.annotation.Nullable;
public class OrangeDatabase extends SQLiteOpenHelper {
public OrangeDatabase(@Nullable Context context) {
super(context, "orange.db3", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建用户表
String sql = "create table orange_user(id integer primary key autoincrement, phone varchar(50),age varchar(50),username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
/**
*
*
* @param sqLiteDatabase
* @param username
* @param password
* @param sex
* @param city
*/
public void insertUser(SQLiteDatabase sqLiteDatabase, String age, String phone, String username, String password, String sex, String city) {
ContentValues contentValues = new ContentValues();
contentValues.put("phone", phone);
contentValues.put("age", age);
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("sex", sex);
contentValues.put("city", city);
sqLiteDatabase.insert("orange_user", null, contentValues);
sqLiteDatabase.close();
}
/**
*
*
* @param sqLiteDatabase
* @param bundle
* @return
*/
public Bundle queryUserInfo(SQLiteDatabase sqLiteDatabase, Bundle bundle) {
String username = bundle.getString("username");
Cursor cursor = sqLiteDatabase.rawQuery("select * from orange_user where username=?", new String[]{username});
if (cursor != null) {
while (cursor.moveToNext()) {
bundle.putString("phone", cursor.getString(1));
bundle.putString("age", cursor.getString(2));
bundle.putString("sex", cursor.getString(5));
bundle.putString("city", cursor.getString(6));
}
}
cursor.close();
sqLiteDatabase.close();
return bundle;
}
}

@ -0,0 +1,79 @@
package com.example.orangesale_0401.entity;
public class OrangeUser {
private Integer id;
private String phone;
private String age;
private String username;
private String password;
private String sex;
private String city;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
@Override
public String toString() {
return "OrangeUser{" +
"phone='" + phone + '\'' +
"age='" + age + '\'' +
"username='" + username + '\'' +
", password='" + password + '\'' +
", sex='" + sex + '\'' +
", city='" + city + '\'' +
'}';
}
}

@ -0,0 +1,44 @@
package com.example.orangesale_0401.entity;
import java.math.BigDecimal;
public class Product {
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public BigDecimal getProductPrice() {
return productPrice;
}
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public Integer getImageUrlId() {
return imageUrlId;
}
public void setImageUrlId(Integer imageUrlId) {
this.imageUrlId = imageUrlId;
}
public String getProductBrief() {
return productBrief;
}
public void setProductBrief(String productBrief) {
this.productBrief = productBrief;
}
private Integer imageUrlId;
private String productName;
private BigDecimal productPrice;
private String productBrief;
}

@ -0,0 +1,113 @@
package com.example.orangesale_0401.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.adapter.ProductAdapter;
import com.example.orangesale_0401.entity.Product;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class IndexFragment extends Fragment implements View.OnClickListener {
private SearchView searchView;
private LinearLayout orangeLine, youziLine, juziLine, xiguaLine, liLine, appleLine, lemonLine, mangguoLine;
private GridView gridView;
private List<Product> productList;
private ProductAdapter productAdapter;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_index, container, false);
init(view);
return view;
}
/**
*
*/
private void init(View view) {
searchView = view.findViewById(R.id.searchView);
searchView.setOnClickListener(this);
orangeLine = view.findViewById(R.id.chengzi);
orangeLine.setOnClickListener(this);
youziLine = view.findViewById(R.id.youzi);
youziLine.setOnClickListener(this);
juziLine = view.findViewById(R.id.juzi);
juziLine.setOnClickListener(this);
xiguaLine = view.findViewById(R.id.xigua);
xiguaLine.setOnClickListener(this);
liLine = view.findViewById(R.id.li);
liLine.setOnClickListener(this);
lemonLine = view.findViewById(R.id.lemon);
lemonLine.setOnClickListener(this);
mangguoLine = view.findViewById(R.id.mangguo);
mangguoLine.setOnClickListener(this);
appleLine = view.findViewById(R.id.apple);
appleLine.setOnClickListener(this);
gridView = view.findViewById(R.id.index_famous_gridview);
initData();
productAdapter = new ProductAdapter(getActivity(), productList);
gridView.setAdapter(productAdapter);
}
@Override
public void onClick(View v) {
}
/**
*
*/
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
product.setImageUrlId(R.drawable.juzip);
product.setProductName("橘子");
product.setProductPrice(new BigDecimal("10"));
Product product1 = new Product();
product1.setImageUrlId(R.drawable.orange);
product1.setProductName("橙子");
product1.setProductPrice(new BigDecimal("10"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.youzip);
product2.setProductName("柚子");
product2.setProductPrice(new BigDecimal("10"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.xiguap);
product3.setProductName("西瓜");
product3.setProductPrice(new BigDecimal("10"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.applep);
product4.setProductName("苹果");
product4.setProductPrice(new BigDecimal("10"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lemonp);
product5.setProductName("柠檬");
product5.setProductPrice(new BigDecimal("10"));
productList.add(product);
productList.add(product1);
productList.add(product2);
productList.add(product3);
productList.add(product4);
productList.add(product5);
}
}

@ -0,0 +1,64 @@
package com.example.orangesale_0401.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
public class PearsonFragment extends Fragment implements View.OnClickListener {
private ImageView userIconImage;
private TextView usernameText, userSexText, userCityText;
private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_user, container, false);
init(view);
return view;
}
/**
*
*/
private void init(View view) {
userIconImage = view.findViewById(R.id.user_icon);
usernameText = view.findViewById(R.id.user_username);
userSexText = view.findViewById(R.id.user_sex);
userCityText = view.findViewById(R.id.user_city);
usernameLine = view.findViewById(R.id.user_username_line);
userSexline = view.findViewById(R.id.user_sex_line);
userCityLine = view.findViewById(R.id.user_city_line);
userPayLine = view.findViewById(R.id.user_pay);
userSettingLine = view.findViewById(R.id.user_setting);
userGeneralLine = view.findViewById(R.id.user_general);
setData();
}
/**
*
*/
private void setData() {
Bundle bundle = getArguments();
usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
userSexText.setText(String.format("性别:%s", bundle.getString("sex")));
userCityText.setText(String.format("城市:%s", bundle.getString("city")));
}
@Override
public void onClick(View v) {
}
}

@ -0,0 +1,89 @@
package com.example.orangesale_0401.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.adapter.ProductAdapter;
import com.example.orangesale_0401.entity.Product;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class ProductFragment extends Fragment implements View.OnClickListener {
private GridView gridView;
private List<Product> productList;
private ProductAdapter productAdapter;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_product, container, false);
init(view);
return view;
}
/**
*
*/
private void init(View view) {
gridView = view.findViewById(R.id.index_famous_gridview);
initData();
productAdapter = new ProductAdapter(getActivity(), productList);
gridView.setAdapter(productAdapter);
}
@Override
public void onClick(View v) {
}
/**
*
*/
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
product.setImageUrlId(R.drawable.juzip);
product.setProductName("橘子");
product.setProductPrice(new BigDecimal("10"));
Product product1 = new Product();
product1.setImageUrlId(R.drawable.orange);
product1.setProductName("橙子");
product1.setProductPrice(new BigDecimal("10"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.youzip);
product2.setProductName("柚子");
product2.setProductPrice(new BigDecimal("10"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.xiguap);
product3.setProductName("西瓜");
product3.setProductPrice(new BigDecimal("10"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.applep);
product4.setProductName("苹果");
product4.setProductPrice(new BigDecimal("10"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lemonp);
product5.setProductName("柠檬");
product5.setProductPrice(new BigDecimal("10"));
productList.add(product);
productList.add(product1);
productList.add(product2);
productList.add(product3);
productList.add(product4);
productList.add(product5);
}
}

@ -0,0 +1,66 @@
package com.example.orangesale_0401.fragment;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
import com.example.orangesale_0401.activity.CategoryActivity;
import com.example.orangesale_0401.entity.Product;
public class SetDetailFragment extends Fragment {
private View view;
private ImageView imageView;
private TextView nameText, briefText;
private TextView priceText;
@SuppressLint("SetTextI18n")
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.categoty_detail_content, container, false);
if (view != null) {
init();
}
CategoryActivity categoryActivity = (CategoryActivity) getActivity();
categoryActivity.setOnChangeListener(new CategoryActivity.OnChangeListener() {
@Override
public void changeText(Product product) {
imageView.setBackgroundResource(product.getImageUrlId());
nameText.setText(product.getProductName());
priceText.setText(product.getProductPrice().toString());
briefText.setText(product.getProductBrief());
}
});
/* Objects.requireNonNull(categoryActivity).setOnChangeListener(product -> {
Log.i("sss", "onCreateView: " + product.getProductName());
imageView.setBackgroundResource(product.getImageUrlId());
nameText.setText(product.getProductName());
priceText.setText(product.getProductPrice().toString());
});
*/
return view;
}
/**
*
*/
private void init() {
imageView = view.findViewById(R.id.category_product_image);
nameText = view.findViewById(R.id.category_product_name);
priceText = view.findViewById(R.id.category_product_price);
briefText = view.findViewById(R.id.category_product_brief);
}
}

@ -0,0 +1,21 @@
package com.example.orangesale_0401.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_0401.R;
public class ShoppingCartFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_shopping, container, false);
return view;
}
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

@ -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>
<solid android:color="#FF5722" />
<corners android:radius="50dp" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="#c0c0c0" />
<corners android:radius="50dp" />
</shape>
</item>
</selector>

@ -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>
<solid android:color="#c0c0c0" />
<corners android:radius="50dp" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="#c0c0c0" />
<corners android:radius="50dp" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -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>

@ -0,0 +1,34 @@
<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:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
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="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 连框颜色值 -->
<item>
<shape>
<solid android:color="#dddddd" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item android:bottom="1dp"> <!--设置只有底部有边框-->
<shape>
<solid android:color="#ffffff" />
<corners android:radius="10dp"></corners>
</shape>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#FFFFFF"/>
<corners android:radius="2dip"/>
<stroke
android:width="1dp"
android:color="#FFFFFF"
/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/arrow_down" android:gravity="end"/>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#F0A732" android:state_selected="true" />
<item android:color="#CFCFCF" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

@ -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>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.IndexActivity">
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<!--底部导航-->
<include layout="@layout/content_nav" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<GridView
android:id="@+id/category_detail_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:gravity="center"/>
</LinearLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/categor_titles"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="标题" />
</LinearLayout>

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical">
<ImageView
android:id="@+id/category_product_image"
android:layout_width="wrap_content"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:id="@+id/category_product_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:textColor="#050505"
android:textSize="16sp" />
<TextView
android:id="@+id/category_product_price"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:gravity="center"
android:textColor="#050505"
android:textSize="16sp" />
<TextView
android:id="@+id/category_product_brief"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginTop="0dp"
android:textColor="#050505"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:orientation="vertical">
<!--标题-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#EFB81C"
android:orientation="horizontal">
<ImageView
android:id="@+id/category_return"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/arrow_left" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="center"
android:text="水果"
android:textColor="#FFF"
android:textSize="20sp" />
</LinearLayout>
<!--分类标题和内容-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--标题-->
<ListView
android:id="@+id/category_title_list"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent" />
<!--内容-->
<FrameLayout
android:id="@+id/category_detail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:orientation="vertical">
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/index_menu"
android:focusable="false"
android:iconifiedByDefault="false"
android:queryHint="请输入搜索内容" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:layout_marginTop="20dp"
android:layout_marginRight="1dp"
android:background="@drawable/index_menu"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/chengzi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="天猫U先"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/youzi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="百亿补贴"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/juzi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="芭芭农场"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/xigua"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="飞猪旅行"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/li"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="天猫超市"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/apple"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="充值中心"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lemon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="淘鲜达"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/mangguo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="领淘金币"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<include layout="@layout/index_famous"/>
</LinearLayout>

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--首页-->
<LinearLayout
android:id="@+id/content_index"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/index" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="首页"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--商品-->
<LinearLayout
android:id="@+id/content_product"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/product" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="商品"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--购物车-->
<LinearLayout
android:id="@+id/content_cart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/shoppingcart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="购物车"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--个人-->
<LinearLayout
android:id="@+id/content_pearson"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/pearson" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="我"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:orientation="vertical">
<!--商品-->
<LinearLayout
android:id="@+id/index_famous_product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#FFF"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:drawableLeft="@drawable/shuiguo"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="商品"
android:textColor="#000"
android:textSize="18sp" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/arrow_right" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<GridView
android:id="@+id/index_famous_gridview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E8E8E8"
android:verticalSpacing="1dp"
android:horizontalSpacing="1dp"
android:numColumns="2" />
</LinearLayout>
</LinearLayout>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save