完善访客模块接口

0515
panqihua 5 years ago
parent e235e1d91d
commit 9dc4962ef6
  1. 4
      app/src/main/java/com/community/pocket/data/adapter/VisitorAdpter.java
  2. 3
      app/src/main/java/com/community/pocket/data/main/garbage/GarbageSortingRequest.java
  3. 5
      app/src/main/java/com/community/pocket/data/main/garbage/GarbageWasteRequest.java
  4. 10
      app/src/main/java/com/community/pocket/data/main/visitor/VisitorMyRequest.java
  5. 9
      app/src/main/java/com/community/pocket/data/main/visitor/VisitorRequest.java
  6. 10
      app/src/main/java/com/community/pocket/data/main/visitor/VisitorReservationRequest.java
  7. 22
      app/src/main/java/com/community/pocket/data/model/MyVisitor.java
  8. 13
      app/src/main/java/com/community/pocket/data/model/Visitor.java
  9. 10
      app/src/main/java/com/community/pocket/data/model/VisitorPeople.java
  10. 23
      app/src/main/java/com/community/pocket/data/model/VisitorReservation.java
  11. 4
      app/src/main/java/com/community/pocket/ui/BaseFragment.java
  12. 4
      app/src/main/java/com/community/pocket/ui/login/LoginResponse.java
  13. 4
      app/src/main/java/com/community/pocket/ui/main/ui/forum/data/ForumDataResponse.java
  14. 4
      app/src/main/java/com/community/pocket/ui/main/ui/forum/hot/ForumHotResponse.java
  15. 6
      app/src/main/java/com/community/pocket/ui/main/ui/forum/main/ForumNoticeResponse.java
  16. 6
      app/src/main/java/com/community/pocket/ui/main/ui/forum/my/ForumMyResponse.java
  17. 6
      app/src/main/java/com/community/pocket/ui/main/ui/forum/news/ForumNewResponse.java
  18. 4
      app/src/main/java/com/community/pocket/ui/main/ui/forum/post/ForumPostResponse.java
  19. 4
      app/src/main/java/com/community/pocket/ui/main/ui/forum/post/QueryUserResponse.java
  20. 9
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingFragment.java
  21. 33
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingResponse.java
  22. 28
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/waste/GarbageWasteFragment.java
  23. 59
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/waste/GarbageWasteResponse.java
  24. 6
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoResponse.java
  25. 75
      app/src/main/java/com/community/pocket/ui/main/ui/share/Response.java
  26. 27
      app/src/main/java/com/community/pocket/ui/main/ui/share/ToastResponse.java
  27. 10
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java
  28. 2
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyVisitor.java
  29. 45
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorAppointmentFragment.java
  30. 10
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorFormState.java
  31. 4
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorPeopleResponse.java
  32. 7
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorResponse.java
  33. 14
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorViewModel.java
  34. 9
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/my/VisitorMyFragment.java
  35. 37
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/my/VisitorMyResponse.java
  36. 9
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/reservation/VisitorReservationFragment.java
  37. 40
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/reservation/VisitorReservationResponse.java
  38. 4
      app/src/main/java/com/community/pocket/ui/register/RegisterResponse.java
  39. 4
      app/src/main/java/com/community/pocket/ui/resetpwd/ResetPwdResponse.java
  40. 23
      app/src/main/java/com/community/pocket/util/SimpleHttpParse.java
  41. 2
      app/src/main/res/layout/main/layout/forum/layout/forum.xml
  42. 29
      app/src/main/res/layout/main/layout/visitor/layout/visitor.xml
  43. 181
      app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml
  44. 78
      app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml
  45. 2
      app/src/main/res/values-en-rUS/strings.xml
  46. 2
      app/src/main/res/values-zh-rCN/strings.xml
  47. 2
      app/src/main/res/values/strings.xml

@ -31,8 +31,8 @@ public class VisitorAdpter extends ArrayAdapter<String> {
this.dataList = dataList;
for (VisitorPeople people : this.dataList) {
this.list.add(people.getName());
this.map.put(people.getName(), people);
this.list.add(people.getUsername());
this.map.put(people.getUsername(), people);
}
addAll(this.list);

@ -3,7 +3,6 @@ package com.community.pocket.data.main.garbage;
import androidx.lifecycle.MutableLiveData;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.garbage.sorting.GarbageSortingResponse;
import com.community.pocket.util.HttpRequest;
import com.community.pocket.util.HttpUtil;
@ -31,7 +30,7 @@ public class GarbageSortingRequest {
@HttpRequest("/garbage/sorting")
public void search(MutableLiveData<GarbageSortingResponse> liveData, String name) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<GarbageSortingResponse>(liveData, R.string.garbage_search_ok, null).getInterface(GarbageSortingResponse.class),
new SimpleHttpParse<GarbageSortingResponse>(liveData).getInterface(GarbageSortingResponse.class),
new FormBody.Builder().add("name", name).build());
}
}

