master
unknown 2 years ago
parent df3995e318
commit fec905e1ee

14
.gitignore vendored

@ -0,0 +1,14 @@
*.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

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1 @@
Snack App

@ -0,0 +1,116 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="13" />
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="OrderStore" uuid="f0146414-aa44-4dc9-8efb-984990e1cf79">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\HP\AppData\Local\JetBrains\IntelliJIdea2021.3\device-explorer\Pixel_5_API_30 [emulator-5554]\data\data\com.shuyue.snack\databases\OrderStore.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.36.0.3/sqlite-jdbc-3.36.0.3.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="false" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DataExportManager">
<export-instructions>
<create-header value="true" />
<friendly-headers value="false" />
<quote-values-containing-separator value="true" />
<quote-all-values value="false" />
<value-separator value="" />
<file-name value="" />
<file-location value="" />
<scope value="GLOBAL" />
<destination value="FILE" />
<format value="EXCEL" />
<charset value="GBK" />
</export-instructions>
</component>
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes />
</component>
<component name="DBNavigator.Project.DatabaseEditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.EditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.ExecutionManager">
<retain-sticky-names value="false" />
</component>
<component name="DBNavigator.Project.MethodExecutionManager">
<method-browser />
<execution-history>
<group-entries value="true" />
<execution-inputs />
</execution-history>
<argument-values-cache />
</component>
<component name="DBNavigator.Project.ObjectDependencyManager">
<last-used-dependency-type value="INCOMING" />
</component>
<component name="DBNavigator.Project.ObjectQuickFilterManager">
<last-used-operator value="EQUAL" />
<filters />
</component>
<component name="DBNavigator.Project.ParserDiagnosticsManager">
<diagnostics-history />
</component>
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
<recently-used-interfaces />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
<object-type name="TYPE ATTRIBUTE" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<audit-columns>
<column-names value="" />
<visible value="true" />
<editable value="false" />
</audit-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="Java" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="Groovy" enabled="true" />
<content-type name="AIDL" enabled="true" />
<content-type name="YAML" enabled="true" />
<content-type name="Manifest" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="ASK" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
<component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables />
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="D:\IntelliJ IDEA\.android\avd\Pixel_5_API_30.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-05-11T06:10:28.721356400Z" />
</component>
</project>

@ -0,0 +1,10 @@
<component name="ProjectDictionaryState">
<dictionary name="snow">
<words>
<w>fujian</w>
<w>gson</w>
<w>guangxi</w>
<w>shuyue</w>
</words>
</dictionary>
</component>

@ -0,0 +1,20 @@
<?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="13" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://mirrors.huaweicloud.com/repository/maven/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component>
</project>

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/drawable/button_shape.xml" value="0.21296296296296297" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/drawable/editext_shape.xml" value="0.21296296296296297" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_add_address.xml" value="0.21025641025641026" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_address_set.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_change_address.xml" value="0.2247863247863248" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_delete_address.xml" value="0.136" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_detail.xml" value="0.25833333333333336" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_forget_password.xml" value="0.21025641025641026" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_login.xml" value="0.2" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_main.xml" value="0.176" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_order.xml" value="0.2" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_register.xml" value="0.21025641025641026" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/activity_welcome.xml" value="0.25833333333333336" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/dialog_view.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/empty_cart_view.xml" value="0.21196581196581196" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/empty_order_view.xml" value="0.21196581196581196" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/footer_no_item.xml" value="0.21196581196581196" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/fragment_home.xml" value="0.21196581196581196" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/fragment_my.xml" value="0.1" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/fragment_place.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/fragment_snack.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/head_home_image.xml" value="0.2" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_address.xml" value="0.22136752136752136" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_address_set.xml" value="0.22136752136752136" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_home_snack.xml" value="0.18704710144927536" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_order.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_place_order.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_snack_left.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/layout/item_snack_right.xml" value="0.2222222222222222" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/menu/activity_list_view.xml" value="0.2341880341880342" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/menu/bottom_nav_menu.xml" value="0.2341880341880342" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/menu/left.xml" value="0.2341880341880342" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/menu/main.xml" value="0.2341880341880342" />
<entry key="..\:/IntelliJ IDEA/AndroidProjects/snack-app-master/app/src/main/res/menu/right.xml" value="0.2341880341880342" />
</map>
</option>
</component>
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" 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,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

@ -0,0 +1,29 @@
@startuml
title __SNACK APP's Component Diagram__\n
component "Snack_App.app.unitTest" {
[Snack_App.app.main]
component "Snack_App.app.main" {
[Snack_App.app.androidTest]
component "Snack_App.app.androidTest" {
[Snack_App.app]
}
}
}
right footer
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
For more information about this tool, please contact philippe.mesmeur@gmail.com
endfooter
@enduml

1
app/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,59 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.shuyue.snack"
minSdkVersion 21
targetSdkVersion 29
versionCode 2
versionName '1.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// ButterKnife requires Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.mediarouter:mediarouter:1.1.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// ButterKnife
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
// BaseRecyclerViewAdapterHelper
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
// CircleImageView
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Gson
implementation 'com.google.code.gson:gson:2.8.6'
//
implementation 'liji.library.dev:citypickerview:1.1.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,26 @@
package com.shuyue.snack;
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.shuyue.snack", appContext.getPackageName());
}
}

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.shuyue.snack">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".MyApplication"
android:icon="@mipmap/momo"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup"
tools:targetApi="n">
<activity
android:name=".activity.Register"
android:exported="true"/>
<activity
android:name=".activity.Login"
android:exported="true"/>
<activity
android:name=".activity.OrderActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
<activity
android:name=".activity.LoginActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
<activity
android:name=".activity.DetailActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<activity
android:name=".activity.WelcomeActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"/>
</application>
</manifest>

@ -0,0 +1,47 @@
package com.shuyue.snack;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.shuyue.snack.dao.UserDao;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BottomNavigationView navView = findViewById(R.id.nav_view);
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_snack, R.id.navigation_place, R.id.navigation_my)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
// 检查登录状态
checkLogin();
}
/**
*
*/
private void checkLogin() {
// 检查持久化的数据
if (UserDao.isLogin()) {
// 已登录
MyApplication.isLogin(true);
MyApplication.setUser(UserDao.getUser());
} else {
// 未登录
MyApplication.isLogin(false);
MyApplication.setUser(null);
}
}
}

@ -0,0 +1,77 @@
package com.shuyue.snack;
import android.app.Application;
import com.shuyue.snack.model.Snack;
import com.shuyue.snack.model.User;
import com.shuyue.snack.utils.Utils;
import java.util.ArrayList;
import java.util.List;
public class MyApplication extends Application {
/**
* Application
*/
private static MyApplication appContext;
/**
*
*/
private static List<Snack> cartSnacks;
private static List<Snack> spsc;
/**
*
*/
private static User user;
/**
*
*/
private static boolean isLogin;
public static MyApplication getInstance() {
return appContext;
}
public static List<Snack> getCartSnacks() {
return cartSnacks;
}
public static List<Snack> getSC() {
return spsc;
}
public static User getUser() {
return user;
}
public static void setUser(User user) {
MyApplication.user = user;
}
/**
*
*
* @return <tt>true</tt>: , <tt>false</tt>:
*/
public static boolean isLogin() {
return isLogin;
}
public static void isLogin(boolean isLogin) {
MyApplication.isLogin = isLogin;
}
@Override
public void onCreate() {
super.onCreate();
appContext = this;
// 初始化购物车集合
cartSnacks = new ArrayList<>();
// 初始化工具类
Utils.init(this);
}
}

@ -0,0 +1,130 @@
package com.shuyue.snack.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Snack;
import com.shuyue.snack.utils.Tips;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class DetailActivity extends AppCompatActivity {
@BindView(R.id.detailImage)
ImageView image;
@BindView(R.id.detailName)
TextView name;
@BindView(R.id.detailPrice)
TextView price;
@BindView(R.id.detailContent)
TextView detail;
@BindView(R.id.detailsc)
Button addsc;
@BindView(R.id.detailAddCartBtn)
Button addCart;
public static void actionStart(Context context, Snack snack) {
Intent intent = new Intent(context, DetailActivity.class);
intent.putExtra("snack", snack);
context.startActivity(intent);
}
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
fullScreen(this);
ButterKnife.bind(this);
Snack snack = (Snack) getIntent().getSerializableExtra("snack");
if (snack != null) {
image.setImageResource(snack.getImage());
name.setText(snack.getName());
price.setText("¥" + snack.getPrice());
detail.setText(snack.getDetail());
addCart.setOnClickListener(v -> {
if (!MyApplication.getCartSnacks().contains(snack)) {
// 添加到购物车
snack.setCount(1);
MyApplication.getCartSnacks().add(snack);
Tips.show("已添加" + snack.getName() + "到购物车");
// 关闭Activity
finish();
} else {
Tips.show("已在购物车中,请勿重复添加");
}
});
addsc.setOnClickListener(v -> {
if (!MyApplication.getSC().contains(snack)) {
// 添加到收藏
snack.setCount(1);
MyApplication.getSC().add(snack);
Tips.show("已添加" + snack.getName() + "到我的收藏");
// 关闭Activity
finish();
} else {
Tips.show("已在我的收藏中,请勿重复收藏");
}
});
}
}
@OnClick(R.id.detailBack)
void clickBack() {
finish();
}
/**
*
*/
private void fullScreen(Activity activity) {
Window window = activity.getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
View decorView = ((Window) window).getDecorView();
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
} else {
WindowManager.LayoutParams attributes = window.getAttributes();
int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
attributes.flags |= flagTranslucentStatus;
window.setAttributes(attributes);
}
}
}

