完善加载更多帖子逻辑

0515
panqihua 4 years ago
parent 6c43376443
commit 174661a375
  1. 2
      app/src/main/java/com/community/pocket/data/main/forum/ForumMyRequest.java
  2. 2
      app/src/main/java/com/community/pocket/data/main/forum/ForumNewRequest.java
  3. 13
      app/src/main/java/com/community/pocket/ui/BaseFragment.java
  4. 5
      app/src/main/java/com/community/pocket/ui/main/ui/forum/FormLoad.java
  5. 49
      app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumPost.java
  6. 39
      app/src/main/java/com/community/pocket/ui/main/ui/forum/main/ForumFragment.java
  7. 43
      app/src/main/java/com/community/pocket/ui/main/ui/forum/my/ForumMyFragment.java
  8. 2
      app/src/main/java/com/community/pocket/ui/main/ui/forum/my/ForumMyResponse.java
  9. 11
      app/src/main/java/com/community/pocket/ui/main/ui/forum/my/ForumMyViewModel.java
  10. 51
      app/src/main/java/com/community/pocket/ui/main/ui/forum/news/ForumNewFragment.java
  11. 2
      app/src/main/java/com/community/pocket/ui/main/ui/forum/news/ForumNewResponse.java
  12. 6
      app/src/main/java/com/community/pocket/ui/main/ui/forum/news/ForumNewViewModel.java
  13. 27
      app/src/main/java/com/community/pocket/ui/main/ui/forum/post/ForumPostContent.java
  14. 76
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/appointment/VisitorAppointmentFragment.java
  15. 1
      app/src/main/res/layout/main/layout/forum/layout/forum.xml
  16. 124
      app/src/main/res/layout/main/layout/forum/layout/forum_hot_fragment.xml
  17. 32
      app/src/main/res/layout/main/layout/forum/layout/forum_my_fragment.xml
  18. 32
      app/src/main/res/layout/main/layout/forum/layout/forum_new_fragment.xml
  19. 80
      app/src/main/res/layout/main/layout/forum/layout/forum_post_fragment.xml
  20. 263
      app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml
  21. 1
      app/src/main/res/values-en-rUS/strings.xml
  22. 1
      app/src/main/res/values-zh-rCN/strings.xml
  23. 1
      app/src/main/res/values/strings.xml

