master
FinalJcsp 2 years ago
parent dd346aa03f
commit 9d103c1751

15
.gitignore vendored

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

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -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,13 @@
<?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$" />
</GradleProjectSettings>
</option>
</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>

1
app/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,51 @@
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.food"
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.food;
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.food", appContext.getPackageName());
}
}

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.food">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/ic_logo"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:roundIcon="@drawable/ic_logo"
android:supportsRtl="true"
android:allowClearUserData="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<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.BrowseActivity"/>
<activity android:name=".ui.activity.AddFruitActivity"/>
<activity android:name=".ui.activity.UserDetailActivity"/>
</application>
</manifest>

@ -0,0 +1,327 @@
{
"fruit": [
{
"typeId": 0,
"title": "水煮肉片",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154088128763034.jpg",
"content": "水煮肉片是一道汉族新创名菜,起源于自贡,由自贡名菜,水煮牛肉变来,发扬于西南,属于渝菜、川菜中著名的家常菜 。其起源于上世纪30年代 自贡名厨范吉安(1887 -1982年),创新出风味突出的水煮肉片 。因肉片未经划油,以水煮熟故名水煮肉片。",
"issuer": "18.80",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 0,
"title": "白切鸡",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154337576945105.jpg",
"content": "无",
"issuer": "23.0",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 0,
"title": "辣子鸡丁",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154338772988443.jpg",
"content": "辣子鸡丁,鲜香麻辣~",
"issuer": "28.00",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 0,
"title": "宫保鸡丁",
"img": "https://st-cn.meishij.net/r/207/11/9502957/s9502957_151304147951837.jpg",
"content": "一盘酥香,略带微辣、咸鲜、微甜、微酸的宫保鸡丁出炉啦",
"issuer": "30.80",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 0,
"title": "川味干锅鸡翅",
"img": "https://st-cn.meishij.net/r/141/154/4351141/s4351141_150509718716126.jpg",
"content": "\n青椒、五花肉、土豆、花椒、姜片、蒜头、干辣椒、生抽、老抽、鸡精、糖",
"issuer": "20.80",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 0,
"title": "经典川菜【麻婆豆腐】",
"img": "https://ali.xinshipu.cn/20170204/original/1486196929827.jpg@196w_126h_99q_1e_1c.jpg",
"content": "鸡翅用黄酒、生抽、蒜蓉、姜茸、盐腌制半个小时左右",
"issuer": "23.00",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 1,
"title": "蓑衣黄瓜",
"img": "https://st-cn.meishij.net/r/147/198/4174647/s4174647_150943807386688.jpg",
"content": "黄瓜我通常都喜欢切成小块,或拍碎凉拌着吃。然而,今天心血来潮,想换个花样,于是便试做了这道地方名菜-蓑衣黄瓜,没想到竟一次成功,特别有成就感。",
"issuer": "12.80",
"date": "2021-9-28 19:35:1 4"
},
{
"typeId": 1,
"title": "赛螃蟹",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154338475808551.jpg",
"content": "无",
"issuer": "25.50",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 1,
"title": "红烧鲤鱼",
"img": "https://st-cn.meishij.net/r/08/75/3768758/s3768758_142763265871365.jpg",
"content": "鱼收拾干净切花刀抹上盐和料酒腌制10分钟",
"issuer": "18.20",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 1,
"title": "红烧排骨",
"img": "https://st-cn.meishij.net/r/08/75/3768758/s3768758_143164448562685.jpg",
"content": "倒入生抽老抽八角桂皮陈皮香叶炒出香味加开水没过排骨放入葱姜大火烧开小火炖1小时",
"issuer": "13.50",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 1,
"title": "葱烧海参",
"img": "https://st-cn.meishij.net/r/112/108/4089612/s4089612_145431725551281.jpg",
"content": "海参清鲜,柔软香滑,葱香味醇,食后无余汁,营养丰富,尤其对生殖功能作用突出,对促进性功能的提高很有帮助。另外,可以改善和调理女性内分泌,促进体内良性循环。因此,准备孕育下一代的夫妻,可以在受孕前三个月开始进行身体调理。",
"issuer": "25.50",
"date": "2021-9-28 19:35:14"
},
{
"typeId": 2,
"title": "白切鸡",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154337576945105.jpg",
"content": "放蒜末、姜末、葱末、白砂糖、盐、生抽",
"issuer": "22.50",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 2,
"title": "梅菜扣肉",
"img": "https://st-cn.meishij.net/r/60/35/3321310/s3321310_154891634276312.jpg",
"content": "梅菜扣肉菜系来说应该算是广东的客家菜,但因其太过于好吃所以流传大家南北,也是不少家庭过年必做的硬菜之一,虽然做法不是很难,但因其制作略有些繁琐所以一般人平时都不愿意碰这个菜。我这道菜是刚学做饭那会跟一位广东网友学习的,此菜被此网友成为“超级大工程”自己尝试了之后觉得虽谈不上“超级”但也可谓之“大工程”,前前后后怎么也得两三个小时,虽然麻烦了点,但尝过之后就一个字“值”。自己家庭制作没有那么多所谓的“秘方调料”,吃的就是用时间带引出的食材本香,无肉不欢的你,不试试还等什么呢?",
"issuer": "27.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 2,
"title": "广东油鸡",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154338658073949.jpg",
"content": "\n鸡腿2只水1/2杯广东油鸡淋酱13杯",
"issuer": "25.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 2,
"title": "煲仔饭",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154089314708674.jpg",
"content": "无",
"issuer": "16.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 2,
"title": "小鸡炖蘑菇",
"img": "https://st-cn.meishij.net/r/118/144/6286118/s6286118_146857570754913.jpg",
"content": "儿时味道的经典再现,满满的回忆,融入到浓醇鲜美的味道之中,一缕缕感动在舌尖化开。",
"issuer": "20.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 3,
"title": "剁椒鱼头",
"img": "https://st-cn.meishij.net/r/246/212/8615746/s8615746_150003929415096.jpg",
"content": "鱼头中含有丰富的不饱和脂肪酸,对脑部的发育尤为重要,可使大脑细胞活跃,因此能极大增强推理,判断能力,常吃鱼头不仅可以健脑,还可以延缓脑力衰退。\n\n鱼头味美易被人体消化和吸收含脂肪较少含有丰富的维生素A、维生素D和维生素K。尤其是富含两种不饱和脂肪酸DHA和EPA它们对清理和软化血管、降血脂以及健脑、延缓衰老都有好处。",
"issuer": "20.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 3,
"title": "蒸腊鱼",
"img": "https://st-cn.meishij.net/r/185/123/1655935/s1655935_18695.jpg",
"content": "还记得舌尖2三餐里湖南小夫妻解乡愁的那道蒸腊鱼么虽然不是我的家乡菜但是那份乡愁却是深深的感染到了我。家乡的味道有种特殊的魔力能让天各一方的家人穿越时空聚在一起。\n既然不是湘妹子所以嗜辣程度也有限我没有用湿的豆豉辣酱而是用的罗定干豆豉辣味减少鲜香味增加。不过这腊鱼可是正宗的湖南腊鱼哦值得一提的是用电视上的方法处理腊鱼块就是先浸泡再焯烫这样真的可以让很咸的腊鱼去掉大部分咸味最后出来的成品咸淡适口鱼肉干香又而不柴这个方法值得一试哦。",
"issuer": "68.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 3,
"title": "酿烧青尖椒",
"img": "https://st-cn.meishij.net/r/150/78/3394650/s3394650_149849114659095.jpg",
"content": "这个是一个“酿青尖椒”在一次饭店吃到,我就喜欢上了。香 辣 醇的口感非常的美味青尖椒是比较常见的炒制食材。它含有非常高的维生素C堪比柠檬并且能开胃、促进食欲、降脂减肥、还具有预防癌症的作用经常食用点对健康非常有帮助。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 3,
"title": "酸辣椒炒肉",
"img": "https://st-cn.meishij.net/r/97/32/4758097/s4758097_150520942704178.jpg",
"content": "酸辣椒采用新鲜的青嫩辣椒,用白醋、加点冰糖浸泡一个星期之后就可以食用。选择的辣椒要嫩,才不会辣,浸泡的时间不要太久,否则会很酸。辣椒尽量切小,让酸味散发出来,肉中融入,酸酸甜甜,开胃好吃。\n白醋具有美容、美白功效浸泡过多白醋还能喝上一小口味道酸酸甜甜很不错。浸泡的酸辣椒也可以直接吃。选择不辣椒的辣椒才能直接吃太辣的辣椒不建议吃。",
"issuer": "20.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 3,
"title": "全家福",
"img": "https://st-cn.meishij.net/r/137/202/3863137/s3863137_142806509977951.jpg",
"content": "一天接近尾声,走在行色匆匆的人群中,是不是有一刻,最想念的不是餐厅里的美味珍馐,而是记忆深处,那个属于家的味道,妈妈的味道。\n全家福是妈妈最爱做给我们吃的一道烩菜温暖的背后是妈妈对营养用心的搭配。今天尝试着也做一次味道也许并不惊艳但那熟悉的味道弥漫开来的时候对心最为温暖的一击这时是离家最近的时刻。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 4,
"title": "红烧鱼块",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154337102842238.jpg",
"content": "鱼,每个人都喜欢吃的,也是每个人都吃过的,鱼总是带着家的味道,有着父亲的味道,我从小很爱吃鱼,父亲总是说“吃鱼会变聪明”,我现在知道他只是想让我吃掉那最后那一块没有刺滑嫩的鱼肉而已。鱼肉的营养价值十分丰富,鱼肉质细嫩,有温中益气、暖胃、润肌肤等功能,是温中补气养生食品。鱼肉脂肪含量低,供热能低,有益气养血,柔筋利骨等功能。鱼有暖胃和中平肝祛风等功能。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 4,
"title": "酱鸭腿",
"img": "https://st-cn.meishij.net/r/20/89/1272270/s1272270_142554525691812.jpg",
"content": "鸭腿的营养价值很高可食部分鸭肉中的蛋白质含量16%一25%,比畜肉含量高得多。鸭腿肉蛋白质主要是肌浆蛋白和肌凝蛋白。另一部分是间质蛋白,其中含有溶于水的胶原蛋白和弹性蛋白,此外还有少量的明胶,其余为非蛋白氮。肉食含氮浸出物越多,味道越鲜美。鸭肉中含氮浸出物比畜肉多,所以鸭肉味美。老鸭肉的含氮浸出物比幼鸭肉多,野鸭内含氮浸出物更多,因此,老鸭的汤比幼鸭鲜美,野鸭滋味更比老鸭好。此外,烹调时,加入少量盐,能有效地溶出含氮浸出物,会获得更鲜美的肉汤。",
"issuer": "40.00",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 4,
"title": "胡萝卜丝饼",
"img": "https://st-cn.meishij.net/r/206/231/5120456/s5120456_147748643457600.jpg",
"content": "上大学的时候最爱吃的就是三食堂的饼,记得那个窗口有各种饼,葱花饼、手抓饼、掉渣饼、龙凤大饼、土豆丝饼、胡萝卜丝饼等,每一种都很好吃,其中最爱的就是胡萝卜丝饼,既有萝卜丝的清甜又有饼的鲜香,很是美味。毕业后,自己没少做这个饼,开始老拿捏不住食材的量,做出来总是差强人意,不过做过几次后就好了,面粉不需要加太多,主要就是萝卜丝,我自己比较喜欢香菜的香气,这次加入了香菜碎,真的要香掉牙了,胡萝卜丝和香菜一起竟然会这么好吃,太意外啦,哈哈,感觉赚到了,以后就要这么做。",
"issuer": "48.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 4,
"title": "清蒸大闸蟹",
"img": "https://st-cn.meishij.net/r/19/208/1364519/s1364519_44452.jpg",
"content": "味道很不错一人干掉2只大闸蟹还嫌不够呢。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 4,
"title": "正宗盐水鸭",
"img": "https://st-cn.meishij.net/r/199/170/3917699/s3917699_142889626409737.jpg",
"content": "古都金陵今南京早在战国时期就有金陵人筑地养鸭的记载可见当地人吃鸭肉已有上千年的历史。估计所有做鸭肉的方法已经让南京人试了一遍了但能保留到今天的也就能数的上来那几种“盐水鸭”便是其中经久不衰的一道菜。以前总是托同事给我带想吃一次得等很久现在用咱自动烹饪锅E15(E153/E152)型号也能做了,味道比当地买的还要好,以后随时都可以尝到“盐水鸭”。想想也是怪任性的,说了这么多,吊足了大家的胃口,也不能让各位失望,回家都试试,准备着春节露一手",
"issuer": "30.00",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 5,
"title": "烤肉",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154338548467834.jpg",
"content": "无",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 5,
"title": "油焖大虾",
"img": "https://st-cn.meishij.net/r/139/60/2827639/s2827639_151556829530544.jpg",
"content": "鲁菜中的油焖大虾是鲁菜中的经典,成品色泽亮丽,味美鲜香,鲜嫩微甜,趁热吃,虾肉洁白细腻,让人胃口大开。作为生活在胶东半岛的人家,油焖大虾也是年夜饭必备的一道菜;",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 5,
"title": "红焖羊肉",
"img": "https://st-cn.meishij.net/r/23/225/2118773/s2118773_142471761675876.jpg",
"content": "冬天吃羊肉可以驱寒保暖,但很多人不喜欢羊肉的那股膻味,可是把羊肉和萝卜搭配起来,萝卜的辣味刚好可以去除羊肉的膻味而且还能提鲜。中医认为羊肉与萝卜在一起有很好的食疗作用,羊肉含有丰富的动物蛋白,萝卜含有丰富的植物蛋白,两者可以互补,充分补充人体所需的蛋白质,并且羊肉较温热,而萝卜性寒凉,能两样东西一起组合,上火的人吃了不会咽喉肿痛,虚寒的人吃了也不会肠胃不适。不爱吃羊肉的小伙伴不防这样做羊肉试试,说不定会喜欢上羊肉哦。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 5,
"title": "酱牛肉",
"img": "https://st-cn.meishij.net/r/115/102/588115/s588115_149347346669780.jpg",
"content": "酱牛肉,肉质紧实 酱香浓郁,虽是一道传统年菜但依旧在上海人过年的餐桌上占据一席之地。个人觉得酱牛肉有点和红烧肉很相似,各家都有自己的一种味道,我们喜欢带有一丝甜味的酱牛肉,除了调味料外还可以加一点干辣椒来解腻去腥增味,菜品酱香浓郁,口味层次丰富,让人垂涎欲滴,欲罢不能",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 5,
"title": "贵妃鸡翅",
"img": "https://st-cn.meishij.net/r/50/123/6030800/s6030800_155374584131082.jpg",
"content": "一提到鸡翅是不是首先想到是可乐鸡翅其实鸡翅的做法有很多种并不仅限于可乐鸡翅红烧鸡翅、清蒸鸡翅、剁椒鸡翅还有贵妃鸡翅。相传杨贵妃最喜欢吃两种美食第一是荔枝第二就是鸡翅了。杨贵妃酷爱美食在饮食上也是极为讲究最爱吃鸡翅。宫廷御厨反复研究琢磨新鲜鸡翅选配多种调料精心研制做出了杨贵妃最喜欢吃的这道鸡翅。所以这道菜因杨贵妃而得名。这道贵妃鸡翅色泽红亮、软嫩爽滑、浓厚醇香回味悠长。比可乐鸡翅要好吃100倍",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 6,
"title": "西湖醋鱼",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154338858269516.jpg",
"content": "江南美味",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 6,
"title": "油焖春笋",
"img": "https://st-cn.meishij.net/r/246/109/4089996/s4089996_148768018789201.jpg",
"content": "笋含脂肪、淀粉很少,属天然低脂、低热量食品,是肥胖者减肥的佳品。养生学家认为,竹林丛生之地的人们多长寿,且极少患高血压,这与经常吃笋有一定关系。\n笋一年四季皆有但惟有春笋、冬笋味道最佳。烹调时无论是凉拌、煎炒还是熬汤均鲜嫩清香是人们喜欢的佳肴之一。春笋含有充足的水分、丰富的植物蛋白钙、磷、铁等人体必需的营养成分和微量元素。\n但是春笋中难溶性草酸钙含量较多因此各种结石患者不宜多食。草酸也会影响人体对钙的吸收和利用为防其弊在食用笋时应将它烧熟煮透若用笋片、笋丁炒菜也要先把笋用开水烫5-10分钟然后再配其它食物炒食。这样既可因高温分解大部分草酸减少其弊又能使菜肴无涩感味道更鲜美。\n小时候隔壁家邻居阿姨经常自己去山里挖一些很小的笋然后做油焖笋也时常给我家送一些。记得当时第一次吃到觉得好好吃啊颜色靓丽口味鲜甜至今想起来那次的美味仿佛还在嘴边",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 6,
"title": "花雕酒蒸鸡",
"img": "https://st-cn.meishij.net/r/115/102/588115/s588115_153477246215536.jpg",
"content": "花雕清蒸鸡是我们这里的传统滋补菜,蒸制过程里面不加一滴水,无需用太多的调料,只需用盐、葱,姜,花雕酒,也不必担心会有浓烈的酒味,通过蒸制之后,早已散发,鸡肉鲜嫩,汤汁清澈醇厚,原汁原味的鲜美,滋补又养身。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 6,
"title": "桂花糯米藕",
"img": "https://st-cn.meishij.net/r/95/122/8905595/s8905595_148008095338853.jpg",
"content": "江浙菜品多以甜味为主,在上海呆了多年,桂花糯米藕基本是每次聚餐必点的菜品。秋冬莲藕上市,此时桂花飘香,选用莲藕加上糯米,辅以桂花蜜,软香甜糯,桂香浓郁,甜甜蜜蜜的味道老少皆宜。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
},
{
"typeId": 6,
"title": "小黄鱼烧豆腐",
"img": "https://st-cn.meishij.net/r/85/180/5045085/s5045085_145014288167252.jpg",
"content": "黄鱼含有丰富的蛋白质、矿物质和维生素,对人体有很好的补益作用",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}, {
"typeId": 7,
"title": "红烧鳝鱼",
"img": "https://st-cn.meishij.net/r/41/203/113291/s113291_154468650537397.jpg",
"content": "无",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}, {
"typeId": 7,
"title": "红烧狮子头",
"img": "https://st-cn.meishij.net/r/86/63/1640836/s1640836_151543003415109.jpg",
"content": "红烧狮子头,颜色红润,寓意着富贵团圆,摆上桌后整桌菜都显气派,而且还是一道非常美味的下饭下酒菜,赶紧来预热春节年菜吧。\n红烧狮子头是一道传统的苏菜选用三肥七瘦的梅肉最好肉要粗切细斩才能保持肉中汁水的存在做起来才入味吃起来才松软加一些荸荠碎和香菇碎不但增加口感松嫩味道也更鲜香而且最好选用干香菇味道才更浓郁泡发香菇的水也千万别倒掉放在肉馅里更香哦今天做的这个红烧狮子头我还放里了我们平时吃的馒头大约1斤肉馅里放入1个平时市售2个/元的馒头刚好,用刚好浸泡馒头能碾碎的水来浸泡馒头然后搅拌再馅里,我刚好用了泡发香菇的水浸泡的馒头,既不浪费香菇水,味道又浓郁,做出来的狮子头非常松软美味哦,喜欢的朋友快来试一试吧。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}, {
"typeId": 7,
"title": "芋头蒸排骨",
"img": "https://st-cn.meishij.net/r/71/149/9599821/s9599821_150509435566915.jpg",
"content": "排骨与芋头是最完美的搭配,\n排骨的肉汁与芋头的香味相互渗透\n嫩滑、绵软两种口感同时兼得。\n虽是朴素的菜式却给予人安稳的家庭归属感",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}, {
"typeId": 7,
"title": "鲈鱼汤",
"img": "https://st-cn.meishij.net/r/150/78/3394650/s3394650_142838520357353.jpg",
"content": "鲈鱼含蛋白质、脂肪、碳水化合物等营养成分还含有维生素B2、烟酸和微量的维生素B1、磷、铁等物质。\n鲈鱼能补肝肾、健脾胃、化痰止咳对肝肾不足的人有很好的补益作用还可以治胎动不安、产后少乳等症。准妈妈和产后妇女吃鲈鱼既可补身又不会造成营养过剩而导致肥胖。另外鲈鱼血中含有较多的铜元素铜是维持人体神经系统正常功能并参与数种物质代谢的关键酶功能发挥的不可缺少的矿物质。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}, {
"typeId": 7,
"title": "红烧带鱼",
"img": "https://st-cn.meishij.net/r/219/162/6603219/s6603219_151290369598435.jpg",
"content": "非常简单的一道家常烧菜,口味咸鲜,是不错的下酒下饭菜。",
"issuer": "28.80",
"date": "2021-5-19 19:35:14"
}
]
}

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<litepal>
<!--数据库名称-->
<dbname value="foods"/>
<version value="1"/>
<list>
<mapping class="com.example.food.bean.User"/>
<mapping class="com.example.food.bean.Fruit"/>
<mapping class="com.example.food.bean.Orders"/>
<mapping class="com.example.food.bean.Browse"/>
</list>
<!-- 直接设置这个,就表示数据库存储的位置,直接打开手机存储就可以找到 -->
</litepal>