@ -0,0 +1,135 @@
package com.shuyue.snack.activity;
import android.widget.ViewFlipper;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.shuyue.snack.MainActivity;
import com.shuyue.snack.R;
/**
*
*/
public class Login extends AppCompatActivity {
private EditText edt_Username, edt_PassWord;
private Button btn_Login, btn_Register;
boolean isFlag = false;
ViewFlipper flipper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
//设置页面标题
setTitle("momo超市");
edt_Username = this.findViewById(R.id.edt_UserName);
edt_PassWord = this.findViewById(R.id.edt_Password);
btn_Login = this.findViewById(R.id.btn_Login);
btn_Register = this.findViewById(R.id.btn_Register);
//用户名
edt_Username.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
//当点击用户名输入框时,清空密码框
edt_PassWord.setText("");
} else {
String username = edt_Username.getText().toString();
if (username.length() < 4) {
Toast.makeText(Login.this, "用户名长度必须大于4,请重新输入", Toast.LENGTH_SHORT).show();
edt_Username.setText("");
}
}
}
});
//密码框
edt_PassWord.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
} else {
String password = edt_PassWord.getText().toString();
if (password.length() < 6 || password.length() > 12) {
Toast.makeText(Login.this, "密码长度必须为6-12位,请重新输入", Toast.LENGTH_LONG).show();
edt_PassWord.setText("");
}
}
}
});
//打开数据库
SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
//若不存在user表则创建user表
String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
database.execSQL(createSQL);//执行创表语句
//若不存在address表则创建address表
String createSQL1 = "create table IF NOT EXISTS address(id integer primary key autoincrement, username text, cosignee text,phone text,address text)";
database.execSQL(createSQL1);//执行创表语句
//登录事件监听
btn_Login.setOnClickListener(new View.OnClickListener() {
@SuppressLint("Range")
@Override
public void onClick(View v) {
isFlag = false;
String username = edt_Username.getText().toString();
String password = edt_PassWord.getText().toString();
//判断输入是否为空,若为空,给出提示
if (username.equals("") || password.equals("")) {
Toast.makeText(Login.this, "请输入账号或密码", Toast.LENGTH_SHORT).show();
isFlag = true;
}
//查询账号密码,若数据库表为空,提示用户注册
Cursor cursor = database.query("user", new String[]{"username,password"}, null, null, null, null, null);
if (cursor.getCount() == 0) {
Toast.makeText(Login.this, "请先注册账号", Toast.LENGTH_SHORT).show();
isFlag=true;
}
//若数据库表不为空,查看用户输入的账号密码是否与数据库表中的相匹配,若匹配,登录成功,跳转到主界面
// 否则无法登录,给出账号密码错误提示
else {
while (cursor.moveToNext()){
if (username.equals(cursor.getString(cursor.getColumnIndex("username"))) && password.equals(cursor.getString(cursor.getColumnIndex("password")))) {
Toast.makeText(Login.this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Login.this, MainActivity.class);
startActivity(intent);
isFlag = true;
break;
}
}
if (isFlag == false) {
Toast.makeText(Login.this, "账号或密码错误,请重新输入", Toast.LENGTH_SHORT).show();
}
}
}
});
//修改密码监听事件,点击忘记密码,跳转到修改密码界面
//注册监听事件,点击新用户,跳转到注册界面
btn_Register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Login.this, Register.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,161 @@
package com.shuyue.snack.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.dao.UserDao;
import com.shuyue.snack.data.DataServer;
import com.shuyue.snack.model.User;
import com.shuyue.snack.utils.Tips;
import butterknife.BindView;
import android.annotation.SuppressLint;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.shuyue.snack.MainActivity;
public class LoginActivity extends AppCompatActivity {
private EditText edt_Username, edt_PassWord;
private Button btn_Login, btn_Register;
boolean isFlag = false;
@BindView(R.id.edt_UserName)
EditText usernameEdit;
@BindView(R.id.edt_Password)
EditText passwordEdit;
public static void actionStart(Context context) {
Intent intent = new Intent(context, LoginActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
edt_Username = this.findViewById(R.id.edt_UserName);
edt_PassWord = this.findViewById(R.id.edt_Password);
btn_Login = this.findViewById(R.id.btn_Login);
btn_Register = this.findViewById(R.id.btn_Register);
//打开数据库
SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
//若不存在user表则创建user表
String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
database.execSQL(createSQL);//执行创表语句
//登录事件监听
btn_Login.setOnClickListener(new View.OnClickListener() {
@SuppressLint("Range")
@Override
public void onClick(View v) {
isFlag = false;
String username = edt_Username.getText().toString();
String password = edt_PassWord.getText().toString();
//判断输入是否为空,若为空,给出提示
if (username.equals("") || password.equals("")) {
Toast.makeText(LoginActivity.this, "请输入账号或密码!", Toast.LENGTH_SHORT).show();
isFlag = true;
}
//查询账号密码,若数据库表为空,提示用户注册
Cursor cursor = database.query("user", new String[]{"username,password"}, null, null, null, null, null);
if (cursor.getCount() == 0) {
Toast.makeText(LoginActivity.this, "请先注册账号!", Toast.LENGTH_SHORT).show();
isFlag=true;
}
//若数据库表不为空,查看用户输入的账号密码是否与数据库表中的相匹配,若匹配,登录成功,跳转到主界面
// 否则无法登录,给出账号密码错误提示
else {
while (cursor.moveToNext()){
if (username.equals(cursor.getString(cursor.getColumnIndex("username"))) && password.equals(cursor.getString(cursor.getColumnIndex("password")))) {
/////
User user = new User(username, password);
// User loginUser = checkUserFromAccountList(user);
Tips.show("登录成功");
MyApplication.isLogin(true);
MyApplication.setUser(user);
// 持久化已登录用户数据
UserDao.saveUser(user);
UserDao.isLogin(true);
// 持久化账号,以便退出登录后不用再输入账号
UserDao.saveUsername(username);
// 关闭Activity
// finish();
// Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
isFlag = true;
break;
}
}
if (isFlag == false) {
Toast.makeText(LoginActivity.this, "账号或密码错误,请重新输入", Toast.LENGTH_SHORT).show();
}
}
}
});
//修改密码监听事件,点击忘记密码,跳转到修改密码界面
//注册监听事件,点击新用户,跳转到注册界面
btn_Register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, Register.class);
startActivity(intent);
}
});
// setTitle("登录");
// ButterKnife.bind(this);
// 恢复账号
// String username = UserDao.getUsername();
// usernameEdit.setText(username);
}
@Override
protected void onStop() {
super.onStop();
finish();
}
/**
*
*
* @return : , : null
*/
public User checkUserFromAccountList(User u) {
for (User tmp : DataServer.getAccountList()) {
if (tmp.equals(u)) {
return tmp;
}
}
return null;
}
}

@ -0,0 +1,88 @@
package com.shuyue.snack.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.service.autofill.Dataset;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.adaptor.OrderAdapter;
import com.shuyue.snack.dao.OrderDao;
import com.shuyue.snack.data.DataServer;
import com.shuyue.snack.model.Order;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class OrderActivity extends AppCompatActivity {
@BindView(R.id.orderRecyclerView)
RecyclerView orderRecyclerView;
Button check;
EditText query;
//
public static void actionStart(Context context) {
Intent intent = new Intent(context, OrderActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order);
/////
query=findViewById(R.id.query);
String name=query.getText().toString();
check=findViewById(R.id.check);
setTitle("我的订单");
ButterKnife.bind(this);
orderRecyclerView.setLayoutManager(new LinearLayoutManager(OrderActivity.this));
initAdapter();
}
////////////
//////////////
/**
*
*/
private void initAdapter() {
// 获取数据库数据
List<Order> orders = OrderDao.findAllByUsername(MyApplication.getUser().getUsername());
OrderAdapter adapter = new OrderAdapter(orders);
// 设置空布局
adapter.setEmptyView(getEmptyView());
orderRecyclerView.setAdapter(adapter);
}
public View getEmptyView() {
return getLayoutInflater().inflate(R.layout.empty_order_view, orderRecyclerView, false);
}
/**
*
*/
}