@ -31,7 +31,7 @@ public class ForumMyRequest {
* 加载我的帖子 * 加载我的帖子
*/ */
@HttpRequest("/forum/my") @HttpRequest("/forum/my")
public void loadForumMy(MutableLiveData<ForumMyResponse> liveData, int page, String title) { public void loadForumMy(MutableLiveData<ForumMyResponse> liveData, Long page, String title) {
HttpUtil.getRequest(HttpUtil.Method.GET, HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<ForumMyResponse>(liveData).getInterface(ForumMyResponse.class), new SimpleHttpParse<ForumMyResponse>(liveData).getInterface(ForumMyResponse.class),
new FormBody.Builder() new FormBody.Builder()

@ -28,7 +28,7 @@ public class ForumNewRequest {
} }
@HttpRequest("/forum/new") @HttpRequest("/forum/new")
public void loadForumNew(MutableLiveData<ForumNewResponse> liveData, int page, String title) { public void loadForumNew(MutableLiveData<ForumNewResponse> liveData, Long page, String title) {
HttpUtil.getRequest(HttpUtil.Method.GET, HttpUtil.getRequest(HttpUtil.Method.GET,
new SimpleHttpParse<ForumNewResponse>(liveData).getInterface(ForumNewResponse.class), new SimpleHttpParse<ForumNewResponse>(liveData).getInterface(ForumNewResponse.class),
new FormBody.Builder() new FormBody.Builder()

@ -27,8 +27,8 @@ public abstract class BaseFragment extends Fragment {
} }
//获取父级Fragment //获取父级Fragment
protected <T extends Fragment> T getParentFragment(int level) { protected <T extends Fragment> T getParentFragment(Class<T> tClass) {
return getParentFragment(level, null); return getParentFragment(tClass, null);
} }
//校验token失败跳转到登陆页 //校验token失败跳转到登陆页
@ -38,17 +38,18 @@ public abstract class BaseFragment extends Fragment {
//获取父级Fragment //获取父级Fragment
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private <T extends Fragment> T getParentFragment(int level, Fragment fragment) { private <T extends Fragment> T getParentFragment(Class<T> tClass, Fragment fragment) {
if (level-- > 0) {
if (fragment == null) { if (fragment == null) {
fragment = getParentFragment(); fragment = getParentFragment();
} else { } else {
fragment = fragment.getParentFragment(); fragment = fragment.getParentFragment();
} }
return getParentFragment(level, fragment); if (fragment != null) {
return fragment.getClass().isAssignableFrom(tClass) ? (T) fragment : getParentFragment(tClass, fragment);
} else { } else {
return (T) fragment; throw new RuntimeException("not fround parent Fragment for " + tClass);
} }
} }
//格式化日期 //格式化日期

@ -0,0 +1,5 @@
package com.community.pocket.ui.main.ui.forum;
public interface FormLoad {
void loadForumNew(Long page, String title);
}

@ -1,18 +1,23 @@
package com.community.pocket.ui.main.ui.forum; package com.community.pocket.ui.main.ui.forum;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.widget.SearchView;
import androidx.core.widget.NestedScrollView;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.data.model.Forum; import com.community.pocket.data.model.Forum;
import com.community.pocket.data.model.Page; import com.community.pocket.data.model.Page;
import com.community.pocket.ui.BaseFragment; import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.main.ui.forum.data.ForumDataActivity; import com.community.pocket.ui.main.ui.forum.data.ForumDataActivity;
import com.community.pocket.ui.main.ui.forum.main.ForumFragment;
import com.community.pocket.util.Param; import com.community.pocket.util.Param;
import org.xutils.view.annotation.ViewInject; import org.xutils.view.annotation.ViewInject;
@ -33,10 +38,9 @@ public abstract class ForumPost extends BaseFragment {
*/ */
protected void loadPost(Page<Forum> forumList) { protected void loadPost(Page<Forum> forumList) {
if (forumList.isEmpty()) { if (forumList.getCurrentPage() == 1) {
Toast.makeText(getContext(), R.string.no_more_forum, Toast.LENGTH_LONG).show(); layout.removeAllViews();
} else { }
layout.removeViews(1, layout.getChildCount() - 1);
for (int i = 0; i < forumList.getList().size(); i++) { for (int i = 0; i < forumList.getList().size(); i++) {
final Forum forum = forumList.getList().get(i); final Forum forum = forumList.getList().get(i);
@ -74,19 +78,36 @@ public abstract class ForumPost extends BaseFragment {
//打开帖子 //打开帖子
Button button = childView.findViewById(R.id.showAll); Button button = childView.findViewById(R.id.showAll);
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(v -> {
@Override Intent intent = new Intent(getContext(), ForumDataActivity.class);
public void onClick(View v) { intent.putExtra(Param.forumId.name(), forum.getId());
Intent intent = new Intent(getContext(), ForumDataActivity.class); startActivityForResult(intent, 1);
intent.putExtra(Param.forumId.name(), forum.getId());
startActivityForResult(intent, 1);
// startActivity(intent);
}
}); });
layout.addView(childView); layout.addView(childView);
} }
}
} }
protected abstract FormLoad getViewModel();
protected abstract Long getCurrentPage();
protected abstract SearchView searchView();
protected void load(Long page) {
getViewModel().loadForumNew(page, searchView().getQuery().toString());
}
//滚动加载更多帖子
@RequiresApi(api = Build.VERSION_CODES.M)
protected void loadMore() {
//滚动加载更多帖子
ForumFragment forumFragment = getParentFragment(ForumFragment.class);
forumFragment.getScrollView().setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
load(getCurrentPage() + 1);
}
});
}
} }

@ -3,6 +3,7 @@ package com.community.pocket.ui.main.ui.forum.main;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
@ -12,6 +13,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R; import com.community.pocket.R;
@ -26,6 +28,7 @@ import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject; import org.xutils.view.annotation.ViewInject;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* 论坛框架 * 论坛框架
@ -37,7 +40,7 @@ public class ForumFragment extends MainFragment {
private MyBanner banner; private MyBanner banner;
@ViewInject(R.id.scroll_body) @ViewInject(R.id.scroll_body)
private NestedScrollView nestedScrollView; private NestedScrollView scrollView;
@ViewInject(R.id.forum_new) @ViewInject(R.id.forum_new)
private Button newButton; private Button newButton;
@ -47,6 +50,9 @@ public class ForumFragment extends MainFragment {
@ViewInject(R.id.notice_next) @ViewInject(R.id.notice_next)
private ImageView noticeNext; private ImageView noticeNext;
//触发自动滚动
private MutableLiveData<Boolean> autoScroll = new MutableLiveData<>();
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
@ -69,6 +75,8 @@ public class ForumFragment extends MainFragment {
initNotice(forumNoticeResponse.getNoticeList()); initNotice(forumNoticeResponse.getNoticeList());
} }
}); });
resumeAutoScroll();
} }
//初始化公告箭头事件 //初始化公告箭头事件
@ -79,6 +87,10 @@ public class ForumFragment extends MainFragment {
initClickListener(noticeNext); initClickListener(noticeNext);
} }
public NestedScrollView getScrollView() {
return scrollView;
}
//箭头随焦点改变透明度 //箭头随焦点改变透明度
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void initFocusListener(ImageView imageView) { private void initFocusListener(ImageView imageView) {
@ -103,6 +115,24 @@ public class ForumFragment extends MainFragment {
} else { } else {
banner.setCurrentItem(banner.getCurrentItem() < banner.getItemCount() - 1 ? banner.getCurrentItem() + 1 : 0); banner.setCurrentItem(banner.getCurrentItem() < banner.getItemCount() - 1 ? banner.getCurrentItem() + 1 : 0);
} }
new Thread(() -> {
try {
TimeUnit.SECONDS.sleep(3);
autoScroll.postValue(true);
} catch (InterruptedException e) {
e.printStackTrace();
Log.e(ForumFragment.class.getName(), e.toString());
}
}).start();
});
}
//恢复自动滚动
private void resumeAutoScroll() {
this.autoScroll.observe(getViewLifecycleOwner(), aBoolean -> {
if (aBoolean) {
banner.start();
}
}); });
} }
@ -127,10 +157,11 @@ public class ForumFragment extends MainFragment {
} }
private void scrollTop() { private void scrollTop() {
nestedScrollView.fling(0); scrollView.fling(0);
nestedScrollView.smoothScrollTo(0, 0); scrollView.smoothScrollTo(0, 0);
} }
//跳转热榜界面 //跳转热榜界面
@RequiresApi(api = Build.VERSION_CODES.KITKAT) @RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Event(value = R.id.forum_hot) @Event(value = R.id.forum_hot)