@ -0,0 +1,25 @@
package com.example.food;
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.initialize(this);//初始化LitePal数据库
}
private Activity mMainActivity;
public Activity getMainActivity() {
return mMainActivity;
}
public void setMainActivity(Activity mainActivity) {
mMainActivity = mainActivity;
}
}

@ -0,0 +1,83 @@
package com.example.food.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.food.R;
import com.example.food.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,138 @@
package com.example.food.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.food.R;
import com.example.food.bean.Fruit;
import com.example.food.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()));
viewHolder.date.setText(fruit.getDate());
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 TextView date;
private ImageView img;
public ViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
author_name = itemView.findViewById(R.id.author_name);
date = itemView.findViewById(R.id.date);
img = itemView.findViewById(R.id.img);
}
}
public interface ItemListener{
void ItemClick(Fruit fruit);
}
}

@ -0,0 +1,134 @@
package com.example.food.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.food.R;
import com.example.food.bean.Fruit;
import com.example.food.bean.Orders;
import com.example.food.bean.User;
import com.example.food.ui.activity.FruitDetailActivity;
import com.example.food.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(order.getNumber());
viewHolder.date.setText(order.getDate());
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mActivity, FruitDetailActivity.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 number;
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);
}
}
public interface ItemListener{
void ItemClick(Orders order);
}
}