@ -0,0 +1,243 @@
package com.shuyue.snack.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.view.View;
import android.widget.*;
import com.shuyue.snack.R;
/**
*
*/
public class Register extends AppCompatActivity {
private Spinner sp_Provinces;
private Spinner sp_Cities;
private RadioGroup rdg_Sex;
private RadioButton rb_Man, rb_Woman;
private Button btn_Register;
private EditText edt_UserName, edt_Password, edt_Password2, edt_Phone;
private boolean isFlag = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
//设置页面标题
setTitle("注册账号");
//用户名及密码
edt_UserName = this.findViewById(R.id.edt_UserName);
edt_Password = this.findViewById(R.id.edt_Password);
edt_Password2 = this.findViewById(R.id.edt_Password2);
//手机号
edt_Phone = this.findViewById(R.id.edt_Phone);
//出生地
sp_Provinces = this.findViewById(R.id.sp_Provinces);
sp_Cities = this.findViewById(R.id.sp_Cities);
//性别选择
rdg_Sex = this.findViewById(R.id.rdg_Sex);
rb_Man = this.findViewById(R.id.rb_Man);
rb_Woman = this.findViewById(R.id.rb_Woman);
//确认注册按钮
btn_Register = this.findViewById(R.id.btn_Register);
//用户名输入框失焦处理
edt_UserName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
isFlag = true;
} else {
isFlag = true;
String username = edt_UserName.getText().toString();
if (username.length() < 4) {
Toast.makeText(Register.this, "用户名长度必须大于4,请重新输入", Toast.LENGTH_SHORT).show();
edt_UserName.setText("");
}
}
}
});
//密码输入框失焦处理
edt_Password.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
isFlag=true;
} else {
isFlag = true;
String password = edt_Password.getText().toString();
if (password.length() < 6 || password.length() > 12) {
Toast.makeText(Register.this, "密码长度必须为6-12位,请重新输入", Toast.LENGTH_LONG).show();
edt_Password.setText("");
}
}
}
});
//确认密码输入框失焦处理
edt_Password2.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
isFlag=true;
} else {
isFlag = true;
String password = edt_Password.getText().toString();
String password2 = edt_Password2.getText().toString();
if (!(password.equals(password2))) {
Toast.makeText(Register.this, "两次密码不一致,请重新输入", Toast.LENGTH_SHORT).show();
edt_Password2.setText("");
} else if (password2.length() < 6 || password2.length() > 12) {
Toast.makeText(Register.this, "密码长度必须为6-12位", Toast.LENGTH_LONG).show();
edt_Password2.setText("");
}
}
}
});
//手机号
edt_Phone.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
isFlag=true;
} else {
isFlag = true;
String phone = edt_Phone.getText().toString();
if (!(phone.length() == 11)) {
Toast.makeText(Register.this, "请输入11位手机号", Toast.LENGTH_SHORT).show();
edt_Phone.setText("");
}
}
}
});
//性别处理
rdg_Sex.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_Man:
Toast.makeText(Register.this, "男", Toast.LENGTH_LONG).show();
break;
case R.id.rb_Woman:
Toast.makeText(Register.this, "女", Toast.LENGTH_LONG).show();
break;
}
}
});
//出生地处理
ArrayAdapter adapter = ArrayAdapter.createFromResource(Register.this, R.array.provinces, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp_Provinces.setAdapter(adapter);
sp_Provinces.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override//省市联动
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.hunan, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 1) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.yunnan, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 2) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.shanxi, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 3) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.fj, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 4) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guangxi, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 5) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guangdong, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
} else if (position == 6) {
ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guizhou, android.R.layout.simple_spinner_item);
sp_Cities.setAdapter(cityAdapter);
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
//打开数据库或创建数据库
SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
database.execSQL(createSQL);
//确认注册处理
btn_Register.setOnClickListener(new View.OnClickListener() {
@SuppressLint("Range")
@Override
public void onClick(View v) {
//获取用户输入信息
String username = edt_UserName.getText().toString();
String password = edt_Password.getText().toString();
String password2 = edt_Password2.getText().toString();
String phone = edt_Phone.getText().toString();
//判断用户输入是否为空,若有一个输入框为空,则给出提示信息
if (username.equals("") || password.equals("") || password2.equals("") || phone.equals("")) {
Toast.makeText(Register.this, "请输入完整信息", Toast.LENGTH_SHORT).show();
isFlag = false;
}
//判断用户是否存在,若已有此账号,则不允许重复注册,否则允许注册
Cursor cursor = database.query("user", new String[]{"username"}, null, null, null, null, null);
while (cursor.moveToNext()) {
if (username.equals(cursor.getString(cursor.getColumnIndex("username")))) {
Toast.makeText(Register.this, "该账户已存在", Toast.LENGTH_SHORT).show();
isFlag = false;//
}
}
if(!password.equals(password2)) {
Toast.makeText(Register.this, "两次密码不一致", Toast.LENGTH_SHORT).show();
//若允许注册则将用户输入的信息插入到数据库表user中,插入成功跳转到登录界面
}else if (!(phone.length() == 11)){
Toast.makeText(Register.this, "请输入11位手机号", Toast.LENGTH_SHORT).show();
}
else if (isFlag ) {
ContentValues values = new ContentValues();
//将数据放入values中
values.put("username", username);
values.put("password", password);
values.put("password2", password2);
values.put("phone", phone);
//用insert()方法将values中的数据插入到user表中
database.insert("user", null, values);
Toast.makeText(Register.this, "注册成功,请登录!", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Register.this, Login.class);
startActivity(intent);
database.close();
}
}
});
}
}

@ -0,0 +1,36 @@
package com.shuyue.snack.activity;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.shuyue.snack.MainActivity;
import com.shuyue.snack.R;
public class WelcomeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}, 800);
}
}

@ -0,0 +1,22 @@
package com.shuyue.snack.adaptor;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Snack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class HomeAdapter extends BaseQuickAdapter<Snack, BaseViewHolder> {
public HomeAdapter(List<Snack> snacks) {
super(R.layout.item_home_snack, snacks);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
baseViewHolder.setImageResource(R.id.homeSnackImage, snack.getImage());
}
}

@ -0,0 +1,38 @@
package com.shuyue.snack.adaptor;
import android.annotation.SuppressLint;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Order;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class OrderAdapter extends BaseQuickAdapter<Order, BaseViewHolder> {
public OrderAdapter(List<Order> orders) {
super(R.layout.item_order, orders);
/////
/////
}
@SuppressLint("SimpleDateFormat")
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, Order order) {
baseViewHolder.setText(R.id.orderName, order.getName());
baseViewHolder.setImageResource(R.id.orderImage, order.getImage());
baseViewHolder.setText(R.id.orderTime, "下单时间: " + order.getTime());
baseViewHolder.setText(R.id.orderMoney, "总付款: ¥" + order.getMoney());
baseViewHolder.setText(R.id.button,"删除订单");
}
}

@ -0,0 +1,28 @@
package com.shuyue.snack.adaptor;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Snack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
*
*/
public class PlaceOrderAdapter extends BaseQuickAdapter<Snack, BaseViewHolder> {
public PlaceOrderAdapter(List<Snack> snacks) {
super(R.layout.item_place_order, snacks);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
baseViewHolder.setImageResource(R.id.placeOrderImage, snack.getImage())
.setText(R.id.placeOrderName, snack.getName())
.setText(R.id.placeOrderPrice, "¥" + snack.getPrice())
.setText(R.id.orderCountBtn, String.valueOf(snack.getCount()));
}
}

@ -0,0 +1,29 @@
package com.shuyue.snack.adaptor;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyue.snack.R;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SnackLeftAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
public SnackLeftAdapter(List<String> types) {
super(R.layout.item_snack_left, types);
}
/**
* item
*/
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
// 第一个item默认选中状态
if (baseViewHolder.getLayoutPosition() == 0) {
baseViewHolder.setBackgroundResource(R.id.snackLeftType, R.color.colorBgWhite);
}
baseViewHolder.setText(R.id.snackLeftType, s);
}
}

@ -0,0 +1,24 @@
package com.shuyue.snack.adaptor;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Snack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SnackRightAdapter extends BaseQuickAdapter<Snack, BaseViewHolder> {
public SnackRightAdapter(List<Snack> snacks) {
super(R.layout.item_snack_right, snacks);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
baseViewHolder.setImageResource(R.id.snackRightImage, snack.getImage())
.setText(R.id.snackRightName, snack.getName())
.setText(R.id.snackRightPrice, "¥" + snack.getPrice());
}
}