@ -7,10 +7,10 @@ import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.SearchView;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.ui.main.ui.forum.FormLoad;
import com.community.pocket.ui.main.ui.forum.ForumPost; import com.community.pocket.ui.main.ui.forum.ForumPost;
import com.community.pocket.ui.main.ui.share.Response; import com.community.pocket.ui.main.ui.share.Response;
@ -28,19 +28,21 @@ public class ForumMyFragment extends ForumPost {
@ViewInject(R.id.search) @ViewInject(R.id.search)
private SearchView searchView; private SearchView searchView;
private Long currentPage = 1L;
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
viewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(ForumMyViewModel.class); viewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(ForumMyViewModel.class);
viewModel.loadForumMy(1, ""); load(1L);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
if (!query.isEmpty()) { if (!query.isEmpty()) {
viewModel.loadForumMy(1, searchView.getQuery().toString()); load(1L);
return true; return true;
} else { } else {
return false; return false;
@ -55,18 +57,16 @@ public class ForumMyFragment extends ForumPost {
}); });
//监听我的帖子加载状态 //监听我的帖子加载状态
viewModel.getForumMyResponse().observe(getViewLifecycleOwner(), new Observer<ForumMyResponse>() { viewModel.getForumMyResponse().observe(getViewLifecycleOwner(), forumMyResponse -> {
@Override if (forumMyResponse == null) {
public void onChanged(ForumMyResponse forumMyResponse) { return;
if (forumMyResponse == null) { }
return;
}
forumMyResponse.toast(getContext()); forumMyResponse.toast(getContext());
if (forumMyResponse.getResult() == Response.Result.OK) { if (forumMyResponse.getResult() == Response.Result.OK) {
loadPost(forumMyResponse.getForumList()); this.currentPage = forumMyResponse.getForumList().getCurrentPage();
} loadPost(forumMyResponse.getForumList());
} }
}); });
} }
@ -81,10 +81,25 @@ public class ForumMyFragment extends ForumPost {
return View.VISIBLE; return View.VISIBLE;
} }
@Override
protected FormLoad getViewModel() {
return viewModel;
}
@Override
protected Long getCurrentPage() {
return currentPage;
}
@Override
protected SearchView searchView() {
return searchView;
}
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
viewModel.loadForumMy(1, ""); load(1L);
} }
} }