@ -0,0 +1,123 @@
package com.example.food.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.food.R;
import com.example.food.bean.Browse;
import com.example.food.bean.User;
import com.example.food.ui.activity.UserDetailActivity;
import com.example.food.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(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<Browse> browses = DataSupport.where("account = ?",user.getAccount()).find(Browse.class);
if (browses !=null && browses.size() > 0){
for (Browse browse: browses) {
browse.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.food.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,75 @@
package com.example.food.bean;
import org.litepal.crud.DataSupport;
import java.io.Serializable;
/**
*
*/
public class Fruit extends DataSupport implements Serializable {
private Integer typeId;//类型 0科技1娱乐2体育3军事,4汽车,5健康
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,62 @@
package com.example.food.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 amount;//数量
private String date;//时间
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 account, String title, String number, String amount, String date) {
this.account = account;
this.title = title;
this.number = number;
this.amount = amount;
this.date = date;
}
}

@ -0,0 +1,66 @@
package com.example.food.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 Integer 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 Integer getAge() {
return age;
}
public void setAge(Integer 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, Integer 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.food.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.food.R;
import com.example.food.bean.Fruit;
import com.example.food.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,101 @@
package com.example.food.ui.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.food.R;
import com.example.food.adapter.BrowseAdapter;
import com.example.food.bean.Browse;
import com.example.food.bean.Fruit;
import com.example.food.util.SPUtils;
import com.example.food.widget.ActionBar;
import org.litepal.crud.DataSupport;
import java.util.List;
/**
*
*/
public class BrowseActivity extends AppCompatActivity {
private Activity myActivity;
private ActionBar mTitleBar;//标题栏
private LinearLayout llEmpty;
private RecyclerView rvBrowseList;
private BrowseAdapter mBrowseAdapter;
private List<Browse> mBrowses;
private String account;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browse);
myActivity = this;
rvBrowseList = findViewById(R.id.rv_collect_list);
llEmpty = findViewById(R.id.ll_empty);
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() {
}
});
initView();
}
private void initView() {
account = (String) SPUtils.get(myActivity,SPUtils.ACCOUNT,"");
LinearLayoutManager layoutManager=new LinearLayoutManager(myActivity);
//=1.2、设置为垂直排列用setOrientation方法设置(默认为垂直布局)
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//=1.3、设置recyclerView的布局管理器
rvBrowseList.setLayoutManager(layoutManager);
//==2、实例化适配器
//=2.1、初始化适配器
mBrowseAdapter=new BrowseAdapter(llEmpty,rvBrowseList);
//=2.3、设置recyclerView的适配器
rvBrowseList.setAdapter(mBrowseAdapter);
loadData();//加载数据
mBrowseAdapter.setItemListener(new BrowseAdapter.ItemListener() {
@Override
public void ItemClick(Browse collect) {
Intent intent = new Intent(myActivity, FruitDetailActivity.class);;
Fruit news = DataSupport.where("title = ?",collect.getTitle()).findFirst(Fruit.class);
intent.putExtra("fruit",news);
startActivityForResult(intent,100);
}
});
}
/**
*
*/
private void loadData(){
mBrowses = DataSupport.where("account = ?",account).find(Browse.class);//查询浏览记录
if (mBrowses !=null && mBrowses.size()>0){
rvBrowseList.setVisibility(View.VISIBLE);
llEmpty.setVisibility(View.GONE);
mBrowseAdapter.addItem(mBrowses);
}else {
rvBrowseList.setVisibility(View.GONE);
llEmpty.setVisibility(View.VISIBLE);
}
}
@Override
public void onResume() {
super.onResume();
loadData();
}
}