@ -0,0 +1,29 @@
package com.shuyue.snack.animator;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.chad.library.adapter.base.animation.BaseAnimation;
import org.jetbrains.annotations.NotNull;
public class MyAnimation implements BaseAnimation {
@NotNull
@Override
public Animator[] animators(@NotNull View view) {
Animator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.3f, 1);
Animator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.3f, 1);
Animator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
scaleY.setDuration(350);
scaleX.setDuration(350);
alpha.setDuration(350);
scaleY.setInterpolator(new DecelerateInterpolator());
scaleX.setInterpolator(new DecelerateInterpolator());
return new Animator[]{scaleY, scaleX, alpha};
}
}

@ -0,0 +1,37 @@
package com.shuyue.snack.animator;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.Interpolator;
import com.chad.library.adapter.base.animation.BaseAnimation;
import org.jetbrains.annotations.NotNull;
import static java.lang.Math.PI;
import static java.lang.Math.pow;
import static java.lang.Math.sin;
public class MyAnimation2 implements BaseAnimation {
static class MyInterpolator2 implements Interpolator {
@Override
public float getInterpolation(float input) {
float factor = 0.7f;
return (float) (pow(2.0, -10.0 * input) * sin((input - factor / 4) * (2 * PI) / factor) + 1);
}
}
@NotNull
@Override
public Animator[] animators(@NotNull View view) {
Animator translationX =
ObjectAnimator.ofFloat(view, "translationX", -view.getRootView().getWidth(), 0f);
translationX.setDuration(800);
translationX.setInterpolator(new MyInterpolator2());
return new Animator[]{translationX};
}
}

@ -0,0 +1,27 @@
package com.shuyue.snack.animator;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.chad.library.adapter.base.animation.BaseAnimation;
import org.jetbrains.annotations.NotNull;
public class MyAnimation3 implements BaseAnimation {
@NotNull
@Override
public Animator[] animators(@NotNull View view) {
Animator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
alpha.setDuration(450);
Animator translationY =
ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0f);
translationY.setDuration(450);
translationY.setInterpolator(new DecelerateInterpolator(1.2f));
return new Animator[]{alpha, translationY};
}
}

@ -0,0 +1,34 @@
package com.shuyue.snack.dao;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
public class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper(@Nullable Context context, int version) {
super(context, "OrderStore.db", null, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
// 创建数据库表
// 创建orders表
String createOrders = "create table orders (" +
"id integer primary key autoincrement," +
"name text," +
"image integer," +
"money real," +
"time text," +
"username text)";
db.execSQL(createOrders);
// 创建address表
String createAddress = "create table address(id integer primary key autoincrement, username text, cosignee text,phone number,address text)";
db.execSQL(createAddress);
// 创建 user表
String createUsers = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
db.execSQL(createUsers);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

@ -0,0 +1,39 @@
package com.shuyue.snack.dao;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DbContect extends SQLiteOpenHelper {
private static final int VERSION=1;
private static final String DBNAME="OrderStore.db"; // 创建数据库名叫 Users
private Context mContext;
public DbContect(Context context){super(context,DBNAME,null,VERSION);
mContext = context;
}
//创建数据库
public void onCreate(SQLiteDatabase db){
// 创建orders表
String createOrders = "create table orders (" +
"id integer primary key autoincrement," +
"name text," +
"image integer," +
"money real," +
"time text," +
"username text)";
db.execSQL(createOrders);
// 创建address表
String createAddress = "create table address(id integer primary key autoincrement, username text, cosignee text,phone number,address text)";
db.execSQL(createAddress);
// 创建 user表
String createUsers = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
db.execSQL(createUsers);
}
//数据库版本更新
public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion)
{
db.execSQL("drop table if exists user");
db.execSQL("drop table if exists orders");
db.execSQL("drop table if exists address");
onCreate(db);
}
}

@ -0,0 +1,77 @@
package com.shuyue.snack.dao;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.shuyue.snack.model.Order;
import com.shuyue.snack.utils.Utils;
import java.util.ArrayList;
import java.util.List;
public class OrderDao {
private static DatabaseHelper dbHelper = new DatabaseHelper(Utils.getContext(), 1);
static {
dbHelper.getWritableDatabase();
}
// * 保存订单数据
public static void saveOrder(List<Order> orders) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
for (Order order : orders) {
ContentValues values = new ContentValues();
values.put("name", order.getName());
values.put("image", order.getImage());
values.put("money", order.getMoney());
values.put("time", order.getTime());
values.put("username", order.getUsername());
db.insert("orders", null, values);
}
}
// * 通过用户名查询订单数据
public static List<Order> findAllByUsername(String username) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
List<Order> orders = new ArrayList<>();
// 查询指定用户名订单
Cursor cursor = db.query("orders", null, "username=?", new String[]{username}, null, null, "time desc");
if (cursor.moveToFirst()) {
do {
String name = cursor.getString(cursor.getColumnIndex("name"));
int image = cursor.getInt(cursor.getColumnIndex("image"));
double money = cursor.getDouble(cursor.getColumnIndex("money"));
String time = cursor.getString(cursor.getColumnIndex("time"));
Order order = new Order(name, image, money, time);
orders.add(order);
} while (cursor.moveToNext());
}
cursor.close();
return orders;
}
// * 通过商品名称查询订单
public static List<Order> findAllByName(String names) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
List<Order> orders1 = new ArrayList<>();
// 查询指定用户名订单
Cursor cursor = db.query("orders", null, "name=?", new String[]{names}, null, null, "time desc");
if (cursor.moveToFirst()) {
do {
String name = cursor.getString(cursor.getColumnIndex("name"));
int image = cursor.getInt(cursor.getColumnIndex("image"));
double money = cursor.getDouble(cursor.getColumnIndex("money"));
String time = cursor.getString(cursor.getColumnIndex("time"));
Order order = new Order(name, image, money, time);
orders1.add(order);
} while (cursor.moveToNext());
}
cursor.close();
return orders1;
}
}

@ -0,0 +1,62 @@
package com.shuyue.snack.dao;
import android.content.Context;
import android.content.SharedPreferences;
import com.google.gson.Gson;
import com.shuyue.snack.model.User;
import com.shuyue.snack.utils.Utils;
public class UserDao {
// 实例化SharedPreferences对象
private static SharedPreferences data = Utils.getContext().getSharedPreferences("data", Context.MODE_PRIVATE);
// Gson对象
private static Gson gson = new Gson();
public static boolean isLogin() {
return data.getBoolean("isLogin", false);
}
public static void isLogin(boolean bool) {
SharedPreferences.Editor edit = data.edit();
edit.putBoolean("isLogin", bool);
edit.apply();
}
// 获取已登录用户对象
public static User getUser() {
String userJson = data.getString("user", "");
return gson.fromJson(userJson, User.class);
}
public static void saveUser(User user) {
String userJson = gson.toJson(user);
SharedPreferences.Editor edit = data.edit();
edit.putString("user", userJson);
edit.apply();
}
//* 清除登录用户信息和登录状态
public static void removeUserAndLoginStatus() {
SharedPreferences.Editor edit = data.edit();
edit.remove("user");
edit.remove("isLogin");
edit.apply();
}
public static void removeAll() {
SharedPreferences.Editor edit = data.edit();
edit.clear();
edit.apply();
}
// * 保存账号
public static void saveUsername(String username) {
SharedPreferences.Editor editor = data.edit();
editor.putString("username", username);
editor.apply();
}
public static String getUsername() {
return data.getString("username", "");
}
}

