增加废品回收UI以及数据管理

0515
panqihua 5 years ago
parent 4b0b118828
commit f836df523b
  1. 3
      app/src/main/java/com/community/pocket/data/adapter/ForumSearchAdapter.java
  2. 7
      app/src/main/java/com/community/pocket/data/adapter/GarbageSortingAdpter.java
  3. 49
      app/src/main/java/com/community/pocket/data/adapter/GarbageWasteAdpter.java
  4. 3
      app/src/main/java/com/community/pocket/data/adapter/LocaleAdapter.java
  5. 3
      app/src/main/java/com/community/pocket/data/adapter/VisitorAdpter.java
  6. 2
      app/src/main/java/com/community/pocket/data/main/garbage/GarbageSortingRequest.java
  7. 72
      app/src/main/java/com/community/pocket/data/main/garbage/GarbageWasteRequest.java
  8. 40
      app/src/main/java/com/community/pocket/data/model/GarbageWaste.java
  9. 25
      app/src/main/java/com/community/pocket/data/model/GarbageWasteManage.java
  10. 25
      app/src/main/java/com/community/pocket/data/model/GarbageWastePrice.java
  11. 44
      app/src/main/java/com/community/pocket/ui/main/TestMainFragment.java
  12. 19
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/GarbageViewModel.java
  13. 10
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/GarbageWasteFragment.java
  14. 18
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingFragment.java
  15. 2
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingResponse.java
  16. 2
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingViewModel.java
  17. 182
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/waste/GarbageWasteFragment.java
  18. 7
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/waste/GarbageWasteResponse.java
  19. 42
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/waste/GarbageWasteViewModel.java
  20. 1
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyVisitor.java
  21. 8
      app/src/main/res/layout/main/layout/garbage/layout/garbage.xml
  22. 11
      app/src/main/res/layout/main/layout/garbage/layout/garbage_sorting.xml
  23. 63
      app/src/main/res/layout/main/layout/garbage/layout/garbage_waste.xml
  24. 24
      app/src/main/res/layout/main/layout/garbage/layout/waste_item.xml
  25. 3
      app/src/main/res/layout/main/layout/info/layout/info_fragment.xml
  26. 4
      app/src/main/res/navigation/garbage_navigation.xml
  27. 6
      app/src/main/res/values-en-rUS/strings.xml
  28. 6
      app/src/main/res/values-zh-rCN/strings.xml
  29. 6
      app/src/main/res/values/strings.xml