@ -23,6 +23,8 @@ public class ForumMyResponse extends Response<ForumMyResponse.Msg> {
enum Msg implements CustomMessage { enum Msg implements CustomMessage {
ok(R.string.load_forum_my_ok), ok(R.string.load_forum_my_ok),
ok_empty(R.string.no_more_forum),
ok_more(R.string.load_more_forum_ok),
fail(R.string.load_forum_my_fail), fail(R.string.load_forum_my_fail),
token(R.string.invalid_token); token(R.string.invalid_token);

@ -3,10 +3,11 @@ package com.community.pocket.ui.main.ui.forum.my;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.community.pocket.data.main.forum.ForumMyRequest; import com.community.pocket.data.main.forum.ForumMyRequest;
import com.community.pocket.ui.main.ui.forum.FormLoad;
import com.community.pocket.ui.main.ui.share.BaseViewModel; import com.community.pocket.ui.main.ui.share.BaseViewModel;
//我的帖子UI数据管理 //我的帖子UI数据管理
public class ForumMyViewModel extends BaseViewModel<ForumMyRequest> { public class ForumMyViewModel extends BaseViewModel<ForumMyRequest> implements FormLoad {
//我的帖子请求状态 //我的帖子请求状态
private MutableLiveData<ForumMyResponse> forumMyResponse = new MutableLiveData<>(); private MutableLiveData<ForumMyResponse> forumMyResponse = new MutableLiveData<>();
@ -15,12 +16,14 @@ public class ForumMyViewModel extends BaseViewModel<ForumMyRequest> {
return forumMyResponse; return forumMyResponse;
} }
void loadForumMy(int page, String title) {
getRequest().loadForumMy(forumMyResponse, page, title);
}
@Override @Override
protected ForumMyRequest getRequest() { protected ForumMyRequest getRequest() {
return ForumMyRequest.getInstance(); return ForumMyRequest.getInstance();
} }
@Override
public void loadForumNew(Long page, String title) {
getRequest().loadForumMy(forumMyResponse, page, title);
}
} }

@ -1,16 +1,17 @@
package com.community.pocket.ui.main.ui.forum.news; package com.community.pocket.ui.main.ui.forum.news;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.SearchView;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.ui.main.ui.forum.FormLoad;
import com.community.pocket.ui.main.ui.forum.ForumPost; import com.community.pocket.ui.main.ui.forum.ForumPost;
import com.community.pocket.ui.main.ui.share.Response; import com.community.pocket.ui.main.ui.share.Response;
@ -28,19 +29,21 @@ public class ForumNewFragment extends ForumPost {
@ViewInject(R.id.search) @ViewInject(R.id.search)
private SearchView searchView; private SearchView searchView;
private Long currentPage = 1L;
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
viewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(ForumNewViewModel.class); viewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(ForumNewViewModel.class);
viewModel.loadForumNew(1, searchView.getQuery().toString()); load(1L);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
if (!query.isEmpty()) { if (!query.isEmpty()) {
viewModel.loadForumNew(1, searchView.getQuery().toString()); load(1L);
return true; return true;
} else { } else {
return false; return false;
@ -54,21 +57,25 @@ public class ForumNewFragment extends ForumPost {
} }
}); });
//监听最新帖子请求状态 //监听最新帖子请求状态
viewModel.getForumNewResponse().observe(getViewLifecycleOwner(), new Observer<ForumNewResponse>() { viewModel.getForumNewResponse().observe(getViewLifecycleOwner(), forumNewResponse -> {
@Override if (forumNewResponse == null) {
public void onChanged(ForumNewResponse forumNewResponse) { return;
if (forumNewResponse == null) { }
return;
}
forumNewResponse.toast(getContext()); forumNewResponse.toast(getContext());
if (forumNewResponse.getResult() == Response.Result.OK) { if (forumNewResponse.getResult() == Response.Result.OK) {
loadPost(forumNewResponse.getForumList()); this.currentPage = forumNewResponse.getForumList().getCurrentPage();
} loadPost(forumNewResponse.getForumList());
} }
}); });
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
loadMore();
}
} }
@Override @Override
@ -81,10 +88,24 @@ public class ForumNewFragment extends ForumPost {
return View.GONE; return View.GONE;
} }
@Override
protected FormLoad getViewModel() {
return viewModel;
}
@Override
protected Long getCurrentPage() {
return currentPage;
}
@Override
protected SearchView searchView() {
return searchView;
}
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
load(1L);
viewModel.loadForumNew(1, searchView.getQuery().toString());
} }
} }