@ -0,0 +1,158 @@
package com.shuyue.snack.data;
import android.annotation.SuppressLint;
import com.shuyue.snack.R;
import com.shuyue.snack.model.Order;
import com.shuyue.snack.model.Snack;
import com.shuyue.snack.model.User;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DataServer {
private static List<String> snackOrderList;
private static List<Snack> homeList;
private static List<Snack> scdpList;
private static List<Snack> sgxhList;
private static List<Snack> xxlsList;
private static List<Snack> rdscList;
private static List<Snack> ssdpList;
private static List<User> accountList;
// * 首页数据
public static List<Snack> getHomeList() {
if (homeList == null) {
homeList = new ArrayList<Snack>() {{
add(new Snack("农家自种小土豆", 9.99, R.mipmap.tudou, "土豆,是中国五大主食之一,其营养价值高、适应力强、产量大,是全球第三大重要的粮食作物,仅次于小麦和玉米。土豆是块茎繁殖,可入药,性平味甘,可以治胃痛、痄肋、痈肿等疾病。"));
add(new Snack("精品小米辣", 12.01, R.mipmap.liaomila, "小米辣是双子叶植物纲、菊亚纲、茄目、茄科、辣椒属植物,味辛,性热。具有开胃消食、温中散寒、美容养颜等功效。"));
add(new Snack("猪肉水饺", 23.10, R.mipmap.zhuroushuijiao, "猪肉水饺. 以猪肉为主料的饺子,饺子原名“娇耳”,相传是我国医圣张仲景首先发明的,已有一千八百多年的历史,饺子多用面皮包馅水煮或蒸制而成是深受中国汉族人民喜爱的传统特色食品。"));
add(new Snack("瑞士卷", 6.99, R.mipmap.ruishijuan, "瑞士卷是海绵蛋糕的一种,在烤炉中将材料烤成薄薄的蛋糕,加上了果酱、奶油和切碎了的果肉,卷成卷状。. 另外可以加上混和的可可粉和咖啡粉,形成松软的海绵质感的卷蛋糕。"));
add(new Snack("麻辣王子", 8.00, R.mipmap.malawangzi, "麻辣王子辣条的最大特点就是麻辣味。辣椒、花椒、姜等多种香料的混合使用,让它的味道独具特色,刺激味蕾,让人食欲大开。"));
add(new Snack("精选龙虾尾", 9.9, R.mipmap.longxiawei, "龙虾中镁的含量很高,食用龙虾有保护心血管系统的功效,不仅能降低血液中胆固醇的含量,预防动脉硬化的发生,而且能扩张冠状动脉,对预防高血压及心肌梗死也非常有效"));
add(new Snack("海南妃子笑荔枝", 16.9, R.mipmap.lizhi, "荔枝对大脑组织有补养作用,能明显改善失眠、忘记、神疲等症。能够增强免疫功能荔枝肉含丰富。作用的物质,对糖尿病患者十分适宜。"));
add(new Snack("新鲜甜脆桃", 13.1, R.mipmap.cuitao, "脆桃中的营养成分以及纤维元素更是水果中之最,它是含铁量最高的水果之一,人体中含量最多也是必不可少的微量元素“铁”,铁是人体主要造血功能中的必需物质,季节性适量食用脆桃能有效提高人体所需铁元素,从而达到清肠健胃、提高抵抗力等功效"));
}};
}
return homeList;
}
// * 点菜页面分类左边列表数据
public static List<String> getSnackOrderList() {
if (snackOrderList == null) {
snackOrderList = new ArrayList<String>() {{
add("蔬菜豆品");
add("水果鲜花");
add("休闲零食");
add("肉蛋水产");
add("速食冻品");
}};
}
return snackOrderList;
}
// * 蔬菜豆品数据
public static List<Snack> getFujianList() {
if (scdpList == null) {
scdpList = new ArrayList<Snack>() {{
add(new Snack("农家自种小土豆", 9.99, R.mipmap.tudou, "土豆,是中国五大主食之一,其营养价值高、适应力强、产量大,是全球第三大重要的粮食作物,仅次于小麦和玉米。土豆是块茎繁殖,可入药,性平味甘,可以治胃痛、痄肋、痈肿等疾病。"));
add(new Snack("精品大蒜", 7.25, R.mipmap.dasuan, "大蒜具有很强的抗氧化性能够增强人体生理机能、促进新陈代谢、延缓机体衰老、提高自身免疫力、预防消化系统疾病等。大蒜中的大蒜素能有效减缓血液中的脂肪上升趋势,抗血脂和动脉硬化、抗血小板聚集,对血液、心血管疾病具有一定的预防作用,并且大蒜素具有很强的杀菌能力和抗菌特性,因此大蒜素也被称为“植物性天然广谱抗生素”。大蒜中的有机硫化物能抑制致癌物质亚硝胺类在体内的合成,能够起到抗癌作用。所以,蒜是一种良好的药用植物。"));
add(new Snack("水果黄瓜", 8.63, R.mipmap.huanggua, "黄瓜,别名青瓜、胡瓜、吊瓜等,是日常生活中最常见的一种瓜类蔬菜。 黄瓜含水量极高,还富含多种维生素、膳食纤维、蛋白质及矿物质钙、磷、镁、钠等营养素,具有清热解毒、生津止渴、减肥消脂等功效,尤其适合夏天食用。"));
add(new Snack("精品小米辣", 12.01, R.mipmap.liaomila, "小米辣是双子叶植物纲、菊亚纲、茄目、茄科、辣椒属植物,味辛,性热。具有开胃消食、温中散寒、美容养颜等功效。"));
add(new Snack("贝贝南瓜", 9.51, R.mipmap.nangua, "贝贝南瓜内含有维生素和果胶,果胶有很好的吸附性,能粘结和消除体内细菌毒素和其他有害物质,如重金属中的铅、汞和放射性元素,起到解毒作用,贝贝南瓜含有丰富的钴,在各类蔬菜中含钻量居首位。"));
}};
}
return scdpList;
}
// * 水果鲜花数据
public static List<Snack> getGuangxiList() {
if (sgxhList == null) {
sgxhList = new ArrayList<Snack>() {{
add(new Snack("早春红玉西瓜", 12.1, R.mipmap.xigua, "夏日炎炎,清甜的西瓜极好的消暑水果。西瓜不仅水分多,营养也很丰富,具有清热解暑、生津止渴、利尿除烦的功效。西瓜其所含的氨基酸还可以滋润皮肤、增添光泽。"));
add(new Snack("海南妃子笑荔枝", 16.9, R.mipmap.lizhi, "荔枝对大脑组织有补养作用,能明显改善失眠、忘记、神疲等症。能够增强免疫功能荔枝肉含丰富。作用的物质,对糖尿病患者十分适宜。"));
add(new Snack("国产红心火龙果", 9.32, R.mipmap.huolg, "火龙果是一种低能量的水果,富含水溶性膳食纤维,具有减肥、降低胆固醇、预防便秘、大肠癌等功效,还有丰富的纤维,能够预防便秘。 火龙果中含有一般蔬果中较少有的植物性白蛋白,这种白蛋白会与人体内的重金属离子结合而起到解毒的作用。 它富含抗氧化剂维生素C能美白皮肤防黑斑。"));
add(new Snack("新鲜甜脆桃", 13.1, R.mipmap.cuitao, "脆桃中的营养成分以及纤维元素更是水果中之最,它是含铁量最高的水果之一,人体中含量最多也是必不可少的微量元素“铁”,铁是人体主要造血功能中的必需物质,季节性适量食用脆桃能有效提高人体所需铁元素,从而达到清肠健胃、提高抵抗力等功效"));
}};
}
return sgxhList;
}
// * 休闲零食数据
public static List<Snack> getGuangzhouList() {
if (xxlsList == null) {
xxlsList = new ArrayList<Snack>() {{
add(new Snack("乐事原味薯片", 6.00, R.mipmap.leshi, "乐事原味薯片: 完美的把马铃薯的味道体现出来,淡淡的咸味在口中融化越嚼越香,不拿别的牌子做比较,就冲这个味道,就百吃不腻,原味是永远的经典!"));
add(new Snack("瑞士卷", 6.99, R.mipmap.ruishijuan, "瑞士卷是海绵蛋糕的一种,在烤炉中将材料烤成薄薄的蛋糕,加上了果酱、奶油和切碎了的果肉,卷成卷状。. 另外可以加上混和的可可粉和咖啡粉,形成松软的海绵质感的卷蛋糕。"));
add(new Snack("咪咪虾条", 9.99, R.mipmap.mimixt, "虾条,是一道油炸类美食,主要材料是小麦粉、虾粉、植物油,直接食用。"));
add(new Snack("麻辣王子", 8.00, R.mipmap.malawangzi, "麻辣王子辣条的最大特点就是麻辣味。辣椒、花椒、姜等多种香料的混合使用,让它的味道独具特色,刺激味蕾,让人食欲大开。"));
}};
}
return xxlsList;
}
// * 肉蛋水产数据
public static List<Snack> getBeijingList() {
if (rdscList == null) {
rdscList = new ArrayList<Snack>() {{
add(new Snack("精选龙虾尾", 9.9, R.mipmap.longxiawei, "龙虾中镁的含量很高,食用龙虾有保护心血管系统的功效,不仅能降低血液中胆固醇的含量,预防动脉硬化的发生,而且能扩张冠状动脉,对预防高血压及心肌梗死也非常有效"));
add(new Snack("去皮五花肉", 8.99, R.mipmap.wuhuar, "五花肉性平味甘,有润肠胃、生津液、补肾气、解热毒的功效,主治热病伤津、消渴羸瘦、肾虚体弱、产后血虚、燥咳、便秘、补虚、滋阴、润燥、滋肝阴、润肌肤、利小便和止消渴。"));
add(new Snack("松花皮蛋", 10.88, R.mipmap.pidan, "皮蛋比鸭蛋含更多矿物质,但是含有的脂肪和总热量却稍有下降,食用皮蛋还能刺激消化,增进食欲,有利于营养的消化吸收,具有润肺、养阴止血的作用。"));
add(new Snack("新鲜鸡蛋", 17.99, R.mipmap.jidan, "鸡蛋作为我们日常生活中经常食用的食品,含有较高的蛋白质及丰富的脂质,是很好的维生素及矿物质的供给源,同时又兼具易于吸收,价格低廉等特点"));
add(new Snack("农家老母鸡", 22.00, R.mipmap.laomj, "老母鸡具有温中益气、补虚劳、健脾益胃之功效,可用于治疗体虚食少、虚劳瘦弱、消渴、水肿等症。"));
}};
}
return rdscList;
}
// * 速食冻品数据
public static List<Snack> getChongqingList() {
if (ssdpList == null) {
ssdpList = new ArrayList<Snack>() {{
add(new Snack("正宗火鸡面", 18.32, R.mipmap.huojim, "火鸡面的辣是其灵魂属性。丰富配料,干拌素食,让你想不到的变态辣度,让你简直爽到爆炸。"));
add(new Snack("千层蛋糕", 9.99, R.mipmap.qcdg, "千层蛋糕由來传说这种千层形狀最早源自匈牙利的Szeged城这里的人们常吃一种上层鋪有焦糖 的千层蛋糕。"));
add(new Snack("黑芝麻汤圆", 10.00, R.mipmap.hzmty, "黑芝麻汤圆是一道色香味俱全的传统名点黑芝麻的神奇功效还在于它含有的维生素E居植物性食品之首。"));
add(new Snack("猪肉水饺", 23.10, R.mipmap.zhuroushuijiao, "猪肉水饺. 以猪肉为主料的饺子,饺子原名“娇耳”,相传是我国医圣张仲景首先发明的,已有一千八百多年的历史,饺子多用面皮包馅水煮或蒸制而成是深受中国汉族人民喜爱的传统特色食品。"));
add(new Snack("地道烤肠", 10.26, R.mipmap.kaochang, "台湾烤肠色泽诱人,肠体饱满而有弹性,经热加工后口感外酥内嫩、香气袭人、风味独特,深受消费者喜爱。"));
}};
}
return ssdpList;
}
// * 用户账号信息
public static List<User> getAccountList() {
if (accountList == null) {
accountList = new ArrayList<User>() {{
add(new User("fdzy", "123456", "ffff", R.mipmap.momo));
add(new User("gsdzy", "123456", "ffff", R.mipmap.momo));
}};
}
return accountList;
}
public static List<Order> getOrderTest() {
@SuppressLint("SimpleDateFormat") SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return new ArrayList<Order>() {{
add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
}};
}
}