@ -0,0 +1,113 @@
package com.example.food.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.food.R;
import com.example.food.bean.Browse;
import com.example.food.bean.Fruit;
import com.example.food.bean.Orders;
import com.example.food.util.SPUtils;
import com.example.food.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(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){
Orders order = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Orders.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) {
Orders order = new Orders(account,fruit.getTitle(),"S"+ System.currentTimeMillis(),account,sf.format(new Date()));
order.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) {
Orders order = DataSupport.where("account = ? and title = ?",account,fruit.getTitle()).findFirst(Orders.class);
order.delete();
Toast.makeText(mActivity,"取消成功", Toast.LENGTH_SHORT).show();
btnCollect.setVisibility(View.VISIBLE);
btnCancel.setVisibility(View.GONE);
}
});
}
}

@ -0,0 +1,126 @@
package com.example.food.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.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.food.R;
import com.example.food.bean.User;
import com.example.food.util.SPUtils;
import com.example.food.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;//用户类型
@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);//获取注册
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);
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);
}
});
//选择类型
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;
}
SPUtils.put(LoginActivity.this,"account",account);
Intent intent = new Intent(activity, MainActivity.class);
startActivity(intent);
finish();
}
}else{
Toast.makeText(activity, "账号不存在", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onResume() {
super.onResume();
}
}

@ -0,0 +1,220 @@
package com.example.food.ui.activity;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.Toast;
import com.example.food.MyApplication;
import com.example.food.R;
import com.example.food.ui.fragment.FruitFragment;
import com.example.food.ui.fragment.OrderFragment;
import com.example.food.ui.fragment.UserFragment;
import com.example.food.ui.fragment.UserManageFragment;
import com.example.food.util.SPUtils;
import com.example.food.widget.ActionBar;
/**
*
*/
public class MainActivity extends Activity {
private ActionBar mActionBar;//标题栏
private Activity myActivity;
private LinearLayout llContent;
private RadioButton rbFruit;
private RadioButton rbFruitData;
private RadioButton rbUserManage;
private RadioButton rbUser;
private Fragment[] fragments = new Fragment[]{null, null,null,null};//存放Fragment
private Boolean mIsAdmin;//是否管理员
private String mAccount;//账号
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myActivity = this;
setContentView(R.layout.activity_main);
MyApplication.Instance.setMainActivity(myActivity);
mIsAdmin = (Boolean) SPUtils.get(myActivity, SPUtils.IS_ADMIN,false);
llContent = (LinearLayout) findViewById(R.id.ll_main_content);
rbFruit = (RadioButton) findViewById(R.id.rb_main_fruit);
rbFruitData = (RadioButton) findViewById(R.id.rb_main_fruit_data);
rbUserManage = (RadioButton) findViewById(R.id.rb_main_setting);
rbUser = (RadioButton) findViewById(R.id.rb_main_user);
mActionBar = (ActionBar) findViewById(R.id.myActionBar);
//侧滑菜单
mActionBar.setData(myActivity,"美食点餐", 0, 0, 0, getResources().getColor(R.color.colorPrimary), new ActionBar.ActionBarClickListener() {
@Override
public void onLeftClick() {
}
@Override
public void onRightClick() {
}
});
initView();
setViewListener();
}
private void setViewListener() {
rbFruit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mActionBar.setTitle("美食点餐");
switchFragment(0);
}
});
rbFruitData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ("".equals(mAccount)) {////未登录,跳转到登录页面
MyApplication.Instance.getMainActivity().finish();
startActivity(new Intent(myActivity, LoginActivity.class));
}else {//已经登录
mActionBar.setTitle("订单");
switchFragment(1);
}
}
});
rbUserManage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mActionBar.setTitle("用户管理");
switchFragment(2);
}
});
rbUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ("".equals(mAccount)) {////未登录,跳转到登录页面
MyApplication.Instance.getMainActivity().finish();
startActivity(new Intent(myActivity, LoginActivity.class));
}else {//已经登录
mActionBar.setTitle("我的");
switchFragment(mIsAdmin?3:2);
}
}
});
}
private void initView() {
mIsAdmin = (Boolean) SPUtils.get(myActivity,SPUtils.IS_ADMIN,false);
mAccount = (String) SPUtils.get(myActivity,SPUtils.ACCOUNT,"");
//设置导航栏图标样式
Drawable iconNews=getResources().getDrawable(R.drawable.selector_main_rb_home);//设置主页图标样式
iconNews.setBounds(0,0,68,68);//设置图标边距 大小
rbFruit.setCompoundDrawables(null,iconNews,null,null);//设置图标位置
rbFruit.setCompoundDrawablePadding(5);//设置文字与图片的间距
Drawable iconNewsData=getResources().getDrawable(R.drawable.selector_main_rb_buy);//设置主页图标样式
iconNewsData.setBounds(0,0,68,68);//设置图标边距 大小
rbFruitData.setCompoundDrawables(null,iconNewsData,null,null);//设置图标位置
rbFruitData.setCompoundDrawablePadding(5);//设置文字与图片的间距
Drawable iconSetting=getResources().getDrawable(R.drawable.selector_main_rb_manage);//设置主页图标样式
iconSetting.setBounds(0,0,60,60);//设置图标边距 大小
rbUserManage.setCompoundDrawables(null,iconSetting,null,null);//设置图标位置
rbUserManage.setCompoundDrawablePadding(5);//设置文字与图片的间距
Drawable iconUser=getResources().getDrawable(R.drawable.selector_main_rb_user);//设置主页图标样式
iconUser.setBounds(0,0,55,55);//设置图标边距 大小
rbUser.setCompoundDrawables(null,iconUser,null,null);//设置图标位置
rbUser.setCompoundDrawablePadding(5);//设置文字与图片的间距
rbUserManage.setVisibility(mIsAdmin? View.VISIBLE: View.GONE);
switchFragment(0);
rbFruit.setChecked(true);
}
/**
* - Fragment
*
* @param fragmentIndex Fragment
*/
private void switchFragment(int fragmentIndex) {
//在Activity中显示Fragment
//1、获取Fragment管理器 FragmentManager
FragmentManager fragmentManager = this.getFragmentManager();
//2、开启fragment事务
FragmentTransaction transaction = fragmentManager.beginTransaction();
//懒加载 - 如果需要显示的Fragment为null就new。并添加到Fragment事务中
if (fragments[fragmentIndex] == null) {
if (mIsAdmin){
switch (fragmentIndex) {
case 0://NewsFragment
fragments[fragmentIndex] = new FruitFragment();
break;
case 1://CollectFragment
fragments[fragmentIndex] = new OrderFragment();
break;
case 2://UserManageFragment
fragments[fragmentIndex] = new UserManageFragment();
break;
case 3://UserFragment
fragments[fragmentIndex] = new UserFragment();
break;
}
}else {
switch (fragmentIndex) {
case 0://NewsFragment
fragments[fragmentIndex] = new FruitFragment();
break;
case 1://CollectFragment
fragments[fragmentIndex] = new OrderFragment();
break;
case 2://UserFragment
fragments[fragmentIndex] = new UserFragment();
break;
}
}
//==添加Fragment对象到Fragment事务中
//参数显示Fragment的容器的IDFragment对象
transaction.add(R.id.ll_main_content, fragments[fragmentIndex]);
}
//隐藏其他的Fragment
for (int i = 0; i < fragments.length; i++) {
if (fragmentIndex != i && fragments[i] != null) {
//隐藏指定的Fragment
transaction.hide(fragments[i]);
}
}
//4、显示Fragment
transaction.show(fragments[fragmentIndex]);
//5、提交事务
transaction.commit();
}
/**
* 退
*
* @param keyCode
* @param event
* @return
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
exit();
}
return false;
}
private long time = 0;
public void exit() {
if (System.currentTimeMillis() - time > 2000) {
time = System.currentTimeMillis();
Toast.makeText(myActivity,"再点击一次退出应用程序", Toast.LENGTH_LONG).show();
} else {
finish();
}
}
}

@ -0,0 +1,111 @@
package com.example.food.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.food.R;
import com.example.food.bean.Fruit;
import com.example.food.bean.User;
import com.example.food.util.SPUtils;
import com.example.food.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","管理员",22,"123456789@qq.com");
user.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,80 @@
package com.example.food.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.food.R;
import com.example.food.bean.User;
import com.example.food.widget.ActionBar;
import org.litepal.crud.DataSupport;
/**
*
*/
public class PasswordActivity extends AppCompatActivity {
private Activity activity;
private ActionBar mTitleBar;//标题栏
private EditText etAccount;
private EditText etEmail; 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);
etEmail = findViewById(R.id.et_email);
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 email = etEmail.getText().toString();
String newPassword = etNewPassword.getText().toString();
if ("".equals(account)){//账号不能为空
Toast.makeText(activity,"账号不能为空", Toast.LENGTH_LONG).show();
return;
}
if ("".equals(email)){//邮箱为空
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 email = ?", account,email).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,103 @@
package com.example.food.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.food.R;
import com.example.food.bean.User;
import com.example.food.util.SPUtils;
import com.example.food.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(Integer.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,125 @@
package com.example.food.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.food.R;
import com.example.food.bean.User;
import com.example.food.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 TextView tvLogin;//登录
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);//获取确认密码
tvLogin=(TextView) findViewById(R.id.tv_login);//登录
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, Integer.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.food.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.food.R;
import com.example.food.bean.User;
import com.example.food.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(Integer.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,195 @@
package com.example.food.ui.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.food.MyApplication;
import com.example.food.R;
import com.example.food.adapter.FruitAdapter;
import com.example.food.bean.Fruit;
import com.example.food.ui.activity.AddFruitActivity;
import com.example.food.ui.activity.FruitDetailActivity;
import com.example.food.ui.activity.LoginActivity;
import com.example.food.util.SPUtils;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import org.litepal.crud.DataSupport;
import java.util.List;
import static android.app.Activity.RESULT_OK;
/**
*
*/
public class FruitFragment extends Fragment {
private Activity myActivity;//上下文
private TabLayout tabTitle;
private RecyclerView rvfruitList;
private FruitAdapter mfruitAdapter;
private LinearLayout llEmpty;
private Boolean mIsAdmin;
private EditText etQuery;//搜索内容
private ImageView ivSearch;//搜索图标
private FloatingActionButton btnAdd;
private String[] state = {"0","1","2","3","4","5","6"};
private String[] title = {"川菜", "鲁菜","粤菜" ,"湘菜","沪菜","京菜","浙菜"};
private String typeId = "0";
private List<Fruit> mfruit;
@Override
public void onAttach(Context context) {
super.onAttach(context);
myActivity= (Activity) context;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.fragment_fruit,container,false);
tabTitle = (TabLayout)view.findViewById(R.id.tab_title);
rvfruitList = (RecyclerView)view.findViewById(R.id.rv_fruit_list);
llEmpty = view.findViewById(R.id.ll_empty);
etQuery=view.findViewById(R.id.et_query);
ivSearch=view.findViewById(R.id.iv_search);
btnAdd = (FloatingActionButton)view.findViewById(R.id.btn_add);
//获取控件
initView();
//软键盘搜索
ivSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadData();//加载数据
}
});
//点击软键盘中的搜索
etQuery.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
loadData();//加载数据
return true;
}
return false;
}
});
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(myActivity, AddFruitActivity.class);
startActivityForResult(intent,100);
}
});
return view;
}
/**
*
*/
private void initView() {
mIsAdmin = (Boolean) SPUtils.get(myActivity, SPUtils.IS_ADMIN, false);
btnAdd.setVisibility(mIsAdmin? View.VISIBLE: View.GONE);
tabTitle.setTabMode(TabLayout.MODE_SCROLLABLE);
//设置tablayout距离上下左右的距离
//tab_title.setPadding(20,20,20,20);
//为TabLayout添加tab名称
for (int i=0;i<title.length;i++){
tabTitle.addTab(tabTitle.newTab().setText(title[i]));
}
LinearLayoutManager layoutManager=new LinearLayoutManager(myActivity);
//=1.2、设置为垂直排列用setOrientation方法设置(默认为垂直布局)
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//=1.3、设置recyclerView的布局管理器
rvfruitList.setLayoutManager(layoutManager);
//==2、实例化适配器
//=2.1、初始化适配器
mfruitAdapter=new FruitAdapter(llEmpty,rvfruitList);
//=2.3、设置recyclerView的适配器
rvfruitList.setAdapter(mfruitAdapter);
loadData();
mfruitAdapter.setItemListener(new FruitAdapter.ItemListener() {
@Override
public void ItemClick(Fruit fruit) {
boolean isAdmin = (boolean) SPUtils.get(myActivity,SPUtils.IS_ADMIN,false);
String account = (String) SPUtils.get(myActivity,SPUtils.ACCOUNT,"");
if ("".equals(account)) {//未登录,跳转到登录页面
MyApplication.Instance.getMainActivity().finish();
startActivity(new Intent(myActivity, LoginActivity.class));
}else {//已经登录
Intent intent;
if (isAdmin){
intent = new Intent(myActivity, AddFruitActivity.class);
}else {
intent = new Intent(myActivity, FruitDetailActivity.class);
}
intent.putExtra("fruit",fruit);
startActivityForResult(intent,100);
}
}
});
tabTitle.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
typeId = state[tab.getPosition()];
loadData();
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
private void loadData(){
String content=etQuery.getText().toString();//获取搜索内容
if ("".equals(content) ){
mfruit = DataSupport.where("typeId = ?",typeId).find(Fruit.class);
}else {
mfruit =DataSupport.where("typeId = ? and title like ?" ,typeId,"%"+content+"%").find(Fruit.class);//通过标题模糊查询留言
}
if (mfruit !=null && mfruit.size()>0){
rvfruitList.setVisibility(View.VISIBLE);
llEmpty.setVisibility(View.GONE);
mfruitAdapter.addItem(mfruit);
}else {
rvfruitList.setVisibility(View.GONE);
llEmpty.setVisibility(View.VISIBLE);
}
}
@Override
public void onResume() {
super.onResume();
loadData();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100 && resultCode == RESULT_OK){
loadData();//加载数据
}
}
}