@ -7,6 +7,9 @@ import androidx.annotation.NonNull;
import java.util.List; import java.util.List;
/**
* 投诉人适配器
*/
public class ForumSearchAdapter extends ArrayAdapter<String> { public class ForumSearchAdapter extends ArrayAdapter<String> {
private List<String> data; private List<String> data;

@ -10,14 +10,17 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class GarbageAdpter extends ArrayAdapter<String> { /**
* 垃圾分类数据适配器
*/
public class GarbageSortingAdpter extends ArrayAdapter<String> {
private List<GarbageSorting> dataList; private List<GarbageSorting> dataList;
private List<String> list = new ArrayList<>(); private List<String> list = new ArrayList<>();
private Map<String, GarbageSorting> map = new HashMap<>(); private Map<String, GarbageSorting> map = new HashMap<>();
public GarbageAdpter(List<GarbageSorting> dataList, Context context) { public GarbageSortingAdpter(List<GarbageSorting> dataList, Context context) {
super(context, android.R.layout.simple_list_item_1); super(context, android.R.layout.simple_list_item_1);
addAll(dataList); addAll(dataList);
} }

@ -0,0 +1,49 @@
package com.community.pocket.data.adapter;
import android.content.Context;
import android.widget.ArrayAdapter;
import com.community.pocket.data.model.GarbageWastePrice;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 废品回收数据适配器
*/
public class GarbageWasteAdpter extends ArrayAdapter<String> {
private List<GarbageWastePrice> dataList;
private List<String> list = new ArrayList<>();
private Map<String, GarbageWastePrice> map = new HashMap<>();
public GarbageWasteAdpter(List<GarbageWastePrice> dataList, Context context) {
super(context, android.R.layout.simple_list_item_1);
addAll(dataList);
}
public void addAll(List<GarbageWastePrice> dataList) {
this.dataList = dataList;
this.list.clear();
this.map.clear();
for (GarbageWastePrice price : dataList) {
this.list.add(price.getName());
this.map.put(price.getName(), price);
}
clear();
addAll(this.list);
}
public GarbageWastePrice get(String name) {
return this.map.get(name);
}
public boolean containsKey(String name) {
return this.list.contains(name);
}
}

@ -14,6 +14,9 @@ import com.community.pocket.util.LocaleType;
import org.xutils.view.annotation.ViewInject; import org.xutils.view.annotation.ViewInject;
import org.xutils.x; import org.xutils.x;
/**
* 切换语言数据适配器
*/
public class LocaleAdapter extends BaseAdapter { public class LocaleAdapter extends BaseAdapter {
private LayoutInflater inflater; private LayoutInflater inflater;

@ -7,6 +7,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 访客信息数据适配器
*/
public class VisitorAdpter extends ArrayAdapter<String> { public class VisitorAdpter extends ArrayAdapter<String> {
private Map<String, List<String>> map; private Map<String, List<String>> map;

@ -3,7 +3,7 @@ package com.community.pocket.data.main.garbage;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.data.model.GarbageSorting; import com.community.pocket.data.model.GarbageSorting;
import com.community.pocket.ui.main.ui.garbage.GarbageSortingResponse; import com.community.pocket.ui.main.ui.garbage.sorting.GarbageSortingResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

@ -0,0 +1,72 @@
package com.community.pocket.data.main.garbage;
import com.community.pocket.R;
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.garbage.waste.GarbageWasteResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* 废品回收接口
* TODO 完善逻辑
*/
public class GarbageWasteRequest {
private static volatile GarbageWasteRequest instance;
private GarbageWasteRequest() {
}
public static GarbageWasteRequest getInstance() {
if (instance == null) {
instance = new GarbageWasteRequest();
}
return instance;
}
//检索默认废品信息
public GarbageWasteResponse searchDefault() {
GarbageWasteManage manage = new GarbageWasteManage();
manage.setMobie("10086");
manage.setName("Test");
List<GarbageWastePrice> priceList = new ArrayList<>();
for (int i = 0; i < 30; i++) {
GarbageWastePrice price = new GarbageWastePrice();
price.setName("waste" + i);
price.setPrice(new Random().nextInt(10) * 1F);
priceList.add(price);
}
GarbageWaste waste = new GarbageWaste();
waste.setDefaultList(priceList);
waste.setGarbageWasteManage(manage);
GarbageWasteResponse response = new GarbageWasteResponse();
response.setSuccess(R.string.garbage_waste_search_ok);
response.setBody(waste);
return response;
}
//检索废品
public GarbageWasteResponse search(String name) {
List<GarbageWastePrice> priceList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
GarbageWastePrice price = new GarbageWastePrice();
price.setName("waste" + i);
price.setPrice(new Random().nextInt(10) * 1F);
priceList.add(price);
}
GarbageWaste waste = new GarbageWaste();
waste.setSearchList(priceList);
GarbageWasteResponse response = new GarbageWasteResponse();
response.setSuccess(R.string.garbage_waste_search_ok);
response.setBody(waste);
return response;
}
}

@ -0,0 +1,40 @@
package com.community.pocket.data.model;
import java.util.List;
//废品回收信息
public class GarbageWaste {
//默认价格信息
private List<GarbageWastePrice> defaultList;
//检索价格信息
private List<GarbageWastePrice> searchList;
//管理员信息
private GarbageWasteManage garbageWasteManage;
public List<GarbageWastePrice> getDefaultList() {
return defaultList;
}
public void setDefaultList(List<GarbageWastePrice> defaultList) {
this.defaultList = defaultList;
}
public List<GarbageWastePrice> getSearchList() {
return searchList;
}
public void setSearchList(List<GarbageWastePrice> searchList) {
this.searchList = searchList;
}
public GarbageWasteManage getGarbageWasteManage() {
return garbageWasteManage;
}
public void setGarbageWasteManage(GarbageWasteManage garbageWasteManage) {
this.garbageWasteManage = garbageWasteManage;
}
}

@ -0,0 +1,25 @@
package com.community.pocket.data.model;
//废品管理员信息
public class GarbageWasteManage {
//管理员名
private String name;
//联系电话
private String mobie;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobie() {
return mobie;
}
public void setMobie(String mobie) {
this.mobie = mobie;
}
}

@ -0,0 +1,25 @@
package com.community.pocket.data.model;
//废品信息
public class GarbageWastePrice {
//废品名
private String name;
//废品价格
private Float price;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Float getPrice() {
return price;
}
public void setPrice(Float price) {
this.price = price;
}
}

@ -1,44 +0,0 @@
package com.community.pocket.ui.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.community.pocket.ui.BaseFragment;
import org.jetbrains.annotations.NotNull;
/**
* 主界面框架
*/
//TODO 测试类
public abstract class TestMainFragment extends BaseFragment {
@NotNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//文本框打印测试信息
View root = super.onCreateView(inflater, container, savedInstanceState);
final TextView textView = root.findViewById(viewId());
MutableLiveData<String> mText = new MutableLiveData<>();
mText.setValue("未完成界面!!!");
mText.observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
protected abstract int viewId();
}

@ -1,19 +0,0 @@
package com.community.pocket.ui.main.ui.garbage;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class GarbageViewModel extends ViewModel {
private MutableLiveData<String> mText;
public GarbageViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is notifications fragment");
}
LiveData<String> getText() {
return mText;
}
}

@ -1,10 +0,0 @@
package com.community.pocket.ui.main.ui.garbage;
import com.community.pocket.R;
import com.community.pocket.ui.BaseFragment;
import org.xutils.view.annotation.ContentView;
@ContentView(R.layout.garbage_waste)
public class GarbageWasteFragment extends BaseFragment {
}

@ -1,4 +1,4 @@
package com.community.pocket.ui.main.ui.garbage; package com.community.pocket.ui.main.ui.garbage.sorting;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
@ -14,7 +14,7 @@ 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.data.adapter.GarbageAdpter; import com.community.pocket.data.adapter.GarbageSortingAdpter;
import com.community.pocket.data.model.GarbageSorting; import com.community.pocket.data.model.GarbageSorting;
import com.community.pocket.ui.BaseFragment; import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.listener.MyTextChange; import com.community.pocket.ui.listener.MyTextChange;
@ -45,7 +45,7 @@ public class GarbageSortingFragment extends BaseFragment {
private MyAutoCompleteTextView myAutoCompleteTextView; private MyAutoCompleteTextView myAutoCompleteTextView;
private GarbageAdpter garbageAdpter; private GarbageSortingAdpter garbageSortingAdpter;
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
@ -77,8 +77,8 @@ public class GarbageSortingFragment extends BaseFragment {
searchSorting.addTextChangedListener(new MyTextChange() { searchSorting.addTextChangedListener(new MyTextChange() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (garbageAdpter != null && garbageAdpter.containsKey(s.toString())) { if (garbageSortingAdpter != null && garbageSortingAdpter.containsKey(s.toString())) {
initView(garbageAdpter.get(s.toString())); initView(garbageSortingAdpter.get(s.toString()));
} }
myAutoCompleteTextView.searchHandler(); myAutoCompleteTextView.searchHandler();
@ -104,12 +104,12 @@ public class GarbageSortingFragment extends BaseFragment {
*/ */
private void initSearch(List<GarbageSorting> garbageSortings) { private void initSearch(List<GarbageSorting> garbageSortings) {
// 设置适配器 // 设置适配器
if (garbageAdpter == null) { if (garbageSortingAdpter == null) {
garbageAdpter = new GarbageAdpter(garbageSortings, getContext()); garbageSortingAdpter = new GarbageSortingAdpter(garbageSortings, getContext());
// 将适配器与当前AutoCompleteTextView控件绑定 // 将适配器与当前AutoCompleteTextView控件绑定
searchSorting.setAdapter(garbageAdpter); searchSorting.setAdapter(garbageSortingAdpter);
} else { } else {
garbageAdpter.addAll(garbageSortings); garbageSortingAdpter.addAll(garbageSortings);
} }
myAutoCompleteTextView.refreshDropList(); myAutoCompleteTextView.refreshDropList();
} }

@ -1,4 +1,4 @@
package com.community.pocket.ui.main.ui.garbage; package com.community.pocket.ui.main.ui.garbage.sorting;
import com.community.pocket.data.model.GarbageSorting; import com.community.pocket.data.model.GarbageSorting;
import com.community.pocket.ui.main.ui.share.Response; import com.community.pocket.ui.main.ui.share.Response;

@ -1,4 +1,4 @@
package com.community.pocket.ui.main.ui.garbage; package com.community.pocket.ui.main.ui.garbage.sorting;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;

@ -0,0 +1,182 @@
package com.community.pocket.ui.main.ui.garbage.waste;
import android.os.Bundle;
import android.text.Editable;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.gridlayout.widget.GridLayout;
import androidx.lifecycle.Observer;
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;
import com.community.pocket.ui.listener.MyTextChange;
import com.community.pocket.ui.main.ui.share.MyAutoCompleteTextView;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import java.util.List;
@ContentView(R.layout.garbage_waste)
public class GarbageWasteFragment extends BaseFragment {
//联系管理员
@ViewInject(R.id.name)
private TextView name;
//联系电话
@ViewInject(R.id.mobie)
private TextView mobie;
//检索废品
@ViewInject(R.id.search_price)
private AutoCompleteTextView searchPrice;
@ViewInject(R.id.waste_layout)
private GridLayout layout;
private MyAutoCompleteTextView myAutoCompleteTextView;
private GarbageWasteAdpter garbageWasteAdpter;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final GarbageWasteViewModel viewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(GarbageWasteViewModel.class);
myAutoCompleteTextView = new MyAutoCompleteTextView(searchPrice, viewModel);
viewModel.searchDefault();
//监听默认废品信息请求状态
viewModel.getDefaultList().observe(getViewLifecycleOwner(), new Observer<GarbageWasteResponse>() {
@Override
public void onChanged(GarbageWasteResponse garbageWasteResponse) {
if (garbageWasteResponse == null) {
return;
}
if (garbageWasteResponse.getSuccess() != null) {
initDefault(garbageWasteResponse.getBody());
}
if (garbageWasteResponse.getError() != null) {
Toast.makeText(getContext(), garbageWasteResponse.fail(getContext()), Toast.LENGTH_SHORT).show();
}
}
});
//监听废品信息请求状态
viewModel.getSearchList().observe(getViewLifecycleOwner(), new Observer<GarbageWasteResponse>() {
@Override
public void onChanged(GarbageWasteResponse garbageWasteResponse) {
if (garbageWasteResponse == null) {
return;
}
if (garbageWasteResponse.getSuccess() != null) {
initSearch(garbageWasteResponse.getBody());
}
if (garbageWasteResponse.getError() != null) {
Toast.makeText(getContext(), garbageWasteResponse.fail(getContext()), Toast.LENGTH_SHORT).show();
}
}
});
//检索内容改变触发监听器
searchPrice.addTextChangedListener(new MyTextChange() {
@Override
public void afterTextChanged(Editable s) {
if (garbageWasteAdpter != null && garbageWasteAdpter.containsKey(s.toString())) {
layout.removeAllViews();
addHead();
addItem(garbageWasteAdpter.get(s.toString()));
}
if (s.length() == 0) {
viewModel.searchDefault();
} else {
myAutoCompleteTextView.searchHandler();
}
}
});
}
/**
* 检索默认废品信息
*
* @param waste 废品信息
*/
private void initDefault(GarbageWaste waste) {
GarbageWasteManage manage = waste.getGarbageWasteManage();
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);
}
}
private void addHead() {
createTextView(getString(R.string.garbage_table_name));
createTextView(getString(R.string.garbage_table_price));
}
/**
* 添加一行数据
*
* @param price 废品信息
*/
private void addItem(GarbageWastePrice price) {
createTextView(price.getName());
createTextView(String.valueOf(price.getPrice()));
}
/**
* 创建单元格
*/
private void createTextView(CharSequence text) {
TextView textView = new TextView(getContext());
textView.setGravity(Gravity.CENTER | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
textView.setText(text);
textView.setBackground(getResources().getDrawable(R.drawable.border));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24);
GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
layoutParams.columnSpec = GridLayout.spec(GridLayout.UNDEFINED, 1f);
textView.setLayoutParams(layoutParams);
layout.addView(textView);
}
/**
* 检索废品回收信息
*
* @param waste 废品信息
*/
private void initSearch(GarbageWaste waste) {
// 设置适配器
if (garbageWasteAdpter == null) {
garbageWasteAdpter = new GarbageWasteAdpter(waste.getSearchList(), getContext());
// 将适配器与当前AutoCompleteTextView控件绑定
searchPrice.setAdapter(garbageWasteAdpter);
} else {
garbageWasteAdpter.addAll(waste.getSearchList());
}
myAutoCompleteTextView.refreshDropList();
}
}

@ -0,0 +1,7 @@
package com.community.pocket.ui.main.ui.garbage.waste;
import com.community.pocket.data.model.GarbageWaste;
import com.community.pocket.ui.main.ui.share.Response;
public class GarbageWasteResponse extends Response<GarbageWaste> {
}

@ -0,0 +1,42 @@
package com.community.pocket.ui.main.ui.garbage.waste;
import androidx.lifecycle.MutableLiveData;
import com.community.pocket.data.main.garbage.GarbageWasteRequest;
import com.community.pocket.ui.main.ui.share.BaseViewModel;
import com.community.pocket.ui.main.ui.share.SearchViewModel;
//废品信息UI管理
public class GarbageWasteViewModel extends BaseViewModel<GarbageWasteRequest> implements SearchViewModel {
//检索默认废品信息
private MutableLiveData<GarbageWasteResponse> defaultList = new MutableLiveData<>();
//检索废品信息
private MutableLiveData<GarbageWasteResponse> searchList = new MutableLiveData<>();
MutableLiveData<GarbageWasteResponse> getDefaultList() {
return defaultList;
}
MutableLiveData<GarbageWasteResponse> getSearchList() {
return searchList;
}
@Override
protected GarbageWasteRequest getRequest() {
return GarbageWasteRequest.getInstance();
}
//检索默认废品请求状态
void searchDefault() {
GarbageWasteResponse response = getRequest().searchDefault();
defaultList.setValue(response);
}
//检索废品请求状态
@Override
public void search(String content) {
GarbageWasteResponse response = getRequest().search(content);
searchList.setValue(response);
}
}

@ -51,7 +51,6 @@ public abstract class VisitorMyVisitor extends BaseFragment {
/** /**
* 初始化数据 * 初始化数据
* TODO 测试数据
*/ */
protected void loadData(List<Visitor> visitors) { protected void loadData(List<Visitor> visitors) {
for (final Visitor visitor : visitors) { for (final Visitor visitor : visitors) {

@ -4,6 +4,7 @@
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"
android:background="@color/colorAccent"
tools:context=".ui.main.ui.garbage.GarbageFragment"> tools:context=".ui.main.ui.garbage.GarbageFragment">
<include <include
@ -13,12 +14,15 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/grabage_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="0dp" android:layout_height="0dp"
app:defaultNavHost="true" app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titlebar"
app:navGraph="@navigation/garbage_navigation" app:navGraph="@navigation/garbage_navigation"
tools:layout_constraintTop_toBottomOf="@id/titlebar" tools:layout_constraintTop_toBottomOf="@id/titlebar" />
android:id="@+id/grabage_fragment" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.garbage.sorting.GarbageSortingFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"> android:layout_gravity="center_vertical">
@ -42,4 +48,5 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sorting" /> app:layout_constraintTop_toBottomOf="@id/sorting" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -1,4 +1,63 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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"
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.garbage.waste.GarbageWasteFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mobie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name" />
<AutoCompleteTextView
android:id="@+id/search_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:completionThreshold="1"
android:hint="@string/garbage_waste_search"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/mobie" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_price">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.gridlayout.widget.GridLayout
android:id="@+id/waste_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:columnCount="2" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/border"
android:gravity="center"
android:textSize="24sp" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/border"
android:gravity="center"
android:textSize="24sp" />
</LinearLayout>

@ -9,7 +9,8 @@
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/colorAccent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

@ -6,10 +6,10 @@
<fragment <fragment
android:id="@+id/garbageSortingFragment" android:id="@+id/garbageSortingFragment"
android:name="com.community.pocket.ui.main.ui.garbage.GarbageSortingFragment" android:name="com.community.pocket.ui.main.ui.garbage.sorting.GarbageSortingFragment"
android:label="GarbageSortingFragment" /> android:label="GarbageSortingFragment" />
<fragment <fragment
android:id="@+id/garbageWasteFragment" android:id="@+id/garbageWasteFragment"
android:name="com.community.pocket.ui.main.ui.garbage.GarbageWasteFragment" android:name="com.community.pocket.ui.main.ui.garbage.waste.GarbageWasteFragment"
android:label="GarbageWasteFragment" /> android:label="GarbageWasteFragment" />
</navigation> </navigation>

@ -157,4 +157,10 @@
<string name="prompt_garbage_name">please input name</string> <string name="prompt_garbage_name">please input name</string>
<string name="garbage_img">grabage image</string> <string name="garbage_img">grabage image</string>
<string name="garbage_search_ok">search success</string> <string name="garbage_search_ok">search success</string>
<string name="garbage_waste_name">waste name:%1s</string>
<string name="garbage_waste_mobie">waste mobie:%1s</string>
<string name="garbage_waste_search">search name</string>
<string name="garbage_waste_search_ok">search success</string>
<string name="garbage_table_name">name</string>
<string name="garbage_table_price">price</string>
</resources> </resources>

@ -157,4 +157,10 @@
<string name="prompt_garbage_name">请输入垃圾名</string> <string name="prompt_garbage_name">请输入垃圾名</string>
<string name="garbage_img">垃圾图片</string> <string name="garbage_img">垃圾图片</string>
<string name="garbage_search_ok">检索成功</string> <string name="garbage_search_ok">检索成功</string>
<string name="garbage_waste_name">废品回收管理员:%1s</string>
<string name="garbage_waste_mobie">联系电话:%1s</string>
<string name="garbage_waste_search">检索废品</string>
<string name="garbage_waste_search_ok">检索废品成功</string>
<string name="garbage_table_name">废品</string>
<string name="garbage_table_price">价格</string>
</resources> </resources>

@ -158,6 +158,12 @@
<string name="prompt_garbage_name">please input name</string> <string name="prompt_garbage_name">please input name</string>
<string name="garbage_img">grabage image</string> <string name="garbage_img">grabage image</string>
<string name="garbage_search_ok">search success</string> <string name="garbage_search_ok">search success</string>
<string name="garbage_waste_name">waste name:%1s</string>
<string name="garbage_waste_mobie">waste mobie:%1s</string>
<string name="garbage_waste_search">search name</string>
<string name="garbage_waste_search_ok">search success</string>
<string name="garbage_table_name">name</string>
<string name="garbage_table_price">price</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