Compare commits

...

No commits in common. 'yyhan' and 'master' have entirely different histories.

@ -3,15 +3,13 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,10 +1,11 @@
apply plugin: 'com.android.application'
android {
compileSdk 31
compileSdkVersion 33
buildToolsVersion "33.0.2"
defaultConfig {
applicationId "com.orangesale.cn"
minSdkVersion 26
applicationId "com.example.mysoft"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
@ -16,19 +17,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
namespace 'com.orangesale.cn'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'liji.library.dev:citypickerview:1.1.0'
}

@ -1,4 +1,4 @@
package com.orangesale.cn;
package com.example.mysoft;
import android.content.Context;
@ -22,6 +22,6 @@ public class ExampleInstrumentedTest {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.orangesale.cn", appContext.getPackageName());
assertEquals("com.example.mysoft", appContext.getPackageName());
}
}

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mysoft">
<application
android:allowBackup="true"
@ -8,10 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:exported="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

@ -1,4 +1,5 @@
package com.orangesale.cn;
package com.example.mysoft;
import android.content.Intent;
import android.database.Cursor;
@ -11,9 +12,9 @@ import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.orangesale.cn.activity.IndexActivity;
import com.orangesale.cn.activity.RegisterActivity;
import com.orangesale.cn.dataoperation.OrangeDatabase;
import com.example.mysoft.activity.IndexActivity;
import com.example.mysoft.activity.RegisterActivity;
import com.example.mysoft.database.Database;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button registerButton, loginButton;
@ -26,6 +27,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
init();
}
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);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -38,9 +48,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if (validateLogin()) {
Intent intent1 = new Intent(MainActivity.this, IndexActivity.class);
Bundle bundle = new Bundle();
OrangeDatabase orangeDatabase = new OrangeDatabase(MainActivity.this);
Database userDatabase = new Database(MainActivity.this);
bundle.putString("username", usernameText.getText().toString());
bundle = orangeDatabase.queryUserInfo(orangeDatabase.getReadableDatabase(), bundle);
bundle = userDatabase.queryUserInfo(userDatabase.getReadableDatabase(), bundle);
intent1.putExtras(bundle);
startActivity(intent1);
} else {
@ -50,16 +60,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
}
//界面组件初始化
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);
}
/**
*
*
@ -68,12 +68,33 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
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});
Database userDatabase = new Database(MainActivity.this);
SQLiteDatabase sqLiteDatabase = userDatabase.getReadableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery("select * from mysoft_user where username=? and password=?", new String[]{username, password});
if (cursor.getCount() > 0) {
return true;
}
return false;
}
}
// //对话框的使用
// Button button=(Button)findViewById(R.id.fpassword);
// button.setOnClickListener(new View.OnClickListener(){
// @Override
// public void onClick(View view){
// new AlertDialog.Builder(MainActivity.this).setTitle("系统提示")
// .setMessage("忘记密码!")
// .setPositiveButton("确定", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// finish();
// }
// }).setNegativeButton("返回", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
//
// }
// }).show();
// }
// });

@ -0,0 +1,128 @@
package com.example.mysoft.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.mysoft.R;
import com.example.mysoft.adapter.Adapter;
import com.example.mysoft.entity.Product;
import com.example.mysoft.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("可莉");
Product product = new Product();
product.setImageUrlId(R.drawable.zhongli);
product.setProductName("钟离");
// product.setProductPrice(new BigDecimal("9.9"));
product.setCharacterStory(" 在璃月的传统中,“请仙”与“送仙”是同样重要的事。最擅长“送别”一道的,莫过于胡家传承七十七代的“往生堂”。但“往生堂”的堂主胡桃本人,主要还是专注于送别凡人的技艺。\n" +
" 送别仙人的诸般仪式,则交由一位“道上的朋友”—钟离打理。仙人与璃月一同度过漫长岁月,三千多年来升天者寥寥无几,这就意味着一切相关传统都只能以纸面形式存在,时间跨度实在太长了,这可不是那种你小时候咬着糖葫芦参加过一回,老了还能躺在竹椅上再次亲眼目睹的事件。\n" +
" 但即便是眼光最为挑剔、沉迷旧纸堆的老学究,也无法对“往生堂”操办的送仙典仪挑出任何毛病。不仅仪式中人的服饰合规,仪式举行的吉时、地点、用具,乃至当天天气、仪式时长、允许观礼人数、观礼者身份职业年龄,哪怕将以上所有全都纳入计量范畴,也无一不合礼节。\n" +
" 若人们以“通古晓今”来形容钟离,他只会无奈地一笑,叹道: “我只是……记性很好。”");
Product product1 = new Product();
product1.setImageUrlId(R.drawable.hutao);
product1.setProductName("胡桃");
// product1.setProductPrice(new BigDecimal("29.9"));
product1.setCharacterStory(" 往生堂第七十七代堂主,掌管堂中事务的少女。身居堂主之位,却没有半分架子。她的鬼点子,比瑶光滩上的海砂都多。她的脑袋里装着无数奇思妙想,叫旁人惊讶不已。平日里,胡桃俨然是个贪玩孩子,一有闲功夫便四处乱逛,被邻里看作甩手掌柜。唯有葬礼上亲自带领仪倌队伍走过繁灯落尽的街道时,她才会表现出凝重、肃穆的一面。");
Product product2 = new Product();
product2.setImageUrlId(R.drawable.bachong);
product2.setProductName("八重神子");
// product2.setProductPrice(new BigDecimal("19.9"));
product2.setCharacterStory(" 掌管鸣神大社的大巫女、白辰血脉的继承者、“永恒”的眷属与友人,以及,轻小说出版社“八重堂”的恐怖总编……细究起来,八重神子的头衔竟与她的性情同样难测多变。\n" +
" 出于各种目的试图搞清神子“真面目”的人,可以从天领奉行府一路排到“八重堂”门口,然而迄今为止,成功者依旧寥寥。\n" +
" 毕竟神子从未刻意掩饰什么。千面百变,不过是兴之所至,随心所欲罢了。没有谜面的谜语,本就不成立。只需记得,她永远是那位“兼具智慧与美貌的八重神子大人”就好。");
Product product3 = new Product();
product3.setImageUrlId(R.drawable.naxida);
product3.setProductName("纳西妲");
// product3.setProductPrice(new BigDecimal("19.9"));
product3.setCharacterStory(" 许久之前,草神创造了须弥雨林,又通过教令院将智慧赐予国民。她的美名无处不在,千万个故事,只为传唱她的事迹与美德而问世。在人民眼中,草神的存在更像是一种符号化的象征——因此,他们才能确信神明的庇护自古就存在于这片土地之上。\n" +
" 城中至贤对草神崇拜备至,民众也坚定不移地追随其后。而影响诸多的“虚空”系统,则是“小吉祥草王”的耳与目。\n" +
" 它给予她遍历人们喜怒哀乐的能力,令她听见看见一切,让她理解了赞美之外的声音。见闻越是拓展,她越明白自己必须不断学习。\n" +
" 她唯有尽快成长,才能面对来自世界最深处的威胁。无法逃离,那是她无法回避的使命。即便没多少人对现状不满,纳西妲依旧坚定不移。\n" +
" 她的顽强来源于信念,她比任何人都明白——在这里,她将是所有人的寄托与依靠。");
Product product4 = new Product();
product4.setImageUrlId(R.drawable.keli);
product4.setProductName("可莉");
// product4.setProductPrice(new BigDecimal("19.9"));
product4.setCharacterStory(" 如果向蒙德的酒客们说起西风骑士团战力最强的成员,恐怕大多数人会列举大名鼎鼎的代理团长琴、骑兵队长凯亚或神秘的贵公子迪卢克。\n" +
" 但也有人在醉眼朦胧间,目睹了一位红色骑士将整座望风山夷为平地的壮举,若想寻访这位神秘的骑士,恐怕就要到西风骑士团的禁闭室一探究竟了。假如禁闭室空空如也,或许某些爆炸性的糟糕事件就快要发生了。\n" +
" 可莉就是这样的“危险人物”。作为骑士团正式成员,她的能力不容小觑。而作为一个过于活泼的孩子,她的破坏力同样巨大。毕竟,与蒙德其他小孩子不同,爆炸物才是可莉最为喜欢的玩具。");
productList.add(product);
productList.add(product1);
productList.add(product2);
productList.add(product3);
productList.add(product4);
}
/**
*
*/
private void init() {
titleList = findViewById(R.id.category_title_list);
adapter = new Adapter(productCategory, CategoryActivity.this);
titleList.setAdapter(adapter);
}
}