@ -0,0 +1,131 @@
package com.example.food.ui.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.food.R;
import com.example.food.adapter.OrderAdapter;
import com.example.food.bean.Orders;
import com.example.food.util.SPUtils;
import org.litepal.crud.DataSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*
*/
public class OrderFragment extends Fragment {
private Activity myActivity;
private LinearLayout llEmpty;
private RecyclerView rvOrderList;
public OrderAdapter mOrderAdapter;
private Boolean mIsAdmin;
private EditText etQuery;//搜索内容
private ImageView ivSearch;//搜索图标
private List<Orders> mOrder = new ArrayList<>();
private String account;
@Override
public void onAttach(Context context) {
super.onAttach(context);
myActivity = (Activity) context;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.fragment_order,container,false);
rvOrderList = view.findViewById(R.id.rv_order_list);
llEmpty = view.findViewById(R.id.ll_empty);
etQuery=view.findViewById(R.id.et_query);
ivSearch=view.findViewById(R.id.iv_search);
//获取控件
initView();
//软键盘搜索
ivSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadData();//加载数据
}
});
//点击软键盘中的搜索
etQuery.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
loadData();//加载数据
return true;
}
return false;
}
});
return view;
}
private void initView() {
mIsAdmin = (Boolean) SPUtils.get(myActivity, SPUtils.IS_ADMIN, false);
account = (String) SPUtils.get(myActivity, SPUtils.ACCOUNT, "");
LinearLayoutManager layoutManager=new LinearLayoutManager(myActivity);
//=1.2、设置为垂直排列用setOrientation方法设置(默认为垂直布局)
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//=1.3、设置recyclerView的布局管理器
rvOrderList.setLayoutManager(layoutManager);
//==2、实例化适配器
//=2.1、初始化适配器
mOrderAdapter =new OrderAdapter(llEmpty, rvOrderList);
//=2.3、设置recyclerView的适配器
rvOrderList.setAdapter(mOrderAdapter);
loadData();//加载数据
}
/**
*
*/
private void loadData(){
String content=etQuery.getText().toString();//获取搜索内容
if ("".equals(content) && !mIsAdmin){
mOrder = DataSupport.where("account = ? " ,account).find(Orders.class);//查询全部
}else {
mOrder =DataSupport.where("number like ? and account != ?" ,"%"+content+"%","admin").find(Orders.class);//通过标题模糊查询留言
}
Collections.reverse(mOrder);
if (mOrder !=null && mOrder.size()>0){
rvOrderList.setVisibility(View.VISIBLE);
llEmpty.setVisibility(View.GONE);
mOrderAdapter.addItem(mOrder);
}else {
rvOrderList.setVisibility(View.GONE);
llEmpty.setVisibility(View.VISIBLE);
}
}
@Override
public void onResume() {
super.onResume();
loadData();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100){
loadData();
}
}
}