@ -0,0 +1,99 @@
package com.shuyue.snack.model;
import android.annotation.SuppressLint;
import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private int image;
private double money;
private String time;
private String username;
public Order() {
}
public Order(String name, int image, double money, String time) {
this.name = name;
this.image = image;
this.money = money;
this.time = time;
}
@SuppressLint("SimpleDateFormat")
public Order(Snack snack) {
this.name = snack.getName();
this.image = snack.getImage();
// 计算金额
BigDecimal money = BigDecimal.valueOf(snack.getPrice()).multiply(BigDecimal.valueOf(snack.getCount()));
this.money = money.doubleValue();
// 订单产生时间(格式化)
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
this.time = simpleDateFormat.format(new Date());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getImage() {
return image;
}
public void setImage(int image) {
this.image = image;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@NotNull
@Override
public String toString() {
return "Order{" +
"name='" + name + '\'' +
", image='" + image + '\'' +
", money=" + money +
", time=" + time +
'}';
}
}

@ -0,0 +1,103 @@
package com.shuyue.snack.model;
import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.util.Objects;
public class Snack implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private double price;
private int image;
private String detail;
private int count;
public Snack() {
}
public Snack(String name, double price, int image, String detail) {
this.name = name;
this.price = price;
this.image = image;
this.detail = detail;
this.count = 1;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getImage() {
return image;
}
public void setImage(int image) {
this.image = image;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Snack snack = (Snack) o;
return Objects.equals(name, snack.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@NotNull
@Override
public String toString() {
return "Snack{" +
"name='" + name + '\'' +
", price=" + price +
", image=" + image +
", detail='" + detail + '\'' +
", count=" + count +
'}';
}
}

@ -0,0 +1,108 @@
package com.shuyue.snack.model;
import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.util.Objects;
public class User implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private String username;
private String password;
private String nickname;
private int headImage;
public User() {
}
public User(String username, String password) {
this.username = username;
this.password = password;
}
public User(String username, String password, String nickname, int headImage) {
this.username = username;
this.password = password;
this.nickname = nickname;
this.headImage = headImage;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
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 getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public int getHeadImage() {
return headImage;
}
public void setHeadImage(int headImage) {
this.headImage = headImage;
}
/**
*
*
* @param o
* @return
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return Objects.equals(username, user.username) &&
Objects.equals(password, user.password);
}
@Override
public int hashCode() {
return Objects.hash(username, password);
}
@NotNull
@Override
public String toString() {
return "User{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", nickname='" + nickname + '\'' +
", headImage='" + headImage + '\'' +
'}';
}
}

@ -0,0 +1,86 @@
package com.shuyue.snack.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.shuyue.snack.R;
import com.shuyue.snack.activity.DetailActivity;
import com.shuyue.snack.adaptor.HomeAdapter;
import com.shuyue.snack.animator.MyAnimation3;
import com.shuyue.snack.data.DataServer;
import com.shuyue.snack.model.Snack;
import butterknife.BindView;
import butterknife.ButterKnife;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
@BindView(R.id.homeRecyclerView)
RecyclerView homeRecyclerView;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
// 绑定资源
ButterKnife.bind(this, root);
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// 首页瀑布流列表
homeRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
initHomeAdapter();
}
private void initHomeAdapter() {
// 实例化购物车列表适配器对象
HomeAdapter adapter = new HomeAdapter(DataServer.getHomeList());
// 设置动画效果
adapter.setAnimationEnable(true);
// adapter.setAnimationFirstOnly(false);
// adapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom);
adapter.setAdapterAnimation(new MyAnimation3());
// 设置头部
adapter.setHeaderView(getHeadView(), 1);
// 设置尾部
adapter.setFooterView(getFooterView(), 1);
// 点击事件监听器
adapter.setOnItemClickListener((adapter1, view, position) -> {
Snack snack = (Snack) adapter1.getItem(position);
DetailActivity.actionStart(getContext(), snack);
});
// 设置适配器
homeRecyclerView.setAdapter(adapter);
}
/**
* RecyclerViewView
*/
private View getHeadView() {
return getLayoutInflater().inflate(R.layout.head_home_image, homeRecyclerView, false);
}
/**
* RecyclerViewView
*/
private View getFooterView() {
return getLayoutInflater().inflate(R.layout.footer_no_item, homeRecyclerView, false);
}
}

@ -0,0 +1,19 @@
package com.shuyue.snack.ui.home;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class HomeViewModel extends ViewModel {
private MutableLiveData<String> mText;
public HomeViewModel() {
mText = new MutableLiveData<>();
mText.setValue("首页页面");
}
public LiveData<String> getText() {
return mText;
}
}

@ -0,0 +1,152 @@
package com.shuyue.snack.ui.my;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.activity.LoginActivity;
import com.shuyue.snack.activity.OrderActivity;
import com.shuyue.snack.adaptor.PlaceOrderAdapter;
import com.shuyue.snack.dao.UserDao;
import com.shuyue.snack.model.User;
import com.shuyue.snack.utils.Tips;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;
import static android.database.sqlite.SQLiteDatabase.openOrCreateDatabase;
public class MyFragment extends Fragment {
private MyViewModel myViewModel;
PlaceOrderAdapter orderAdapter;
// 头像
@BindView(R.id.myUserHead)
CircleImageView image;
// 用户名
@BindView(R.id.myUserNickName)
TextView nickname;
// 账号
@BindView(R.id.myUserName)
TextView username;
// 我的订单
// 待付款
@BindView(R.id.Obligation)
LinearLayout Obligation;
// 待评价
@BindView(R.id.Evaluate)
LinearLayout Evaluate;
// 退款
@BindView(R.id.Refund)
LinearLayout Refund;
// 设置部分
// 地址管理
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
myViewModel =
ViewModelProviders.of(this).get(MyViewModel.class);
View root = inflater.inflate(R.layout.fragment_my, container, false);
// 绑定资源
ButterKnife.bind(this, root);
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initView();
}
@Override
public void onResume() {
super.onResume();
initView();
}
// 获取当前用户名
@SuppressLint("SetTextI18n")
private void initView() {
if (MyApplication.isLogin()) {
User user = MyApplication.getUser();
//image.setImageResource(user.getHeadImage());
image.setImageResource(R.mipmap.momo);
nickname.setText("用户名: " +user.getUsername());
}
}
/**
*
*/
@OnClick(R.id.myUserHead)
void clickImage() {
if (MyApplication.isLogin()) {
Tips.show("已登录");
} else {
LoginActivity.actionStart(getActivity());
}
}
/**
*
*/
@OnClick(R.id.myOrderView)
void clickOrder() {
if (MyApplication.isLogin()) {
OrderActivity.actionStart(getContext());
} else {
Tips.show("请先登录");
}
}
/**
* 退
*/
@OnClick(R.id.logoutBtn)
void clickLogout() {
if (MyApplication.isLogin()) {
// 清除持久化数据
UserDao.removeUserAndLoginStatus();
// 清除全局数据
MyApplication.isLogin(false);
MyApplication.setUser(null);
nickname.setText("登录/注册");
username.setText("");
image.setImageResource(R.mipmap.momo);
} else {
Tips.show("还没有登录,请先登录");
}
}
//
public static void actionStartP(Context context) {
Intent intent = new Intent(context, LoginActivity.class);
context.startActivity(intent);
}
}

@ -0,0 +1,19 @@
package com.shuyue.snack.ui.my;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class MyViewModel extends ViewModel {
private MutableLiveData<String> mText;
public MyViewModel() {
mText = new MutableLiveData<>();
mText.setValue("我的页面");
}
public LiveData<String> getText() {
return mText;
}
}

@ -0,0 +1,248 @@
package com.shuyue.snack.ui.place;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.activity.DetailActivity;
import com.shuyue.snack.activity.OrderActivity;
import com.shuyue.snack.adaptor.PlaceOrderAdapter;
import com.shuyue.snack.dao.OrderDao;
import com.shuyue.snack.model.Order;
import com.shuyue.snack.model.Snack;
import com.shuyue.snack.ui.my.MyFragment;
import com.shuyue.snack.utils.Tips;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class PlaceFragment extends Fragment {
private PlaceViewModel placeViewModel;
@BindView(R.id.placeRecyclerView)
RecyclerView orderRecyclerView;
@BindView(R.id.placeBuyBtn)
Button buyButton;
@BindView(R.id.placeMoney)
TextView placeMoney;
PlaceOrderAdapter orderAdapter;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
placeViewModel =
ViewModelProviders.of(this).get(PlaceViewModel.class);
View root = inflater.inflate(R.layout.fragment_place, container, false);
// 绑定资源
ButterKnife.bind(this, root);
// final TextView textView = root.findViewById(R.id.text_notifications);
// notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
// @Override
// public void onChanged(@Nullable String s) {
// textView.setText(s);
// }
// });
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
orderRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
initOrderAdapter();
}
@Override
public void onResume() {
super.onResume();
// 每次页面显示都计算合计金额
calcTotalMoney();
}
/**
*
*/
private void initOrderAdapter() {
// 实例化购物车列表适配器对象
orderAdapter = new PlaceOrderAdapter(MyApplication.getCartSnacks());
// 设置空布局
orderAdapter.setEmptyView(getEmptyView());
// 设置动画效果
orderAdapter.setAnimationEnable(true);
// orderAdapter.setAnimationFirstOnly(false);
orderAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.ScaleIn);
// 点击item事件触发
orderAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
Snack snack = (Snack) adapter.getItem(position);
DetailActivity.actionStart(getContext(), snack);
}
});
// 注册item内子控件id
orderAdapter.addChildClickViewIds(R.id.orderLessLabel, R.id.orderAddLabel);
// 子控件点击监听
orderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
Snack snack = (Snack) adapter.getItem(position);
switch (view.getId()) {
case R.id.orderLessLabel:
// 点击减少数量
if (snack.getCount() == 1) {
MyApplication.getCartSnacks().remove(position);
} else {
MyApplication.getCartSnacks().get(position).setCount(snack.getCount() - 1);
}
adapter.notifyDataSetChanged();
break;
case R.id.orderAddLabel:
// 点击添加数量
MyApplication.getCartSnacks().get(position).setCount(snack.getCount() + 1);
adapter.notifyDataSetChanged();
break;
default:
break;
}
calcTotalMoney();
});
// 设置适配器
orderRecyclerView.setAdapter(orderAdapter);
}
/**
*
*/
@OnClick(R.id.placeBuyBtn)
void initClick() {
if (MyApplication.getCartSnacks().isEmpty()) {
Tips.show("购物车是空的啦!!!");
} else {
if (MyApplication.isLogin()) {
// 显示Dialog
showDialog();
} else {
Tips.show("请先登录");
}
}
}
/**
*
*/
@SuppressLint("InflateParams")
public void showDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = requireActivity().getLayoutInflater();
builder.setView(inflater.inflate(R.layout.dialog_view, null))
.setTitle("待支付")
.setPositiveButton("支付成功", (dialog, which) -> {
// 持久化订单数据
saveOrder();
// 清空购物车数据
MyApplication.getCartSnacks().removeAll(MyApplication.getCartSnacks());
// 通知适配器数据变化
orderAdapter.notifyDataSetChanged();
// 刷新总金额
calcTotalMoney();
Tips.show("支付成功");
})
.create()
.show();
}
/**
*
*/
public void saveOrder() {
List<Order> orders = new ArrayList<>();
// 购物车数据产生订单
for (Snack snack : MyApplication.getCartSnacks()) {
Order order = new Order(snack);
order.setUsername(MyApplication.getUser().getUsername());
orders.add(order);
}
OrderDao.saveOrder(orders);
}
/**
*
*/
@OnClick(R.id.deleteOrder)
void deleteOrder() {
if (MyApplication.getCartSnacks().isEmpty()) {
Tips.show("购物车是空的");
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("提示")
.setMessage("是否清空购物车?")
.setPositiveButton("确定", (dialog, which) -> {
// 清空购物车数据
MyApplication.getCartSnacks().removeAll(MyApplication.getCartSnacks());
// 通知适配器数据变化
orderAdapter.notifyDataSetChanged();
// 刷新总金额
calcTotalMoney();
Tips.show("已清空购物车");
})
.create()
.show();
}
}
// 计算合计金额
@SuppressLint("SetTextI18n")
private void calcTotalMoney() {
BigDecimal totalMoney = BigDecimal.valueOf(0);
// 遍历计算总金额(解决舍入误差)
if (!MyApplication.getCartSnacks().isEmpty()) {
for (Snack snack : MyApplication.getCartSnacks()) {
// 小吃单价 × 小吃数量
BigDecimal tmp = BigDecimal.valueOf(snack.getPrice()).multiply(BigDecimal.valueOf(snack.getCount()));
totalMoney = totalMoney.add(tmp);
}
}
placeMoney.setText("¥" + totalMoney.doubleValue());
}
/**
*
*/
private View getEmptyView() {
return getLayoutInflater().inflate(R.layout.empty_cart_view, orderRecyclerView, false);
}
}

@ -0,0 +1,19 @@
package com.shuyue.snack.ui.place;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class PlaceViewModel extends ViewModel {
private MutableLiveData<String> mText;
public PlaceViewModel() {
mText = new MutableLiveData<>();
mText.setValue("下单页面");
}
public LiveData<String> getText() {
return mText;
}
}

@ -0,0 +1,171 @@
package com.shuyue.snack.ui.snack;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.shuyue.snack.MyApplication;
import com.shuyue.snack.R;
import com.shuyue.snack.activity.DetailActivity;
import com.shuyue.snack.adaptor.SnackLeftAdapter;
import com.shuyue.snack.adaptor.SnackRightAdapter;
import com.shuyue.snack.data.DataServer;
import com.shuyue.snack.model.Snack;
import com.shuyue.snack.utils.Tips;
import java.util.Objects;
import butterknife.BindView;
import butterknife.ButterKnife;
public class SnackFragment extends Fragment {
private SnackViewModel snackViewModel;
// 小吃页面左边列表已选择的Position
private int leftSelectPosition = 0;
@BindView(R.id.snackLeftRecyclerView)
RecyclerView leftRecyclerview;
@BindView(R.id.snackRightRecyclerView)
RecyclerView rightRecyclerView;
// 右边适配器
private SnackRightAdapter rightAdapter;
public static SnackFragment newInstance() {
return new SnackFragment();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
snackViewModel = ViewModelProviders.of(this).get(SnackViewModel.class);
View root = inflater.inflate(R.layout.fragment_snack, container, false);
// 绑定资源
ButterKnife.bind(this, root);
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
leftRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
rightRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
initLeftAdapter();
initRightAdapter();
}
/**
*
*/
@SuppressLint("ResourceAsColor")
private void initLeftAdapter() {
// 实例化左边适配器对象
SnackLeftAdapter leftAdapter = new SnackLeftAdapter(DataServer.getSnackOrderList());
// 设置动画效果
leftAdapter.setAnimationEnable(true);
leftAdapter.setAnimationFirstOnly(false);
leftAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInLeft);
// 触发点击按钮
leftAdapter.setOnItemClickListener((adapter, view, position) -> {
if (position != leftSelectPosition) {
String item = (String) adapter.getItem(position);
// 原本选中的item变成未选中颜色
Objects.requireNonNull(adapter.getViewByPosition(leftSelectPosition, R.id.snackLeftType)).setBackgroundResource(R.color.colorContent);
// 当前item变成选中颜色
Objects.requireNonNull(adapter.getViewByPosition(position, R.id.snackLeftType)).setBackgroundResource(R.color.colorBgWhite);
leftSelectPosition = position;
// 刷新右边列表
// rightAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom);
rightAdapter.setAnimationEnable(false);
switch (position) {
case 1:
rightAdapter.setNewInstance(DataServer.getGuangxiList());
break;
case 2:
rightAdapter.setNewInstance(DataServer.getGuangzhouList());
break;
case 3:
rightAdapter.setNewInstance(DataServer.getBeijingList());
break;
case 4:
rightAdapter.setNewInstance(DataServer.getChongqingList());
break;
default:
rightAdapter.setNewInstance(DataServer.getFujianList());
break;
}
}
});
// 设置左边列表适配器
leftRecyclerview.setAdapter(leftAdapter);
}
/**
*
*/
public void initRightAdapter() {
// 实例化右边适配器对象
rightAdapter = new SnackRightAdapter(DataServer.getFujianList());
// 设置动画效果
rightAdapter.setAnimationEnable(true);
// rightAdapter.setAnimationFirstOnly(false);
rightAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInRight);
// 设置尾部
rightAdapter.addFooterView(getFooterView());
// 点击item事件
rightAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
Snack snack = (Snack) adapter.getItem(position);
DetailActivity.actionStart(getContext(), snack);
}
});
// 左边列表加入购物车点击事件
rightAdapter.addChildClickViewIds(R.id.snackRightAddBtn);
rightAdapter.setOnItemChildClickListener((adapter, view, position) -> {
Snack snack = (Snack) adapter.getItem(position);
if (view.getId() == R.id.snackRightAddBtn) {
if (!MyApplication.getCartSnacks().contains(snack)) {
// 添加到购物车
snack.setCount(1);
MyApplication.getCartSnacks().add(snack);
Tips.show("已添加" + snack.getName() + "到购物车");
} else {
Tips.show("已在购物车中,不能重复添加");
}
}
});
// 设置右边列表适配器
rightRecyclerView.setAdapter(rightAdapter);
}
/**
* RecyclerViewView
*/
private View getFooterView() {
return getLayoutInflater().inflate(R.layout.footer_no_item, rightRecyclerView, false);
}
}

