@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="11" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/bottom_navigation_item_selector.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/ic_home_black_24dp.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/ic_launcher_background.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/ic_notifications_black_24dp.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/sharp_edit.xml" value="0.25729166666666664" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/sharp_edittext.xml" value="0.16770833333333332" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/drawable/text_view_tags.xml" value="0.13697916666666668" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/activity_main.xml" value="0.12083333333333333" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/bottom_navigation_item_selector.xml" value="0.2265625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/dialog_goods.xml" value="0.1" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/fragment_dashboard.xml" value="0.24114583333333334" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/fragment_goods.xml" value="0.1515625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/fragment_person.xml" value="0.1515625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/fragment_shopping.xml" value="0.1515625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/layout.xml" value="0.10625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/list_item_buying.xml" value="0.1192084942084942" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/list_item_goods.xml" value="0.25" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/list_item_history.xml" value="0.2259963768115942" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/list_item_shopping.xml" value="0.2259963768115942" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/login_layout.xml" value="0.15572916666666667" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/login_success_layout.xml" value="0.1703125" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/registered_layout.xml" value="0.15572916666666667" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/shopping_bottom.xml" value="0.20104754230459307" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/shpping_bottom.xml" value="0.2259963768115942" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/title.xml" value="0.2265625" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/layout/top_bar.xml" value="0.2" />
|
||||
<entry key="..\:/Android/LinShopping/app/src/main/res/menu/bottom_nav_menu.xml" value="0.12083333333333333" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/drawable/bottom_navigation_item_selector.xml" value="0.1265" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1265" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/drawable/sharp_edit.xml" value="0.1265" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/drawable/text_view_tags.xml" value="0.1265" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/activity_main.xml" value="0.25815217391304346" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/dialog_goods.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/fragment_goods.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/fragment_person.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/fragment_shopping.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/list_item_buying.xml" value="0.264" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/list_item_goods.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/list_item_shopping.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/login_layout.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/login_success_layout.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/registered_layout.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/shopping_bottom.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/layout/top_bar.xml" value="0.115625" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/menu/bottom_nav_menu.xml" value="0.264" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2265" />
|
||||
<entry key="..\:/文件/学校/大三下/Andriod/程序/LinShopping/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.2265" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" 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>
|
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,45 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.ronglin.linshopping"
|
||||
minSdk 27
|
||||
targetSdk 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.5'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.ronglin.linshopping",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ronglin.linshopping;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.ronglin.linshopping", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ronglin.linshopping" >
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/photo"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@drawable/photo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.LinShopping" >
|
||||
<activity
|
||||
android:name=".RegisteredActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,54 @@
|
||||
package com.ronglin.linshopping;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
import com.ronglin.linshopping.databinding.DialogGoodsBinding;
|
||||
|
||||
public class GoodsDialog extends Dialog implements View.OnClickListener {
|
||||
|
||||
private Goods goods;
|
||||
private Context context;
|
||||
private DialogGoodsBinding binding;
|
||||
|
||||
public GoodsDialog(@NonNull Context context, Goods goods) {
|
||||
super(context);
|
||||
this.goods = goods;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = DialogGoodsBinding.inflate(LayoutInflater.from(context));
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// binding.imageViewPreviewDialog
|
||||
if (goods.getBitmaps().size() > 0){
|
||||
binding.imageViewPreviewDialog.setImageBitmap(goods.getBitmaps().get(0));
|
||||
}
|
||||
binding.getRoot().setOnClickListener(this);
|
||||
|
||||
|
||||
binding.textViewGoodsDescribeDialog.setText(goods.getDescribe());
|
||||
|
||||
binding.textViewGoodsNameDialog.setText(goods.getGoodsName());
|
||||
|
||||
binding.textViewGoodsTagsDialog.setText(goods.getTags().toString());
|
||||
|
||||
binding.textViewGoodsPriceDialog.setText(Goods.toPriceString(goods.getPrice()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
hide();
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.ronglin.linshopping;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
import com.ronglin.linshopping.application.Person;
|
||||
import com.ronglin.linshopping.databinding.ActivityMainBinding;
|
||||
import com.ronglin.linshopping.ui.goods.GoodsFragment;
|
||||
import com.ronglin.linshopping.ui.person.PersonFragment;
|
||||
import com.ronglin.linshopping.ui.person.PersonViewModel;
|
||||
import com.ronglin.linshopping.ui.shopping.ShoppingFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private ActivityMainBinding binding;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActionBar actionBar=getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
ImageView navView = findViewById(R.id.imageViewPersonPhoto);
|
||||
// Passing each menu ID as a set of Ids because each
|
||||
// menu should be considered as top level destinations.
|
||||
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
|
||||
R.id.navigation_goods, R.id.navigation_shopping, R.id.navigation_person)
|
||||
.build();
|
||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
|
||||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
||||
NavigationUI.setupWithNavController(binding.navView, navController);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.ronglin.linshopping;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ronglin.linshopping.application.Database;
|
||||
import com.ronglin.linshopping.application.MySQLiteHelper;
|
||||
import com.ronglin.linshopping.application.Person;
|
||||
import com.ronglin.linshopping.databinding.ActivityMainBinding;
|
||||
import com.ronglin.linshopping.databinding.RegisteredLayoutBinding;
|
||||
|
||||
public class RegisteredActivity extends AppCompatActivity {
|
||||
private RegisteredLayoutBinding registeredLayoutBinding;
|
||||
public static int RESULTCODE_NEWPERSON = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
registeredLayoutBinding = RegisteredLayoutBinding.inflate(getLayoutInflater());
|
||||
setContentView(registeredLayoutBinding.getRoot());
|
||||
|
||||
registeredLayoutBinding.buttonCancelR.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
RegisteredActivity.this.finish();
|
||||
}
|
||||
});
|
||||
|
||||
registeredLayoutBinding.buttonRegistered.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String userName = registeredLayoutBinding.editTextUsernameR.getText().toString().trim();
|
||||
String password = registeredLayoutBinding.editTextPasswordR.getText().toString().trim();
|
||||
String password2 = registeredLayoutBinding.editTextPasswordR2.getText().toString().trim();
|
||||
|
||||
if (!password.equals(password2)){
|
||||
Toast.makeText(RegisteredActivity.this,"两次密码输入不一致!",Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
Database database = new Database(new MySQLiteHelper(RegisteredActivity.this));
|
||||
Person person = database.findPersonFromSQLite(null,userName,password);
|
||||
if (person != null){
|
||||
Toast.makeText(RegisteredActivity.this,"该账号已经注册过了!",Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
userName = registeredLayoutBinding.editTextUsernameR.getText().toString().trim();
|
||||
password = registeredLayoutBinding.editTextPasswordR.getText().toString().trim();
|
||||
|
||||
person = new Person(userName,password);
|
||||
person.setNum(database.getPersonMaxNumFromSQLite()+1);
|
||||
person.setId(String.valueOf(person.getNum()));
|
||||
person.setMoney(0);
|
||||
|
||||
database.insertPersonToSQLite(person);
|
||||
Toast.makeText(RegisteredActivity.this,"注册成功!",Toast.LENGTH_SHORT).show();
|
||||
Intent intentRegisterSuccess = new Intent();
|
||||
intentRegisterSuccess.putExtra("newPerson",person);
|
||||
setResult(RESULTCODE_NEWPERSON,intentRegisterSuccess);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ronglin.linshopping.GoodsDialog;
|
||||
import com.ronglin.linshopping.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BuyingListAdapter extends BaseAdapter {
|
||||
private ArrayList<Goods> list_goods ;
|
||||
private final Context context;
|
||||
|
||||
public BuyingListAdapter(ArrayList<Goods> list,Context context){
|
||||
this.list_goods = list;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setListGoods(ArrayList<Goods> list){
|
||||
this.list_goods = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list_goods.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list_goods.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressLint("ViewHolder")
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
@SuppressLint("ViewHolder") View item_view;
|
||||
item_view = View.inflate(this.context, R.layout.list_item_buying,null);
|
||||
|
||||
ImageView imageViewPreviewBuying = item_view.findViewById(R.id.imageViewPreviewBuying);
|
||||
TextView textViewGoodsNameBuying = item_view.findViewById(R.id.textViewGoodsNameBuying);
|
||||
TextView textViewGoodsPriceBuying = item_view.findViewById(R.id.textViewGoodsPriceBuying);
|
||||
|
||||
item_view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
String t="-"+Goods.toPriceString(list_goods.get(i).getPrice());
|
||||
textViewGoodsPriceBuying.setText(t);
|
||||
|
||||
textViewGoodsNameBuying.setText(list_goods.get(i).getGoodsName());
|
||||
|
||||
if (list_goods.get(i).getBitmaps().size() > 0){
|
||||
imageViewPreviewBuying.setImageBitmap(list_goods.get(i).getBitmaps().get(0));
|
||||
}
|
||||
|
||||
|
||||
return item_view;
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import com.ronglin.linshopping.R;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Goods {
|
||||
private ArrayList<Bitmap> bitmaps;
|
||||
private String goodsName;
|
||||
private String describe;
|
||||
private ArrayList<String> tags;
|
||||
private int price;
|
||||
|
||||
public static ArrayList<Goods> GOODSLIST =new ArrayList<>();
|
||||
public static Goods DEULT_GOODS = new Goods();
|
||||
|
||||
public Goods(){
|
||||
this.bitmaps = new ArrayList<>();
|
||||
this.goodsName = "";
|
||||
this.describe = "";
|
||||
this.tags = new ArrayList<>();
|
||||
this.price = -1;
|
||||
}
|
||||
|
||||
public Goods(String goodsName, String describe, String[] tags, int price){
|
||||
this();
|
||||
this.goodsName = goodsName;
|
||||
this.describe = describe;
|
||||
this.price = price;
|
||||
this.tags.addAll(Arrays.asList(tags));
|
||||
}
|
||||
|
||||
public ArrayList<Bitmap> getBitmaps() {
|
||||
return bitmaps;
|
||||
}
|
||||
|
||||
public void setBitmaps(ArrayList<Bitmap> bitmaps) {
|
||||
this.bitmaps = bitmaps;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
}
|
||||
|
||||
public void setDescribe(String describe) {
|
||||
this.describe = describe;
|
||||
}
|
||||
|
||||
public ArrayList<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(ArrayList<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(int price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public boolean equals(Goods goods){
|
||||
return this.getGoodsName().equals(goods.getGoodsName())
|
||||
&& this.getTags().equals(goods.getTags())
|
||||
&& this.getDescribe().equals(goods.getDescribe())
|
||||
&& this.getPrice() == goods.getPrice();
|
||||
}
|
||||
|
||||
public static String toPriceString(int price){
|
||||
StringBuffer sb = new StringBuffer(String.valueOf(price));
|
||||
//小于2位数
|
||||
if (sb.length()<=2)
|
||||
{
|
||||
if (sb.length() == 0){
|
||||
sb.insert(0,"0.00");
|
||||
} else if(sb.length() == 1){
|
||||
sb.insert(0,"0.0");
|
||||
} else if(sb.length() == 2){
|
||||
sb.insert(0,"0.");
|
||||
}
|
||||
} else {
|
||||
sb.insert(sb.length()-2,'.');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void getDefaultGoodsList(Context context){
|
||||
|
||||
GOODSLIST.clear();
|
||||
Goods goods1 = new Goods("人字拖","夏季人字拖,清凉一夏",new String[]{"板鞋","凉鞋","人字拖"},5000);
|
||||
goods1.setDescribe("夏季人字拖,清凉一夏,夏季人字拖,清凉一夏,夏季人字拖,清凉一夏,夏季人字拖,清凉一夏,夏季人字拖,清凉一夏");
|
||||
Goods goods2 = new Goods("莱布尼茨篮球","好篮球就是它",new String[]{"篮球","莱布尼茨"},30000);
|
||||
goods2.setDescribe("好篮球就是它,他就是好篮球!好篮球就是它,他就是好篮球!好篮球就是它,他就是好篮球!好篮球就是它,他就是好篮球!");
|
||||
Goods goods3 = new Goods("尼龙克斯羽毛球拍","夏季球拍,神挡杀神",new String[]{"羽毛球拍","尼龙克斯"},15000);
|
||||
goods3.setDescribe("夏季球拍,神挡杀神,买下此拍,让你的羽毛球技术增加几倍,买下此拍,让你的羽毛球技术增加几倍!!!");
|
||||
Goods goods4 = new Goods("常德大拖鞋","应急拖鞋,紧急备用",new String[]{"凉鞋"},100);
|
||||
goods4.setDescribe("应急拖鞋,紧急备用,应急拖鞋,紧急备用,应急拖鞋,紧急备用,应急拖鞋,紧急备用,应急拖鞋,紧急备用,应急拖鞋,紧急备用");
|
||||
|
||||
ArrayList<Bitmap> bitmaps1 = new ArrayList<>();
|
||||
bitmaps1.add(BitmapFactory.decodeResource(context.getResources(), R.drawable.renzituo));
|
||||
goods1.setBitmaps(bitmaps1);
|
||||
|
||||
ArrayList<Bitmap> bitmaps2 = new ArrayList<>();
|
||||
bitmaps2.add(BitmapFactory.decodeResource(context.getResources(), R.drawable.liangxie));
|
||||
goods2.setBitmaps(bitmaps2);
|
||||
|
||||
ArrayList<Bitmap> bitmaps3 = new ArrayList<>();
|
||||
bitmaps3.add(BitmapFactory.decodeResource(context.getResources(), R.drawable.pixue));
|
||||
goods3.setBitmaps(bitmaps3);
|
||||
|
||||
ArrayList<Bitmap> bitmaps4 = new ArrayList<>();
|
||||
bitmaps4.add(BitmapFactory.decodeResource(context.getResources(), R.drawable.tuoxie));
|
||||
goods4.setBitmaps(bitmaps4);
|
||||
|
||||
|
||||
GOODSLIST.add(goods1);
|
||||
GOODSLIST.add(goods2);
|
||||
GOODSLIST.add(goods3);
|
||||
GOODSLIST.add(goods4);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ronglin.linshopping.GoodsDialog;
|
||||
import com.ronglin.linshopping.R;
|
||||
import com.ronglin.linshopping.ui.person.PersonFragment;
|
||||
import com.ronglin.linshopping.ui.shopping.ShoppingFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class GoodsListAdapter extends BaseAdapter{
|
||||
private ArrayList<Goods> list_goods;
|
||||
private final Context context;
|
||||
private boolean delay = false;
|
||||
|
||||
// private final ListItemGoodsBinding listItemGoodsBinding;
|
||||
|
||||
public GoodsListAdapter(ArrayList<Goods> list, Context context){
|
||||
this.list_goods = list;
|
||||
this.context = context;
|
||||
// listItemGoodsBinding =ListItemGoodsBinding.inflate(LayoutInflater.from(context));
|
||||
}
|
||||
|
||||
public void setListGoods(ArrayList<Goods> list){
|
||||
this.list_goods = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list_goods.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list_goods.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressLint("ViewHolder")
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
@SuppressLint("ViewHolder") View item_view;
|
||||
item_view = View.inflate(this.context, R.layout.list_item_goods,null);
|
||||
// View item_view = listItemGoodsBinding.getRoot();
|
||||
//设置列表的显示形式
|
||||
ImageView imageViewPreview = item_view.findViewById(R.id.imageViewPreview);
|
||||
TextView textViewGoodsName = item_view.findViewById(R.id.textViewGoodsName);
|
||||
TextView textViewGoodsTags = item_view.findViewById(R.id.textViewGoodsTags);
|
||||
TextView textViewPrice = item_view.findViewById(R.id.textViewPrice);
|
||||
ImageButton imageButtonAdd = item_view.findViewById(R.id.imageButtonAdd);
|
||||
|
||||
imageViewPreview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(GoodsListAdapter.this.context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
textViewGoodsName.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(GoodsListAdapter.this.context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
textViewGoodsTags.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(GoodsListAdapter.this.context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
textViewPrice.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(GoodsListAdapter.this.context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (list_goods.get(i).getBitmaps().size() > 0){
|
||||
imageViewPreview.setImageBitmap(list_goods.get(i).getBitmaps().get(0));
|
||||
}
|
||||
textViewGoodsName.setText(list_goods.get(i).getGoodsName());
|
||||
textViewGoodsTags.setText(list_goods.get(i).getTags().toString());
|
||||
|
||||
textViewPrice.setText(Goods.toPriceString(list_goods.get(i).getPrice()));
|
||||
|
||||
|
||||
imageButtonAdd.setOnClickListener(new View.OnClickListener() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
|
||||
if(!PersonFragment.ISLOGIN){
|
||||
Toast.makeText(context,"请先登录",Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
if (!delay){
|
||||
ShoppingFragment.shoppingList.add(Goods.GOODSLIST.get(i));
|
||||
Toast.makeText(context,"添加成功",Toast.LENGTH_SHORT).show();
|
||||
delay = true;
|
||||
imageButtonAdd.setImageResource(R.drawable.ok);
|
||||
|
||||
@SuppressLint("HandlerLeak") Handler mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
delay=false;
|
||||
imageButtonAdd.setImageResource(R.drawable.shopping_add);
|
||||
}
|
||||
};
|
||||
TimerTask task = new TimerTask(){
|
||||
public void run() {
|
||||
Message message = new Message();
|
||||
mHandler.sendMessage(message);
|
||||
}
|
||||
};
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(task, 1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return item_view;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class MySQLiteHelper extends SQLiteOpenHelper {
|
||||
public MySQLiteHelper(@Nullable Context context) {
|
||||
super(context,"LinShopping.db", null, 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||
sqLiteDatabase.execSQL("create table person(id varchar(10) primary key,num integer,username varchar(30),password varchar(30),money integer)");
|
||||
sqLiteDatabase.execSQL("create table shopping(id varchar(10),goodsName varchar(30),time bigint)");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Person implements Serializable {
|
||||
private String id;
|
||||
private int num;
|
||||
private String username;
|
||||
private String password;
|
||||
private int money =0 ;
|
||||
|
||||
public Person(String name, String password){
|
||||
this.username = name;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
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 getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public int getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
public void setMoney(int money) {
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
String t;
|
||||
t ="{id:%s,num:%s,username:%s,password:%s,money:%s}";
|
||||
t =String.format(t,this.id,this.num,this.username,this.password,this.money);
|
||||
return t;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package com.ronglin.linshopping.application;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ronglin.linshopping.GoodsDialog;
|
||||
import com.ronglin.linshopping.R;
|
||||
import com.ronglin.linshopping.databinding.FragmentShoppingBinding;
|
||||
import com.ronglin.linshopping.databinding.ListItemGoodsBinding;
|
||||
import com.ronglin.linshopping.databinding.ListItemShoppingBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShoppingListAdapter extends BaseAdapter {
|
||||
|
||||
private ArrayList<Goods> list_goods ;
|
||||
private static ArrayList<Integer> list_select = new ArrayList<>();
|
||||
private int allPrice = 0;
|
||||
private final Context context;
|
||||
private FragmentShoppingBinding binding;
|
||||
|
||||
public ShoppingListAdapter(ArrayList<Goods> list, Context context, FragmentShoppingBinding binding){
|
||||
this.list_goods = list;
|
||||
this.context = context;
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void setListGoods(ArrayList<Goods> list){
|
||||
this.list_goods = list;
|
||||
}
|
||||
|
||||
public void setSelectList(ArrayList<Integer> list){
|
||||
this.list_select = list;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getSelectList(){
|
||||
return this.list_select;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list_goods.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list_goods.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressLint("ViewHolder")
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
@SuppressLint("ViewHolder") View item_view;
|
||||
item_view = View.inflate(this.context, R.layout.list_item_shopping,null);
|
||||
|
||||
CheckBox checkBoxSelect = item_view.findViewById(R.id.checkBoxSelect);
|
||||
ImageView imageViewPreviewShopping = item_view.findViewById(R.id.imageViewPreviewShopping);
|
||||
TextView textViewGoodsNameShopping = item_view.findViewById(R.id.textViewGoodsNameShopping);
|
||||
TextView textViewGoodsPriceShopping = item_view.findViewById(R.id.textViewGoodsPriceShopping);
|
||||
|
||||
//被选中了就显示选中
|
||||
if (list_select.contains(i)){
|
||||
checkBoxSelect.setChecked(true);
|
||||
}
|
||||
|
||||
checkBoxSelect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (checkBoxSelect.isChecked()){
|
||||
list_select.add(i);
|
||||
} else {
|
||||
list_select.remove(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
allPrice = 0;
|
||||
|
||||
for (int i=0;i<list_goods.size();i++){
|
||||
if (list_select.contains(i)){
|
||||
allPrice+=list_goods.get(i).getPrice();
|
||||
}
|
||||
}
|
||||
|
||||
binding.shoppingBottom.textViewAllPrice.setText(Goods.toPriceString(allPrice));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (list_goods.get(i).getBitmaps().size() > 0){
|
||||
imageViewPreviewShopping.setImageBitmap(list_goods.get(i).getBitmaps().get(0));
|
||||
}
|
||||
imageViewPreviewShopping.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
textViewGoodsNameShopping.setText(list_goods.get(i).getGoodsName());
|
||||
textViewGoodsNameShopping.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
textViewGoodsPriceShopping.setText(Goods.toPriceString(list_goods.get(i).getPrice()));
|
||||
textViewGoodsPriceShopping.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
GoodsDialog dialog = new GoodsDialog(context,list_goods.get(i));
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
return item_view;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ronglin.linshopping.ui.goods;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GoodsViewModel extends ViewModel {
|
||||
|
||||
private final MutableLiveData<ArrayList<Goods>> list_goods;
|
||||
|
||||
public GoodsViewModel() {
|
||||
list_goods = new MutableLiveData<>();
|
||||
}
|
||||
|
||||
public LiveData<ArrayList<Goods>> getListGoods() {
|
||||
return list_goods;
|
||||
}
|
||||
|
||||
public void setListGoods(ArrayList<Goods> list){
|
||||
this.list_goods.setValue(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
package com.ronglin.linshopping.ui.person;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.ronglin.linshopping.RegisteredActivity;
|
||||
import com.ronglin.linshopping.application.BuyingListAdapter;
|
||||
import com.ronglin.linshopping.application.Database;
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
import com.ronglin.linshopping.application.MySQLiteHelper;
|
||||
import com.ronglin.linshopping.application.Person;
|
||||
import com.ronglin.linshopping.databinding.FragmentPersonBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PersonFragment extends Fragment {
|
||||
|
||||
private PersonViewModel personViewModel;
|
||||
private FragmentPersonBinding binding;
|
||||
public static boolean ISLOGIN = false;
|
||||
public static int REQUESTCODE_NEWPERSON = 1;
|
||||
public static Person person;
|
||||
private ArrayList<Goods> goodsArrayList = new ArrayList<>();
|
||||
private BuyingListAdapter buyingListAdapter;
|
||||
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
personViewModel =
|
||||
new ViewModelProvider(this).get(PersonViewModel.class);
|
||||
|
||||
binding = FragmentPersonBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
if (!ISLOGIN){
|
||||
binding.linearLayoutLogin.setVisibility(View.VISIBLE);
|
||||
binding.linearLayoutLoginSuccess.setVisibility(View.GONE);
|
||||
} else
|
||||
{
|
||||
binding.linearLayoutLogin.setVisibility(View.GONE);
|
||||
binding.linearLayoutLoginSuccess.setVisibility(View.VISIBLE);
|
||||
|
||||
goodsArrayList.clear();
|
||||
Database database = new Database(new MySQLiteHelper(getContext()));
|
||||
ArrayList<String> goodsNameList = database.findGoodsListFromSQLite(person);
|
||||
for (String t:goodsNameList
|
||||
) {
|
||||
for (Goods goods:Goods.GOODSLIST
|
||||
) {
|
||||
if (t.equals(goods.getGoodsName())){
|
||||
goodsArrayList.add(goods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
personViewModel.getPerson().observe(getViewLifecycleOwner(), new Observer<Person>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable Person person) {
|
||||
if (person != null){
|
||||
PersonFragment.person = person;
|
||||
|
||||
binding.includeLogin.editTextUsername.setText(person.getUsername());
|
||||
binding.includeLogin.editTextPassword.setText(person.getPassword());
|
||||
|
||||
binding.includeLoginSuccess.textViewPersonName.setText(person.getUsername());
|
||||
|
||||
//购物清单也要跟着变
|
||||
Database database = new Database(new MySQLiteHelper(getContext()));
|
||||
ArrayList<String> goodsNameList = database.findGoodsListFromSQLite(person);
|
||||
ArrayList<Goods> goodsArrayList = new ArrayList<>();
|
||||
for (String t:goodsNameList
|
||||
) {
|
||||
for (Goods goods:Goods.GOODSLIST
|
||||
) {
|
||||
if (t.equals(goods.getGoodsName())){
|
||||
goodsArrayList.add(goods);
|
||||
}
|
||||
}
|
||||
}
|
||||
personViewModel.setBuyingList(goodsArrayList);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
personViewModel.setBuyingList(goodsArrayList);
|
||||
buyingListAdapter = new BuyingListAdapter(goodsArrayList,getContext());
|
||||
binding.includeLoginSuccess.buyingListView.setAdapter(buyingListAdapter);
|
||||
|
||||
personViewModel.getBuyingList().observe(getViewLifecycleOwner(), new Observer<ArrayList<Goods>>(){
|
||||
@Override
|
||||
public void onChanged(ArrayList<Goods> list) {
|
||||
buyingListAdapter.setListGoods(list);
|
||||
binding.includeLoginSuccess.buyingListView.setAdapter(buyingListAdapter);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
initLayoutLogin();
|
||||
initLayoutLoginSuccess();
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
// String result = (personViewModel.getPerson().getValue() == null)?"null":personViewModel.getPerson().getValue().toString();
|
||||
// Log.i("TAG", "onDestroyView: "+result);
|
||||
}
|
||||
|
||||
|
||||
public void initLayoutLogin(){
|
||||
if (personViewModel.getPerson().getValue() != null){
|
||||
binding.includeLogin.editTextUsername.setText(personViewModel.getPerson().getValue().getUsername());
|
||||
}
|
||||
|
||||
binding.includeLogin.buttonRegistered.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intentStartRegistered = new Intent(getActivity(), RegisteredActivity.class);
|
||||
startActivityForResult(intentStartRegistered,REQUESTCODE_NEWPERSON);
|
||||
}
|
||||
});
|
||||
binding.includeLogin.buttonLogin.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String userName = binding.includeLogin.editTextUsername.getText().toString().trim();
|
||||
String password = binding.includeLogin.editTextPassword.getText().toString().trim();
|
||||
|
||||
if (userName.isEmpty()){
|
||||
Toast.makeText(getContext(), "请输入用户名", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.isEmpty()){
|
||||
Toast.makeText(getContext(), "请输入密码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
Database database = new Database(new MySQLiteHelper(getContext()));
|
||||
Person person = database.findPersonFromSQLite(null,userName,password);
|
||||
if (person == null){
|
||||
Toast.makeText(getContext(), "用户名或密码错误,请核对后重新输入", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
personViewModel.setPerson(person);
|
||||
binding.includeLoginSuccess.textViewPersonName.setText(personViewModel.getPerson().getValue().getUsername());
|
||||
StringBuffer sb = new StringBuffer(String.valueOf(personViewModel.getPerson().getValue().getMoney()));
|
||||
//小于2位数
|
||||
if (sb.length()<=2)
|
||||
{
|
||||
if (sb.length() == 0){
|
||||
sb.insert(0,"0.00");
|
||||
} else if(sb.length() == 1){
|
||||
sb.insert(0,"0.0");
|
||||
} else if(sb.length() == 2){
|
||||
sb.insert(0,"0.");
|
||||
}
|
||||
} else {
|
||||
sb.insert(sb.length()-2,'.');
|
||||
}
|
||||
binding.includeLoginSuccess.textViewPersonMoney.setText(sb.toString());
|
||||
ISLOGIN = true;
|
||||
binding.linearLayoutLogin.setVisibility(View.GONE);
|
||||
binding.linearLayoutLoginSuccess.setVisibility(View.VISIBLE);
|
||||
|
||||
goodsArrayList.clear();
|
||||
ArrayList<String> goodsNameList = database.findGoodsListFromSQLite(person);
|
||||
for (String t:goodsNameList
|
||||
) {
|
||||
for (Goods goods:Goods.GOODSLIST
|
||||
) {
|
||||
if (t.equals(goods.getGoodsName())){
|
||||
goodsArrayList.add(goods);
|
||||
}
|
||||
}
|
||||
}
|
||||
personViewModel.setBuyingList(goodsArrayList);
|
||||
Log.i("TAG", "onClick: "+person.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void initLayoutLoginSuccess(){
|
||||
if (personViewModel.getPerson().getValue() != null){
|
||||
binding.includeLoginSuccess.textViewPersonName.setText(personViewModel.getPerson().getValue().getUsername());
|
||||
|
||||
StringBuffer sb = new StringBuffer(String.valueOf(personViewModel.getPerson().getValue().getMoney()));
|
||||
//小于2位数
|
||||
if (sb.length()<=2)
|
||||
{
|
||||
if (sb.length() == 0){
|
||||
sb.insert(0,"0.00");
|
||||
} else if(sb.length() == 1){
|
||||
sb.insert(0,"0.0");
|
||||
} else if(sb.length() == 2){
|
||||
sb.insert(0,"0.");
|
||||
}
|
||||
} else {
|
||||
sb.insert(sb.length()-2,'.');
|
||||
}
|
||||
binding.includeLoginSuccess.textViewPersonMoney.setText(sb.toString());
|
||||
}
|
||||
|
||||
binding.includeLoginSuccess.buttonEsc.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
binding.linearLayoutLoginSuccess.setVisibility(View.GONE);
|
||||
binding.linearLayoutLogin.setVisibility(View.VISIBLE);
|
||||
|
||||
if (personViewModel.getPerson().getValue()!= null){
|
||||
binding.includeLogin.editTextUsername.setText(personViewModel.getPerson().getValue().getUsername());
|
||||
binding.includeLogin.editTextPassword.setText(personViewModel.getPerson().getValue().getPassword());
|
||||
}
|
||||
|
||||
ISLOGIN = false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.includeLoginSuccess.buttonCharge.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Toast.makeText(getContext(),"充值成功",Toast.LENGTH_SHORT).show();
|
||||
Person person = personViewModel.getPerson().getValue();
|
||||
person.setMoney(person.getMoney()+10000);
|
||||
Database database = new Database(new MySQLiteHelper(getContext()));
|
||||
database.updatePersonToSQLite(person);
|
||||
personViewModel.setPerson(person);
|
||||
|
||||
binding.includeLoginSuccess.textViewPersonMoney.setText(Goods.toPriceString(personViewModel.getPerson().getValue().getMoney()));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == PersonFragment.REQUESTCODE_NEWPERSON){
|
||||
if (resultCode == RegisteredActivity.RESULTCODE_NEWPERSON){
|
||||
Person person =(Person) data.getSerializableExtra("newPerson");
|
||||
// Navigation.findNavController(MainActivity.this.binding.getRoot()).navigate(R.id.navigation_person);
|
||||
personViewModel = new ViewModelProvider(this).get(PersonViewModel.class);
|
||||
personViewModel.setPerson(person);
|
||||
// Log.i("MainActivity", "onActivityResult: "+personViewModel.getPerson().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.ronglin.linshopping.ui.person;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.ronglin.linshopping.application.Database;
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
import com.ronglin.linshopping.application.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PersonViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<Person> personMutableLiveData;
|
||||
private MutableLiveData<ArrayList<Goods>> buyingListMutableLiveData;
|
||||
|
||||
public PersonViewModel() {
|
||||
personMutableLiveData = new MutableLiveData<>();
|
||||
buyingListMutableLiveData = new MutableLiveData<>();
|
||||
buyingListMutableLiveData.setValue(new ArrayList<>());
|
||||
personMutableLiveData.setValue(PersonFragment.person); //从MainActivity中恢复数据
|
||||
}
|
||||
|
||||
public void setPerson(Person person){
|
||||
personMutableLiveData.setValue(person);
|
||||
PersonFragment.person = person; //防止Fragment销毁的时候数据也被清空
|
||||
|
||||
}
|
||||
|
||||
public LiveData<Person> getPerson() {
|
||||
return personMutableLiveData;
|
||||
}
|
||||
|
||||
public void setBuyingList(ArrayList<Goods> list){
|
||||
buyingListMutableLiveData.setValue(list);
|
||||
}
|
||||
|
||||
public LiveData<ArrayList<Goods>> getBuyingList() {
|
||||
return buyingListMutableLiveData;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.ronglin.linshopping.ui.shopping;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.ronglin.linshopping.application.Goods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShoppingViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<ArrayList<Goods>> shoppingList;
|
||||
|
||||
public ShoppingViewModel() {
|
||||
shoppingList = new MutableLiveData<>();
|
||||
}
|
||||
|
||||
public void setShoppingList(ArrayList<Goods> list){
|
||||
this.shoppingList.setValue(list);
|
||||
ShoppingFragment.shoppingList = list;
|
||||
}
|
||||
|
||||
public LiveData<ArrayList<Goods>> getShoppingList() {
|
||||
return shoppingList;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:color="@color/color_focused" android:state_checked="true" />
|
||||
<item android:color="@color/color_un_focused" android:state_checked="false" />
|
||||
</selector>
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 2.5 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="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
After Width: | Height: | Size: 516 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 769 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners android:radius="10dp" />
|
||||
<stroke android:color="#2980b9" android:width="3dp" />
|
||||
</shape>
|
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 3.5 KiB |
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!--底层使用蓝色填充色-->
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#FFB0C4DE"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!--上面一层距离底层的顶部1dp,距离底部1dp,类似marginTop,填充色为白色,这样就形成了一个带有蓝色顶部边线和底部边线的白色背景的图-->
|
||||
<item android:bottom="3dp" android:top="3dp">
|
||||
<shape>
|
||||
<solid android:color="#FFFFFFFF"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
After Width: | Height: | Size: 245 KiB |
@ -0,0 +1,36 @@
|
||||
<?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:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:menu="@menu/bottom_nav_menu"
|
||||
app:itemIconTint="@drawable/bottom_navigation_item_selector"
|
||||
app:itemTextColor="@drawable/bottom_navigation_item_selector" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_activity_main"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="55dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/mobile_navigation" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPreviewDialog"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/default_goods"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsNameDialog"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="20sp"
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="center"
|
||||
android:text="拖鞋" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsTagsDialog"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="#B0C4DE"
|
||||
android:textSize="10sp"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsDescribeDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="5dp"
|
||||
android:textSize="10sp"
|
||||
android:textColor="#708090"
|
||||
android:gravity="center_vertical"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsPriceDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="2"
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/red"
|
||||
android:text="TextView" />
|
||||
</LinearLayout>
|
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.goods.GoodsFragment"
|
||||
android:id="@+id/fragment_goods"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="vertical" >
|
||||
<include
|
||||
android:id="@+id/top_bar"
|
||||
layout="@layout/top_bar"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listViewGoods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:divider="#FFD8BFD8"
|
||||
android:dividerHeight="5dp"
|
||||
android:transcriptMode="alwaysScroll"
|
||||
/>
|
||||
</LinearLayout>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragment_person"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.shopping.ShoppingFragment" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayoutLogin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
<include
|
||||
android:id="@+id/includeLogin"
|
||||
layout="@layout/login_layout" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayoutLoginSuccess"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible" >
|
||||
<include
|
||||
android:id="@+id/includeLoginSuccess"
|
||||
layout="@layout/login_success_layout" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragment_shopping"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.person.PersonFragment">
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listViewShopping"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include
|
||||
android:id="@+id/shoppingBottom"
|
||||
layout="@layout/shopping_bottom"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPreviewBuying"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="2"
|
||||
app:srcCompat="@drawable/default_goods"
|
||||
android:background="@color/white"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsNameBuying"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="10"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textStyle="bold"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsPriceBuying"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="5"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/red"
|
||||
android:text="TextView" />
|
||||
</LinearLayout>
|
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPreview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/default_goods"
|
||||
android:background="@color/white"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:layout_margin="5dp"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="鸿星尔克大球鞋"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsTags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:layout_margin="5dp"
|
||||
android:padding="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/text_view_tags"
|
||||
android:textSize="10sp"
|
||||
android:text="球鞋 皮鞋 板鞋 运动鞋" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPrice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/red"
|
||||
android:text="100.00" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButtonAdd"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/shopping_add"
|
||||
android:background="@color/white"
|
||||
android:layout_gravity="top"
|
||||
android:scaleType="fitEnd"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxSelect"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPreviewShopping"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="2"
|
||||
app:srcCompat="@drawable/default_goods"
|
||||
android:background="@color/white"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsNameShopping"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="10"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewGoodsPriceShopping"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="3"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/red"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPersonPhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="150dp"
|
||||
app:srcCompat="@drawable/default_person" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewUsername"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:ems="5"
|
||||
android:text="用户名:" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextUsername"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hint="请输入用户名"
|
||||
android:inputType="textPersonName" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:ems="5"
|
||||
android:gravity="center"
|
||||
android:text="密码:" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextPassword"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hint="请输入密码"
|
||||
android:inputType="textWebPassword"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRegistered"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="注册" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonLogin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="登录" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewPersonPhoto"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/default_person" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPersonName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="4"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:text="default" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPersonMoney"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/red" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCharge"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="充值" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonEsc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="2"
|
||||
android:text="注销" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
android:text="购物订单" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/buyingListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="10"/>
|
||||
</LinearLayout>
|
@ -0,0 +1,112 @@
|
||||
<?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/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="25sp"
|
||||
android:layout_marginTop="150dp"
|
||||
android:text="注册为新用户" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewUsernameR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:ems="5"
|
||||
android:text="用户名:" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextUsernameR"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hint="请输入用户名"
|
||||
android:inputType="textPersonName" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPasswordR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:ems="5"
|
||||
android:gravity="center"
|
||||
android:text="密码:" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextPasswordR"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hint="请输入密码"
|
||||
android:inputType="textWebPassword"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewPasswordR2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:ems="5"
|
||||
android:gravity="center"
|
||||
android:text="确认密码:" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextPasswordR2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hint="请再次确认密码"
|
||||
android:inputType="textWebPassword"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancelR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textColor="@color/red"
|
||||
android:text="取消" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRegistered"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="注册" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,51 @@
|
||||
<?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:gravity="center_vertical">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxAll"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold"
|
||||
android:text="全选" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewAllPrice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:textColor="@color/red"
|
||||
android:gravity="center"
|
||||
android:text="0.00" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonDelete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="10sp"
|
||||
android:text="删除" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonBuy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:textSize="10sp"
|
||||
android:text="购买" />
|
||||
</LinearLayout>
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButtonPhoto"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/default_photo"
|
||||
android:background="@color/white"
|
||||
android:scaleType="fitStart" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextSearch"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="4"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:paddingStart="10dp"
|
||||
android:background="@drawable/sharp_edit"
|
||||
android:hint="@string/searchHint"
|
||||
android:inputType="textPersonName"
|
||||
android:text="" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButtonShopping"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/shopping2"
|
||||
android:background="@color/white"
|
||||
android:scaleType="fitEnd" />
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_goods"
|
||||
android:icon="@drawable/goods"
|
||||
android:title="@string/title_goods" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_shopping"
|
||||
android:icon="@drawable/shopping"
|
||||
android:title="@string/title_shopping" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_person"
|
||||
android:icon="@drawable/person"
|
||||
android:title="@string/title_person" />
|
||||
|
||||
</menu>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 982 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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:id="@+id/mobile_navigation"
|
||||
app:startDestination="@+id/navigation_goods">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_goods"
|
||||
android:name="com.ronglin.linshopping.ui.goods.GoodsFragment"
|
||||
android:label="@string/title_goods"
|
||||
tools:layout="@layout/fragment_goods" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_shopping"
|
||||
android:name="com.ronglin.linshopping.ui.shopping.ShoppingFragment"
|
||||
android:label="@string/title_shopping"
|
||||
tools:layout="@layout/fragment_shopping" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_person"
|
||||
android:name="com.ronglin.linshopping.ui.person.PersonFragment"
|
||||
android:label="@string/title_person"
|
||||
tools:layout="@layout/fragment_person" />
|
||||
</navigation>
|
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.LinShopping" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="selector_color">#FFBB86FC</color>
|
||||
<color name="title_color">#FFBB86FC</color>
|
||||
<color name="color_focused">#4169E1</color>
|
||||
<color name="color_un_focused">#000000</color>
|
||||
<color name="red">#FFFF0000</color>
|
||||
</resources>
|
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">高午商店</string>
|
||||
<string name="title_goods">商品</string>
|
||||
<string name="title_shopping">购物车</string>
|
||||
<string name="title_person">个人中心</string>
|
||||
<string name="searchHint">请输入商品名称</string>
|
||||
</resources>
|
@ -0,0 +1,17 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.LinShopping" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/title_color</item>
|
||||
<item name="colorPrimaryVariant">@color/title_color</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- <item name="android:statusBarColor">@color/purple_500</item>-->
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
@ -0,0 +1,17 @@
|
||||
package com.ronglin.linshopping;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:7.0.3"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
android.overridePathCheck=true
|
||||
android.injected.testOnly = false
|
@ -0,0 +1,6 @@
|
||||
#Mon Nov 29 18:57:08 CST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -0,0 +1,10 @@
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter() // Warning: this repository is going to shut down soon
|
||||
}
|
||||
}
|
||||
rootProject.name = "LinShopping"
|
||||
include ':app'
|