@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
@ -0,0 +1 @@
|
|||||||
|
Fruit
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="1.8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,414 @@
|
|||||||
|
<?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="true" />
|
||||||
|
<value-preview-pinned value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.DatabaseEditorStateManager">
|
||||||
|
<last-used-providers />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.DatabaseFileManager">
|
||||||
|
<open-files />
|
||||||
|
</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>
|
||||||
|
</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="C:\Users\Lenovo\.android\avd\Pixel_XL_API_30.avd" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</targetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2023-05-18T17:35:43.033687300Z" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="GRADLE" />
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="$PROJECT_DIR$/../gradle-6.7.1" />
|
||||||
|
<option name="gradleJvm" value="1.8" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?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="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>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
/build
|
@ -0,0 +1,51 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.example.fruit"
|
||||||
|
minSdkVersion 16
|
||||||
|
targetSdkVersion 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
|
implementation 'com.google.android.material:material:1.1.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
testImplementation 'junit:junit:4.+'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
//litePal
|
||||||
|
implementation 'org.litepal.android:core:1.6.1'
|
||||||
|
//glide图片加载框架
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||||
|
//recyclerview
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
compile 'com.google.code.gson:gson:2.7'
|
||||||
|
//网络请求
|
||||||
|
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
|
||||||
|
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'
|
||||||
|
implementation 'com.zhy:okhttputils:2.0.0' //glide图片加载框架
|
||||||
|
implementation 'com.github.bumptech.glide:glide:3.6.1'
|
||||||
|
}
|
@ -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.example.fruit;
|
||||||
|
|
||||||
|
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.example.fruit", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.fruit">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".MyApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:allowClearUserData="true"
|
||||||
|
android:icon="@drawable/a1"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:roundIcon="@drawable/a1"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".ui.activity.FruitYActivity"></activity>
|
||||||
|
<activity android:name=".ui.activity.FruitXActivity" />
|
||||||
|
<activity android:name=".ui.activity.ManageActivity" />
|
||||||
|
<activity android:name=".ui.activity.WxActivity" />
|
||||||
|
<activity android:name=".ui.activity.OrderActivity" />
|
||||||
|
<activity android:name=".ui.activity.JsActivity" />
|
||||||
|
<activity android:name=".ui.activity.OpeningActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".ui.activity.LoginActivity" />
|
||||||
|
<activity android:name=".ui.activity.RegisterActivity" />
|
||||||
|
<activity android:name=".ui.activity.MainActivity" />
|
||||||
|
<activity android:name=".ui.activity.FruitDetailActivity" />
|
||||||
|
<activity android:name=".ui.activity.PersonActivity" />
|
||||||
|
<activity android:name=".ui.activity.PasswordActivity" />
|
||||||
|
<activity android:name=".ui.activity.AddFruitActivity" />
|
||||||
|
<activity android:name=".ui.activity.UserDetailActivity" />
|
||||||
|
<activity android:name=".ui.activity.BrowseActivity" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<litepal>
|
||||||
|
<!--数据库名称-->
|
||||||
|
<dbname value="fruit"/>
|
||||||
|
<!--数据库版本-->
|
||||||
|
<version value="1"/>
|
||||||
|
<list>
|
||||||
|
<!--映射 每一张表 -->
|
||||||
|
<mapping class="com.example.fruit.bean.User"/>
|
||||||
|
<mapping class="com.example.fruit.bean.Fruit"/>
|
||||||
|
<mapping class="com.example.fruit.bean.Orders"/>
|
||||||
|
<mapping class="com.example.fruit.bean.Car"/>
|
||||||
|
<mapping class="com.example.fruit.bean.Browse"/>
|
||||||
|
</list>
|
||||||
|
|
||||||
|
</litepal>
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.fruit;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import org.litepal.LitePal;
|
||||||
|
|
||||||
|
public class MyApplication extends Application {
|
||||||
|
public static MyApplication Instance;
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
Instance = this;
|
||||||
|
//初始化LitePal数据库
|
||||||
|
LitePal.initialize(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
private Activity mMainActivity;
|
||||||
|
|
||||||
|
public Activity getMainActivity() {
|
||||||
|
return mMainActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainActivity(Activity mainActivity) {
|
||||||
|
mMainActivity = mainActivity;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.example.fruit.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
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.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Browse;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览记录适配器
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BrowseAdapter extends RecyclerView.Adapter<BrowseAdapter.ViewHolder> {
|
||||||
|
private List<Browse> list =new ArrayList<>();
|
||||||
|
private Context mActivity;
|
||||||
|
private ItemListener mItemListener;
|
||||||
|
private LinearLayout llEmpty;
|
||||||
|
private RecyclerView rvNewsList;
|
||||||
|
public void setItemListener(ItemListener itemListener){
|
||||||
|
this.mItemListener = itemListener;
|
||||||
|
}
|
||||||
|
public BrowseAdapter(LinearLayout llEmpty, RecyclerView rvNewsList){
|
||||||
|
this.llEmpty = llEmpty;
|
||||||
|
this.rvNewsList =rvNewsList;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||||
|
mActivity = viewGroup.getContext();
|
||||||
|
View view= LayoutInflater.from(mActivity).inflate(R.layout.item_rv_collect_list,viewGroup,false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||||
|
Browse browse = list.get(i);
|
||||||
|
if (browse != null) {
|
||||||
|
viewHolder.title.setText(browse.getTitle());
|
||||||
|
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mItemListener!=null){
|
||||||
|
mItemListener.ItemClick(browse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void addItem(List<Browse> listAdd) {
|
||||||
|
//如果是加载第一页,需要先清空数据列表
|
||||||
|
this.list.clear();
|
||||||
|
if (listAdd!=null){
|
||||||
|
//添加数据
|
||||||
|
this.list.addAll(listAdd);
|
||||||
|
}
|
||||||
|
//通知RecyclerView进行改变--整体
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView title;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
title = itemView.findViewById(R.id.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public interface ItemListener{
|
||||||
|
void ItemClick(Browse browse);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,161 @@
|
|||||||
|
package com.example.fruit.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Car;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.ui.activity.FruitYActivity;
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//购物车适配器
|
||||||
|
|
||||||
|
public class CarAdapter extends RecyclerView.Adapter<CarAdapter.ViewHolder> {
|
||||||
|
private List<Car> list =new ArrayList<>();
|
||||||
|
private Context mActivity;
|
||||||
|
private RequestOptions headerRO = new RequestOptions().circleCrop();//圆角变换
|
||||||
|
private LinearLayout llEmpty;
|
||||||
|
private RecyclerView rvOrderList;
|
||||||
|
private ItemListener mItemListener;
|
||||||
|
|
||||||
|
|
||||||
|
public void setItemListener(ItemListener itemListener){
|
||||||
|
this.mItemListener = itemListener;
|
||||||
|
}
|
||||||
|
public CarAdapter(LinearLayout llEmpty, RecyclerView rvOrderList){
|
||||||
|
this.llEmpty = llEmpty;
|
||||||
|
this.rvOrderList =rvOrderList;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||||
|
mActivity = viewGroup.getContext();
|
||||||
|
View view= LayoutInflater.from(mActivity).inflate(R.layout.item_rv_car_list,viewGroup,false);
|
||||||
|
|
||||||
|
return new ViewHolder(view);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||||
|
Car car = list.get(i);
|
||||||
|
|
||||||
|
|
||||||
|
User user = DataSupport.where("account = ? ", car.getAccount()).findFirst(User.class);
|
||||||
|
if (car != null && user!=null ) {
|
||||||
|
|
||||||
|
viewHolder.j.setText(String.format("¥%s",car.getIssuer()));//order.getNumber
|
||||||
|
|
||||||
|
viewHolder.title.setText(car.getTitle());
|
||||||
|
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
viewHolder.zf.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
if (!viewHolder.cb.isChecked()) {
|
||||||
|
Toast.makeText(mActivity, "您还没有选择商品哦!", Toast.LENGTH_LONG).show();
|
||||||
|
}else {
|
||||||
|
Intent intent = new Intent(mActivity, FruitYActivity.class);
|
||||||
|
Fruit fruit = DataSupport.where("title = ?",car.getTitle()).findFirst(Fruit.class);
|
||||||
|
intent.putExtra("fruit",fruit);
|
||||||
|
mActivity.startActivity(intent);
|
||||||
|
return;
|
||||||
|
}}
|
||||||
|
});
|
||||||
|
|
||||||
|
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity);
|
||||||
|
dialog.setMessage("确认要删除该商品吗");
|
||||||
|
//消息框确认按钮
|
||||||
|
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
list.remove(car);
|
||||||
|
car.delete();
|
||||||
|
notifyDataSetChanged();//刷新ListView与数据库同步
|
||||||
|
Toast.makeText(mActivity,"删除成功", Toast.LENGTH_LONG).show();
|
||||||
|
if (list!=null && list.size() > 0){
|
||||||
|
rvOrderList.setVisibility(View.VISIBLE);
|
||||||
|
llEmpty.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
rvOrderList.setVisibility(View.GONE);
|
||||||
|
llEmpty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//消息框取消按钮
|
||||||
|
dialog.setNeutralButton("取消", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(List<Car> listAdd) {
|
||||||
|
//如果是加载第一页,需要先清空数据列表
|
||||||
|
this.list.clear();
|
||||||
|
if (listAdd!=null){
|
||||||
|
//添加数据
|
||||||
|
this.list.addAll(listAdd);
|
||||||
|
}
|
||||||
|
//通知RecyclerView进行改变--整体
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private Button zf;
|
||||||
|
private TextView j;
|
||||||
|
private LinearLayout ll_img;
|
||||||
|
private TextView title;
|
||||||
|
private CheckBox cb;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
zf=itemView.findViewById(R.id.zf);
|
||||||
|
ll_img=itemView.findViewById(R.id.ll_img);
|
||||||
|
title = itemView.findViewById(R.id.title);
|
||||||
|
j=itemView.findViewById(R.id.j);
|
||||||
|
cb=itemView.findViewById(R.id.cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public interface ItemListener{
|
||||||
|
void ItemClick(Car car);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,138 @@
|
|||||||
|
package com.example.fruit.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder> {
|
||||||
|
private List<Fruit> list =new ArrayList<>();
|
||||||
|
private Context mActivity;
|
||||||
|
private ItemListener mItemListener;
|
||||||
|
private LinearLayout llEmpty;
|
||||||
|
private RecyclerView rvfruitList;
|
||||||
|
public void setItemListener(ItemListener itemListener){
|
||||||
|
this.mItemListener = itemListener;
|
||||||
|
}
|
||||||
|
public FruitAdapter(LinearLayout llEmpty, RecyclerView rvfruitList){
|
||||||
|
this.llEmpty = llEmpty;
|
||||||
|
this.rvfruitList =rvfruitList;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||||
|
mActivity = viewGroup.getContext();
|
||||||
|
View view= LayoutInflater.from(mActivity).inflate(R.layout.item_rv_fruit_list,viewGroup,false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||||
|
Fruit fruit = list.get(i);
|
||||||
|
if (fruit != null) {
|
||||||
|
viewHolder.title.setText(fruit.getTitle());
|
||||||
|
viewHolder.author_name.setText(String.format("¥%s",fruit.getIssuer()));
|
||||||
|
|
||||||
|
Glide.with(mActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.load(fruit.getImg())
|
||||||
|
.error(R.drawable.ic_error)
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.into(viewHolder.img);
|
||||||
|
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
|
||||||
|
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mItemListener!=null){
|
||||||
|
mItemListener.ItemClick(fruit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (isAdmin){
|
||||||
|
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity);
|
||||||
|
dialog.setMessage("确认要删除该水果吗?");
|
||||||
|
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
list.remove(fruit);
|
||||||
|
fruit.delete();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
Toast.makeText(mActivity,"删除成功", Toast.LENGTH_LONG).show();
|
||||||
|
if (list!=null && list.size() > 0){
|
||||||
|
rvfruitList.setVisibility(View.VISIBLE);
|
||||||
|
llEmpty.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
rvfruitList.setVisibility(View.GONE);
|
||||||
|
llEmpty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.setNeutralButton("取消", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
public void addItem(List<Fruit> listAdd) {
|
||||||
|
//如果是加载第一页,需要先清空数据列表
|
||||||
|
this.list.clear();
|
||||||
|
if (listAdd!=null){
|
||||||
|
//添加数据
|
||||||
|
this.list.addAll(listAdd);
|
||||||
|
}
|
||||||
|
//通知RecyclerView进行改变--整体
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView title;
|
||||||
|
private TextView author_name;
|
||||||
|
|
||||||
|
private ImageView img;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
title = itemView.findViewById(R.id.title);
|
||||||
|
author_name = itemView.findViewById(R.id.author_name);
|
||||||
|
|
||||||
|
img = itemView.findViewById(R.id.img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ItemListener{
|
||||||
|
void ItemClick(Fruit fruit);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,146 @@
|
|||||||
|
package com.example.fruit.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.example.fruit.ui.activity.FruitXActivity;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.bean.Orders;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.ViewHolder> {
|
||||||
|
private List<Orders> list =new ArrayList<>();
|
||||||
|
private Context mActivity;
|
||||||
|
private RequestOptions headerRO = new RequestOptions().circleCrop();//圆角变换
|
||||||
|
private LinearLayout llEmpty;
|
||||||
|
private RecyclerView rvOrderList;
|
||||||
|
private ItemListener mItemListener;
|
||||||
|
public void setItemListener(ItemListener itemListener){
|
||||||
|
this.mItemListener = itemListener;
|
||||||
|
}
|
||||||
|
public OrderAdapter(LinearLayout llEmpty, RecyclerView rvOrderList){
|
||||||
|
this.llEmpty = llEmpty;
|
||||||
|
this.rvOrderList =rvOrderList;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||||
|
mActivity = viewGroup.getContext();
|
||||||
|
View view= LayoutInflater.from(mActivity).inflate(R.layout.item_rv_order_list,viewGroup,false);
|
||||||
|
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||||
|
Orders order = list.get(i);
|
||||||
|
|
||||||
|
|
||||||
|
User user = DataSupport.where("account = ? ", order.getAccount()).findFirst(User.class);
|
||||||
|
if (order != null && user!=null ) {
|
||||||
|
viewHolder.nickName.setText(String.format("用户:%s",user.getNickName()));
|
||||||
|
viewHolder.number.setText(String.format("订单号:%s",order.getNumber()));
|
||||||
|
viewHolder.j.setText(String.format("¥%s",order.getIssuer()));//order.getNumber
|
||||||
|
viewHolder.date.setText(order.getDate());
|
||||||
|
|
||||||
|
viewHolder.title.setText(order.getTitle());
|
||||||
|
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(mActivity, FruitXActivity.class);
|
||||||
|
Fruit fruit = DataSupport.where("title = ?",order.getTitle()).findFirst(Fruit.class);
|
||||||
|
intent.putExtra("fruit",fruit);
|
||||||
|
mActivity.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
|
||||||
|
if (isAdmin){
|
||||||
|
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity);
|
||||||
|
dialog.setMessage("确认要删除该订单吗");
|
||||||
|
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
list.remove(order);
|
||||||
|
order.delete();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
Toast.makeText(mActivity,"删除成功", Toast.LENGTH_LONG).show();
|
||||||
|
if (list!=null && list.size() > 0){
|
||||||
|
rvOrderList.setVisibility(View.VISIBLE);
|
||||||
|
llEmpty.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
rvOrderList.setVisibility(View.GONE);
|
||||||
|
llEmpty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.setNeutralButton("取消", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void addItem(List<Orders> listAdd) {
|
||||||
|
//如果是加载第一页,需要先清空数据列表
|
||||||
|
this.list.clear();
|
||||||
|
if (listAdd!=null){
|
||||||
|
//添加数据
|
||||||
|
this.list.addAll(listAdd);
|
||||||
|
}
|
||||||
|
//通知RecyclerView进行改变--整体
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView nickName;
|
||||||
|
private TextView date;
|
||||||
|
private TextView j;
|
||||||
|
private TextView number;
|
||||||
|
private TextView title;
|
||||||
|
// private ImageView img;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
nickName = itemView.findViewById(R.id.nickName);
|
||||||
|
date = itemView.findViewById(R.id.date);
|
||||||
|
number = itemView.findViewById(R.id.number);
|
||||||
|
title = itemView.findViewById(R.id.title);
|
||||||
|
j=itemView.findViewById(R.id.j);
|
||||||
|
// img=itemView.findViewById(R.id.img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public interface ItemListener{
|
||||||
|
void ItemClick(Orders order);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
package com.example.fruit.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Car;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.ui.activity.UserDetailActivity;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
|
||||||
|
private List<User> list =new ArrayList<>();
|
||||||
|
private Context mActivity;
|
||||||
|
private LinearLayout llEmpty;
|
||||||
|
private RecyclerView rvUserList;
|
||||||
|
|
||||||
|
public UserAdapter(LinearLayout llEmpty, RecyclerView rvUserList){
|
||||||
|
this.llEmpty = llEmpty;
|
||||||
|
this.rvUserList =rvUserList;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||||
|
mActivity = viewGroup.getContext();
|
||||||
|
View view= LayoutInflater.from(mActivity).inflate(R.layout.item_rv_user_list,viewGroup,false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||||
|
User user = list.get(i);
|
||||||
|
if (user!=null) {
|
||||||
|
String account = (String) SPUtils.get(mActivity,SPUtils.ACCOUNT,"");
|
||||||
|
viewHolder.itemView.setVisibility(account.equals(user.getAccount())? View.GONE: View.VISIBLE);
|
||||||
|
viewHolder.nickName.setText(String.format("用户昵称:%s",user.getNickName()));
|
||||||
|
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(mActivity, UserDetailActivity.class);
|
||||||
|
intent.putExtra("user",user);
|
||||||
|
mActivity.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity);
|
||||||
|
dialog.setMessage("确认要删除该用户吗");
|
||||||
|
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
//删除收藏记录和浏览记录
|
||||||
|
List<Car> brows = DataSupport.where("account = ?",user.getAccount()).find(Car.class);
|
||||||
|
if (brows !=null && brows.size() > 0){
|
||||||
|
for (Car car : brows) {
|
||||||
|
car.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.remove(user);
|
||||||
|
user.delete();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
Toast.makeText(mActivity,"删除成功", Toast.LENGTH_LONG).show();
|
||||||
|
if (list!=null && list.size() > 1){
|
||||||
|
rvUserList.setVisibility(View.VISIBLE);
|
||||||
|
llEmpty.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
rvUserList.setVisibility(View.GONE);
|
||||||
|
llEmpty.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.setNeutralButton("取消", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void addItem(List<User> listAdd) {
|
||||||
|
//如果是加载第一页,需要先清空数据列表
|
||||||
|
this.list.clear();
|
||||||
|
if (listAdd!=null){
|
||||||
|
//添加数据
|
||||||
|
this.list.addAll(listAdd);
|
||||||
|
}
|
||||||
|
//通知RecyclerView进行改变--整体
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView nickName;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
nickName = itemView.findViewById(R.id.nickName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.fruit.bean;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览记录
|
||||||
|
*/
|
||||||
|
public class Browse extends DataSupport {
|
||||||
|
private String account;//账号
|
||||||
|
private String title;//水果标题
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Browse(String account, String title) {
|
||||||
|
this.account = account;
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package com.example.fruit.bean;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Car extends DataSupport implements Serializable {
|
||||||
|
private String account;//账号
|
||||||
|
private String title;//标题
|
||||||
|
private String number;//编号
|
||||||
|
private String issuer;//价格
|
||||||
|
private String img;//图片
|
||||||
|
private String amount;//数量
|
||||||
|
private String date;//时间
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssuer() {
|
||||||
|
return issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssuer(String issuer) {
|
||||||
|
this.issuer=issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Car(String issuer, String account, String title, String number, String amount, String date) {
|
||||||
|
this.issuer=issuer;
|
||||||
|
this.account = account;
|
||||||
|
this.title = title;
|
||||||
|
this.number = number;
|
||||||
|
this.amount = amount;
|
||||||
|
this.date = date;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.example.fruit.bean;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水果
|
||||||
|
*/
|
||||||
|
public class Fruit extends DataSupport implements Serializable {
|
||||||
|
private Integer typeId;//类型
|
||||||
|
private String title;//标题
|
||||||
|
private String img;//图片
|
||||||
|
private String content;//内容
|
||||||
|
private String issuer;//价格
|
||||||
|
private String date;//时间
|
||||||
|
|
||||||
|
public Integer getTypeId() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(Integer typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssuer() {
|
||||||
|
return issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssuer(String issuer) {
|
||||||
|
this.issuer = issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fruit(Integer typeId, String title, String img, String content, String issuer, String date) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
this.title = title;
|
||||||
|
this.img = img;
|
||||||
|
this.content = content;
|
||||||
|
this.issuer = issuer;
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package com.example.fruit.bean;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Orders extends DataSupport implements Serializable {
|
||||||
|
private String account;//账号
|
||||||
|
private String title;//标题
|
||||||
|
private String number;//编号
|
||||||
|
private String issuer;//价格
|
||||||
|
private String img;//图片
|
||||||
|
private String amount;//数量
|
||||||
|
private String date;//时间
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssuer() {
|
||||||
|
return issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssuer(String issuer) {
|
||||||
|
this.issuer=issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders(String issuer,String account,String title, String number, String amount, String date) {
|
||||||
|
this.issuer=issuer;
|
||||||
|
this.account = account;
|
||||||
|
this.title = title;
|
||||||
|
this.number = number;
|
||||||
|
this.amount = amount;
|
||||||
|
this.date = date;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.example.fruit.bean;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户
|
||||||
|
*/
|
||||||
|
public class User extends DataSupport implements Serializable {
|
||||||
|
private String account;//账号
|
||||||
|
private String password;//密码
|
||||||
|
private String nickName;//昵称
|
||||||
|
private String age;//年龄
|
||||||
|
private String email;//邮箱
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(String age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String account, String password, String nickName, String age, String email) {
|
||||||
|
this.account = account;
|
||||||
|
this.password = password;
|
||||||
|
this.nickName = nickName;
|
||||||
|
this.age = age;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加页面
|
||||||
|
*/
|
||||||
|
public class AddFruitActivity extends AppCompatActivity {
|
||||||
|
private ActionBar mActionBar;//标题栏
|
||||||
|
private Activity myActivity;
|
||||||
|
private EditText etTitle;//标题
|
||||||
|
private EditText etIssuer;//发布单位
|
||||||
|
private EditText etImg;//图片
|
||||||
|
private Spinner spType;//类型
|
||||||
|
private EditText etContent;//内容
|
||||||
|
private ImageView ivImg;//图片
|
||||||
|
SimpleDateFormat sf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
private Fruit mfruit;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
myActivity = this;
|
||||||
|
setContentView(R.layout.activity_fruit_add);
|
||||||
|
etTitle = findViewById(R.id.title);
|
||||||
|
etIssuer = findViewById(R.id.issuer);
|
||||||
|
spType = findViewById(R.id.type);
|
||||||
|
etImg = findViewById(R.id.img);
|
||||||
|
etContent = findViewById(R.id.content);
|
||||||
|
ivImg = findViewById(R.id.iv_img);
|
||||||
|
mActionBar = findViewById(R.id.myActionBar);
|
||||||
|
//侧滑菜单
|
||||||
|
mActionBar.setData(myActivity,"编辑水果信息", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
mfruit = (Fruit) getIntent().getSerializableExtra("fruit");
|
||||||
|
if (mfruit !=null){
|
||||||
|
etTitle.setText(mfruit.getTitle());
|
||||||
|
spType.setSelection(mfruit.getTypeId());
|
||||||
|
etImg.setText(mfruit.getImg());
|
||||||
|
etIssuer.setText(mfruit.getIssuer());
|
||||||
|
etContent.setText(mfruit.getContent());
|
||||||
|
spType.setSelection(mfruit.getTypeId(),true);
|
||||||
|
Glide.with(myActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.load(mfruit.getImg())
|
||||||
|
.error(R.drawable.ic_error)
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.into(ivImg);
|
||||||
|
}
|
||||||
|
ivImg.setVisibility(mfruit ==null? View.GONE: View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(View view){
|
||||||
|
String title = etTitle.getText().toString();
|
||||||
|
String issuer = etIssuer.getText().toString();
|
||||||
|
String img = etImg.getText().toString();
|
||||||
|
String content = etContent.getText().toString();
|
||||||
|
Integer typeId = spType.getSelectedItemPosition();
|
||||||
|
if ("".equals(title)) {
|
||||||
|
Toast.makeText(myActivity,"标题不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(issuer)) {
|
||||||
|
Toast.makeText(myActivity,"价格不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(img)) {
|
||||||
|
Toast.makeText(myActivity,"图片地址不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(content)) {
|
||||||
|
Toast.makeText(myActivity,"描述不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Fruit fruit = null;
|
||||||
|
if (!title.equals(mfruit != null? mfruit.getTitle():"")){
|
||||||
|
fruit = DataSupport.where("title = ?",title).findFirst(Fruit.class);
|
||||||
|
}
|
||||||
|
if (fruit == null ){
|
||||||
|
if (mfruit != null){
|
||||||
|
fruit = DataSupport.where("title = ?", mfruit.getTitle()).findFirst(Fruit.class);
|
||||||
|
fruit.setTypeId(typeId);
|
||||||
|
fruit.setTitle(title);
|
||||||
|
fruit.setIssuer(issuer);
|
||||||
|
fruit.setImg(img);
|
||||||
|
fruit.setContent(content);
|
||||||
|
}else {
|
||||||
|
fruit = new Fruit(typeId,title,img,content,issuer,sf.format(new Date()));
|
||||||
|
}
|
||||||
|
fruit.save();
|
||||||
|
setResult(RESULT_OK);
|
||||||
|
finish();
|
||||||
|
Toast.makeText(myActivity,"保存成功", Toast.LENGTH_LONG).show();
|
||||||
|
}else {
|
||||||
|
Toast.makeText(myActivity,"该标题已存在", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Browse;
|
||||||
|
import com.example.fruit.bean.Car;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水果明细信息
|
||||||
|
*/
|
||||||
|
public class FruitDetailActivity extends AppCompatActivity {
|
||||||
|
private Activity mActivity;
|
||||||
|
private ImageView ivImg;
|
||||||
|
private TextView tvTitle;
|
||||||
|
private TextView tvDate;
|
||||||
|
private TextView tvContent;
|
||||||
|
private TextView tvIssuer;
|
||||||
|
private Button btnCollect;
|
||||||
|
private Button btnCancel;
|
||||||
|
private ActionBar mActionBar;//标题栏
|
||||||
|
private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mActivity = this;
|
||||||
|
setContentView(R.layout.activity_fruit_detail);
|
||||||
|
ivImg = findViewById(R.id.img);
|
||||||
|
tvTitle= findViewById(R.id.title);
|
||||||
|
tvDate = findViewById(R.id.date);
|
||||||
|
tvContent = findViewById(R.id.content);
|
||||||
|
tvIssuer = findViewById(R.id.issuer);
|
||||||
|
btnCollect = findViewById(R.id.btn_collect);
|
||||||
|
btnCancel = findViewById(R.id.btn_cancel);
|
||||||
|
mActionBar = findViewById(R.id.myActionBar);
|
||||||
|
//侧滑菜单
|
||||||
|
mActionBar.setData(mActivity,"商品详情", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Fruit fruit = (Fruit) getIntent().getSerializableExtra("fruit");
|
||||||
|
tvTitle.setText(fruit.getTitle());
|
||||||
|
tvDate.setText(String.format("上架时间:%s",fruit.getDate()));
|
||||||
|
tvContent.setText(fruit.getContent());
|
||||||
|
tvIssuer.setText(String.format("¥ %s",fruit.getIssuer()));
|
||||||
|
Glide.with(mActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.load(fruit.getImg())
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.into(ivImg);
|
||||||
|
String account = (String) SPUtils.get(mActivity,SPUtils.ACCOUNT,"");
|
||||||
|
//浏览记录
|
||||||
|
Browse browse = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Browse.class);//浏览记录
|
||||||
|
if (browse == null) {//不存在该条浏览记录 新增记录
|
||||||
|
Browse browse1 = new Browse(account,fruit.getTitle());
|
||||||
|
browse1.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
|
||||||
|
if (!isAdmin){
|
||||||
|
Car order = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Car.class);
|
||||||
|
btnCollect.setVisibility(order!=null?View.GONE:View.VISIBLE);
|
||||||
|
btnCancel.setVisibility(order!=null?View.VISIBLE:View.GONE);
|
||||||
|
}
|
||||||
|
//收藏
|
||||||
|
btnCollect.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Car car = new Car(fruit.getIssuer(),account,fruit.getTitle(),"S"+System.currentTimeMillis(),account,sf.format(new Date()));
|
||||||
|
car.save();
|
||||||
|
Toast.makeText(mActivity,"加入购物车成功", Toast.LENGTH_SHORT).show();
|
||||||
|
btnCollect.setVisibility(View.GONE);
|
||||||
|
btnCancel.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//取消收藏
|
||||||
|
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Car order = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Car.class);
|
||||||
|
order.delete();
|
||||||
|
Toast.makeText(mActivity,"已从购物车移除", Toast.LENGTH_SHORT).show();
|
||||||
|
btnCollect.setVisibility(View.VISIBLE);
|
||||||
|
btnCancel.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细信息
|
||||||
|
*/
|
||||||
|
public class FruitXActivity extends AppCompatActivity {
|
||||||
|
private Activity mActivity;
|
||||||
|
private ImageView ivImg;
|
||||||
|
private TextView tvTitle;
|
||||||
|
private TextView tvDate;
|
||||||
|
private TextView tvContent;
|
||||||
|
private TextView tvIssuer;
|
||||||
|
private Button btnCollect;
|
||||||
|
private Button btnCancel;
|
||||||
|
private ActionBar mActionBar;//标题栏
|
||||||
|
private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mActivity = this;
|
||||||
|
setContentView(R.layout.activity_fruit_x);
|
||||||
|
ivImg = findViewById(R.id.img);
|
||||||
|
tvTitle= findViewById(R.id.title);
|
||||||
|
tvDate = findViewById(R.id.date);
|
||||||
|
tvContent = findViewById(R.id.content);
|
||||||
|
tvIssuer = findViewById(R.id.issuer);
|
||||||
|
btnCollect = findViewById(R.id.btn_collect);
|
||||||
|
btnCancel = findViewById(R.id.btn_cancel);
|
||||||
|
mActionBar = findViewById(R.id.myActionBar);
|
||||||
|
//侧滑菜单
|
||||||
|
mActionBar.setData(mActivity,"查看详情", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Fruit fruit = (Fruit) getIntent().getSerializableExtra("fruit");
|
||||||
|
tvTitle.setText(fruit.getTitle());
|
||||||
|
tvDate.setText(String.format("上架时间:%s",fruit.getDate()));
|
||||||
|
tvContent.setText(fruit.getContent());
|
||||||
|
tvIssuer.setText(String.format("¥ %s",fruit.getIssuer()));
|
||||||
|
Glide.with(mActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.load(fruit.getImg())
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.into(ivImg);
|
||||||
|
String account = (String) SPUtils.get(mActivity,SPUtils.ACCOUNT,"");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Car;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.bean.Orders;
|
||||||
|
import com.example.fruit.ui.activity.JsActivity;
|
||||||
|
import com.example.fruit.ui.activity.MainActivity;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算商品
|
||||||
|
*/
|
||||||
|
public class FruitYActivity extends AppCompatActivity {
|
||||||
|
private Activity mActivity;
|
||||||
|
private ImageView ivImg;
|
||||||
|
private TextView tvTitle;
|
||||||
|
private TextView tvDate;
|
||||||
|
private TextView tvIssuer;
|
||||||
|
private Button btnCollect;
|
||||||
|
private Button btnCancel;
|
||||||
|
private ActionBar mActionBar;//标题栏
|
||||||
|
private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mActivity = this;
|
||||||
|
setContentView(R.layout.activity_fruit_y);
|
||||||
|
ivImg = findViewById(R.id.img);
|
||||||
|
tvTitle= findViewById(R.id.title);
|
||||||
|
tvDate = findViewById(R.id.date);
|
||||||
|
tvIssuer = findViewById(R.id.issuer);
|
||||||
|
btnCollect = findViewById(R.id.btn_collect);
|
||||||
|
btnCancel = findViewById(R.id.btn_cancel);
|
||||||
|
mActionBar = findViewById(R.id.myActionBar);
|
||||||
|
//侧滑菜单
|
||||||
|
mActionBar.setData(mActivity,"结算商品", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
final RadioButton rab_weixin = (RadioButton)findViewById(R.id.rab_wenxin);
|
||||||
|
final RadioButton rab_zhifubao = (RadioButton)findViewById(R.id.rab_zhifubao);
|
||||||
|
final RadioButton rab_yinhangka = (RadioButton)findViewById(R.id.rab_yinhangka);
|
||||||
|
final TextView tv_zf = (TextView)findViewById(R.id.tv_zf);
|
||||||
|
|
||||||
|
View.OnClickListener a = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n"+" 微信支付");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
View.OnClickListener b = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n"+" 支付宝支付");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
View.OnClickListener c = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n "+" 银行卡支付");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//3、将两个监听器分别配置给两个按钮
|
||||||
|
rab_weixin.setOnClickListener(a);
|
||||||
|
rab_zhifubao.setOnClickListener(b);
|
||||||
|
rab_yinhangka.setOnClickListener(c);
|
||||||
|
|
||||||
|
|
||||||
|
Fruit fruit = (Fruit) getIntent().getSerializableExtra("fruit");
|
||||||
|
tvTitle.setText(fruit.getTitle());
|
||||||
|
tvDate.setText(String.format("上架时间:%s",fruit.getDate()));
|
||||||
|
tvIssuer.setText(String.format("¥ %s",fruit.getIssuer()));
|
||||||
|
Glide.with(mActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.load(fruit.getImg())
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.into(ivImg);
|
||||||
|
String account = (String) SPUtils.get(mActivity,SPUtils.ACCOUNT,"");
|
||||||
|
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
|
||||||
|
if (!isAdmin){
|
||||||
|
Car car = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Car.class);
|
||||||
|
btnCollect.setVisibility(car!=null?View.VISIBLE:View.GONE);
|
||||||
|
btnCancel.setVisibility(car!=null?View.GONE:View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//支付
|
||||||
|
btnCollect.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
if (!rab_yinhangka.isChecked()&&!rab_zhifubao.isChecked()&&!rab_weixin.isChecked()) {
|
||||||
|
Toast.makeText(mActivity, "请选择支付方式!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Orders orders = new Orders(fruit.getIssuer(),account,fruit.getTitle(),"S"+System.currentTimeMillis(),account,sf.format(new Date()));
|
||||||
|
orders.save();
|
||||||
|
Car car = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Car.class);
|
||||||
|
car.delete();
|
||||||
|
// Intent intent = new Intent(mActivity, JsActivity.class);
|
||||||
|
// startActivity(intent);
|
||||||
|
Toast.makeText(mActivity,"支付成功,请勿重复支付!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
btnCollect.setVisibility(View.GONE);
|
||||||
|
btnCancel.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//已支付
|
||||||
|
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(mActivity,"该商品已支付,请在我的订单中查看!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
btnCollect.setVisibility(View.GONE);
|
||||||
|
btnCancel.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算
|
||||||
|
*/
|
||||||
|
public class JsActivity extends AppCompatActivity implements View.OnClickListener{
|
||||||
|
Button btn_ZF;
|
||||||
|
private Activity myActivity;
|
||||||
|
private ActionBar mTitleBar;//标题栏
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_js);
|
||||||
|
mTitleBar = (ActionBar) findViewById(R.id.myActionBar);
|
||||||
|
mTitleBar.setData(myActivity,"付款方式", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
final RadioButton rab_weixin = (RadioButton)findViewById(R.id.rab_wenxin);
|
||||||
|
final RadioButton rab_zhifubao = (RadioButton)findViewById(R.id.rab_zhifubao);
|
||||||
|
final RadioButton rab_yinhangka = (RadioButton)findViewById(R.id.rab_yinhangka);
|
||||||
|
final TextView tv_zf = (TextView)findViewById(R.id.tv_zf);
|
||||||
|
|
||||||
|
View.OnClickListener nanJianTingQi = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n\n"+" 微信支付");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
View.OnClickListener nan2JianTingQi = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n\n"+" 支付宝支付(暂不支持)");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
View.OnClickListener nvJianTingQi = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
tv_zf.setText("您选择的支付方式是:"+"\n\n"+" 银行卡支付(暂不支持)");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//3、将两个监听器分别配置给两个按钮
|
||||||
|
rab_weixin.setOnClickListener(nanJianTingQi);
|
||||||
|
rab_zhifubao.setOnClickListener(nan2JianTingQi);
|
||||||
|
rab_yinhangka.setOnClickListener(nvJianTingQi);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
initView();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void initView() { }
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(JsActivity.this, "抱歉,目前仅支持微信扫码支付", Toast.LENGTH_LONG).show();
|
||||||
|
Intent intent = new Intent(JsActivity.this, WxActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,147 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录页面
|
||||||
|
*/
|
||||||
|
public class LoginActivity extends Activity {
|
||||||
|
private static final String TAG = "LoginActivity";
|
||||||
|
private Activity activity;
|
||||||
|
private ActionBar mTitleBar;//标题栏
|
||||||
|
private EditText etAccount;//手机号
|
||||||
|
private EditText etPassword;//密码
|
||||||
|
private TextView tvRegister;//注册
|
||||||
|
private Button btnLogin;//登录按钮
|
||||||
|
private RadioGroup rgType;//用户类型
|
||||||
|
private RadioButton rbUser;//用户类型
|
||||||
|
private RadioButton rbAdmin;//用户类型
|
||||||
|
private CheckBox cbAgree;
|
||||||
|
private TextView tv_mm;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
activity=this;
|
||||||
|
setContentView(R.layout.activity_login);//加载页面
|
||||||
|
etAccount =(EditText) findViewById(R.id.et_account);//获取手机号
|
||||||
|
etPassword=(EditText)findViewById(R.id.et_password);//获取密码
|
||||||
|
tvRegister=(TextView)findViewById(R.id.tv_register);//获取注册
|
||||||
|
tv_mm=(TextView)findViewById(R.id.tv_mm);
|
||||||
|
btnLogin=(Button)findViewById(R.id.btn_login);//获取登录
|
||||||
|
rgType = findViewById(R.id.rg_type);
|
||||||
|
rbUser = findViewById(R.id.rb_user);
|
||||||
|
rbAdmin = findViewById(R.id.rb_admin);
|
||||||
|
cbAgree = findViewById(R.id.cb_agree);
|
||||||
|
mTitleBar = (ActionBar)findViewById(R.id.myActionBar);
|
||||||
|
mTitleBar.setData(activity,"登录",0, 0, 0,getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//注册
|
||||||
|
tvRegister.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转到注册页面
|
||||||
|
Intent intent=new Intent(activity, RegisterActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
tv_mm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent=new Intent(activity,PasswordActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//选择类型
|
||||||
|
rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
|
SPUtils.put(activity,SPUtils.IS_ADMIN,checkedId == R.id.rb_admin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//设置点击按钮
|
||||||
|
btnLogin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//关闭虚拟键盘
|
||||||
|
InputMethodManager inputMethodManager= (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(),0);
|
||||||
|
//获取请求参数
|
||||||
|
String account= etAccount.getText().toString();
|
||||||
|
String password=etPassword.getText().toString();
|
||||||
|
Boolean isAdmit = (Boolean) SPUtils.get(activity,SPUtils.IS_ADMIN,false);
|
||||||
|
if ("".equals(account)){//账号不能为空
|
||||||
|
Toast.makeText(activity,"账号不能为空!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(password)){//密码为空
|
||||||
|
Toast.makeText(activity,"密码为空!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = DataSupport.where("account = ?", account).findFirst(User.class);
|
||||||
|
if (user != null) {
|
||||||
|
if (!password.equals(user.getPassword())) {
|
||||||
|
Toast.makeText(activity, "密码错误!", Toast.LENGTH_SHORT).show();
|
||||||
|
}else{
|
||||||
|
if (isAdmit && !"admin".equals(user.getAccount())){
|
||||||
|
Toast.makeText(activity,"该账号不是管理员账号!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isAdmit && "admin".equals(user.getAccount())){
|
||||||
|
Toast.makeText(activity,"该账号不是普通用户账号!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!cbAgree.isChecked()) {
|
||||||
|
Toast.makeText(activity, "请同意用户协议!", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SPUtils.put(LoginActivity.this,"account",account);
|
||||||
|
Intent intent = new Intent(activity, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
Toast.makeText(activity,"恭喜你,登录成功!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Toast.makeText(activity, "账号不存在", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.Fruit;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.util.StatusBarUtil;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏页面
|
||||||
|
*/
|
||||||
|
public class OpeningActivity extends AppCompatActivity {
|
||||||
|
private Activity myActivity;
|
||||||
|
private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
myActivity = this;
|
||||||
|
//设置页面布局
|
||||||
|
setContentView(R.layout.activity_opening);
|
||||||
|
try {
|
||||||
|
initView();
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private void initView() throws IOException, JSONException {
|
||||||
|
StatusBarUtil.setStatusBar(myActivity,true);//设置当前界面是否是全屏模式(状态栏)
|
||||||
|
StatusBarUtil.setStatusBarLightMode(myActivity,true);//状态栏文字颜色
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0){
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Boolean isFirst= (Boolean) SPUtils.get(myActivity,SPUtils.IF_FIRST,true);
|
||||||
|
String account= (String) SPUtils.get(myActivity,SPUtils.ACCOUNT,"");
|
||||||
|
if (isFirst){//第一次进来 初始化本地数据
|
||||||
|
SPUtils.put(myActivity,SPUtils.IF_FIRST,false);//第一次
|
||||||
|
//初始化数据
|
||||||
|
//获取json数据
|
||||||
|
String rewardJson = "";
|
||||||
|
String rewardJsonLine;
|
||||||
|
//assets文件夹下db.json文件的路径->打开db.json文件
|
||||||
|
BufferedReader bufferedReader = null;
|
||||||
|
try {
|
||||||
|
bufferedReader = new BufferedReader(new InputStreamReader(myActivity.getAssets().open("db.json")));
|
||||||
|
while (true) {
|
||||||
|
if (!((rewardJsonLine = bufferedReader.readLine()) != null)) break;
|
||||||
|
rewardJson += rewardJsonLine;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = new JSONObject(rewardJson);
|
||||||
|
JSONArray fruitList = jsonObject.getJSONArray("fruit");//获得列表
|
||||||
|
//把物品列表保存到本地
|
||||||
|
for (int i = 0, length = fruitList.length(); i < length; i++) {
|
||||||
|
JSONObject o = fruitList.getJSONObject(i);
|
||||||
|
Fruit fruit = new Fruit(o.getInt("typeId"),
|
||||||
|
o.getString("title"),
|
||||||
|
o.getString("img"),
|
||||||
|
o.getString("content"),
|
||||||
|
o.getString("issuer"),
|
||||||
|
sf.format(new Date())
|
||||||
|
);
|
||||||
|
fruit.save();//保存到本地
|
||||||
|
}
|
||||||
|
User user = new User("admin","123","管理员","1632957243","四川省内江市东兴区");
|
||||||
|
user.save();
|
||||||
|
User user1 = new User("0","0","普通人","1632957243","四川省南充市仪陇县");
|
||||||
|
user1.save();
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//两秒后跳转到主页面
|
||||||
|
Intent intent2 = new Intent();
|
||||||
|
if ("".equals(account)) {
|
||||||
|
intent2.setClass(OpeningActivity.this, MainActivity.class);
|
||||||
|
}else {
|
||||||
|
intent2.setClass(OpeningActivity.this, MainActivity.class);
|
||||||
|
}
|
||||||
|
startActivity(intent2);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
public class PasswordActivity extends AppCompatActivity {
|
||||||
|
private Activity activity;
|
||||||
|
private ActionBar mTitleBar;//标题栏
|
||||||
|
private EditText etAccount;
|
||||||
|
private EditText etAge;
|
||||||
|
private EditText etNewPassword;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
activity =this;
|
||||||
|
setContentView(R.layout.activity_password);
|
||||||
|
etAccount = findViewById(R.id.et_account);
|
||||||
|
etAge = findViewById(R.id.et_age);
|
||||||
|
etNewPassword = findViewById(R.id.et_new_password);
|
||||||
|
mTitleBar = (ActionBar)findViewById(R.id.myActionBar);
|
||||||
|
mTitleBar.setData(activity,"重置密码", R.drawable.ic_back, 0, 0,getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存信息
|
||||||
|
public void save(View v){
|
||||||
|
//关闭虚拟键盘
|
||||||
|
InputMethodManager inputMethodManager= (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(),0);
|
||||||
|
String account = etAccount.getText().toString();
|
||||||
|
String age = etAge.getText().toString();
|
||||||
|
String newPassword = etNewPassword.getText().toString();
|
||||||
|
if ("".equals(account)){//账号不能为空
|
||||||
|
Toast.makeText(activity,"账号不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(age)){//为空
|
||||||
|
Toast.makeText(activity,"电话为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(newPassword)){//密码为空
|
||||||
|
Toast.makeText(activity,"新密码为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = DataSupport.where("account = ? and age = ?", account,age).findFirst(User.class);
|
||||||
|
if (user != null) {
|
||||||
|
user.setPassword(newPassword);
|
||||||
|
user.save();
|
||||||
|
Toast.makeText(activity, "密码修改成功", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(activity, "账号或者电话错误", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
public class PersonActivity extends AppCompatActivity {
|
||||||
|
private Activity mActivity;
|
||||||
|
private ActionBar mTitleBar;//标题栏
|
||||||
|
private TextView tvAccount;
|
||||||
|
private TextView etNickName;
|
||||||
|
private TextView etAge;
|
||||||
|
private TextView etEmail;
|
||||||
|
private Button btnSave;//保存
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_person);
|
||||||
|
mActivity = this;
|
||||||
|
tvAccount = findViewById(R.id.tv_account);
|
||||||
|
etNickName = findViewById(R.id.tv_nickName);
|
||||||
|
etAge = findViewById(R.id.tv_age);
|
||||||
|
etEmail = findViewById(R.id.tv_email);
|
||||||
|
btnSave = findViewById(R.id.btn_save);
|
||||||
|
mTitleBar = (ActionBar) findViewById(R.id.myActionBar);
|
||||||
|
mTitleBar.setData(mActivity,"个人信息", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
String account = (String) SPUtils.get(mActivity,"account","");
|
||||||
|
User user = DataSupport.where("account = ?", account).findFirst(User.class);
|
||||||
|
if (user != null) {
|
||||||
|
tvAccount.setText(user.getAccount());
|
||||||
|
etNickName.setText(user.getNickName());
|
||||||
|
etAge.setText(String.valueOf(user.getAge()));
|
||||||
|
etEmail.setText(user.getEmail());
|
||||||
|
}
|
||||||
|
//保存
|
||||||
|
btnSave.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String account = tvAccount.getText().toString();
|
||||||
|
String nickName = etNickName.getText().toString();
|
||||||
|
String age = etAge.getText().toString();
|
||||||
|
String email = etEmail.getText().toString();
|
||||||
|
User user1 = DataSupport.where("account = ?",account).findFirst(User.class);
|
||||||
|
if ("".equals(nickName)) {
|
||||||
|
Toast.makeText(mActivity,"昵称不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(age)) {
|
||||||
|
Toast.makeText(mActivity,"电话不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(email)) {
|
||||||
|
Toast.makeText(mActivity,"收货地址不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
user1.setNickName(nickName);
|
||||||
|
user1.setAge(String.valueOf(age));
|
||||||
|
user1.setEmail(email);
|
||||||
|
user1.save();
|
||||||
|
Toast.makeText(mActivity,"保存成功", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();//关闭页面
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* btnLogout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MyApplication.Instance.getMainActivity().finish();
|
||||||
|
SPUtils.remove(mActivity,"account");
|
||||||
|
startActivity(new Intent(mActivity, LoginActivity.class));
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册页面
|
||||||
|
*/
|
||||||
|
public class RegisterActivity extends Activity {
|
||||||
|
private Activity activity;
|
||||||
|
private ActionBar mTitleBar;//标题栏
|
||||||
|
private EditText etAccount;//手机号
|
||||||
|
private EditText etNickName;//昵称
|
||||||
|
private EditText etAge;//
|
||||||
|
private EditText etEmail;//邮箱
|
||||||
|
private EditText etPassword;//密码
|
||||||
|
private EditText etPasswordSure;//确认密码
|
||||||
|
|
||||||
|
private Button btnRegister;//注册按钮
|
||||||
|
private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
activity=this;
|
||||||
|
setContentView(R.layout.activity_register);//加载页面
|
||||||
|
etAccount =(EditText) findViewById(R.id.et_account);//获取手机号
|
||||||
|
etNickName =(EditText) findViewById(R.id.et_nickName);//获取昵称
|
||||||
|
etAge =(EditText) findViewById(R.id.et_age);//获取年龄
|
||||||
|
etEmail =(EditText) findViewById(R.id.et_email);//获取邮箱
|
||||||
|
etPassword=(EditText) findViewById(R.id.et_password);//获取密码
|
||||||
|
etPasswordSure=(EditText) findViewById(R.id.et_password_sure);//获取确认密码
|
||||||
|
|
||||||
|
btnRegister=(Button) findViewById(R.id.btn_register);//获取注册按钮
|
||||||
|
mTitleBar = (ActionBar) findViewById(R.id.myActionBar);
|
||||||
|
mTitleBar.setData(activity,"注册", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* tvLogin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转到登录页面
|
||||||
|
Intent intent=new Intent(activity, LoginActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});**/
|
||||||
|
//设置注册点击按钮
|
||||||
|
btnRegister.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//关闭虚拟键盘
|
||||||
|
InputMethodManager inputMethodManager= (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(),0);
|
||||||
|
String account= etAccount.getText().toString();
|
||||||
|
String nickName= etNickName.getText().toString();
|
||||||
|
String age = etAge.getText().toString();
|
||||||
|
String email= etEmail.getText().toString();
|
||||||
|
String password=etPassword.getText().toString();
|
||||||
|
String passwordSure=etPasswordSure.getText().toString();
|
||||||
|
if ("".equals(account)){//账号不能为空
|
||||||
|
Toast.makeText(activity,"账号不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(nickName)){//昵称不能为空
|
||||||
|
Toast.makeText(activity,"昵称不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(age)){//年龄不能为空
|
||||||
|
Toast.makeText(activity,"电话不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(email)){//邮箱不能为空
|
||||||
|
Toast.makeText(activity,"收货地址不能为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(password)){//密码为空
|
||||||
|
Toast.makeText(activity,"密码为空", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!password.equals(passwordSure)){//密码不一致
|
||||||
|
Toast.makeText(activity,"密码不一致", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = DataSupport.where("account = ?", account).findFirst(User.class);
|
||||||
|
if (user == null) {
|
||||||
|
user = new User (account,password,nickName, String.valueOf(age),email);
|
||||||
|
user.save();//保存用户信息
|
||||||
|
Intent intent = new Intent(activity, LoginActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
Toast.makeText(activity, "注册成功", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
}else {
|
||||||
|
Toast.makeText(activity, "该账号已存在", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,92 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.bean.User;
|
||||||
|
import com.example.fruit.widget.ActionBar;
|
||||||
|
|
||||||
|
import org.litepal.crud.DataSupport;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户明细
|
||||||
|
*/
|
||||||
|
public class UserDetailActivity extends AppCompatActivity {
|
||||||
|
private ActionBar mActionBar;//标题栏
|
||||||
|
private Activity mActivity;
|
||||||
|
private TextView account;
|
||||||
|
private EditText nickName;
|
||||||
|
private EditText age;
|
||||||
|
private EditText email;
|
||||||
|
private User mUser;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_user_detail);
|
||||||
|
mActivity = this;
|
||||||
|
account = findViewById(R.id.account);
|
||||||
|
nickName = findViewById(R.id.nickName);
|
||||||
|
age = findViewById(R.id.age);
|
||||||
|
email = findViewById(R.id.email);
|
||||||
|
mActionBar = findViewById(R.id.myActionBar);
|
||||||
|
//侧滑菜单
|
||||||
|
mActionBar.setData(mActivity,"用户信息", R.drawable.ic_back, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mUser = (User) getIntent().getSerializableExtra("user");
|
||||||
|
if (mUser != null) {
|
||||||
|
account.setText(mUser.getAccount());
|
||||||
|
nickName.setText(mUser.getNickName());
|
||||||
|
age.setText(String.valueOf(mUser.getAge()));
|
||||||
|
email.setText(mUser.getEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存
|
||||||
|
public void save(View view){
|
||||||
|
User user = DataSupport.where("account = ?",mUser.getAccount()).findFirst(User.class);
|
||||||
|
String nickNameStr = nickName.getText().toString();
|
||||||
|
String ageStr = age.getText().toString();
|
||||||
|
String emailStr = email.getText().toString();
|
||||||
|
if ("".equals(nickNameStr)) {
|
||||||
|
Toast.makeText(mActivity,"昵称不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(ageStr)) {
|
||||||
|
Toast.makeText(mActivity,"电话不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("".equals(emailStr)) {
|
||||||
|
Toast.makeText(mActivity,"地址不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (user != null) {
|
||||||
|
user.setNickName(nickNameStr);
|
||||||
|
user.setAge(String.valueOf(ageStr));
|
||||||
|
user.setEmail(emailStr);
|
||||||
|
user.save();
|
||||||
|
Toast.makeText(mActivity,"保存成功", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
}else {
|
||||||
|
Toast.makeText(mActivity,"保存失败", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.example.fruit.ui.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
|
||||||
|
public class WxActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_wx);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
package com.example.fruit.ui.fragment;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import com.example.fruit.bean.Browse;
|
||||||
|
import com.example.fruit.ui.activity.BrowseActivity;
|
||||||
|
import com.example.fruit.ui.activity.ManageActivity;
|
||||||
|
import com.example.fruit.MyApplication;
|
||||||
|
import com.example.fruit.ui.activity.OrderActivity;
|
||||||
|
import com.example.fruit.R;
|
||||||
|
import com.example.fruit.ui.activity.LoginActivity;
|
||||||
|
import com.example.fruit.ui.activity.PasswordActivity;
|
||||||
|
import com.example.fruit.ui.activity.PersonActivity;
|
||||||
|
import com.example.fruit.util.SPUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人中心
|
||||||
|
*/
|
||||||
|
public class UserFragment extends Fragment {
|
||||||
|
private Activity mActivity;
|
||||||
|
private LinearLayout llPerson;
|
||||||
|
private LinearLayout llSecurity;
|
||||||
|
|
||||||
|
private LinearLayout llFavorite;
|
||||||
|
private LinearLayout llBrowse;
|
||||||
|
private LinearLayout order;
|
||||||
|
private LinearLayout manage;
|
||||||
|
private Button btnLogout;
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
mActivity = (Activity) context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_user,container,false);
|
||||||
|
llPerson = view.findViewById(R.id.person);
|
||||||
|
llSecurity = view.findViewById(R.id.security);
|
||||||
|
llBrowse = view.findViewById(R.id.browse);
|
||||||
|
order = view.findViewById(R.id.order);
|
||||||
|
manage = view.findViewById(R.id.manage);
|
||||||
|
btnLogout = view.findViewById(R.id.logout);
|
||||||
|
llFavorite = view.findViewById(R.id.favorite);
|
||||||
|
initView();
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
|
||||||
|
|
||||||
|
llFavorite.setVisibility(isAdmin?View.GONE:View.VISIBLE);
|
||||||
|
order.setVisibility(isAdmin?View.GONE:View.VISIBLE);
|
||||||
|
llBrowse.setVisibility(isAdmin?View.GONE:View.VISIBLE);
|
||||||
|
manage.setVisibility(isAdmin?View.VISIBLE:View.GONE);
|
||||||
|
//个人信息
|
||||||
|
llPerson.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
Intent intent = new Intent(mActivity, PersonActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//用户管理
|
||||||
|
manage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
Intent intent = new Intent(mActivity, ManageActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//账号安全
|
||||||
|
llSecurity.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
Intent intent = new Intent(mActivity, PasswordActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//浏览记录
|
||||||
|
llBrowse.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
Intent intent = new Intent(mActivity, BrowseActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//我的订单
|
||||||
|
order.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
Intent intent = new Intent(mActivity, OrderActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//联系客服
|
||||||
|
llFavorite.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//跳转页面
|
||||||
|
//跳转到我的资料卡
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mqqapi://card/show_pslcard?src_type=internal&source=sharecard&version=1&uin=1632957243")));//跳转到QQ资料
|
||||||
|
//startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mqqapi://card/show_pslcard?src_type=internal&version=1&card_type=group&source=qrcode&uin=485761716")));//跳转到QQ群
|
||||||
|
//startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mqqwpa://im/chat?chat_type=wpa&version=1&uin=1632957243")));//跳转到临时会话
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//退出登录
|
||||||
|
btnLogout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MyApplication.Instance.getMainActivity().finish();
|
||||||
|
SPUtils.remove(mActivity,SPUtils.IS_ADMIN);
|
||||||
|
SPUtils.remove(mActivity,SPUtils.ACCOUNT);
|
||||||
|
startActivity(new Intent(mActivity, LoginActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.fruit.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟键盘操作
|
||||||
|
*/
|
||||||
|
public class KeyBoardUtil {
|
||||||
|
/**
|
||||||
|
* 打开键盘
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
public static void showKeyboard(View view){
|
||||||
|
InputMethodManager imm= (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
if (imm!=null){
|
||||||
|
view.requestFocus();
|
||||||
|
imm.showSoftInput(view,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 关闭键盘
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
public static void hideKeyboard(View view){
|
||||||
|
InputMethodManager imm= (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
if (imm!=null){
|
||||||
|
imm.hideSoftInputFromWindow(view.getWindowToken(),0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,307 @@
|
|||||||
|
package com.example.fruit.widget;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
|
||||||
|
import com.example.fruit.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义ActionBar
|
||||||
|
*/
|
||||||
|
public final class ActionBar extends LinearLayout {
|
||||||
|
|
||||||
|
private LinearLayout llActionbarRoot;//自定义ActionBar根节点
|
||||||
|
private View vStatusBar;//状态栏位置
|
||||||
|
private ImageView ivLeft;//左边图标
|
||||||
|
private TextView tvLeft;//左边
|
||||||
|
private TextView tvTitle;//中间标题
|
||||||
|
private ImageView ivRight;//右边图标
|
||||||
|
private Button btnRight;//右边按钮
|
||||||
|
private TextView tvRight;//右边文字
|
||||||
|
public ActionBar(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionBar(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(context);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置标题
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
public void setTitle(String title){
|
||||||
|
if (!TextUtils.isEmpty(title)) {
|
||||||
|
tvTitle.setText(title);
|
||||||
|
} else {
|
||||||
|
tvTitle.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置左侧文本
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void setLeftText(String text){
|
||||||
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
tvLeft.setText(text);
|
||||||
|
tvLeft.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
tvLeft.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置左侧图标
|
||||||
|
* @param ico
|
||||||
|
*/
|
||||||
|
public void setLeftIco(int ico){
|
||||||
|
if (ico!=0) {
|
||||||
|
ivLeft.setImageResource(ico);
|
||||||
|
ivLeft.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
ivLeft.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置右侧文本
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void setRightText(String text){
|
||||||
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
tvRight.setText(text);
|
||||||
|
tvRight.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
tvRight.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置右侧btn
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void setRightBtn(String text){
|
||||||
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
btnRight.setText(text);
|
||||||
|
btnRight.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
btnRight.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置右侧图标
|
||||||
|
* @param ico
|
||||||
|
*/
|
||||||
|
public void setRightIco(int ico){
|
||||||
|
if (ico!=0) {
|
||||||
|
ivRight.setImageResource(ico);
|
||||||
|
ivRight.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
ivRight.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(Context context) {
|
||||||
|
setOrientation(HORIZONTAL);//设置横向布局
|
||||||
|
View contentView = inflate(getContext(), R.layout.widget_actionbar, this);
|
||||||
|
//获取控件
|
||||||
|
llActionbarRoot = (LinearLayout)contentView.findViewById(R.id.ll_actionbar_root);
|
||||||
|
vStatusBar = contentView.findViewById(R.id.v_statusbar);
|
||||||
|
ivLeft = (ImageView)contentView.findViewById(R.id.iv_actionbar_left);
|
||||||
|
tvLeft=(TextView) contentView.findViewById(R.id.tv_actionbar_left);
|
||||||
|
tvTitle =(TextView) contentView.findViewById(R.id.tv_actionbar_title);
|
||||||
|
ivRight =(ImageView) contentView.findViewById(R.id.iv_actionbar_right);
|
||||||
|
btnRight=(Button) contentView.findViewById(R.id.btn_actionbar_right);
|
||||||
|
tvRight=(TextView) contentView.findViewById(R.id.tv_actionbar_right);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置透明度
|
||||||
|
*
|
||||||
|
* @param transAlpha{Integer} 0-255 之间
|
||||||
|
*/
|
||||||
|
public void setTranslucent(int transAlpha) {
|
||||||
|
//设置透明度
|
||||||
|
llActionbarRoot.setBackgroundColor(ColorUtils.setAlphaComponent(getResources().getColor(R.color.colorPrimary), transAlpha));
|
||||||
|
tvTitle.setAlpha(transAlpha);
|
||||||
|
ivLeft.setAlpha(transAlpha);
|
||||||
|
ivRight.setAlpha(transAlpha);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置数据
|
||||||
|
*
|
||||||
|
* @param strTitle 标题
|
||||||
|
* @param resIdLeft 左边图标资源
|
||||||
|
* @param resIdRight 右边图标资源
|
||||||
|
* @param intColor 内容颜色 0为白色 1为黑色
|
||||||
|
* @param backgroundColor 背景颜色
|
||||||
|
* @param listener 点击事件监听
|
||||||
|
*/
|
||||||
|
public void setData(String strTitle, int resIdLeft, int resIdRight, int intColor, int backgroundColor, final ActionBarClickListener listener) {
|
||||||
|
String textColor=intColor==0?"#FFFFFF":"#000000";
|
||||||
|
if (!TextUtils.isEmpty(strTitle)) {
|
||||||
|
tvTitle.setText(strTitle);
|
||||||
|
tvTitle.setTextColor(Color.parseColor(textColor));
|
||||||
|
} else {
|
||||||
|
tvTitle.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (resIdLeft == 0) {
|
||||||
|
ivLeft.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ivLeft.setBackgroundResource(resIdLeft);
|
||||||
|
ivLeft.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (resIdRight == 0) {
|
||||||
|
ivRight.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ivRight.setBackgroundResource(resIdRight);
|
||||||
|
ivRight.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backgroundColor==0){
|
||||||
|
llActionbarRoot.setBackgroundResource(0);
|
||||||
|
}else {
|
||||||
|
llActionbarRoot.setBackgroundColor(backgroundColor);//设置标题栏背景颜色
|
||||||
|
}
|
||||||
|
if (listener != null) {
|
||||||
|
ivLeft.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onLeftClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ivRight.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onRightClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void setData(Activity context, String strTitle, int resIdLeft, int resIdRight, int intColor, int backgroundColor, final ActionBarClickListener listener) {
|
||||||
|
String textColor=intColor==0?"#FFFFFF":"#000000";
|
||||||
|
if (!TextUtils.isEmpty(strTitle)) {
|
||||||
|
tvTitle.setText(strTitle);
|
||||||
|
tvTitle.setTextColor(Color.parseColor(textColor));
|
||||||
|
} else {
|
||||||
|
tvTitle.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (resIdLeft == 0) {
|
||||||
|
ivLeft.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ivLeft.setBackgroundResource(resIdLeft);
|
||||||
|
ivLeft.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (resIdRight == 0) {
|
||||||
|
ivRight.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ivRight.setBackgroundResource(resIdRight);
|
||||||
|
ivRight.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backgroundColor==0){
|
||||||
|
llActionbarRoot.setBackgroundResource(0);
|
||||||
|
}else {
|
||||||
|
llActionbarRoot.setBackgroundColor(backgroundColor);//设置标题栏背景颜色
|
||||||
|
}
|
||||||
|
if (listener != null) {
|
||||||
|
ivLeft.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onLeftClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ivRight.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onRightClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String strTitle, int resIdLeft, String strRight, int intColor, int backgroundColor, final ActionBarClickListener listener) {
|
||||||
|
String textColor=intColor==0?"#FFFFFF":"#000000";
|
||||||
|
if (!TextUtils.isEmpty(strTitle)) {
|
||||||
|
tvTitle.setText(strTitle);
|
||||||
|
tvTitle.setTextColor(Color.parseColor(textColor));
|
||||||
|
} else {
|
||||||
|
tvTitle.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (resIdLeft == 0) {
|
||||||
|
ivLeft.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ivLeft.setBackgroundResource(resIdLeft);
|
||||||
|
ivLeft.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(strRight)) {
|
||||||
|
btnRight.setText(strRight);
|
||||||
|
btnRight.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
btnRight.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (backgroundColor==0){
|
||||||
|
llActionbarRoot.setBackgroundResource(0);
|
||||||
|
}else {
|
||||||
|
llActionbarRoot.setBackgroundColor(backgroundColor);//设置标题栏背景颜色
|
||||||
|
}
|
||||||
|
if (listener != null) {
|
||||||
|
if(ivLeft.getVisibility()==VISIBLE){
|
||||||
|
ivLeft.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onLeftClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if(tvLeft.getVisibility()==VISIBLE){
|
||||||
|
tvLeft.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onLeftClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(btnRight.getVisibility()==VISIBLE){
|
||||||
|
btnRight.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onRightClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if(tvRight.getVisibility()==VISIBLE){
|
||||||
|
tvRight.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
listener.onRightClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public interface ActionBarClickListener {
|
||||||
|
//左边点击
|
||||||
|
void onLeftClick();
|
||||||
|
//右边点击
|
||||||
|
void onRightClick();
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
After Width: | Height: | Size: 832 KiB |
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--底部边-->
|
||||||
|
<item android:left="-2dp"
|
||||||
|
android:top="-2dp"
|
||||||
|
android:right="-2dp"
|
||||||
|
android:bottom="1dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:color="#6FCCCCCC" android:width="1px"></stroke>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--顶部边-->
|
||||||
|
<item android:left="-2dp"
|
||||||
|
android:top="1dp"
|
||||||
|
android:right="-2dp"
|
||||||
|
android:bottom="-2dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:color="#6FCCCCCC" android:width="1px"></stroke>
|
||||||
|
<solid android:color="@color/colorWhite"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="@color/colorGrayTint"> <!--波纹颜色-->
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<!-- 填充背景色-->
|
||||||
|
<solid android:color="@color/colorWhite"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<solid android:color="@color/colorWhite" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<!--按钮边框-->
|
||||||
|
<!--solid用以指定内部填充色-->
|
||||||
|
<solid android:color="@color/colorPrimary" />
|
||||||
|
<!--渐变色-->
|
||||||
|
<gradient
|
||||||
|
android:angle="0"
|
||||||
|
android:startColor="@color/colorPrimary"
|
||||||
|
android:endColor="@color/colorPrimary"/>
|
||||||
|
<corners
|
||||||
|
android:radius="25dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<!--按钮边框-->
|
||||||
|
<!--solid用以指定内部填充色-->
|
||||||
|
<solid android:color="#7CF44336" />
|
||||||
|
<!--渐变色-->
|
||||||
|
<gradient
|
||||||
|
android:angle="0"
|
||||||
|
android:startColor="#7CF44336"
|
||||||
|
android:endColor="#7CF44336"/>
|
||||||
|
<corners
|
||||||
|
android:radius="25dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<!--按钮边框-->
|
||||||
|
<!--solid用以指定内部填充色-->
|
||||||
|
<solid android:color="#45CCCCCC"/>
|
||||||
|
<corners
|
||||||
|
android:radius="50dp"/>
|
||||||
|
</shape>
|
After Width: | Height: | Size: 360 KiB |
After Width: | Height: | Size: 512 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 640 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 832 B |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 849 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 37 KiB |