平板更多功能、首页调整
This commit is contained in:
parent
29d2eb5252
commit
2f721bf817
@ -240,4 +240,5 @@ public class PathConfig {
|
||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_WORK_REPORT_DETAIL = "/oamodule/fragment/workReportDetail";//工作报告详情
|
||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_WORK_REPORT = "/oamodule/fragment/workReport";//工作报告
|
||||
|
||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_MORE_FUNCTION = "/oamodule/fragment/functionList";//功能列表
|
||||
}
|
||||
|
@ -57,12 +57,20 @@ public class FunctionListActivity extends BaseActivity {
|
||||
mSrlContent.setEnableLoadMore(false);
|
||||
mId = getIntent().getStringExtra("id");
|
||||
mDatas = new ArrayList();
|
||||
mAdapter = new FunctionSubAdapter(mActivity, mDatas);
|
||||
mAdapter = new FunctionSubAdapter(mActivity, mDatas,4);
|
||||
mRlvFunction.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvFunction.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(this::choosePage);
|
||||
doRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面跳转
|
||||
*/
|
||||
private void choosePage(FuncBean funcBean) {
|
||||
|
||||
}
|
||||
|
||||
private void doRefresh() {
|
||||
mDatas.clear();
|
||||
getMenuTypeList();
|
||||
|
@ -23,9 +23,11 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
* 描述:
|
||||
*/
|
||||
public class FunctionSubAdapter extends BaseRecyclerAdapter<FuncBean, FunctionHolder> {
|
||||
private int mCount=4;
|
||||
|
||||
public FunctionSubAdapter(Context ctx, List<FuncBean> list) {
|
||||
public FunctionSubAdapter(Context ctx, List<FuncBean> list,int count) {
|
||||
super(ctx, list);
|
||||
this.mCount= count;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,8 +42,8 @@ public class FunctionSubAdapter extends BaseRecyclerAdapter<FuncBean, FunctionHo
|
||||
h.mTvTitle.setText(bean.getAppFunctionName());
|
||||
LogUtils.e(bean.getSubList().size());
|
||||
if (bean.getSubList().size() > 0) {
|
||||
FunctionTitleNumAdapter adapter = new FunctionTitleNumAdapter(mContext, bean.getSubList(), 4, 5);
|
||||
h.mRlvFuncs.setLayoutManager(new GridLayoutManager(mContext, 4));
|
||||
FunctionTitleNumAdapter adapter = new FunctionTitleNumAdapter(mContext, bean.getSubList(), mCount, 5);
|
||||
h.mRlvFuncs.setLayoutManager(new GridLayoutManager(mContext, mCount));
|
||||
h.mLlFuncHint.setVisibility(View.GONE);
|
||||
h.mRlvFuncs.setAdapter(adapter);
|
||||
if (mListener != null) {
|
||||
|
@ -9,6 +9,9 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
@ -207,6 +210,12 @@ public class PadMainActivity extends BaseActivity {
|
||||
if (isNavBarHasShown(this)) {
|
||||
checkNavigation();
|
||||
}
|
||||
Glide.with(mActivity)
|
||||
.load(BaseUrlApi.BASE_IMG_URL + UserLgUtils.getAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||
.error(R.drawable.ic_user_default)
|
||||
.placeholder(R.drawable.ic_user_default))
|
||||
.into(mIvUserIcon);
|
||||
}
|
||||
|
||||
//适配虚拟按钮
|
||||
|
@ -173,7 +173,7 @@ public class PadOaMainFragment extends BaseFragment {
|
||||
private void choosePage(FuncBean funcBean) {
|
||||
String path = funcBean.getAppFunctionPath().replace("activity", "fragment");
|
||||
//fragment栈管理
|
||||
BaseFragment fragment = FragmentUtils.getFragment(path);
|
||||
BaseFragment fragment = FragmentUtils.getFragmentOne(path, "id", funcBean.getAppFunctionId());
|
||||
if (fragment != null) {
|
||||
mPadMainActivity.addFragment(1, fragment);
|
||||
}
|
||||
|
@ -0,0 +1,204 @@
|
||||
package com.tenlionsoft.oamodule.pad.fragments.home.funcations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.tenlionsoft.baselib.constant.PathConfig;
|
||||
import com.tenlionsoft.baselib.core.beans.FuncBean;
|
||||
import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager;
|
||||
import com.tenlionsoft.baselib.core.retrofit_net.conver.RxTransformer;
|
||||
import com.tenlionsoft.baselib.core.widget.base.BaseFragment;
|
||||
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||
import com.tenlionsoft.oamodule.R;
|
||||
import com.tenlionsoft.oamodule.R2;
|
||||
import com.tenlionsoft.oamodule.adapter.FunctionSubAdapter;
|
||||
import com.tenlionsoft.oamodule.net.OAApi;
|
||||
import com.tenlionsoft.oamodule.pad.activitys.home.PadMainActivity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2022/5/10 - 15:17
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 更多功能
|
||||
*/
|
||||
@Route(path = PathConfig.PATH_MODULE_PAD_OA_FRAGMENT_MORE_FUNCTION)
|
||||
public class MoreMenuFragment extends BaseFragment {
|
||||
|
||||
@BindView(R2.id.rlv_function)
|
||||
RecyclerView mRlvFunction;
|
||||
private PadMainActivity mMainActivity;
|
||||
private String mId;
|
||||
private List<FuncBean> mDatas;
|
||||
private FunctionSubAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected int getContentViewId() {
|
||||
return R.layout.fragment_more_menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDataToView(View dataView) {
|
||||
ButterKnife.bind(this, dataView);
|
||||
setTitleView(true);
|
||||
mTvFragmentTitle.setText("更多功能");
|
||||
mIvFragmentBack.setOnClickListener(v -> mMainActivity.backFragment(1, this));
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
mId = bundle.getString("id");
|
||||
}
|
||||
mDatas = new ArrayList();
|
||||
mAdapter = new FunctionSubAdapter(mActivity, mDatas, 6);
|
||||
mRlvFunction.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvFunction.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(this::choosePage);
|
||||
refreshView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面跳转
|
||||
*/
|
||||
private void choosePage(FuncBean funcBean) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单类型
|
||||
*/
|
||||
private void getMenuTypeList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getMenuTypeList(mId)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<FuncBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<FuncBean> funcBeans) {
|
||||
mSrlView.finishRefresh();
|
||||
mSrlView.finishLoadMore();
|
||||
|
||||
if (funcBeans.size() > 0) {
|
||||
setStateView(STATE_SUCCESS);
|
||||
for (int i = 0; i < funcBeans.size(); i++) {
|
||||
funcBeans.get(i).setSubList(new ArrayList<>());
|
||||
}
|
||||
getMenuList(funcBeans);
|
||||
} else {
|
||||
setStateView(STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.finishRefresh();
|
||||
setStateView(STATE_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int mCount = 0;
|
||||
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
private void getMenuList(List<FuncBean> funcBeans) {
|
||||
List<Observable<List<FuncBean>>> requests = new ArrayList<>();
|
||||
for (int i = 0; i < funcBeans.size(); i++) {
|
||||
Observable<List<FuncBean>> observable = createObservable(funcBeans.get(i).getAppFunctionId());
|
||||
if (observable == null) return;
|
||||
requests.add(observable);
|
||||
}
|
||||
Observable<List<FuncBean>>[] observables1 = requests.toArray(new Observable[requests.size()]);
|
||||
Observable.mergeArrayDelayError(observables1)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<FuncBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<FuncBean> beans) {
|
||||
++mCount;
|
||||
if (beans.size() > 0) {
|
||||
for (int i = 0; i < funcBeans.size(); i++) {
|
||||
if (beans.get(0).getAppFunctionParentId().equals(funcBeans.get(i).getAppFunctionId())) {
|
||||
funcBeans.get(i).setSubList(beans);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mCount == funcBeans.size()) {
|
||||
mCount = 0;
|
||||
mDatas = funcBeans;
|
||||
mAdapter.setData(mDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
mCount = 0;
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Observable<List<FuncBean>> createObservable(String id) {
|
||||
return RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getMenuListByPid(id)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull @NotNull Context context) {
|
||||
super.onAttach(context);
|
||||
mMainActivity = (PadMainActivity) getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void refreshView() {
|
||||
setStateView(STATE_LOAD);
|
||||
mDatas.clear();
|
||||
mAdapter.setData(mDatas);
|
||||
getMenuTypeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadMoreData() {
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.setNoMoreData(true);
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
}
|
||||
}
|
@ -97,7 +97,7 @@ public class WorkReportAddFragment extends BaseFragment {
|
||||
ButterKnife.bind(this, dataView);
|
||||
setTitleView(true);
|
||||
mTvFragmentTitle.setText("工作报告新增");
|
||||
mIvFragmentBack.setOnClickListener(v->mMainActivity.backFragment(1,this));
|
||||
mIvFragmentBack.setOnClickListener(v -> mMainActivity.backFragment(1, this));
|
||||
setStateView(STATE_SUCCESS);
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
mSrlView.setEnableRefresh(false);
|
||||
@ -384,6 +384,8 @@ public class WorkReportAddFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void loadMoreData() {
|
||||
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.setNoMoreData(true);
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
}
|
||||
}
|
||||
|
@ -323,6 +323,8 @@ public class WorkReportDetailFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void loadMoreData() {
|
||||
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.setNoMoreData(true);
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
}
|
||||
}
|
||||
|
@ -215,6 +215,8 @@ public class WorkReportFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void loadMoreData() {
|
||||
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.setNoMoreData(true);
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
tools:context=".pad.activitys.home.PadMainActivity">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
@ -19,7 +19,6 @@
|
||||
android:id="@+id/iv_user_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
tools:src="@drawable/ic_user_default" />
|
||||
@ -28,8 +27,8 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="80dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
@ -161,7 +160,7 @@
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <androidx.viewpager2.widget.ViewPager2-->
|
||||
<!-- android:id="@+id/vp_content"-->
|
||||
|
18
oamodule/src/main/res/layout/fragment_more_menu.xml
Normal file
18
oamodule/src/main/res/layout/fragment_more_menu.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gray_f0"
|
||||
tools:context=".activity.common.FunctionListActivity">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_function"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
tools:listitem="@layout/item_type_function" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user