parent
4b0b118828
commit
f836df523b
@ -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); |
||||
} |
||||
} |
@ -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 com.community.pocket.data.model.GarbageSorting; |
||||
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; |
||||
|
@ -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); |
||||
} |
||||
} |
@ -1,45 +1,52 @@ |
||||
<?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_height="wrap_content" |
||||
android:layout_gravity="center_vertical"> |
||||
android:layout_height="match_parent" |
||||
tools:context=".ui.main.ui.garbage.sorting.GarbageSortingFragment"> |
||||
|
||||
<AutoCompleteTextView |
||||
android:id="@+id/search_sorting" |
||||
<androidx.constraintlayout.widget.ConstraintLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:completionThreshold="1" |
||||
android:hint="@string/prompt_garbage_name" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
android:layout_gravity="center_vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/name" |
||||
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/search_sorting" /> |
||||
<AutoCompleteTextView |
||||
android:id="@+id/search_sorting" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:completionThreshold="1" |
||||
android:hint="@string/prompt_garbage_name" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/sorting" |
||||
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" /> |
||||
<TextView |
||||
android:id="@+id/name" |
||||
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/search_sorting" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/sorting" |
||||
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" /> |
||||
|
||||
<ImageView |
||||
android:id="@+id/image" |
||||
android:layout_width="@dimen/size_200" |
||||
android:layout_height="@dimen/size_200" |
||||
android:contentDescription="@string/garbage_img" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@id/sorting" /> |
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
<ImageView |
||||
android:id="@+id/image" |
||||
android:layout_width="@dimen/size_200" |
||||
android:layout_height="@dimen/size_200" |
||||
android:contentDescription="@string/garbage_img" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@id/sorting" /> |
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
</FrameLayout> |
@ -1,4 +1,63 @@ |
||||
<?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_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> |
Loading…
Reference in new issue