@ -1,4 +1,4 @@
package com.orangesale.cn.activity;
package com.example.mysoft.activity;
import android.app.Activity;
import android.app.FragmentTransaction;
@ -9,11 +9,11 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.orangesale.cn.fragment.IndexFragment;
import com.orangesale.cn.fragment.PearsonFragment;
import com.orangesale.cn.fragment.ProductFragment;
import com.orangesale.cn.fragment.ShoppingCartFragment;
import com.example.mysoft.R;
import com.example.mysoft.fragment.IndexFragment;
import com.example.mysoft.fragment.PearsonFragment;
import com.example.mysoft.fragment.ProductFragment;
import com.example.mysoft.fragment.ShoppingCartFragment;
public class IndexActivity extends Activity implements View.OnClickListener {
private IndexFragment indexFragment;
@ -25,7 +25,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.menu);
init();
initIndexFragment();
}

@ -1,4 +1,4 @@
package com.orangesale.cn.activity;
package com.example.mysoft.activity;
import android.content.ContentValues;
import android.content.Intent;
@ -15,42 +15,39 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.mysoft.R;
import com.lljjcoder.citypickerview.widget.CityPicker;
import com.orangesale.cn.R;
import com.orangesale.cn.dataoperation.OrangeDatabase;
import com.example.mysoft.database.Database;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
private EditText usernameEdit, passwordEdit, surePasswordEdit;
private TextView cityText;
private CityPicker cityPicker;
private Button regButton;
private RadioGroup sexGroup;
private String sexStr = "男";
private String sexStr="男";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
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);
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);
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=findViewById(R.id.sex);
sexGroup.setOnCheckedChangeListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -62,7 +59,6 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
//注册验证方法
validateRegister();
break;
}
}
@ -79,9 +75,9 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
.backgroundPop(0xa0000000)
.confirTextColor("#000000")
.cancelTextColor("#000000")
.province("江西省")
.city("赣州市")
.district("章贡区")
.province("湖南省")
.city("常德市")
.district("武陵区")
.textColor(Color.parseColor("#000000"))
.provinceCyclic(true)
.cityCyclic(false)
@ -103,30 +99,27 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
public void onCancel() {
}
});
}
/**
*
*/
public void validateRegister() {
public void validateRegister() {
//Intent intent = new Intent(RegisterActivity.this, UserActivity.class);
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 (password.equals("") || !password.equals("")) {
if (!city.equals("")) {
Bundle bundle = new Bundle();
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();
// intent.putExtras(bundle);
// startActivity(intent);
Database database = new Database(RegisterActivity.this);
SQLiteDatabase sqLiteDatabase = database.getWritableDatabase();
insertData(sqLiteDatabase, bundle);
Intent intent = new Intent(RegisterActivity.this, IndexActivity.class);
intent.putExtras(bundle);
@ -140,14 +133,12 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
} else {
Toast.makeText(RegisterActivity.this, "两次密码输入不一致", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
//根据用户选择来改变sex的值
sexStr = checkedId == R.id.reg_man ? "男" : "女";
public void onCheckedChanged(RadioGroup group,int checkedId){
sexStr=checkedId==R.id.reg_man?"男":"女";
}
/**
@ -162,7 +153,7 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
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.insert("mysoft_user", null, contentValues);
sqLiteDatabase.close();
}
}

@ -1,29 +1,43 @@
package com.orangesale.cn.activity;
package com.example.mysoft.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.example.mysoft.MainActivity;
import com.example.mysoft.R;
public class UserActivity extends Activity implements View.OnClickListener {
public class UserActivity extends Activity implements View.OnClickListener{
private ImageView userIconImage;
private TextView usernameText, userSexText, userCityText;
private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine, userSearchProductLine;
private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine,userSearchProductLine;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_user);
init();
Button toLogin = findViewById(R.id.toLogin);//退出登录按钮
toLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(UserActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
/**
*
*/
@ -57,10 +71,13 @@ public class UserActivity extends Activity implements View.OnClickListener {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.user_searchProduct:
case R.id.user_searchProduct://查看商品
Intent intent1 = new Intent(UserActivity.this, CategoryActivity.class);
startActivity(intent1);
break;
}
}
}

@ -1,4 +1,4 @@
package com.orangesale.cn.adapter;
package com.example.mysoft.adapter;
import android.content.Context;
import android.graphics.Color;
@ -9,7 +9,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.orangesale.cn.R;
import com.example.mysoft.R;
import java.util.List;

@ -1,5 +1,4 @@
package com.orangesale.cn.adapter;
package com.example.mysoft.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
@ -9,8 +8,8 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.orangesale.cn.R;
import com.orangesale.cn.entity.Product;
import com.example.mysoft.R;
import com.example.mysoft.entity.Product;
import java.util.List;
@ -42,7 +41,6 @@ public class ProductAdapter extends BaseAdapter {
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
Log.i("aa", "getView: "+"aa");
convertView = layoutInflater.inflate(R.layout.categoty_detail_content, null);
viewHolder = new ViewHolder();
viewHolder.productImage = convertView.findViewById(R.id.category_product_image);

@ -1,4 +1,4 @@
package com.orangesale.cn.dataoperation;
package com.example.mysoft.database;
import android.content.ContentValues;
import android.content.Context;
@ -9,15 +9,15 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
public class OrangeDatabase extends SQLiteOpenHelper {
public OrangeDatabase(@Nullable Context context) {
super(context, "orange", null, 1);
public class Database extends SQLiteOpenHelper {
public Database(@Nullable Context context) {
super(context, "mysoft.db3", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建用户表
String sql = "create table orange_user(id integer primary key autoincrement, username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
String sql = "create table mysoft_user(id integer primary key autoincrement, username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
db.execSQL(sql);
}
@ -41,7 +41,7 @@ public class OrangeDatabase extends SQLiteOpenHelper {
contentValues.put("password", password);
contentValues.put("sex", sex);
contentValues.put("city", city);
sqLiteDatabase.insert("orange_user", null, contentValues);
sqLiteDatabase.insert("mysoft_user", null, contentValues);
sqLiteDatabase.close();
}
@ -54,7 +54,7 @@ public class OrangeDatabase extends SQLiteOpenHelper {
*/
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});
Cursor cursor = sqLiteDatabase.rawQuery("select * from mysoft_user where username=?", new String[]{username});
if (cursor != null) {
while (cursor.moveToNext()) {
bundle.putString("sex", cursor.getString(3));

@ -1,6 +1,6 @@
package com.orangesale.cn.entity;
package com.example.mysoft.entity;
public class OrangeUser {
public class MyUser {
private Integer id;
private String username;
private String password;

@ -1,4 +1,4 @@
package com.orangesale.cn.entity;
package com.example.mysoft.entity;
import java.math.BigDecimal;
@ -19,6 +19,11 @@ public class Product {
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public String getCharacterStory(){ return characterStory;}
public void setCharacterStory(String characterStory){
this.characterStory=characterStory;
}
public Integer getImageUrlId() {
return imageUrlId;
@ -31,6 +36,7 @@ public class Product {
private Integer imageUrlId;
private String productName;
private BigDecimal productPrice;
private String characterStory;
@Override
public String toString() {
@ -40,4 +46,4 @@ public class Product {
", productPrice=" + productPrice +
'}';
}
}
}

@ -1,4 +1,4 @@
package com.orangesale.cn.fragment;
package com.example.mysoft.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -12,9 +12,9 @@ import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.orangesale.cn.adapter.ProductAdapter;
import com.orangesale.cn.entity.Product;
import com.example.mysoft.R;
import com.example.mysoft.adapter.ProductAdapter;
import com.example.mysoft.entity.Product;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -75,28 +75,28 @@ public class IndexFragment extends Fragment implements View.OnClickListener {
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
product.setImageUrlId(R.drawable.juzip);
product.setProductName("橘子");
product.setImageUrlId(R.drawable.yihep);
product.setProductName("益禾烤奶");
product.setProductPrice(new BigDecimal("9.9"));
Product product1 = new Product();
product1.setImageUrlId(R.drawable.orange);
product1.setProductName("橙子");
product1.setImageUrlId(R.drawable.hefengp);
product1.setProductName("和风奶绿");
product1.setProductPrice(new BigDecimal("29.9"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.youzip);
product2.setProductName("柚子");
product2.setImageUrlId(R.drawable.mitaop);
product2.setProductName("蜜桃乌龙");
product2.setProductPrice(new BigDecimal("19.9"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.xiguap);
product3.setProductName("西瓜");
product3.setImageUrlId(R.drawable.xiguazhip);
product3.setProductName("西瓜");
product3.setProductPrice(new BigDecimal("19.9"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.applep);
product4.setProductName("苹果");
product4.setImageUrlId(R.drawable.longzhup);
product4.setProductName("泷珠奶茶");
product4.setProductPrice(new BigDecimal("49.9"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lemonp);
product5.setProductName("柠檬");
product5.setImageUrlId(R.drawable.shaoxiancaop);
product5.setProductName("烧仙草");
product5.setProductPrice(new BigDecimal("9.9"));
productList.add(product);
productList.add(product1);
@ -106,4 +106,4 @@ public class IndexFragment extends Fragment implements View.OnClickListener {
productList.add(product5);
}
}
}

@ -1,4 +1,4 @@
package com.orangesale.cn.fragment;
package com.example.mysoft.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -12,7 +12,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.example.mysoft.R;
public class PearsonFragment extends Fragment implements View.OnClickListener {
private ImageView userIconImage;

@ -1,4 +1,4 @@
package com.orangesale.cn.fragment;
package com.example.mysoft.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -9,7 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.example.mysoft.R;
public class ProductFragment extends Fragment {
@Nullable

@ -1,5 +1,4 @@
package com.orangesale.cn.fragment;
package com.example.mysoft.fragment;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
@ -13,15 +12,16 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.orangesale.cn.activity.CategoryActivity;
import com.example.mysoft.R;
import com.example.mysoft.activity.CategoryActivity;
import com.example.mysoft.entity.Product;
import java.util.Objects;
public class SetDetailFragment extends Fragment {
private View view;
private ImageView imageView;
private TextView nameText, priceText;
private TextView nameText, priceText,storyText;
@SuppressLint("SetTextI18n")
@Nullable
@ -32,12 +32,23 @@ public class SetDetailFragment extends Fragment {
init();
}
CategoryActivity categoryActivity = (CategoryActivity) getActivity();
Objects.requireNonNull(categoryActivity).setOnChangeListener(product -> {
categoryActivity.setOnChangeListener(new CategoryActivity.OnChangeListener() {
@Override
public void changeText(Product product) {
imageView.setBackgroundResource(product.getImageUrlId());
nameText.setText(product.getProductName());
// priceText.setText(product.getProductPrice().toString());
storyText.setText(product.getCharacterStory());
}
});
/* 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;
}
@ -47,7 +58,8 @@ public class SetDetailFragment extends Fragment {
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);
// priceText = view.findViewById(R.id.category_product_price);
storyText = view.findViewById(R.id.characterStory);
}
}

@ -1,4 +1,4 @@
package com.orangesale.cn.fragment;
package com.example.mysoft.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -9,7 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.orangesale.cn.R;
import com.example.mysoft.R;
public class ShoppingCartFragment extends Fragment {
@Nullable

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 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"
tools:context=".MainActivity">
<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>

@ -11,4 +11,4 @@
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="标题" />
</LinearLayout>
</LinearLayout>

@ -2,13 +2,18 @@
<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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
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_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center" />
<TextView
@ -16,17 +21,29 @@
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:layout_marginTop="5dp"
android:textColor="#050505"
android:textSize="16sp" />
android:textSize="24sp" />
<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:layout_marginTop="10dp"
android:gravity="center"
android:textColor="#050505"
android:textSize="24sp" />
<TextView
android:id="@+id/characterStory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:gravity="start"
android:textColor="#050505"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
</LinearLayout>

@ -25,7 +25,7 @@
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="center"
android:text="商品种类"
android:text="背景故事"
android:textColor="#FFF"
android:textSize="20sp" />
</LinearLayout>
@ -39,8 +39,8 @@
<ListView
android:id="@+id/category_title_list"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_weight="1" />
<!--内容-->
<FrameLayout
android:id="@+id/category_detail"

@ -40,15 +40,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/chengzi" />
android:src="@drawable/yihe" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="橙子"
android:text="益禾烤奶"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -62,15 +62,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/youzi" />
android:src="@drawable/hefeng" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="柚子"
android:text="和风奶绿"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -84,15 +84,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/juzi" />
android:src="@drawable/mitao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="橘子"
android:text="蜜桃乌龙"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -106,15 +106,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xigua" />
android:src="@drawable/xiguazhi" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="西瓜"
android:text="西瓜"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
@ -136,15 +136,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/li" />
android:src="@drawable/bingqilin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="香梨"
android:text="冰淇淋抹茶"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -158,15 +158,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/apple" />
android:src="@drawable/longzhu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="苹果"
android:text="泷珠奶茶"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -180,15 +180,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/lemon" />
android:src="@drawable/yibei" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="柠檬"
android:text="烧仙草"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
@ -202,15 +202,15 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mangguo" />
android:src="@drawable/hongcha" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="芒果"
android:text="冰淇淋红茶"
android:textColor="#696969"
android:textSize="20sp" />
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -51,7 +51,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="商品"
android:text="点单"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>

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

Loading…
Cancel
Save