期末大作业

master
wangyi 2 years ago
parent 2a30096423
commit 3e62a777bc

15
FLower/.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

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

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

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

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

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1 @@
/build

@ -0,0 +1,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.Flower;
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.Flower">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="com.example.Flower.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="com.example.Flower.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="com.example.Flower.ui.activity.LoginActivity"/>
<activity android:name="com.example.Flower.ui.activity.RegisterActivity"/>
<activity android:name="com.example.Flower.ui.activity.MainActivity"/>
<activity android:name="com.example.Flower.ui.activity.FruitDetailActivity"/>
<activity android:name="com.example.Flower.ui.activity.PersonActivity"/>
<activity android:name="com.example.Flower.ui.activity.PasswordActivity"/>
<activity android:name="com.example.Flower.ui.activity.BrowseActivity"/>
<activity android:name="com.example.Flower.ui.activity.AddFruitActivity"/>
<activity android:name="com.example.Flower.ui.activity.UserDetailActivity"/>
</application>
</manifest>

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

@ -0,0 +1,25 @@
package com.example.Flower;
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.Flower.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.Flower.R;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Fruit;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Fruit;
import com.example.Flower.bean.Orders;
import com.example.Flower.bean.User;
import com.example.Flower.ui.activity.FruitDetailActivity;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Browse;
import com.example.Flower.bean.User;
import com.example.Flower.ui.activity.UserDetailActivity;
import com.example.Flower.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.Flower.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.Flower.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.Flower.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.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Fruit;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.adapter.BrowseAdapter;
import com.example.Flower.bean.Browse;
import com.example.Flower.bean.Fruit;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Browse;
import com.example.Flower.bean.Fruit;
import com.example.Flower.bean.Orders;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.User;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.MyApplication;
import com.example.Flower.R;
import com.example.Flower.ui.fragment.FruitFragment;
import com.example.Flower.ui.fragment.OrderFragment;
import com.example.Flower.ui.fragment.UserFragment;
import com.example.Flower.ui.fragment.UserManageFragment;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.Fruit;
import com.example.Flower.bean.User;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.User;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.User;
import com.example.Flower.util.SPUtils;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.User;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.bean.User;
import com.example.Flower.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.Flower.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.Flower.MyApplication;
import com.example.Flower.R;
import com.example.Flower.adapter.FruitAdapter;
import com.example.Flower.bean.Fruit;
import com.example.Flower.ui.activity.AddFruitActivity;
import com.example.Flower.ui.activity.FruitDetailActivity;
import com.example.Flower.ui.activity.LoginActivity;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.adapter.OrderAdapter;
import com.example.Flower.bean.Orders;
import com.example.Flower.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.Flower.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.Flower.MyApplication;
import com.example.Flower.R;
import com.example.Flower.ui.activity.BrowseActivity;
import com.example.Flower.ui.activity.LoginActivity;
import com.example.Flower.ui.activity.PasswordActivity;
import com.example.Flower.ui.activity.PersonActivity;
import com.example.Flower.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.Flower.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.Flower.R;
import com.example.Flower.adapter.UserAdapter;
import com.example.Flower.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.Flower.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.Flower.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.Flower.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.Flower.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.Flower.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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

@ -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/red" />
<!--渐变色-->
<gradient
android:angle="0"
android:startColor="@color/red"
android:endColor="@color/red"/>
<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

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 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,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/pink" />
<stroke android:width="1dip" android:color="#fefefe" />
<corners android:radius="20dp"/>
<padding android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>

@ -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.Flower.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,168 @@
<?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.Flower.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: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: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: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: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.Flower.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,123 @@
<?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="@drawable/bg2">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.Flower.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="@drawable/sharp"
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="@drawable/sharp"
android:textSize="14dp"
android:singleLine="true"
android:hint="请输入密码"/>
</LinearLayout>
<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="登 录"/>
<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>
</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.Flower.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/colorBlack"
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/logo1"/>
</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,112 @@
<?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="@drawable/bg2">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.Flower.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: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="@drawable/sharp"
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="@drawable/sharp"
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:textSize="14dp"
android:singleLine="true"
android:background="@drawable/sharp"
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,110 @@
<?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"
android:background="@drawable/bg2">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.Flower.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="@drawable/bg2">
<!--标题栏-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border_bottom">
<com.example.Flower.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="@drawable/sharp"
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="@drawable/sharp"
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="@drawable/sharp"
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="@drawable/sharp"
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="@drawable/sharp"
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="@drawable/sharp"
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,124 @@
<?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.Flower.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

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

Loading…
Cancel
Save