@ -2,7 +2,6 @@ package com.community.pocket.data.main.garbage;
import androidx.lifecycle.MutableLiveData;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.garbage.waste.GarbageWasteResponse;
import com.community.pocket.util.HttpRequest;
import com.community.pocket.util.HttpUtil;
@ -30,14 +29,14 @@ public class GarbageWasteRequest {
@HttpRequest("/garbage/waste")
public void searchDefault(MutableLiveData<GarbageWasteResponse> liveData) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<GarbageWasteResponse>(liveData, R.string.garbage_waste_search_ok, R.string.garbage_waste_search_ok).getInterface(GarbageWasteResponse.class));
new SimpleHttpParse<GarbageWasteResponse>(liveData).getInterface(GarbageWasteResponse.class));
}
//检索废品
@HttpRequest("/garbage/waste/query")
public void search(MutableLiveData<GarbageWasteResponse> liveData, String name) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<GarbageWasteResponse>(liveData, R.string.garbage_waste_search_ok, R.string.garbage_waste_search_ok).getInterface(GarbageWasteResponse.class),
new SimpleHttpParse<GarbageWasteResponse>(liveData).getInterface(GarbageWasteResponse.class),
new FormBody.Builder().add("name", name).build());
}

@ -2,12 +2,14 @@ package com.community.pocket.data.main.visitor;
import androidx.lifecycle.MutableLiveData;
import com.community.pocket.R;
import com.community.pocket.data.model.LocalToken;
import com.community.pocket.ui.main.ui.visitor.my.VisitorMyResponse;
import com.community.pocket.util.HttpRequest;
import com.community.pocket.util.HttpUtil;
import com.community.pocket.util.SimpleHttpParse;
import okhttp3.FormBody;
/**
* 我的访客请求接口
*/
@ -30,6 +32,10 @@ public class VisitorMyRequest {
@HttpRequest("/visitor/my")
public void loadMy(MutableLiveData<VisitorMyResponse> liveData) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<VisitorMyResponse>(liveData, R.string.load_visitor_my_ok, R.string.load_visitor_my_fail).getInterface(VisitorMyResponse.class));
new SimpleHttpParse<VisitorMyResponse>(liveData).getInterface(VisitorMyResponse.class),
new FormBody.Builder()
.add("username", LocalToken.getUsername())
.add("token", LocalToken.getToken())
.build());
}
}

@ -30,14 +30,16 @@ public class VisitorRequest {
//访客预约
@HttpRequest("/visitor/visitor")
public void appointment(MutableLiveData<VisitorResponse> liveData, String appointment, String chooseTime, String notes) {
public void appointment(MutableLiveData<VisitorResponse> liveData, String appointment, String chooseDate, String chooseTime, String notes) {
HttpUtil.getRequest(HttpUtil.Method.POST,
new SimpleHttpParse<VisitorResponse>(liveData).getInterface(VisitorResponse.class),
new FormBody.Builder()
.add("appointment", appointment)
.add("chooseDate", chooseDate)
.add("chooseTime", chooseTime)
.add("notes", notes)
.add("token", LocalToken.getToken())
.add("username", LocalToken.getUsername())
.build());
}
@ -46,7 +48,10 @@ public class VisitorRequest {
public void searchPeople(MutableLiveData<VisitorPeopleResponse> liveData, String name) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<VisitorPeopleResponse>(liveData).getInterface(VisitorPeopleResponse.class),
new FormBody.Builder().add("name", name).build());
new FormBody.Builder()
.add("name", name)
.add("username", LocalToken.getUsername())
.build());
}

@ -2,12 +2,14 @@ package com.community.pocket.data.main.visitor;
import androidx.lifecycle.MutableLiveData;
import com.community.pocket.R;
import com.community.pocket.data.model.LocalToken;
import com.community.pocket.ui.main.ui.visitor.reservation.VisitorReservationResponse;
import com.community.pocket.util.HttpRequest;
import com.community.pocket.util.HttpUtil;
import com.community.pocket.util.SimpleHttpParse;
import okhttp3.FormBody;
/**
* 我的预约请求接口
*/
@ -30,7 +32,11 @@ public class VisitorReservationRequest {
@HttpRequest("/visitor/reservation")
public void loadReservation(MutableLiveData<VisitorReservationResponse> liveData) {
HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<VisitorReservationResponse>(liveData, R.string.load_visitor_my_ok, R.string.load_visitor_my_fail).getInterface(VisitorReservationResponse.class));
new SimpleHttpParse<VisitorReservationResponse>(liveData).getInterface(VisitorReservationResponse.class),
new FormBody.Builder()
.add("username", LocalToken.getUsername())
.add("token", LocalToken.getToken())
.build());
}
}

@ -0,0 +1,22 @@
package com.community.pocket.data.model;
/**
* 我的访客
*/
public class MyVisitor extends Visitor {
//访客人
private String username;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String getName() {
return username;
}
}