@ -0,0 +1,90 @@
package com.example.food.ui.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import com.example.food.MyApplication;
import com.example.food.R;
import com.example.food.ui.activity.BrowseActivity;
import com.example.food.ui.activity.LoginActivity;
import com.example.food.ui.activity.PasswordActivity;
import com.example.food.ui.activity.PersonActivity;
import com.example.food.util.SPUtils;
/**
*
*/
public class UserFragment extends Fragment {
private Activity mActivity;
private LinearLayout llPerson;
private LinearLayout llSecurity;
private LinearLayout llBrowse;
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);
btnLogout = view.findViewById(R.id.logout);
initView();
return view;
}
private void initView() {
Boolean isAdmin = (Boolean) SPUtils.get(mActivity,SPUtils.IS_ADMIN,false);
llBrowse.setVisibility(isAdmin? View.GONE: View.VISIBLE);
//个人信息
llPerson.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//跳转页面
Intent intent = new Intent(mActivity, PersonActivity.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);
}
});
//退出登录
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,128 @@
package com.example.food.ui.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.food.R;
import com.example.food.adapter.UserAdapter;
import com.example.food.bean.User;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.litepal.crud.DataSupport;
import java.util.Collections;
import java.util.List;
/**
*
*/
public class UserManageFragment extends Fragment {
private Activity myActivity;
private LinearLayout llEmpty;
private RecyclerView rvUserList;
public UserAdapter mUserAdapter;
private FloatingActionButton btnAdd;
private EditText etQuery;//搜索内容
private ImageView ivSearch;//搜索图标
private List<User> mUsers;
@Override
public void onAttach(Context context) {
super.onAttach(context);
myActivity = (Activity) context;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.fragment_user_manage,container,false);
rvUserList = view.findViewById(R.id.rv_user_list);
llEmpty = view.findViewById(R.id.ll_empty);
etQuery=view.findViewById(R.id.et_query);
ivSearch=view.findViewById(R.id.iv_search);
//获取控件
initView();
//软键盘搜索
ivSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadData();//加载数据
}
});
//点击软键盘中的搜索
etQuery.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
loadData();//加载数据
return true;
}
return false;
}
});
return view;
}
private void initView() {
LinearLayoutManager layoutManager=new LinearLayoutManager(myActivity);
//=1.2、设置为垂直排列用setOrientation方法设置(默认为垂直布局)
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//=1.3、设置recyclerView的布局管理器
rvUserList.setLayoutManager(layoutManager);
//==2、实例化适配器
//=2.1、初始化适配器
mUserAdapter=new UserAdapter(llEmpty, rvUserList);
//=2.3、设置recyclerView的适配器
rvUserList.setAdapter(mUserAdapter);
loadData();
}
/**
*
*/
private void loadData(){
String content=etQuery.getText().toString();//获取搜索内容
if ("".equals(content)){
mUsers= DataSupport.where("account != ?","admin").find(User.class);//查询全部
}else {
mUsers=DataSupport.where("account like ?","%"+content+"%").find(User.class);//通过账号模糊查询用户
}
Collections.reverse(mUsers);
if (mUsers !=null && mUsers.size()>0){
rvUserList.setVisibility(View.VISIBLE);
llEmpty.setVisibility(View.GONE);
mUserAdapter.addItem(mUsers);
}else {
rvUserList.setVisibility(View.GONE);
llEmpty.setVisibility(View.VISIBLE);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100){
initView();
}
}
@Override
public void onResume() {
super.onResume();
loadData();
}
}

@ -0,0 +1,176 @@
package com.example.food.util;
import android.content.Context;
import android.content.SharedPreferences;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/**
*
*/
public class SPUtils {
public static final String IF_FIRST = "is_first";//是否第一次进来
public static final String IS_ADMIN = "is_admin";//是否是管理员
public static final String ACCOUNT = "account";//账号
/**
*
*/
private static final String FILE_NAME = "share_data";
/**
*
*
* @param context
* @param key key
* @param object value
*/
public static void put(Context context, String key, Object object) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
if (object instanceof String) {
editor.putString(key, (String) object);
} else if (object instanceof Integer) {
editor.putInt(key, (Integer) object);
} else if (object instanceof Boolean) {
editor.putBoolean(key, (Boolean) object);
} else if (object instanceof Float) {
editor.putFloat(key, (Float) object);
} else if (object instanceof Long) {
editor.putLong(key, (Long) object);
} else {
editor.putString(key, object.toString());
}
SharedPreferencesCompat.apply(editor);
}
/**
*
*
* @param context
* @param key key
* @param defaultObject value
* @return value
*/
public static Object get(Context context, String key, Object defaultObject) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
if (defaultObject instanceof String) {
return sp.getString(key, (String) defaultObject);
} else if (defaultObject instanceof Integer) {
return sp.getInt(key, (Integer) defaultObject);
} else if (defaultObject instanceof Boolean) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if (defaultObject instanceof Float) {
return sp.getFloat(key, (Float) defaultObject);
} else if (defaultObject instanceof Long) {
return sp.getLong(key, (Long) defaultObject);
}
return null;
}
/**
* key
*
* @param context
* @param key key
*/
public static void remove(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
SharedPreferencesCompat.apply(editor);
}
/**
*
*
* @param context
*/
public static void clear(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
SharedPreferencesCompat.apply(editor);
}
/**
* key
*
* @param context
* @param key key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.contains(key);
}
/**
*
*
* @param context
* @return
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.getAll();
}
/**
* SharedPreferencesCompat.apply
*
* @author zhy
*/
private static class SharedPreferencesCompat {
private static final Method sApplyMethod = findApplyMethod();
/**
* apply
*
* @return Method
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private static Method findApplyMethod() {
try {
Class clz = SharedPreferences.Editor.class;
return clz.getMethod("apply");
} catch (NoSuchMethodException e) {
}
return null;
}
/**
* 使apply使commit
*
* @param editor SharedPreferences.Edito
*/
public static void apply(SharedPreferences.Editor editor) {
try {
if (sApplyMethod != null) {
sApplyMethod.invoke(editor);
return;
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
editor.commit();
}
}
}

@ -0,0 +1,212 @@
package com.example.food.util;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.example.food.R;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
*
*/
public class StatusBarUtil {
/**
* Activity hideStatusBarBackground :true false
*
* @param activity
* @param hideStatusBarBackground
*/
public static void setStatusBar(Activity activity, boolean hideStatusBarBackground) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
if (hideStatusBarBackground) {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
} else {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
ViewGroup mContentView = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
View mChildView = mContentView.getChildAt(0);
if (mChildView != null) {
if (hideStatusBarBackground) {
mChildView.setPadding(
mChildView.getPaddingLeft(),
0,
mChildView.getPaddingRight(),
mChildView.getPaddingBottom()
);
} else {
int statusHeight = getStatusBarHeight(activity);
mChildView.setPadding(
mChildView.getPaddingLeft(),
statusHeight,
mChildView.getPaddingRight(),
mChildView.getPaddingBottom()
);
}
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (hideStatusBarBackground) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(Color.TRANSPARENT);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
} else {
window.setStatusBarColor(activity.getResources().getColor(R.color.colorPrimary));
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
}
/**
*
*/
public static int getStatusBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
/**
*
*/
/* public static void setStatusBarColor(Activity activity, int colorId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(colorId));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明
transparentBar(activity);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(colorId);
}
}*/
@TargetApi(19)
public static void transparentBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = activity.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
/**
* true false XML android:fitsSystemWindows="true"
*/
public static void setStatusBarLightMode(Activity activity, boolean dark) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (dark) { //
if (MIUISetStatusBarLightMode(activity, dark)) {
} else if (FlymeSetStatusBarLightMode(activity.getWindow(), dark)) {
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//其他
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
} else {
if (MIUISetStatusBarLightMode(activity, dark)) {
} else if (FlymeSetStatusBarLightMode(activity.getWindow(), dark)) {
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
}
}
/**
*
* Flyme
*
* @param window
* @param dark
* @return boolean true
*/
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
boolean result = false;
if (window != null) {
try {
WindowManager.LayoutParams lp = window.getAttributes();
Field darkFlag = WindowManager.LayoutParams.class
.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
Field meizuFlags = WindowManager.LayoutParams.class
.getDeclaredField("meizuFlags");
darkFlag.setAccessible(true);
meizuFlags.setAccessible(true);
int bit = darkFlag.getInt(null);
int value = meizuFlags.getInt(lp);
if (dark) {
value |= bit;
} else {
value &= ~bit;
}
meizuFlags.setInt(lp, value);
window.setAttributes(lp);
result = true;
} catch (Exception e) {
}
}
return result;
}
/**
* MIUIV6
*
* @param activity
* @param dark
* @return boolean true
*/
public static boolean MIUISetStatusBarLightMode(Activity activity, boolean dark) {
boolean result = false;
Window window = activity.getWindow();
if (window != null) {
Class clazz = window.getClass();
try {
int darkModeFlag = 0;
Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
darkModeFlag = field.getInt(layoutParams);
Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
if (dark) {
extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
} else {
extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
}
result = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//开发版 7.7.13 及以后版本采用了系统API旧方法无效但不会报错所以两个方式都要加上
if (dark) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} else {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
} catch (Exception e) {
}
}
return result;
}
}

@ -0,0 +1,307 @@
package com.example.food.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.food.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();
}
}

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--RadioButton被选中时的显示效果-->
<item android:drawable="@drawable/ic_buy_check" android:state_checked="true"/>
<!--正常情况下显示效果-->
<item android:drawable="@drawable/ic_buy"/>
</selector>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--RadioButton被选中时的显示效果-->
<item android:drawable="@drawable/ic_home_check" android:state_checked="true"/>
<!--正常情况下显示效果-->
<item android:drawable="@drawable/ic_home"/>
</selector>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--RadioButton被选中时的显示效果-->
<item android:drawable="@drawable/ic_manage_check" android:state_checked="true"/>
<!--正常情况下显示效果-->
<item android:drawable="@drawable/ic_manage"/>
</selector>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--主页面导航栏选中改变-->
<item android:color="@color/colorPrimary" android:state_checked="true"/>
<item android:color="@color/colorGray"/>
<item android:drawable="@color/colorPrimary" android:state_checked="true"/>
<item android:drawable="@color/colorGray"/>
</selector>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--RadioButton被选中时的显示效果-->
<item android:drawable="@drawable/ic_user_check" android:state_checked="true"/>
<!--正常情况下显示效果-->
<item android:drawable="@drawable/ic_user"/>
</selector>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_empty"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="暂无数据"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
android:id="@+id/rv_collect_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
</LinearLayout>

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!--表单布局-->
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:orientation="vertical">
<!--账号-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="标题"
android:textSize="14dp" />
<EditText
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入标题" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="图片"
android:textSize="14dp" />
<EditText
android:id="@+id/img"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入图片地址" />
</LinearLayout>
<ImageView
android:id="@+id/iv_img"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="类型"
android:textSize="14dp" />
<Spinner
android:id="@+id/type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/type"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="价格"
android:textSize="14dp" />
<EditText
android:id="@+id/issuer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入价格" />
</LinearLayout>
<!--描述-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:orientation="vertical">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="信息"
android:textSize="14dp" />
<EditText
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:padding="10dp"
android:layout_height="match_parent"
android:background="@drawable/bg_border_bottom"
android:textSize="14dp"
android:hint="请输入信息" />
</LinearLayout>
<!--注册按钮-->
<Button
android:onClick="save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"
android:layout_marginBottom="20dp"
android:textSize="22dp"
android:textAllCaps="false"
android:text="保存"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="300dp"
android:scaleType="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:background="@color/colorWhite"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18dp"
android:textStyle="bold"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:textColor="@color/colorPrimary"
android:textSize="14dp"
android:text=""/>
<TextView
android:id="@+id/issuer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="@color/colorPrimary"
android:textSize="14dp"
android:text=""/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:text=""
android:textSize="16dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/colorWhite"
android:padding="20dp">
<Button
android:visibility="gone"
android:id="@+id/btn_collect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_border_fill"
android:text="点餐"
android:textColor="@color/colorWhite"/>
<Button
android:visibility="gone"
android:id="@+id/btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_border_fill"
android:text="取消点餐"
android:textColor="@color/colorWhite"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!--线性布局 LinearLayout 根布局-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:background="@color/colorWhite">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!--表单布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:orientation="vertical">
<!--账号-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="账号"/>
<EditText
android:id="@+id/et_account"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:hint="请输入账号"
android:singleLine="true"
android:textSize="14dp" />
</LinearLayout>
<!--密码-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="密码"/>
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入密码"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:textSize="16dp"
android:text="注册"/>
</RelativeLayout>
<RadioGroup
android:id="@+id/rg_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_user"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="普通用户"/>
<RadioButton
android:id="@+id/rb_admin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="管理员"/>
</RadioGroup>
<!--登录按钮-->
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"
android:textSize="22dp"
android:textAllCaps="false"
android:text="登 录"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_main_content"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="58dp"
android:background="@drawable/bg_border_top"
android:paddingTop="8dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_main_fruit"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:button="@null"
android:textAlignment="center"
android:gravity="center_horizontal"
android:drawableTop="@drawable/selector_main_rb_home"
android:textColor="@drawable/selector_main_rb_text"
android:textSize="12dp"
android:background="@null"
android:text="首页"/>
<RadioButton
android:id="@+id/rb_main_fruit_data"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:button="@null"
android:textAlignment="center"
android:gravity="center_horizontal"
android:drawableTop="@drawable/selector_main_rb_buy"
android:textColor="@drawable/selector_main_rb_text"
android:textSize="12dp"
android:background="@null"
android:text="订单"/>
<RadioButton
android:visibility="gone"
android:id="@+id/rb_main_setting"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:button="@null"
android:textAlignment="center"
android:gravity="center_horizontal"
android:drawableTop="@drawable/selector_main_rb_manage"
android:textColor="@drawable/selector_main_rb_text"
android:textSize="12dp"
android:background="@null"
android:text="用户管理"/>
<RadioButton
android:id="@+id/rb_main_user"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:button="@null"
android:textAlignment="center"
android:gravity="center_horizontal"
android:drawableTop="@drawable/selector_main_rb_user"
android:textColor="@drawable/selector_main_rb_text"
android:textSize="12dp"
android:background="@null"
android:text="我的"/>
</RadioGroup>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.4">
<ImageView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:src="@drawable/ic_logo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="bottom"
android:layout_marginBottom="50dp"
android:layout_weight="0.4">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="30dp"
android:textSize="22dp"
android:textColor="@color/colorPrimary"
android:gravity="center"
android:text="@string/app_name"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!--线性布局 LinearLayout 根布局-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:background="@color/colorWhite">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!--表单布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:orientation="vertical">
<!--账号-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="账号"/>
<EditText
android:id="@+id/et_account"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:hint="请输入账号"
android:singleLine="true"
android:textSize="14dp" />
</LinearLayout>
<!--密码-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="邮箱"/>
<EditText
android:id="@+id/et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入邮箱"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="新密码"/>
<EditText
android:id="@+id/et_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入新密码"/>
</LinearLayout>
<!--注册按钮-->
<Button
android:onClick="save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"
android:textSize="22dp"
android:textAllCaps="false"
android:text="保 存"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_border_bottom"
android:padding="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:text="账号:"/>
<TextView
android:id="@+id/tv_account"
android:layout_width="wrap_content"
android:textSize="16dp"
android:layout_height="wrap_content"
android:text=""/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_border_bottom"
android:padding="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:text="昵称:"/>
<EditText
android:id="@+id/tv_nickName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:textSize="16dp"
android:text=""/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_border_bottom"
android:padding="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:text="年龄:"/>
<EditText
android:id="@+id/tv_age"
android:layout_width="wrap_content"
android:textSize="16dp"
android:background="@null"
android:inputType="number"
android:layout_height="wrap_content"
android:text=""/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_border_bottom"
android:padding="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:text="邮箱:"/>
<EditText
android:id="@+id/tv_email"
android:layout_width="wrap_content"
android:textSize="16dp"
android:inputType="textEmailAddress"
android:background="@null"
android:layout_height="wrap_content"
android:text=""/>
</LinearLayout>
<Button
android:id="@+id/btn_save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="保存"
android:background="@drawable/btn_border_fill"
android:textSize="18dp"
android:textColor="@color/colorWhite"
android:layout_marginTop="100dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
</LinearLayout>

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<!--线性布局 LinearLayout 根布局-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:background="@color/colorWhite">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--表单布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:orientation="vertical">
<!--账号-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="账号"
android:textSize="14dp" />
<EditText
android:id="@+id/et_account"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入账号" />
</LinearLayout>
<!--昵称-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="昵称"
android:textSize="14dp" />
<EditText
android:id="@+id/et_nickName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入昵称" />
</LinearLayout>
<!--年龄-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="年龄"
android:textSize="14dp" />
<EditText
android:id="@+id/et_age"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:inputType="number"
android:singleLine="true"
android:hint="请输入年龄" />
</LinearLayout>
<!--邮箱-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="邮箱"
android:textSize="14dp" />
<EditText
android:id="@+id/et_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@null"
android:textSize="14dp"
android:inputType="textEmailAddress"
android:singleLine="true"
android:hint="请输入邮箱" />
</LinearLayout>
<!--密码-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="密码"/>
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入密码"/>
</LinearLayout>
<!--确认密码-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="14dp"
android:text="确认密码"/>
<EditText
android:id="@+id/et_password_sure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:background="@null"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入密码"/>
</LinearLayout>
<TextView
android:id="@+id/tv_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_marginTop="10dp"
android:textSize="16dp"
android:text="马上登录"/>
<!--注册按钮-->
<Button
android:id="@+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"
android:textSize="22dp"
android:textAllCaps="false"
android:text="注 册"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.food.widget.ActionBar
android:id="@+id/myActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!--表单布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:orientation="vertical">
<!--账号-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="账号"
android:textSize="14dp" />
<TextView
android:id="@+id/account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16dp"/>
</LinearLayout>
<!--昵称-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="昵称"
android:textSize="14dp" />
<EditText
android:id="@+id/nickName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:textSize="16dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="年龄"
android:textSize="14dp" />
<EditText
android:id="@+id/age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:background="@null"
android:textSize="16dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:orientation="horizontal">
<!--TextView 文本 html的p标签-->
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="邮箱"
android:textSize="14dp" />
<EditText
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:textSize="16dp"/>
</LinearLayout>
</LinearLayout>
<Button
android:onClick="save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="保存"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"/>
</LinearLayout>

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingLeft="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center_vertical"
android:background="@drawable/btn_border_radius_fill_gray"
android:orientation="horizontal">
<EditText
android:id="@+id/et_query"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:imeOptions="actionSearch"
android:singleLine="true"
android:layout_marginRight="5dp"
android:scrollHorizontally="true"
android:maxLines="1"
android:textSize="12dp"
android:hint="请输入美食标题"/>
<TextView
android:layout_width="1px"
android:layout_height="wrap_content"
android:textSize="14dp"
android:background="@color/colorGray"/>
<ImageView
android:id="@+id/iv_search"
android:layout_width="50dp"
android:layout_height="20dp"
android:src="@drawable/ic_search_gray"/>
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_title"
android:layout_width="match_parent"
android:layout_height="40dp"
app:tabMode="fixed"
app:tabGravity="fill"
android:background="@color/colorWhite"
app:tabIndicatorColor="@color/colorPrimary"
app:tabTextColor="@color/colorBlack"
app:tabSelectedTextColor="@color/colorPrimary"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_empty"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="暂无数据"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_fruit_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorWhite"
android:src="@drawable/ic_add"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_margin="20dp"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center_vertical"
android:background="@drawable/btn_border_radius_fill_gray"
android:orientation="horizontal">
<EditText
android:id="@+id/et_query"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:imeOptions="actionSearch"
android:singleLine="true"
android:layout_marginRight="5dp"
android:scrollHorizontally="true"
android:maxLines="1"
android:textSize="12dp"
android:hint="请输入订单编号"/>
<TextView
android:layout_width="1px"
android:layout_height="wrap_content"
android:textSize="14dp"
android:background="@color/colorGray"/>
<ImageView
android:id="@+id/iv_search"
android:layout_width="50dp"
android:layout_height="20dp"
android:src="@drawable/ic_search_gray"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_empty"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="暂无订单"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
android:id="@+id/rv_order_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
</LinearLayout>

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--列表-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/person"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_ripple"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_person"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:text="个人信息"
android:textSize="14dp"
android:textColor="@color/colorBlack"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_right"/>
</LinearLayout>
<LinearLayout
android:id="@+id/security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_ripple"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_security"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:text="账号安全"
android:textSize="14dp"
android:textColor="@color/colorBlack"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_right"/>
</LinearLayout>
<LinearLayout
android:id="@+id/browse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_ripple"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_browse"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:text="浏览记录"
android:textSize="14dp"
android:textColor="@color/colorBlack"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/ic_right"/>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/logout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="退出登录"
android:background="@drawable/btn_border_fill"
android:textSize="18dp"
android:textColor="@color/colorWhite"
android:layout_marginTop="100dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
</LinearLayout>

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center_vertical"
android:background="@drawable/btn_border_radius_fill_gray"
android:orientation="horizontal">
<EditText
android:id="@+id/et_query"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:imeOptions="actionSearch"
android:singleLine="true"
android:layout_marginRight="5dp"
android:scrollHorizontally="true"
android:maxLines="1"
android:textSize="12dp"
android:hint="请输入用户账号"/>
<TextView
android:layout_width="1px"
android:layout_height="wrap_content"
android:textSize="14dp"
android:background="@color/colorGray"/>
<ImageView
android:id="@+id/iv_search"
android:layout_width="50dp"
android:layout_height="20dp"
android:src="@drawable/ic_search_gray"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_empty"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="暂无用户"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
android:id="@+id/rv_user_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
</LinearLayout>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="20dp"
android:background="@drawable/bg_border_bottom">
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="标题"
android:textSize="16sp"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_go"/>
</LinearLayout>

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:background="@color/colorWhite"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="标题"
android:textSize="16sp"
android:textColor="@color/colorBlack"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/author_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:textSize="12sp"
android:text="新京报"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="2021年3月28日12:32:37"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/img"
android:layout_width="130dp"
android:layout_height="100dp"
android:scaleType="centerCrop"/>
</LinearLayout>

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:layout_margin="10dp"
android:background="@drawable/bg_round_white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/nickName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="koi"
android:textSize="18sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123456789"
android:textSize="16sp"/>
</LinearLayout>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textSize="12sp"
android:layout_gravity="right"
android:text="2021-4-12 17:12:36"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/bg_round_white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/nickName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="20dp"
android:textSize="18sp"
android:text="姓名"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_go"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_actionbar_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:id="@+id/v_statusbar"
android:layout_width="match_parent"
android:layout_height="1.0dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="vertical">
<!--左边 图标和文字 返回-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_actionbar_left"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"/>
<TextView
android:id="@+id/tv_actionbar_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="8dp"
android:textSize="15dp"
android:text="" />
</RelativeLayout>
<!--标题-->
<TextView
android:id="@+id/tv_actionbar_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:textSize="16dp" />
<!--右边 图标和文字-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_actionbar_right"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"/>
<TextView
android:id="@+id/tv_actionbar_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:textSize="15dp"
android:text="" />
<Button
android:id="@+id/btn_actionbar_right"
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:layout_marginRight="12dp"
android:background="@drawable/btn_border_fill"
android:textColor="@color/colorWhite"
android:textAllCaps="false"
android:text=""
android:visibility="gone"
android:textSize="14dp"/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

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

Loading…
Cancel
Save