@ -18,6 +18,8 @@ public class ForumNewResponse extends Response<ForumNewResponse.Msg> {
enum Msg implements CustomMessage { enum Msg implements CustomMessage {
ok(R.string.load_forum_new_ok), ok(R.string.load_forum_new_ok),
ok_empty(R.string.no_more_forum),
ok_more(R.string.load_more_forum_ok),
fail(R.string.load_forum_new_fail); fail(R.string.load_forum_new_fail);

@ -3,12 +3,13 @@ package com.community.pocket.ui.main.ui.forum.news;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.community.pocket.data.main.forum.ForumNewRequest; import com.community.pocket.data.main.forum.ForumNewRequest;
import com.community.pocket.ui.main.ui.forum.FormLoad;
import com.community.pocket.ui.main.ui.share.BaseViewModel; import com.community.pocket.ui.main.ui.share.BaseViewModel;
/** /**
* 最新帖子 * 最新帖子
*/ */
public class ForumNewViewModel extends BaseViewModel<ForumNewRequest> { public class ForumNewViewModel extends BaseViewModel<ForumNewRequest> implements FormLoad {
//最新帖子请求状态 //最新帖子请求状态
private MutableLiveData<ForumNewResponse> forumNewResponse = new MutableLiveData<>(); private MutableLiveData<ForumNewResponse> forumNewResponse = new MutableLiveData<>();
@ -17,7 +18,8 @@ public class ForumNewViewModel extends BaseViewModel<ForumNewRequest> {
return forumNewResponse; return forumNewResponse;
} }
void loadForumNew(int page, String title) { @Override
public void loadForumNew(Long page, String title) {
getRequest().loadForumNew(forumNewResponse, page, title); getRequest().loadForumNew(forumNewResponse, page, title);
} }

@ -10,7 +10,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.lifecycle.Observer;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.ui.BaseFragment; import com.community.pocket.ui.BaseFragment;
@ -58,7 +57,7 @@ abstract class ForumPostContent extends BaseFragment {
//初始化父级布局组件 //初始化父级布局组件
@RequiresApi(api = Build.VERSION_CODES.KITKAT) @RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void initParentView() { private void initParentView() {
ForumPostFragment forumPostFragment = getParentFragment(2); ForumPostFragment forumPostFragment = getParentFragment(ForumPostFragment.class);
View parentView = Objects.requireNonNull(Objects.requireNonNull(forumPostFragment).getView()); View parentView = Objects.requireNonNull(Objects.requireNonNull(forumPostFragment).getView());
postTitle = parentView.findViewById(R.id.post_title); postTitle = parentView.findViewById(R.id.post_title);
postButton = parentView.findViewById(R.id.post_button); postButton = parentView.findViewById(R.id.post_button);
@ -67,20 +66,16 @@ abstract class ForumPostContent extends BaseFragment {
//监听发帖状态 //监听发帖状态
void sendPost(ForumPostViewModel viewModel) { void sendPost(ForumPostViewModel viewModel) {
viewModel.getForumPostResponse().observe(getViewLifecycleOwner(), new Observer<ForumPostResponse>() { viewModel.getForumPostResponse().observe(getViewLifecycleOwner(), forumPostResponse -> {
@RequiresApi(api = Build.VERSION_CODES.KITKAT) if (forumPostResponse == null) {
@Override return;
public void onChanged(ForumPostResponse forumPostResponse) { }
if (forumPostResponse == null) {
return; forumPostResponse.toast(getContext());
} if (forumPostResponse.getResult() == Response.Result.OK) {
ForumFragment forumFragment = getParentFragment(ForumFragment.class);
forumPostResponse.toast(getContext()); Button button = Objects.requireNonNull(forumFragment.getView()).findViewById(R.id.forum_new);
if (forumPostResponse.getResult() == Response.Result.OK) { forumFragment._new(button);
ForumFragment forumFragment = getParentFragment(4);
Button button = Objects.requireNonNull(forumFragment.getView()).findViewById(R.id.forum_new);
forumFragment._new(button);
}
} }
}); });
} }

@ -19,7 +19,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R; import com.community.pocket.R;
@ -99,63 +98,54 @@ public class VisitorAppointmentFragment extends BaseFragment {
myAutoCompleteTextView = new MyAutoCompleteTextView(appointment, appointmentViewModel); myAutoCompleteTextView = new MyAutoCompleteTextView(appointment, appointmentViewModel);
//监听访客预约表单校验状态 //监听访客预约表单校验状态
appointmentViewModel.getVisitorFormState().observe(getViewLifecycleOwner(), new Observer<VisitorFormState>() { appointmentViewModel.getVisitorFormState().observe(getViewLifecycleOwner(), visitorFormState -> {
@Override if (visitorFormState == null) {
public void onChanged(VisitorFormState visitorFormState) { return;
if (visitorFormState == null) { }
return; submit.setEnabled(visitorFormState.isDataValid());
} if (visitorFormState.getAppointmentError() != null) {
submit.setEnabled(visitorFormState.isDataValid()); appointment.setError(getString(visitorFormState.getAppointmentError(), PropertiesUtil.getIntValue("username.length")));
if (visitorFormState.getAppointmentError() != null) { }
appointment.setError(getString(visitorFormState.getAppointmentError(), PropertiesUtil.getIntValue("username.length")));
}
if (visitorFormState.getDateError() != null) { if (visitorFormState.getDateError() != null) {
if (visitorFormState.getDateError() == R.string.visitor_invalid_date) { if (visitorFormState.getDateError() == R.string.visitor_invalid_date) {
chooseDate.setError(getString(visitorFormState.getDateError(), today)); chooseDate.setError(getString(visitorFormState.getDateError(), today));
} else { } else {
chooseDate.setError(getString(visitorFormState.getDateError())); chooseDate.setError(getString(visitorFormState.getDateError()));
}
} }
}
if (visitorFormState.getNotesError() != null) { if (visitorFormState.getNotesError() != null) {
notes.setError(getString(visitorFormState.getNotesError())); notes.setError(getString(visitorFormState.getNotesError()));
}
} }
}); });
//监听预约请求结果 //监听预约请求结果
appointmentViewModel.getVisitorResponse().observe(getViewLifecycleOwner(), new Observer<VisitorResponse>() { appointmentViewModel.getVisitorResponse().observe(getViewLifecycleOwner(), visitorResponse -> {
@Override if (visitorResponse == null) {
public void onChanged(VisitorResponse visitorResponse) { return;
if (visitorResponse == null) { }
return;
}
visitorResponse.toast(getContext()); visitorResponse.toast(getContext());
if (visitorResponse.getResult() == Response.Result.OK) { if (visitorResponse.getResult() == Response.Result.OK) {
VisitorFragment visitorFragment = getParentFragment(2); VisitorFragment visitorFragment = getParentFragment(VisitorFragment.class);
Button button = Objects.requireNonNull(visitorFragment.getView()).findViewById(R.id.visitor_reservation); Button button = Objects.requireNonNull(visitorFragment.getView()).findViewById(R.id.visitor_reservation);
visitorFragment.reservation(button); visitorFragment.reservation(button);
}
} }
}); });
//检索预约人请求结果 //检索预约人请求结果
appointmentViewModel.getSearchPeopleReq().observe(getViewLifecycleOwner(), new Observer<VisitorPeopleResponse>() { appointmentViewModel.getSearchPeopleReq().observe(getViewLifecycleOwner(), visitorResponse -> {
@Override if (visitorResponse == null) {
public void onChanged(VisitorPeopleResponse visitorResponse) { return;
if (visitorResponse == null) { }
return;
}
visitorResponse.toast(getContext()); visitorResponse.toast(getContext());
if (visitorResponse.getResult() == Response.Result.OK) { if (visitorResponse.getResult() == Response.Result.OK) {
if (!visitorResponse.getVisitorPeopleList().isEmpty()) { if (!visitorResponse.getVisitorPeopleList().isEmpty()) {
initSearch(visitorResponse.getVisitorPeopleList()); initSearch(visitorResponse.getVisitorPeopleList());
}
} }
} }
}); });

@ -67,7 +67,6 @@
android:name="androidx.navigation.fragment.NavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_100"
android:background="@color/colorAccent" android:background="@color/colorAccent"
app:defaultNavHost="true" app:defaultNavHost="true"
app:navGraph="@navigation/forum_navigation" /> app:navGraph="@navigation/forum_navigation" />

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -7,78 +7,76 @@
tools:context=".ui.main.ui.forum.hot.ForumHotFragment"> tools:context=".ui.main.ui.forum.hot.ForumHotFragment">
<androidx.core.widget.NestedScrollView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UselessParent"> tools:ignore="UselessParent">
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/active_user"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/size_200"
android:orientation="vertical"> android:layout_marginTop="@dimen/size_50"
android:background="@drawable/border">
<androidx.constraintlayout.widget.ConstraintLayout <TextView
android:id="@+id/active_user" android:id="@+id/active_user_text"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="@dimen/size_200" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_50" android:layout_marginTop="16dp"
android:background="@drawable/border"> android:gravity="center"
android:text="@string/active_user"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/active_user_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/active_user"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/hot_topic"
android:layout_width="match_parent"
android:layout_height="@dimen/size_200"
android:layout_marginTop="@dimen/size_50"
android:background="@drawable/border">
<androidx.constraintlayout.widget.ConstraintLayout <TextView
android:id="@+id/hot_topic" android:id="@+id/hot_topic_text"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="@dimen/size_200" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_50" android:layout_marginTop="16dp"
android:background="@drawable/border"> android:gravity="center"
android:text="@string/hot_topic"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/hot_topic_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/hot_topic"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/hot_events"
android:layout_width="match_parent"
android:layout_height="@dimen/size_200"
android:layout_marginTop="@dimen/size_50"
android:background="@drawable/border">
<androidx.constraintlayout.widget.ConstraintLayout <TextView
android:id="@+id/hot_events" android:id="@+id/hot_events_text"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="@dimen/size_200" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_50" android:layout_marginTop="16dp"
android:background="@drawable/border"> android:gravity="center"
android:text="@string/hot_events"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/hot_events_text" </LinearLayout>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/hot_events"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.main.ui.forum.my.ForumMyFragment"> tools:context=".ui.main.ui.forum.my.ForumMyFragment">
<androidx.core.widget.NestedScrollView <androidx.appcompat.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
tools:ignore="UselessParent"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout <LinearLayout
android:id="@+id/post_layout" android:id="@+id/post_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
<androidx.appcompat.widget.SearchView app:layout_constraintTop_toBottomOf="@id/search" />
android:id="@+id/search" </androidx.constraintlayout.widget.ConstraintLayout>
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.main.ui.forum.news.ForumNewFragment"> tools:context=".ui.main.ui.forum.news.ForumNewFragment">
<androidx.core.widget.NestedScrollView <androidx.appcompat.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
tools:ignore="UselessParent"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout <LinearLayout
android:id="@+id/post_layout" android:id="@+id/post_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
<androidx.appcompat.widget.SearchView app:layout_constraintTop_toBottomOf="@id/search" />
android:id="@+id/search" </androidx.constraintlayout.widget.ConstraintLayout>
android:layout_width="match_parent"
android:layout_height="37dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

@ -1,57 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.main.ui.forum.post.ForumPostFragment"> tools:context=".ui.main.ui.forum.post.ForumPostFragment">
<androidx.core.widget.NestedScrollView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
tools:ignore="UselessParent"> android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout <EditText
android:id="@+id/post_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:ems="10"
android:hint="@string/prompt_title"
<EditText android:importantForAutofill="no"
android:id="@+id/post_title" android:inputType="none|text"
android:layout_width="match_parent" app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent" />
android:ems="10"
android:hint="@string/prompt_title" <Spinner
android:importantForAutofill="no" android:id="@+id/post_type"
android:inputType="none|text" android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" /> android:entries="@array/post_type_list"
app:layout_constraintStart_toStartOf="parent"
<Spinner app:layout_constraintTop_toBottomOf="@id/post_title" />
android:id="@+id/post_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/post_type_list"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/post_title" />
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/post_type_fragment" android:id="@+id/post_type_fragment"
android:name="androidx.navigation.fragment.NavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_8" android:layout_marginTop="@dimen/size_8"
app:defaultNavHost="true" app:defaultNavHost="true"
app:navGraph="@navigation/nav_forum_post_type" /> app:navGraph="@navigation/nav_forum_post_type" />
<Button <Button
android:id="@+id/post_button" android:id="@+id/post_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
android:text="@string/forum_post" /> android:text="@string/forum_post" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -1,153 +1,136 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.main.ui.visitor.appointment.VisitorAppointmentFragment"> tools:context=".ui.main.ui.visitor.appointment.VisitorAppointmentFragment">
<androidx.core.widget.NestedScrollView
<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_toBottomOf="@id/button_group_layout" />
<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" />
<EditText
android:id="@+id/chooseDate"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:fillViewport="true"> 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" />
<LinearLayout
android:id="@+id/choose_time_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chooseDate">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/prompt_choose_time" />
<LinearLayout <Spinner
android:id="@+id/choose_time"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_weight="1" />
</LinearLayout>
<EditText
android:id="@+id/notes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:hint="@string/prompt_input_notes"
android:importantForAutofill="no"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/choose_time_layout" />
<LinearLayout
android:id="@+id/button_group_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/visitor_is_people"
android:textSize="18sp" />
<RadioGroup
android:id="@+id/button_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/is_outpeople"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_8"
android:checked="true"
android:text="@string/visitor_is_outpeole" />
<androidx.constraintlayout.widget.ConstraintLayout <RadioButton
android:layout_width="match_parent" android:id="@+id/not_outpeolle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"> android:text="@string/visitor_not_outpeole" />
</RadioGroup>
<AutoCompleteTextView </LinearLayout>
android:id="@+id/appointment"
android:layout_width="0dp" <Button
android:layout_height="wrap_content" android:id="@+id/submit"
android:completionThreshold="1" android:layout_width="0dp"
android:gravity="center" android:layout_height="wrap_content"
android:hint="@string/prompt_appointment" android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent" android:enabled="false"
app:layout_constraintStart_toStartOf="parent" android:text="@string/submit_appointment"
app:layout_constraintTop_toBottomOf="@id/button_group_layout" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
<TextView app:layout_constraintTop_toBottomOf="@id/notes" />
android:id="@+id/tip"
android:layout_width="0dp" </androidx.constraintlayout.widget.ConstraintLayout>
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" />
<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" />
<LinearLayout
android:id="@+id/choose_time_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chooseDate">
<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>
<EditText
android:id="@+id/notes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:hint="@string/prompt_input_notes"
android:importantForAutofill="no"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/choose_time_layout" />
<LinearLayout
android:id="@+id/button_group_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/visitor_is_people"
android:textSize="18sp" />
<RadioGroup
android:id="@+id/button_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/is_outpeople"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_8"
android:checked="true"
android:text="@string/visitor_is_outpeole" />
<RadioButton
android:id="@+id/not_outpeolle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/visitor_not_outpeole" />
</RadioGroup>
</LinearLayout>
<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/notes" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

@ -227,4 +227,5 @@
<string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string> <string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string>
<string name="server_address_error_3">服务端地址应该以http开头</string> <string name="server_address_error_3">服务端地址应该以http开头</string>
<string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string> <string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string>
<string name="load_more_forum_ok">load more forum OK</string>
</resources> </resources>

@ -227,4 +227,5 @@
<string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string> <string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string>
<string name="server_address_error_3">服务端地址应该以http开头</string> <string name="server_address_error_3">服务端地址应该以http开头</string>
<string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string> <string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string>
<string name="load_more_forum_ok">成功加载更多帖子</string>
</resources> </resources>

@ -228,6 +228,7 @@
<string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string> <string name="server_address_error_2">服务端地址的冒号句号应该是半角符号,\":\"、\".\",而不是全角符号\":\"、\"。\"</string>
<string name="server_address_error_3">服务端地址应该以http开头</string> <string name="server_address_error_3">服务端地址应该以http开头</string>
<string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string> <string name="server_address_error_4">恭喜你发现了新的错误,请联系管理员解决问题</string>
<string name="load_more_forum_ok">load more forum OK</string>
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save