@ -3,15 +3,10 @@ package com.community.pocket.data.model;
/**
* 访客信息
*/
public class Visitor {
private String name;
public abstract class Visitor {
private long time;
private String notes;
public void setName(String name) {
this.name = name;
}
public void setTime(long time) {
this.time = time;
}
@ -20,10 +15,6 @@ public class Visitor {
this.notes = notes;
}
public String getName() {
return name;
}
public long getTime() {
return time;
}
@ -31,4 +22,6 @@ public class Visitor {
public String getNotes() {
return notes;
}
public abstract String getName();
}

@ -6,15 +6,15 @@ import java.util.List;
* 检索预约人
*/
public class VisitorPeople {
private String name;
private String username;
private List<String> time;
public String getName() {
return name;
public String getUsername() {
return username;
}
public void setName(String name) {
this.name = name;
public void setUsername(String username) {
this.username = username;
}
public List<String> getTime() {

@ -0,0 +1,23 @@
package com.community.pocket.data.model;
/**
* 我的预约
*/
public class VisitorReservation extends Visitor {
//预约对象
private String appointment;
public String getAppointment() {
return appointment;
}
public void setAppointment(String appointment) {
this.appointment = appointment;
}
@Override
public String getName() {
return appointment;
}
}

@ -10,7 +10,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.xutils.x;
@ -31,7 +31,7 @@ public abstract class BaseFragment extends Fragment {
}
//校验token失败跳转到登陆页
protected <E extends CustomMessage, T extends ToastResponse<E>> boolean invalidToken(T t) {
protected <E extends CustomMessage, T extends Response<E>> boolean invalidToken(T t) {
return t.getMessage() != null && t.getMessage().getMsg() == R.string.invalid_token;
}

@ -4,7 +4,7 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.Token;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
/**
* 登陆响应结果
*/
public class LoginResponse extends ToastResponse<LoginResponse.Msg> {
public class LoginResponse extends Response<LoginResponse.Msg> {
private Token token;
public Token getToken() {

@ -4,7 +4,7 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.ForumContent;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -15,7 +15,7 @@ import java.util.List;
* 帖子详情数据管理
*
*/
public class ForumDataResponse extends ToastResponse<ForumDataResponse.Msg> {
public class ForumDataResponse extends Response<ForumDataResponse.Msg> {
private List<ForumContent> forumContentList;
List<ForumContent> getForumContentList() {

@ -2,7 +2,7 @@ package com.community.pocket.ui.main.ui.forum.hot;
import com.community.pocket.R;
import com.community.pocket.data.model.Hot;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
/**
* 热榜信息响应体
*/
public class ForumHotResponse extends ToastResponse<ForumHotResponse.Msg> {
public class ForumHotResponse extends Response<ForumHotResponse.Msg> {
private Hot hot;
public Hot getHot() {

@ -4,7 +4,7 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.Notice;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -14,7 +14,7 @@ import java.util.List;
/**
* 公告信息响应体
*/
public class ForumNoticeResponse extends ToastResponse<ForumNoticeResponse.Msg> {
public class ForumNoticeResponse extends Response<ForumNoticeResponse.Msg> {
private List<Notice> noticeList;
@ -35,7 +35,7 @@ public class ForumNoticeResponse extends ToastResponse<ForumNoticeResponse.Msg>
}
}
public List<Notice> getNoticeList() {
List<Notice> getNoticeList() {
return noticeList;
}

@ -4,17 +4,17 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.Forum;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class ForumMyResponse extends ToastResponse<ForumMyResponse.Msg> {
public class ForumMyResponse extends Response<ForumMyResponse.Msg> {
private List<Forum> forumList;
public List<Forum> getForumList() {
List<Forum> getForumList() {
return forumList;
}

@ -4,7 +4,7 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.Forum;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -14,7 +14,7 @@ import java.util.List;
/**
* 最新帖子响应实体
*/
public class ForumNewResponse extends ToastResponse<ForumNewResponse.Msg> {
public class ForumNewResponse extends Response<ForumNewResponse.Msg> {
private List<Forum> forumList;
enum Msg implements CustomMessage {
@ -35,7 +35,7 @@ public class ForumNewResponse extends ToastResponse<ForumNewResponse.Msg> {
}
}
public List<Forum> getForumList() {
List<Forum> getForumList() {
return forumList;
}

@ -3,7 +3,7 @@ package com.community.pocket.ui.main.ui.forum.post;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/**
* 发帖请求结果
*/
public class ForumPostResponse extends ToastResponse<ForumPostResponse.Msg> {
public class ForumPostResponse extends Response<ForumPostResponse.Msg> {
enum Msg implements CustomMessage {

@ -3,7 +3,7 @@ package com.community.pocket.ui.main.ui.forum.post;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -13,7 +13,7 @@ import java.util.List;
/**
* 查询用户结果
*/
public class QueryUserResponse extends ToastResponse<QueryUserResponse.Msg> {
public class QueryUserResponse extends Response<QueryUserResponse.Msg> {
private List<String> peopleList;

@ -18,6 +18,7 @@ import com.community.pocket.data.model.GarbageSorting;
import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.listener.MyTextChange;
import com.community.pocket.ui.main.ui.share.MyAutoCompleteTextView;
import com.community.pocket.ui.main.ui.share.Response;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
@ -62,12 +63,10 @@ public class GarbageSortingFragment extends BaseFragment {
return;
}
if (garbageSortingResponse.getSuccess() != null) {
initSearch(garbageSortingResponse.getBody());
}
garbageSortingResponse.toast(getContext());
if (garbageSortingResponse.getError() != null) {
garbageSortingResponse.fail(getContext());
if (garbageSortingResponse.getResult() == Response.Result.OK) {
initSearch(garbageSortingResponse.getGarbageSortings());
}
}
});

@ -1,9 +1,40 @@
package com.community.pocket.ui.main.ui.garbage.sorting;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.GarbageSorting;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class GarbageSortingResponse extends Response<List<GarbageSorting>> {
public class GarbageSortingResponse extends Response<GarbageSortingResponse.Msg> {
private List<GarbageSorting> garbageSortings;
List<GarbageSorting> getGarbageSortings() {
return garbageSortings;
}
public void setGarbageSortings(List<GarbageSorting> garbageSortings) {
this.garbageSortings = garbageSortings;
}
enum Msg implements CustomMessage {
ok(R.string.garbage_search_ok);
private Integer msg;
Msg(@StringRes Integer msg) {
this.msg = msg;
}
@NotNull
@Override
public Integer getMsg() {
return msg;
}
}
}

@ -16,7 +16,6 @@ import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R;
import com.community.pocket.data.adapter.GarbageWasteAdpter;
import com.community.pocket.data.model.GarbageWaste;
import com.community.pocket.data.model.GarbageWasteManage;
import com.community.pocket.data.model.GarbageWastePrice;
import com.community.pocket.ui.BaseFragment;
@ -68,12 +67,10 @@ public class GarbageWasteFragment extends BaseFragment {
return;
}
if (garbageWasteResponse.getSuccess() != null) {
initDefault(garbageWasteResponse.getBody());
}
garbageWasteResponse.toast(getContext());
if (garbageWasteResponse.getError() != null) {
garbageWasteResponse.fail(getContext());
if (garbageWasteResponse.getResult() == Response.Result.OK) {
initDefault(garbageWasteResponse.getDefaultList(), garbageWasteResponse.getGarbageWasteManage());
}
}
});
@ -86,11 +83,10 @@ public class GarbageWasteFragment extends BaseFragment {
return;
}
garbageWasteResponse.toast(getContext());
if (garbageWasteResponse.getResult() == Response.Result.OK) {
initSearch(garbageWasteResponse.getBody());
} else {
garbageWasteResponse.fail(getContext());
initSearch(garbageWasteResponse.getSearchList());
}
}
});
@ -117,17 +113,16 @@ public class GarbageWasteFragment extends BaseFragment {
/**
* 检索默认废品信息
*
* @param waste 废品信息
*/
private void initDefault(GarbageWaste waste) {
GarbageWasteManage manage = waste.getGarbageWasteManage();
private void initDefault(List<GarbageWastePrice> priceList, GarbageWasteManage manage) {
name.setText(getString(R.string.garbage_waste_name, manage.getName()));
mobie.setText(getString(R.string.garbage_waste_mobie, manage.getMobie()));
layout.removeAllViews();
addHead();
List<GarbageWastePrice> priceList = waste.getDefaultList();
for (GarbageWastePrice price : priceList) {
addItem(price);
}
@ -166,16 +161,15 @@ public class GarbageWasteFragment extends BaseFragment {
/**
* 检索废品回收信息
*
* @param waste 废品信息
*/
private void initSearch(GarbageWaste waste) {
private void initSearch(List<GarbageWastePrice> searchList) {
// 设置适配器
if (garbageWasteAdpter == null) {
garbageWasteAdpter = new GarbageWasteAdpter(waste.getSearchList(), getContext());
garbageWasteAdpter = new GarbageWasteAdpter(searchList, getContext());
// 将适配器与当前AutoCompleteTextView控件绑定
searchPrice.setAdapter(garbageWasteAdpter);
} else {
garbageWasteAdpter.addAll(waste.getSearchList());
garbageWasteAdpter.addAll(searchList);
}
myAutoCompleteTextView.refreshDropList();
}

@ -1,7 +1,62 @@
package com.community.pocket.ui.main.ui.garbage.waste;
import com.community.pocket.data.model.GarbageWaste;
import com.community.pocket.data.model.GarbageWasteManage;
import com.community.pocket.data.model.GarbageWastePrice;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
public class GarbageWasteResponse extends Response<GarbageWaste> {
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class GarbageWasteResponse extends Response<GarbageWasteResponse.Msg> {
enum Msg implements CustomMessage {
;
private Integer msg;
Msg(Integer msg) {
this.msg = msg;
}
@NotNull
@Override
public Integer getMsg() {
return msg;
}
}
//默认价格信息
private List<GarbageWastePrice> defaultList;
//检索价格信息
private List<GarbageWastePrice> searchList;
//管理员信息
private GarbageWasteManage garbageWasteManage;
List<GarbageWastePrice> getDefaultList() {
return defaultList;
}
public void setDefaultList(List<GarbageWastePrice> defaultList) {
this.defaultList = defaultList;
}
List<GarbageWastePrice> getSearchList() {
return searchList;
}
public void setSearchList(List<GarbageWastePrice> searchList) {
this.searchList = searchList;
}
GarbageWasteManage getGarbageWasteManage() {
return garbageWasteManage;
}
public void setGarbageWasteManage(GarbageWasteManage garbageWasteManage) {
this.garbageWasteManage = garbageWasteManage;
}
}

@ -4,7 +4,7 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.MyInfo;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -14,11 +14,11 @@ import org.jetbrains.annotations.NotNull;
* 个人信息响应结果
*
*/
public class InfoResponse extends ToastResponse<InfoResponse.Msg> {
public class InfoResponse extends Response<InfoResponse.Msg> {
private MyInfo myInfo;
public MyInfo getMyInfo() {
MyInfo getMyInfo() {
return myInfo;
}

@ -3,36 +3,22 @@ package com.community.pocket.ui.main.ui.share;
import android.content.Context;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.util.CustomMessage;
/**
* 响应体父类
*
* @param <T>
*/
public abstract class Response<T> {
//成功描述
@Nullable
@Deprecated
private Integer success;
//失败描述
@Nullable
@Deprecated
private Integer error;
public abstract class Response<T extends CustomMessage> {
//描述参数
private Object[] args;
@Deprecated
// TODO 废弃
//响应体
private T body;
//响应信息
private T message;
//操作结果
private Result result;
public T getMessage() {
@ -51,45 +37,7 @@ public abstract class Response<T> {
this.result = result;
}
@Nullable
@Deprecated
// TODO 废弃
public Integer getSuccess() {
return success;
}
@Deprecated
// TODO 废弃
public void setSuccess(@Nullable @StringRes Integer success) {
this.success = success;
}
@Nullable
@Deprecated
// TODO 废弃
public Integer getError() {
return error;
}
@Deprecated
// TODO 废弃
public void setError(@Nullable @StringRes Integer error) {
this.error = error;
}
@Deprecated
// TODO 废弃
public T getBody() {
return body;
}
@Deprecated
// TODO 废弃
public void setBody(T body) {
this.body = body;
}
Object[] getArgs() {
private Object[] getArgs() {
return args;
}
@ -97,21 +45,14 @@ public abstract class Response<T> {
this.args = args;
}
public void ok(Context context) {
if (success != null) {
Toast.makeText(context, context.getString(success, args), Toast.LENGTH_SHORT).show();
}
}
public void fail(Context context) {
if (error != null) {
Toast.makeText(context, context.getString(error, args), Toast.LENGTH_LONG).show();
public void toast(Context context) {
if (getMessage() != null) {
Toast.makeText(context, context.getString(getMessage().getMsg(), getArgs()), getResult() == Result.OK ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
} else {
Toast.makeText(context, context.getString(R.string.unknow_error), Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.unknow_error, Toast.LENGTH_LONG).show();
}
}
public enum Result {
OK,
FAIL

@ -1,27 +0,0 @@
package com.community.pocket.ui.main.ui.share;
import android.content.Context;
import android.widget.Toast;
import com.community.pocket.R;
import com.community.pocket.util.CustomMessage;
/**
* 弹窗响应
*
* @param <T>
*/
@Deprecated
// TODO 废弃
public abstract class ToastResponse<T extends CustomMessage> extends Response<T> {
@Deprecated
// TODO 废弃
public void toast(Context context) {
if (getMessage() != null) {
Toast.makeText(context, context.getString(getMessage().getMsg(), getArgs()), getResult() == Result.OK ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
} else {
Toast.makeText(context, R.string.unknow_error, Toast.LENGTH_LONG).show();
}
}
}

@ -23,7 +23,7 @@ import org.xutils.view.annotation.ViewInject;
public class VisitorFragment extends MainFragment {
//访客预约按钮
@ViewInject(R.id.visitor_visitor)
@ViewInject(R.id.visitor_reservation)
private Button myBtn;
@Override
@ -34,7 +34,7 @@ public class VisitorFragment extends MainFragment {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onClick(View v) {
my(v);
reservation(v);
}
});
}
@ -48,16 +48,16 @@ public class VisitorFragment extends MainFragment {
}
//跳转到我的预约界面
@Event(value = R.id.visitor_reservation)
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void reservation(View view) {
public void reservation(View view) {
ctrl().navigate(R.id.visitorReservationFragment);
changeColor(view);
}
//跳转到我的访客界面
@Event(value = R.id.visitor_visitor)
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void my(View view) {
private void my(View view) {
ctrl().navigate(R.id.visitorMyFragment);
changeColor(view);
}

@ -52,7 +52,7 @@ public abstract class VisitorMyVisitor extends BaseFragment {
/**
* 初始化数据
*/
protected void loadData(List<Visitor> visitors) {
protected <T extends Visitor> void loadData(List<T> visitors) {
for (final Visitor visitor : visitors) {
createTextView(visitor.getName());
createTextView(DateFormat.format(getString(R.string.dateformat), visitor.getTime()));

@ -3,12 +3,15 @@ package com.community.pocket.ui.main.ui.visitor.appointment;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -44,6 +47,15 @@ public class VisitorAppointmentFragment extends BaseFragment {
@ViewInject(R.id.appointment)
private AutoCompleteTextView appointment;
@ViewInject(R.id.chooseDate)
private EditText chooseDate;
//日期格式提示
@ViewInject(R.id.tip)
private TextView tip;
private String today;
//预约时间
@ViewInject(R.id.choose_time)
private Spinner chooseTime;
@ -73,6 +85,7 @@ public class VisitorAppointmentFragment extends BaseFragment {
ShowWordCount showWordCount = new ShowWordCount(new int[]{R.id.show_word_top, R.id.show_word_bottom}, R.id.notes, view);
showWordCount.showCount();
appointmentViewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(VisitorViewModel.class);
myAutoCompleteTextView = new MyAutoCompleteTextView(appointment, appointmentViewModel);
@ -89,6 +102,14 @@ public class VisitorAppointmentFragment extends BaseFragment {
appointment.setError(getString(visitorFormState.getAppointmentError(), PropertiesUtil.getIntValue("username.length")));
}
if (visitorFormState.getDateError() != null) {
if (visitorFormState.getDateError() == R.string.visitor_invalid_date) {
chooseDate.setError(getString(visitorFormState.getDateError(), today));
} else {
chooseDate.setError(getString(visitorFormState.getDateError()));
}
}
if (visitorFormState.getNotesError() != null) {
notes.setError(getString(visitorFormState.getNotesError()));
}
@ -108,7 +129,7 @@ public class VisitorAppointmentFragment extends BaseFragment {
if (visitorResponse.getResult() == Response.Result.OK) {
VisitorFragment visitorFragment = getParentFragment(2);
Button button = Objects.requireNonNull(visitorFragment.getView()).findViewById(R.id.visitor_reservation);
visitorFragment.my(button);
visitorFragment.reservation(button);
}
}
});
@ -141,7 +162,7 @@ public class VisitorAppointmentFragment extends BaseFragment {
return;
}
if (visitorAdpter != null && visitorAdpter.containsKey(s.toString())) {
appointmentViewModel.appointmentDataChanged(appointment.getText(), notes.getText());
appointmentViewModel.appointmentDataChanged(appointment.getText(), chooseDate.getText(), today, notes.getText());
initTime(s);
return;
}
@ -151,13 +172,18 @@ public class VisitorAppointmentFragment extends BaseFragment {
}
});
notes.addTextChangedListener(new MyTextChange() {
TextWatcher textWatcher = new MyTextChange() {
@Override
public void afterTextChanged(Editable s) {
appointmentViewModel.appointmentDataChanged(appointment.getText(), notes.getText());
appointmentViewModel.appointmentDataChanged(appointment.getText(), chooseDate.getText(), today, notes.getText());
}
});
};
chooseDate.addTextChangedListener(textWatcher);
notes.addTextChangedListener(textWatcher);
initTip();
}
@ -193,7 +219,14 @@ public class VisitorAppointmentFragment extends BaseFragment {
*/
@Event(value = R.id.submit)
private void submit(View view) {
appointmentViewModel.appointment(appointment.getText().toString(), chooseTime.getSelectedItem().toString(), notes.getText().toString());
appointmentViewModel.appointment(appointment.getText().toString(), chooseDate.getText().toString(), chooseTime.getSelectedItem().toString(), notes.getText().toString());
}
//初始化日期提示
private void initTip() {
String format = PropertiesUtil.getValue("date.pattern");
today = DateFormat.format(format, System.currentTimeMillis()).toString();
tip.setText(getString(R.string.dateformat_tip, format, today));
}
}

@ -9,12 +9,15 @@ class VisitorFormState {
@Nullable
private Integer appointmentError;
@Nullable
private Integer dateError;
@Nullable
private Integer notesError;
private boolean isDataValid;
VisitorFormState(@Nullable Integer appointmentError, @Nullable Integer notesError) {
VisitorFormState(@Nullable Integer appointmentError, @Nullable Integer dateError, @Nullable Integer notesError) {
this.appointmentError = appointmentError;
this.dateError = dateError;
this.notesError = notesError;
}
@ -22,6 +25,11 @@ class VisitorFormState {
this.isDataValid = isDataValid;
}
@Nullable
Integer getDateError() {
return dateError;
}
@Nullable
Integer getAppointmentError() {
return appointmentError;

@ -4,14 +4,14 @@ import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.VisitorPeople;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class VisitorPeopleResponse extends ToastResponse<VisitorPeopleResponse.Msg> {
public class VisitorPeopleResponse extends Response<VisitorPeopleResponse.Msg> {
private List<VisitorPeople> visitorPeopleList;

@ -1,7 +1,7 @@
package com.community.pocket.ui.main.ui.visitor.appointment;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -9,11 +9,12 @@ import org.jetbrains.annotations.NotNull;
/**
* 访客接口请求结果
*/
public class VisitorResponse extends ToastResponse<VisitorResponse.Msg> {
public class VisitorResponse extends Response<VisitorResponse.Msg> {
enum Msg implements CustomMessage {
ok(R.string.visitor_appointment_ok),
fail(R.string.visitor_appointment_fail);
fail(R.string.visitor_appointment_fail),
token(R.string.invalid_token);
private Integer msg;

@ -38,8 +38,8 @@ public class VisitorViewModel extends BaseViewModel<VisitorRequest> implements S
}
//访客预约
void appointment(String appointment, String chooseTime, String notes) {
getRequest().appointment(visitorResponse, appointment, chooseTime, notes);
void appointment(String appointment, String chooseDate, String chooseTime, String notes) {
getRequest().appointment(visitorResponse, appointment, chooseDate, chooseTime, notes);
}
//检索预约人
@ -48,11 +48,15 @@ public class VisitorViewModel extends BaseViewModel<VisitorRequest> implements S
}
//校验访客预约表单
void appointmentDataChanged(Editable appointment, Editable notes) {
void appointmentDataChanged(Editable appointment, Editable chooseDate, String today, Editable notes) {
if (!ValidUtil.usernamevalid(appointment.toString())) {
visitorFormState.setValue(new VisitorFormState(R.string.invalid_username, null));
visitorFormState.setValue(new VisitorFormState(R.string.invalid_username, null, null));
} else if (!ValidUtil.dateValid(chooseDate.toString())) {
visitorFormState.setValue(new VisitorFormState(null, R.string.invalid_date, null));
} else if (!ValidUtil.before(today, chooseDate.toString())) {
visitorFormState.setValue(new VisitorFormState(null, R.string.visitor_invalid_date, null));
} else if (!ValidUtil.notesValid(notes.toString())) {
visitorFormState.setValue(new VisitorFormState(null, R.string.invalid_notes));
visitorFormState.setValue(new VisitorFormState(null, null, R.string.invalid_notes));
} else {
visitorFormState.setValue(new VisitorFormState(true));
}

@ -10,6 +10,7 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.ui.main.ui.visitor.VisitorMyVisitor;
import org.xutils.view.annotation.ContentView;
@ -39,12 +40,10 @@ public class VisitorMyFragment extends VisitorMyVisitor {
return;
}
if (visitorMyResponse.getSuccess() != null) {
loadData(visitorMyResponse.getBody());
}
visitorMyResponse.toast(getContext());
if (visitorMyResponse.getError() != null) {
Toast.makeText(getContext(), visitorMyResponse.getError(), Toast.LENGTH_SHORT).show();
if (visitorMyResponse.getResult() == Response.Result.OK) {
loadData(visitorMyResponse.getVisitorList());
}
}
});

@ -1,9 +1,42 @@
package com.community.pocket.ui.main.ui.visitor.my;
import com.community.pocket.data.model.Visitor;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.MyVisitor;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class VisitorMyResponse extends Response<List<Visitor>> {
public class VisitorMyResponse extends Response<VisitorMyResponse.Msg> {
private List<MyVisitor> visitorList;
List<MyVisitor> getVisitorList() {
return visitorList;
}
public void setVisitorList(List<MyVisitor> visitorList) {
this.visitorList = visitorList;
}
enum Msg implements CustomMessage {
ok(R.string.load_visitor_my_ok),
fail(R.string.load_visitor_my_fail),
token(R.string.invalid_token);
private Integer msg;
Msg(@StringRes Integer msg) {
this.msg = msg;
}
@NotNull
@Override
public Integer getMsg() {
return msg;
}
}
}

@ -10,6 +10,7 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.ui.main.ui.visitor.VisitorMyVisitor;
import org.xutils.view.annotation.ContentView;
@ -39,12 +40,10 @@ public class VisitorReservationFragment extends VisitorMyVisitor {
return;
}
if (visitorReservationResponse.getSuccess() != null) {
loadData(visitorReservationResponse.getBody());
}
visitorReservationResponse.toast(getContext());
if (visitorReservationResponse.getError() != null) {
Toast.makeText(getContext(), visitorReservationResponse.getError(), Toast.LENGTH_SHORT).show();
if (visitorReservationResponse.getResult() == Response.Result.OK) {
loadData(visitorReservationResponse.getVisitorList());
}
}
});

@ -1,9 +1,45 @@
package com.community.pocket.ui.main.ui.visitor.reservation;
import com.community.pocket.data.model.Visitor;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.data.model.VisitorReservation;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class VisitorReservationResponse extends Response<List<Visitor>> {
/**
* 我的预约信息
*/
public class VisitorReservationResponse extends Response<VisitorReservationResponse.Msg> {
private List<VisitorReservation> visitorList;
List<VisitorReservation> getVisitorList() {
return visitorList;
}
public void setVisitorList(List<VisitorReservation> visitorList) {
this.visitorList = visitorList;
}
enum Msg implements CustomMessage {
ok(R.string.load_visitor_reservation_ok),
fail(R.string.load_visitor_reservation_fail),
token(R.string.invalid_token);
private Integer msg;
Msg(@StringRes Integer msg) {
this.msg = msg;
}
@NotNull
@Override
public Integer getMsg() {
return msg;
}
}
}

@ -3,7 +3,7 @@ package com.community.pocket.ui.register;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/**
* 注册结果
*/
public class RegisterResponse extends ToastResponse<RegisterResponse.Msg> {
public class RegisterResponse extends Response<RegisterResponse.Msg> {
/**
* 响应类型

@ -3,7 +3,7 @@ package com.community.pocket.ui.resetpwd;
import androidx.annotation.StringRes;
import com.community.pocket.R;
import com.community.pocket.ui.main.ui.share.ToastResponse;
import com.community.pocket.ui.main.ui.share.Response;
import com.community.pocket.util.CustomMessage;
import org.jetbrains.annotations.NotNull;
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/**
* 重置密码结果
*/
public class ResetPwdResponse extends ToastResponse<ResetPwdResponse.Msg> {
public class ResetPwdResponse extends Response<ResetPwdResponse.Msg> {
enum Msg implements CustomMessage {
step1_ok(R.string.resetpwd_step1_ok),

@ -1,6 +1,5 @@
package com.community.pocket.util;
import androidx.annotation.StringRes;
import androidx.lifecycle.MutableLiveData;
import org.jetbrains.annotations.NotNull;
@ -17,23 +16,6 @@ public class SimpleHttpParse<T extends com.community.pocket.ui.main.ui.share.Res
private MutableLiveData liveData;
//TODO 废弃
@Deprecated
private Integer success;
//TODO 废弃
@Deprecated
private Integer error;
//TODO 废弃
@Deprecated
public SimpleHttpParse(MutableLiveData liveData, @StringRes Integer success, @StringRes Integer error) {
this.liveData = liveData;
this.success = success;
this.error = error;
}
public SimpleHttpParse(MutableLiveData liveData) {
this.liveData = liveData;
}
@ -45,11 +27,6 @@ public class SimpleHttpParse<T extends com.community.pocket.ui.main.ui.share.Res
@Override
@SuppressWarnings("unchecked")
public void onParseOk(@NotNull Call call, @NotNull Response response, T t) {
if (t.getResult() == com.community.pocket.ui.main.ui.share.Response.Result.OK) {
t.setSuccess(success);
} else {
t.setError(error);
}
liveData.postValue(t);
}
}

@ -20,7 +20,7 @@
android:fillViewport="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titlebar"
tools:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:layout_width="match_parent"

@ -13,16 +13,29 @@
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintEnd_toEndOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_body"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorAccent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:fillViewport="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titlebar"
app:navGraph="@navigation/visitor_navigation" />
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
app:defaultNavHost="true"
app:navGraph="@navigation/visitor_navigation" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -6,89 +6,126 @@
android:layout_height="match_parent"
tools:context=".ui.main.ui.visitor.appointment.VisitorAppointmentFragment">
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<AutoCompleteTextView
android:id="@+id/appointment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:gravity="center"
android:hint="@string/prompt_appointment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/choose_time_layout"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appointment">
android:orientation="vertical">
<TextView
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/prompt_choose_time" />
android:layout_gravity="center_vertical">
<Spinner
android:id="@+id/choose_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<AutoCompleteTextView
android:id="@+id/appointment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:gravity="center"
android:hint="@string/prompt_appointment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
<TextView
android:id="@+id/tip"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appointment" />
<TextView
android:id="@+id/show_word_top"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/choose_time_layout" />
<EditText
android:id="@+id/chooseDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:gravity="center"
android:hint="@string/prompt_choose_date"
android:importantForAutofill="no"
android:inputType="date"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tip" />
<EditText
android:id="@+id/notes"
android:layout_width="0dp"
android:layout_height="@dimen/size_200"
android:background="@drawable/border"
android:ems="15"
android:gravity="start|top"
android:hint="@string/prompt_input_notes"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxLength="@integer/post_content"
android:maxLines="@integer/post_content_maxLines"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/show_word_top" />
<LinearLayout
android:id="@+id/choose_time_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chooseDate">
<TextView
android:id="@+id/show_word_bottom"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notes" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/prompt_choose_time" />
<Spinner
android:id="@+id/choose_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<TextView
android:id="@+id/show_word_top"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/choose_time_layout" />
<EditText
android:id="@+id/notes"
android:layout_width="0dp"
android:layout_height="@dimen/size_200"
android:background="@drawable/border"
android:ems="15"
android:gravity="start|top"
android:hint="@string/prompt_input_notes"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxLength="@integer/post_content"
android:maxLines="@integer/post_content_maxLines"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/show_word_top" />
<TextView
android:id="@+id/show_word_bottom"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notes" />
<Button
android:id="@+id/submit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="@string/submit_appointment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/show_word_bottom" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<Button
android:id="@+id/submit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/submit_appointment"
android:enabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/show_word_bottom" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -51,58 +51,54 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/query_layout" />
<androidx.core.widget.NestedScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/query">
<LinearLayout
<androidx.gridlayout.widget.GridLayout
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="match_parent"
app:columnCount="4">
<androidx.gridlayout.widget.GridLayout
android:id="@+id/table"
android:layout_width="match_parent"
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:columnCount="4">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
app:layout_columnWeight="1" />
android:gravity="center"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/notes"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/notes"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/action"
android:textSize="18sp"
app:layout_columnWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/action"
android:textSize="18sp"
app:layout_columnWeight="1" />
</androidx.gridlayout.widget.GridLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.gridlayout.widget.GridLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -170,4 +170,6 @@
<string name="invalid_token">token error,please login</string>
<string name="no_more_forum">no more forum</string>
<string name="modify_oldpwd_fail">modify error</string>
<string name="prompt_choose_date">please choose date</string>
<string name="visitor_invalid_date">date error</string>
</resources>

@ -170,4 +170,6 @@
<string name="invalid_token">身份有效期已过,请重新登录</string>
<string name="no_more_forum">没有更多帖子</string>
<string name="modify_oldpwd_fail">修改密码失败,原密码不正确</string>
<string name="prompt_choose_date">请选择预约日期</string>
<string name="visitor_invalid_date">上门日期不能是%1s以前</string>
</resources>

@ -171,6 +171,8 @@
<string name="invalid_token">token error,please login</string>
<string name="no_more_forum">no more forum</string>
<string name="modify_oldpwd_fail">modify error</string>
<string name="prompt_choose_date">please choose date</string>
<string name="visitor_invalid_date">date error</string>
<!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save