@ -0,0 +1,19 @@
package com.shuyue.snack.ui.snack;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.ViewModel;
public class SnackViewModel extends ViewModel {
private MediatorLiveData<String> mText;
public SnackViewModel() {
mText = new MediatorLiveData<>();
mText.setValue("点单页面");
}
public LiveData<String> getText() {
return mText;
}
}

@ -0,0 +1,84 @@
package com.shuyue.snack.utils;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
public class Tips {
/**
* Toast
*
* @param message
*/
public static void show(String message) {
show(message, Toast.LENGTH_SHORT);
}
/**
* Toast
*
* @param message
* @param duration
*/
public static void show(String message, int duration) {
Toast toast = new Toast(Utils.getContext());
toast.setDuration(duration);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setView(createToastView(message));
toast.show();
}
/**
* ToastView
*
* @param message
* @return View
*/
private static View createToastView(String message) {
// 构建圆角矩形背景
float radius = dp2px(6);
RoundRectShape shape = new RoundRectShape(new float[]{radius, radius, radius, radius, radius, radius, radius, radius}, null, null);
ShapeDrawable drawable = new ShapeDrawable(shape);
drawable.getPaint().setColor(Color.argb(225, 240, 240, 240));
drawable.getPaint().setStyle(Paint.Style.FILL);
drawable.getPaint().setAntiAlias(true);
drawable.getPaint().setFlags(Paint.ANTI_ALIAS_FLAG);
// 创建View
FrameLayout layout = new FrameLayout(Utils.getContext());
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layout.setLayoutParams(layoutParams);
layout.setPadding(dp2px(16), dp2px(12), dp2px(16), dp2px(12));
layout.setBackground(drawable);
TextView textView = new TextView(Utils.getContext());
textView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
textView.setTextSize(15);
textView.setText(message);
textView.setLineSpacing(dp2px(4), 1f);
textView.setTextColor(Color.BLACK);
layout.addView(textView);
return layout;
}
/**
* dppx
*
* @param dp dp
* @return px
*/
private static int dp2px(float dp) {
final float scale = Utils.getContext().getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
}

@ -0,0 +1,35 @@
package com.shuyue.snack.utils;
import android.annotation.SuppressLint;
import android.content.Context;
public class Utils {
@SuppressLint("StaticFieldLeak")
private static Context context;
private Utils() {
throw new UnsupportedOperationException("我是需要实例化的啦!!!");
}
/**
*
*
* @param context
*/
public static void init(Context context) {
Utils.context = context.getApplicationContext();
}
/**
* ApplicationContext
*
* @return ApplicationContext
*/
public static Context getContext() {
if (context != null) {
return context;
}
throw new NullPointerException("上下文为空啊!!!");
}
}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="1000"
android:fromXDelta="100%p"
android:toXDelta="0" />
</set>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="1000"
android:fromXDelta="0"
android:toXDelta="-100%p"/>
</set>

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#4D000000" />
<corners android:radius="10dp" />
</shape>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#00BCD4"></solid>
<corners
android:radius="25dp">
</corners>
</shape>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorBgWhite" />
<corners
android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp" />
</shape>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
android:shape="rectangle">
<solid
android:color="#EDF4F0"></solid>
<corners
android:radius="25dp">
</corners>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM10,17l-4,-4 1.41,-1.41L10,14.17l6.59,-6.59L18,9l-8,8z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#F56C6C"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M21,6h-2v9L6,15v2c0,0.55 0.45,1 1,1h11l4,4L22,7c0,-0.55 -0.45,-1 -1,-1zM17,12L17,3c0,-0.55 -0.45,-1 -1,-1L3,2c-0.55,0 -1,0.45 -1,1v14l4,-4h10c0.55,0 1,-0.45 1,-1z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.73,3L8.27,3L3,8.27v7.46L8.27,21h7.46L21,15.73L21,8.27L15.73,3zM12,17.3c-0.72,0 -1.3,-0.58 -1.3,-1.3 0,-0.72 0.58,-1.3 1.3,-1.3 0.72,0 1.3,0.58 1.3,1.3 0,0.72 -0.58,1.3 -1.3,1.3zM13,13h-2L11,7h2v6z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7,18c-1.1,0 -1.99,0.9 -1.99,2S5.9,22 7,22s2,-0.9 2,-2 -0.9,-2 -2,-2zM1,2v2h2l3.6,7.59 -1.35,2.45c-0.16,0.28 -0.25,0.61 -0.25,0.96 0,1.1 0.9,2 2,2h12v-2L7.42,15c-0.14,0 -0.25,-0.11 -0.25,-0.25l0.03,-0.12 0.9,-1.63h7.45c0.75,0 1.41,-0.41 1.75,-1.03l3.58,-6.49c0.08,-0.14 0.12,-0.31 0.12,-0.48 0,-0.55 -0.45,-1 -1,-1L5.21,4l-0.94,-2L1,2zM17,18c-1.1,0 -1.99,0.9 -1.99,2s0.89,2 1.99,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13.41,18.09L13.41,20h-2.67v-1.93c-1.71,-0.36 -3.16,-1.46 -3.27,-3.4h1.96c0.1,1.05 0.82,1.87 2.65,1.87 1.96,0 2.4,-0.98 2.4,-1.59 0,-0.83 -0.44,-1.61 -2.67,-2.14 -2.48,-0.6 -4.18,-1.62 -4.18,-3.67 0,-1.72 1.39,-2.84 3.11,-3.21L10.74,4h2.67v1.95c1.86,0.45 2.79,1.86 2.85,3.39L14.3,9.34c-0.05,-1.11 -0.64,-1.87 -2.22,-1.87 -1.5,0 -2.4,0.68 -2.4,1.64 0,0.84 0.65,1.39 2.67,1.91s4.18,1.39 4.18,3.91c-0.01,1.83 -1.38,2.83 -3.12,3.16z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8.1,13.34l2.83,-2.83L3.91,3.5c-1.56,1.56 -1.56,4.09 0,5.66l4.19,4.18zM14.88,11.53c1.53,0.71 3.68,0.21 5.27,-1.38 1.91,-1.91 2.28,-4.65 0.81,-6.12 -1.46,-1.46 -4.2,-1.1 -6.12,0.81 -1.59,1.59 -2.09,3.74 -1.38,5.27L3.7,19.87l1.41,1.41L12,14.41l6.88,6.88 1.41,-1.41L13.41,13l1.47,-1.47z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1A409EFF" />
<corners android:bottomLeftRadius="12sp" android:bottomRightRadius="12sp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

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

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

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

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorBgWhite"/>
<corners android:radius="12dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorContent" />
<corners android:radius="14sp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

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

Loading…
Cancel
Save