Commit fad0dfe8 authored by 杨秀秀's avatar 杨秀秀

基础搭建

功能开发
1:1.2.0 修复bug
parent 88cc501b
......@@ -244,6 +244,18 @@
<LayoutPositions>
<option name="myPositions">
<map>
<entry key="listSelectFragment">
<value>
<LayoutPositions>
<option name="myPosition">
<Point>
<option name="x" value="648" />
<option name="y" value="-366" />
</Point>
</option>
</LayoutPositions>
</value>
</entry>
<entry key="merchantIntroduceFragment">
<value>
<LayoutPositions>
......@@ -307,6 +319,20 @@
<option name="y" value="12" />
</Point>
</option>
<option name="myPositions">
<map>
<entry key="action_registerMaterialFragment_to_listSelectFragment">
<value>
<LayoutPositions />
</value>
</entry>
<entry key="action_registerMaterialFragment_to_merchantWaitFragment">
<value>
<LayoutPositions />
</value>
</entry>
</map>
</option>
</LayoutPositions>
</value>
</entry>
......
This diff is collapsed.
package com.xx.merchanthbh
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
......@@ -50,7 +50,7 @@ class LoginRequest: BaseRespons() {
fun getProtocols(): Observable<BaseResponse<List<String>>>
{
return apiService.getProtocols(ApiParams<Array<String>>().setParams(arrayOf("6","7","8","9","10")))
return apiService.getProtocols(ApiParams<Array<String>>().setParams(arrayOf("6","7","13","9","10")))
}
......
......@@ -75,13 +75,13 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding, HomeViewMode
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!Environment.isExternalStorageManager()) {
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
intent.setData(Uri.parse("package:" + getContext().getPackageName()));
startActivityForResult(intent, 1024);
}
}
}*/
}
// 重写初始方法调用参数
......
package com.xx.merchanthbh.ui.merchantenter
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.xx.merchanthbh.BR
import com.xx.merchanthbh.R
import com.xx.merchanthbh.databinding.FragmentListSelectBinding
import com.xx.merchanthbh.dialog.adapter.BoothListAdapter
import me.goldze.mvvmhabit.base.BaseFragment
/**
* 选择展位号
*/
class ListSelectFragment : BaseFragment<FragmentListSelectBinding, MerchantEnterViewModel>() {
override fun viewModelType(): Int {
return 1;
}
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
): Int {
return R.layout.fragment_list_select;
}
override fun initVariableId(): Int {
return BR.viewModel
}
override fun initData() {
super.initData()
viewModel.boothAdapter=BoothListAdapter(context);
binding.rvSelelctList.adapter=viewModel.boothAdapter;
if (viewModel. boothAdapter.mList==null)
{viewModel. boothAdapter.mList=ArrayList();
}
viewModel. boothAdapter.mList.addAll( viewModel.boothBeanList)
viewModel. boothAdapter.notifyDataSetChanged()
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import static me.goldze.mvvmhabit.utils.Utils.Interceptor_TOKEN;
import android.app.Application;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
......@@ -18,10 +19,12 @@ import com.xx.merchanthbh.data.http.requst.body.Brankbody;
import com.xx.merchanthbh.data.http.requst.body.MerchantMsgbody;
import com.xx.merchanthbh.data.http.respons.BoothBean;
import com.xx.merchanthbh.data.http.respons.Filebean;
import com.xx.merchanthbh.data.http.respons.MerchantBean;
import com.xx.merchanthbh.data.http.respons.RegisterBean;
import com.xx.merchanthbh.data.http.respons.UserBean;
import com.xx.merchanthbh.data.local.LocalData;
import com.xx.merchanthbh.dialog.BoothListDialog;
import com.xx.merchanthbh.dialog.adapter.BoothListAdapter;
import com.xx.merchanthbh.dialog.data.TextListProvider;
import com.xx.xxviewlibrary.base.xxBaseDialog;
import com.xx.xxviewlibrary.comm.CommTextDialog;
......@@ -54,10 +57,15 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
public ObservableField<String> pwds = new ObservableField<>("");
public ObservableField<String> boothSelect = new ObservableField<>("");
public RegisterModel registerBody=new RegisterModel();
public List<BoothBean> boothBeanList=new ArrayList<>();
public BoothListAdapter boothAdapter;
/**
* 获取验证码按钮文字
*/
......@@ -100,13 +108,21 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
public MerchantEnterViewModel(@NonNull Application application) {
super(application);
model= new MerchantEnterRequst();
Log.e("fragment 生命周期","MerchantEnterViewModel");
if(LocalData.getUser()!=null)
{
user=LocalData.getUser();
merchantInfo=new MerchantEnterRequst.MerchantInfo(user.getPhonenumber());
}
MerchantBean merchantBean =LocalData.getMerchant();
if (merchantBean!=null )
{
userStatic=merchantBean.getBusinessId();
merchantInfo.setMerchantInfo(merchantBean);
}
}
......@@ -375,7 +391,8 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
* 获取展位列表
*/
public void getBoothList()
{model.getBoothList()
{
model.getBoothList()
.compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(MerchantEnterViewModel.this)
.doOnSubscribe (new Consumer<Disposable>() {
......@@ -404,20 +421,67 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
*/
public void openBooth(View view)
{
BoothListDialog dialoh=new BoothListDialog(view.getContext(),"请选择所属展位",boothBeanList);
dialoh.setDialogClickListener(new xxBaseDialog.onDialogClickListener<TextListProvider>() {
@Override
public void dialogClickBack(int code, TextListProvider data) {
merchantInfo.getBoothNum().set(data.providerText());
merchantInfo.setBoothId(data.ProviderId());
if (boothBeanList.size()<=0)
{
ToastUtils.showShort("正在加载展位数据请稍后点击");
}else {
NavController navController= Navigation.findNavController(view);
navController.navigate(R.id.action_registerMaterialFragment_to_listSelectFragment);
}
});
dialoh.show();
}
/**
* 筛选展位号
* @param view
*/
public void searchBooth(View view)
{
List<BoothBean> newBoothBeanList=new ArrayList<>();
if (!TextUtils.isEmpty(boothSelect.get()))
{
for (BoothBean bean:boothBeanList)
{
if (bean.getBoothNumber().indexOf(boothSelect.get())>-1)
{
newBoothBeanList.add(bean);
}
}
}else {
newBoothBeanList=boothBeanList;
}
boothAdapter.mList.clear();
boothAdapter.mList.addAll(newBoothBeanList);
boothAdapter.notifyDataSetChanged();
}
/**
* 确定选择展位号
* @param view
*/
public void searchBoothSure(View view)
{
if (boothAdapter.getBuuthBusinessId()==null)
{
ToastUtils.showShort("请选择展位号");
}else {
NavController navController= Navigation.findNavController(view);
navController.popBackStack();
merchantInfo.getBoothNum().set(boothAdapter.getBuuthBusinessId().providerText());
merchantInfo.setBoothId(boothAdapter.getBuuthBusinessId().ProviderId());
}
}
/**
* 添加品牌
* @param view
......
......@@ -29,10 +29,15 @@ class RegisterMaterialFragment : BaseFragment<FragmentRegisterMaterialBinding, M
return BR.viewModel
}
override fun initParam() {
super.initParam()
}
override fun initData() {
super.initData()
viewModel.title.set("商家信息")
viewModel.getBoothList()
viewModel.getBoothList();
adapter=AddBrankAdapter(context)
binding.rvFrmBrankList.adapter=adapter
......@@ -59,10 +64,9 @@ class RegisterMaterialFragment : BaseFragment<FragmentRegisterMaterialBinding, M
})
var merchantBean :MerchantBean?=LocalData.getMerchant();
if (merchantBean!=null)
if (merchantBean!=null )
{
viewModel.userStatic=merchantBean.businessId;
viewModel.merchantInfo.setMerchantInfo(merchantBean)
if (merchantBean.brandAuthorizationList!=null)
{
adapter.mList = viewModel.merchantInfo.reBrankbody(merchantBean.brandAuthorizationList!!)
......
......@@ -104,9 +104,9 @@ public class MineFragment extends BaseFragment<FragmentMineBinding, MineViewMode
@Override
public void onChanged(String s) {
if ("1".equals(s)) {
var packageURI = Uri.parse("package:" + getContext().getPackageName());
/* var packageURI = Uri.parse("package:" + getContext().getPackageName());
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI);
startActivityForResult(intent, 1002);
startActivityForResult(intent, 1002);*/
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:binding="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.xx.merchanthbh.ui.merchantenter.MerchantEnterViewModel" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LayoutManagers" />
<import type="me.goldze.mvvmhabit.binding.viewadapter.recyclerview.LineManagers" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:paddingLeft="17dp"
android:layout_margin="20dp"
android:id="@+id/fls_select"
android:background="@drawable/bg_gray_size_1_radius_6"
android:layout_height="48dp">
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#00000000"
android:textColor="@color/text_grey"
android:text="@={viewModel.boothSelect}"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:onClick="@{viewModel.searchBooth}"
android:text="搜索"
android:background="#00000000"
android:textColor="#333333"
android:textSize="14dp"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_selelct_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:layout_constraintBottom_toTopOf="@+id/button2"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="20dp"
binding:layoutManager="@{LayoutManagers.linear(1,false)}"
tools:layout_editor_absoluteX="24dp" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@drawable/bg_forground_radius_24"
android:text="确定"
android:onClick="@{viewModel.searchBoothSure}"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="20dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -31,10 +31,18 @@
<action
android:id="@+id/action_registerMaterialFragment_to_merchantWaitFragment"
app:destination="@id/merchantWaitFragment" />
<action
android:id="@+id/action_registerMaterialFragment_to_listSelectFragment"
app:destination="@id/listSelectFragment" />
</fragment>
<fragment
android:id="@+id/merchantWaitFragment"
android:name="com.xx.merchanthbh.ui.merchantenter.MerchantWaitFragment"
android:label="MerchantWaitFragment" />
<fragment
android:id="@+id/listSelectFragment"
android:name="com.xx.merchanthbh.ui.merchantenter.ListSelectFragment"
android:label="fragment_list_select"
tools:layout="@layout/fragment_list_select" />
</navigation>
\ No newline at end of file
......@@ -93,7 +93,7 @@
<!--我的模块 用户职位-->
<string name="user_position">店长</string>
<!--我的模块 创建日期-->
<string name="user_createdate" >创建日期</string>
<string name="user_createdate">创建日期</string>
<!--我的模块 菜单列表-->
<!--2-->
<string name="change_password">修改密码</string>
......@@ -239,4 +239,6 @@
<string name="pay_count">付款金额</string>
<string name="pay_time">付款时间</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -64,6 +65,7 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("fragment 生命周期","onCreate");
initParam();
}
......@@ -75,6 +77,7 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Log.e("fragment 生命周期","onCreateView");
binding = DataBindingUtil.inflate(inflater, initContentView(inflater, container, savedInstanceState), container, false);
return binding.getRoot();
}
......@@ -82,6 +85,7 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
@Override
public void onDestroyView() {
super.onDestroyView();
Log.e("fragment 生命周期","onDestroyView");
//解除Messenger注册
Messenger.getDefault().unregister(viewModel);
if (viewModel != null) {
......@@ -96,6 +100,7 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
rp =new RxPermissions(this);
Log.e("fragment 生命周期","onViewCreated");
//私有的初始化Databinding和ViewModel方法
initViewDataBinding(viewModelType());
//私有的ViewModel与View的契约事件回调逻辑
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment