新闻
This commit is contained in:
parent
d9548a4184
commit
b0accf1e3c
@ -8,6 +8,10 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
@ -34,9 +38,6 @@ 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.Observer;
|
||||
@ -130,9 +131,9 @@ public class NewsCenterActivity extends BaseActivity {
|
||||
mRlvContent.setAdapter(mNewsAdapter);
|
||||
mRlvContent.addItemDecoration(new ItemSplitDivider(mActivity, LinearLayoutManager.VERTICAL, 1, Color.parseColor("#b4b4b4")));
|
||||
mNewsAdapter.addOnItemClickListener(newsDetailBean -> ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_OA_ACTIVITY_NEWS_DETAIL)
|
||||
.withString("id", newsDetailBean.getContentId())
|
||||
.navigation());
|
||||
.build(PathConfig.PATH_MODULE_OA_ACTIVITY_NEWS_DETAIL)
|
||||
.withString("id", newsDetailBean.getContentId())
|
||||
.navigation());
|
||||
mSrlContent.setOnRefreshListener(v -> doRefresh());
|
||||
mSrlContent.setOnLoadMoreListener(v -> doLoadMore());
|
||||
mTvBaseSearchCancel.setOnClickListener(v -> doResetCondition());
|
||||
@ -162,43 +163,43 @@ public class NewsCenterActivity extends BaseActivity {
|
||||
*/
|
||||
private void getNewsTypeList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getNewsTypeList()
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<NewsTypeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.getNewsTypeList()
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<NewsTypeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<NewsTypeBean> newsTypeBeans) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTypes.clear();
|
||||
NewsTypeBean bean = new NewsTypeBean();
|
||||
bean.setChecked(true);
|
||||
bean.setCategoryId("");
|
||||
bean.setTitle("全部");
|
||||
mTvType.setText("全部");
|
||||
mSelItemPosition = 0;
|
||||
mTypes.add(bean);
|
||||
mTypes.addAll(newsTypeBeans);
|
||||
mSelType = bean.getCategoryId();
|
||||
mTypeAdapter.setData(mTypes);
|
||||
doRefresh();
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<NewsTypeBean> newsTypeBeans) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTypes.clear();
|
||||
NewsTypeBean bean = new NewsTypeBean();
|
||||
bean.setChecked(true);
|
||||
bean.setCategoryId("");
|
||||
bean.setTitle("全部");
|
||||
mTvType.setText("全部");
|
||||
mSelItemPosition = 0;
|
||||
mTypes.add(bean);
|
||||
mTypes.addAll(newsTypeBeans);
|
||||
mSelType = bean.getCategoryId();
|
||||
mTypeAdapter.setData(mTypes);
|
||||
doRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doResetCondition() {
|
||||
@ -231,62 +232,62 @@ public class NewsCenterActivity extends BaseActivity {
|
||||
private void getNewsList(int currentPage) {
|
||||
mCurrentPage = currentPage;
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getNewsList(mCurrentPage + "", mKeywords, mSelType)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NewsListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.getNewsList(mCurrentPage + "", mKeywords, mSelType)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NewsListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull NewsListBean listBean) {
|
||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||
++mCurrentPage;
|
||||
if (currentPage == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(listBean.getRows());
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull NewsListBean listBean) {
|
||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||
++mCurrentPage;
|
||||
if (currentPage == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(listBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(listBean.getRows());
|
||||
}
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
mNewsAdapter.notifyDataSetChanged();
|
||||
mSrlContent.finishRefresh();
|
||||
if (mDatas.size() >= listBean.getTotal()) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(false);
|
||||
}
|
||||
} else {
|
||||
mDatas.addAll(listBean.getRows());
|
||||
}
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
mNewsAdapter.notifyDataSetChanged();
|
||||
mSrlContent.finishRefresh();
|
||||
if (mDatas.size() >= listBean.getTotal()) {
|
||||
mSrlContent.finishRefresh();
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(false);
|
||||
}
|
||||
} else {
|
||||
mSrlContent.finishRefresh();
|
||||
mSrlContent.finishLoadMore();
|
||||
if (currentPage > 1) {
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
if (!TextUtils.isEmpty(mKeywords)) {
|
||||
ToastUtils.show("未查询到相关内容");
|
||||
if (currentPage > 1) {
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
if (!TextUtils.isEmpty(mKeywords)) {
|
||||
ToastUtils.show("未查询到相关内容");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,6 +13,8 @@ import android.webkit.WebViewClient;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.tenlionsoft.baselib.constant.PathConfig;
|
||||
@ -26,7 +28,6 @@ import com.tenlionsoft.oamodule.R2;
|
||||
import com.tenlionsoft.oamodule.beans.NewsDetailBean;
|
||||
import com.tenlionsoft.oamodule.net.OAApi;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
@ -79,31 +80,31 @@ public class NewsDetailActivity extends BaseActivity {
|
||||
*/
|
||||
private void getDetailById(String id) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getNewsDetailById(id)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NewsDetailBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.getNewsDetailById(id)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NewsDetailBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull NewsDetailBean rowsBean) {
|
||||
setDataToView(rowsBean);
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull NewsDetailBean rowsBean) {
|
||||
setDataToView(rowsBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.tenlionsoft.oamodule.pad.fragments.home.notice;
|
||||
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_EMPTY;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_ERROR;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_LOADING;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_SUCCESS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
@ -11,6 +16,9 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||
import com.bigkoo.pickerview.view.TimePickerView;
|
||||
@ -26,9 +34,7 @@ import com.tenlionsoft.baselib.utils.LogUtils;
|
||||
import com.tenlionsoft.baselib.utils.TimeUtils;
|
||||
import com.tenlionsoft.oamodule.R;
|
||||
import com.tenlionsoft.oamodule.R2;
|
||||
import com.tenlionsoft.oamodule.adapter.NewsTypeAdapter;
|
||||
import com.tenlionsoft.oamodule.adapter.NoticeAdapter;
|
||||
import com.tenlionsoft.oamodule.beans.NewsTypeBean;
|
||||
import com.tenlionsoft.oamodule.beans.NoticeListBean;
|
||||
import com.tenlionsoft.oamodule.net.OAApi;
|
||||
import com.tenlionsoft.oamodule.pad.activitys.home.PadMainActivity;
|
||||
@ -38,19 +44,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_EMPTY;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_ERROR;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_LOADING;
|
||||
import static com.tenlionsoft.baselib.core.widget.base.BaseActivity.STATE_LOAD_SUCCESS;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2022/5/9 - 17:21
|
||||
@ -187,13 +186,13 @@ public class NoticeListFragment extends BaseFragment {
|
||||
break;
|
||||
}
|
||||
})
|
||||
.setTitleText("请选时间")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.isDialog(false)
|
||||
.setType(new boolean[]{true, true, true, false, false, false})
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
.setTitleText("请选时间")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.isDialog(false)
|
||||
.setType(new boolean[]{true, true, true, false, false, false})
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mTimePickerView.show();
|
||||
}
|
||||
|
||||
@ -261,62 +260,62 @@ public class NoticeListFragment extends BaseFragment {
|
||||
String start = mTvStartDate.getText().toString().trim();
|
||||
String end = mTvEndDate.getText().toString().trim();
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getNoticeList("2",PathConfig.NOTICE_CONFIG_ID,start, end, mKeywords, mCurrentPage + "", "10")
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NoticeListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.getNoticeList("2", PathConfig.NOTICE_CONFIG_ID, start, end, mKeywords, mCurrentPage + "", "10")
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<NoticeListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull NoticeListBean listBean) {
|
||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||
++mCurrentPage;
|
||||
if (currentPage == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(listBean.getRows());
|
||||
@Override
|
||||
public void onNext(@NonNull NoticeListBean listBean) {
|
||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||
++mCurrentPage;
|
||||
if (currentPage == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(listBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(listBean.getRows());
|
||||
}
|
||||
refreshPageState(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mSrlContent.finishRefresh();
|
||||
if (mDatas.size() >= listBean.getTotal()) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(false);
|
||||
}
|
||||
} else {
|
||||
mDatas.addAll(listBean.getRows());
|
||||
}
|
||||
refreshPageState(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mSrlContent.finishRefresh();
|
||||
if (mDatas.size() >= listBean.getTotal()) {
|
||||
mSrlContent.finishRefresh();
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.setNoMoreData(false);
|
||||
}
|
||||
} else {
|
||||
mSrlContent.finishRefresh();
|
||||
mSrlContent.finishLoadMore();
|
||||
if (currentPage > 1) {
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
refreshPageState(STATE_LOAD_EMPTY);
|
||||
if (!TextUtils.isEmpty(mKeywords)) {
|
||||
ToastUtils.show("未查询到相关内容");
|
||||
if (currentPage > 1) {
|
||||
mSrlContent.setNoMoreData(true);
|
||||
} else {
|
||||
refreshPageState(STATE_LOAD_EMPTY);
|
||||
if (!TextUtils.isEmpty(mKeywords)) {
|
||||
ToastUtils.show("未查询到相关内容");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshPageState(STATE_LOAD_ERROR);
|
||||
}
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshPageState(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user