通知公告
This commit is contained in:
parent
693590fcab
commit
eb9a12657b
@ -226,4 +226,8 @@ public class PathConfig {
|
|||||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_ADD = "/oamodule/fragment/superviseAdd";//发起督办事项
|
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_ADD = "/oamodule/fragment/superviseAdd";//发起督办事项
|
||||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_DETAIL = "/oamodule/fragment/superviseDetail";//督办详情
|
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_DETAIL = "/oamodule/fragment/superviseDetail";//督办详情
|
||||||
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_TRANSACT = "/oamodule/fragment/superviseTransact";//督办回复
|
public static final String PATH_MODULE_PAD_OA_FRAGMENT_SUPERVISE_TRANSACT = "/oamodule/fragment/superviseTransact";//督办回复
|
||||||
|
|
||||||
|
public static final String PATH_MODULE_PAD_OA_FRAGMENT_NOTICE_LIST = "/oamodule/fragment/noticeList";//通知公告
|
||||||
|
public static final String PATH_MODULE_PAD_OA_FRAGMENT_NOTICE_DETAIL = "/oamodule/fragment/noticeDetail";//通知公告详情
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,270 @@
|
|||||||
|
package com.tenlionsoft.oamodule.pad.fragments.home.notice;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.net.http.SslError;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.webkit.HttpAuthHandler;
|
||||||
|
import android.webkit.JsResult;
|
||||||
|
import android.webkit.SslErrorHandler;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import com.tenlionsoft.baselib.constant.PathConfig;
|
||||||
|
import com.tenlionsoft.baselib.core.beans.BaseSuccessBean;
|
||||||
|
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.core.widget.views.NestedScrollWebView;
|
||||||
|
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||||
|
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||||
|
import com.tenlionsoft.oamodule.R;
|
||||||
|
import com.tenlionsoft.oamodule.R2;
|
||||||
|
import com.tenlionsoft.oamodule.beans.NoticeListBean;
|
||||||
|
import com.tenlionsoft.oamodule.net.OAApi;
|
||||||
|
import com.tenlionsoft.oamodule.pad.activitys.home.PadMainActivity;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
|
import static com.luck.picture.lib.thread.PictureThreadUtils.runOnUiThread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作者: adam
|
||||||
|
* 日期: 2022/5/9 - 17:39
|
||||||
|
* 邮箱: itgaojian@163.com
|
||||||
|
* 描述: 通知公告详情
|
||||||
|
*/
|
||||||
|
@Route(path = PathConfig.PATH_MODULE_PAD_OA_FRAGMENT_NOTICE_DETAIL)
|
||||||
|
public class NoticeDetailFragment extends BaseFragment {
|
||||||
|
|
||||||
|
@BindView(R2.id.tv_title)
|
||||||
|
TextView mTvTitle;
|
||||||
|
@BindView(R2.id.tv_time)
|
||||||
|
TextView mTvTime;
|
||||||
|
@BindView(R2.id.tv_num)
|
||||||
|
TextView mTvNum;
|
||||||
|
@BindView(R2.id.tv_type)
|
||||||
|
TextView mTvType;
|
||||||
|
@BindView(R2.id.tv_level)
|
||||||
|
TextView mTvLevel;
|
||||||
|
@BindView(R2.id.rlv_files)
|
||||||
|
RecyclerView mRlvFiles;
|
||||||
|
@BindView(R2.id.nsw_web)
|
||||||
|
NestedScrollWebView mNswWeb;
|
||||||
|
@BindView(R2.id.ll_num)
|
||||||
|
LinearLayout mLlNum;
|
||||||
|
@BindView(R2.id.tv_read_state)
|
||||||
|
TextView mTvReadState;
|
||||||
|
private String mId;
|
||||||
|
private NoticeListBean.RowsBean mBean;
|
||||||
|
private PadMainActivity mMainActivity;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getContentViewId() {
|
||||||
|
return R.layout.fragment_notice_detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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");
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(mId)) {
|
||||||
|
ToastUtils.show("数据有误");
|
||||||
|
mMainActivity.backFragment(1, this);
|
||||||
|
} else {
|
||||||
|
getDetailById(mId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull @NotNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
mMainActivity = (PadMainActivity) getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情
|
||||||
|
*/
|
||||||
|
private void getDetailById(String id) {
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.getNoticeDetailById(id)
|
||||||
|
.compose(RxTransformer.getTransformer())
|
||||||
|
.subscribe(new Observer<NoticeListBean.RowsBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(NoticeListBean.@io.reactivex.rxjava3.annotations.NonNull RowsBean rowsBean) {
|
||||||
|
setDataToView(rowsBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||||
|
setStateView(STATE_ERROR);
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回显数据
|
||||||
|
*/
|
||||||
|
private void setDataToView(NoticeListBean.RowsBean bean) {
|
||||||
|
setStateView(STATE_SUCCESS);
|
||||||
|
mSrlView.setEnableLoadMore(false);
|
||||||
|
mSrlView.setEnableRefresh(false);
|
||||||
|
mBean = bean;
|
||||||
|
mTvTitle.setText(bean.getNoticeTitle());
|
||||||
|
mTvTime.setText("发布时间:" + bean.getNoticeCheckTime());
|
||||||
|
mTvNum.setText(bean.getNoticeReadCount() + "");
|
||||||
|
mTvType.setText(bean.getNoticeTypeName());
|
||||||
|
switch (bean.getNoticeLevel()) {
|
||||||
|
case "1":
|
||||||
|
mTvLevel.setText("紧急");
|
||||||
|
mTvLevel.setTextColor(Color.RED);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
mTvLevel.setText("一般");
|
||||||
|
mTvLevel.setTextColor(Color.GREEN);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
mTvLevel.setText("普通");
|
||||||
|
mTvLevel.setTextColor(Color.BLACK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断状态 1全部人员 2指定部门 3指定人员
|
||||||
|
if (!"1".equals(bean.getNoticeRange())) {
|
||||||
|
if ("1".equals(bean.getNoticeReadStatus())) {
|
||||||
|
mTvReadState.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mTvReadState.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mTvReadState.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
WebSettings settings = mNswWeb.getSettings();
|
||||||
|
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
|
settings.setAppCacheEnabled(true);
|
||||||
|
settings.setJavaScriptEnabled(true);//启用JS
|
||||||
|
settings.setBlockNetworkImage(true);//阻塞页面图片加载
|
||||||
|
settings.setDomStorageEnabled(true);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
mNswWeb.loadData(bean.getNoticeContent(), "text/html", "utf-8");
|
||||||
|
|
||||||
|
mNswWeb.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||||
|
handler.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
view.getSettings().setBlockNetworkImage(false);//开启页面图片加载
|
||||||
|
doSaveReadState();
|
||||||
|
runOnUiThread(() -> mNswWeb.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
|
||||||
|
super.onReceivedHttpAuthRequest(view, handler, host, realm);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
view.loadUrl(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mNswWeb.setWebChromeClient(new WebChromeClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
|
||||||
|
return super.onJsAlert(view, url, message, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存已读
|
||||||
|
*/
|
||||||
|
private void doSaveReadState() {
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.doSaveReadNotice(mId, "true", "false")
|
||||||
|
.compose(RxTransformer.getTransformer())
|
||||||
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean baseSuccessBean) {
|
||||||
|
LogUtils.e("通知公告已读==" + mId);
|
||||||
|
if (!"1".equals(mBean.getNoticeRange())) {
|
||||||
|
mTvReadState.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mTvReadState.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadMoreData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,324 @@
|
|||||||
|
package com.tenlionsoft.oamodule.pad.fragments.home.notice;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||||
|
import com.bigkoo.pickerview.view.TimePickerView;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||||
|
import com.tenlionsoft.baselib.constant.PathConfig;
|
||||||
|
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.core.widget.base.FragmentUtils;
|
||||||
|
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||||
|
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.NoticeAdapter;
|
||||||
|
import com.tenlionsoft.oamodule.beans.NoticeListBean;
|
||||||
|
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.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
|
||||||
|
* 邮箱: itgaojian@163.com
|
||||||
|
* 描述:
|
||||||
|
*/
|
||||||
|
@Route(path = PathConfig.PATH_MODULE_PAD_OA_FRAGMENT_NOTICE_LIST)
|
||||||
|
public class NoticeListFragment extends BaseFragment {
|
||||||
|
@BindView(R2.id.et_base_search_cancel)
|
||||||
|
EditText mEtBaseSearchCancel;
|
||||||
|
@BindView(R2.id.tv_base_search_cancel)
|
||||||
|
TextView mTvBaseSearchCancel;
|
||||||
|
@BindView(R2.id.ll_base_search_cancel)
|
||||||
|
LinearLayout mLlBaseSearchCancel;
|
||||||
|
@BindView(R2.id.tv_start_date)
|
||||||
|
TextView mTvStartDate;
|
||||||
|
@BindView(R2.id.tv_end_date)
|
||||||
|
TextView mTvEndDate;
|
||||||
|
@BindView(R2.id.rlv_content)
|
||||||
|
RecyclerView mRlvContent;
|
||||||
|
@BindView(R2.id.srl_content)
|
||||||
|
SmartRefreshLayout mSrlContent;
|
||||||
|
@BindView(R2.id.pb_loading)
|
||||||
|
ProgressBar mLoading;
|
||||||
|
@BindView(R2.id.iv_empty_data)
|
||||||
|
ImageView mIvData;
|
||||||
|
@BindView(R2.id.tv_error_hint)
|
||||||
|
TextView mTvHint;
|
||||||
|
|
||||||
|
|
||||||
|
private int mCurrentPage = 1;
|
||||||
|
private String mKeywords = "";
|
||||||
|
|
||||||
|
private List<NoticeListBean.RowsBean> mDatas;
|
||||||
|
private NoticeAdapter mAdapter;
|
||||||
|
private PadMainActivity mMainActivity;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getContentViewId() {
|
||||||
|
return R.layout.fragment_notice_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setDataToView(View dataView) {
|
||||||
|
ButterKnife.bind(this, dataView);
|
||||||
|
setTitleView(true);
|
||||||
|
mTvFragmentTitle.setText("通知公告");
|
||||||
|
mIvFragmentBack.setOnClickListener(v -> mMainActivity.backFragment(1, this));
|
||||||
|
setStateView(STATE_SUCCESS);
|
||||||
|
mSrlView.setEnableRefresh(false);
|
||||||
|
mSrlView.setEnableLoadMore(false);
|
||||||
|
initViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@androidx.annotation.NonNull @NotNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
mMainActivity = (PadMainActivity) getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews() {
|
||||||
|
mTvStartDate.setOnClickListener(v -> onShowDate(1));
|
||||||
|
mTvEndDate.setOnClickListener(v -> onShowDate(2));
|
||||||
|
mDatas = new ArrayList<>();
|
||||||
|
mAdapter = new NoticeAdapter(mActivity, mDatas);
|
||||||
|
refreshPageState(STATE_LOAD_LOADING);
|
||||||
|
mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||||
|
mRlvContent.setAdapter(mAdapter);
|
||||||
|
mAdapter.addOnItemClickListener(bean -> {
|
||||||
|
BaseFragment fragment = FragmentUtils.getFragmentOne(PathConfig.PATH_MODULE_PAD_OA_FRAGMENT_NOTICE_DETAIL, "id", bean.getNoticeId());
|
||||||
|
mMainActivity.addFragment(1, fragment);
|
||||||
|
});
|
||||||
|
mSrlContent.setOnRefreshListener(v -> doRefresh());
|
||||||
|
mSrlContent.setOnLoadMoreListener(v -> doLoadMore());
|
||||||
|
mTvBaseSearchCancel.setOnClickListener(v -> doResetCondition());
|
||||||
|
doRefresh();
|
||||||
|
mEtBaseSearchCancel.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
|
LogUtils.e("搜索==" + actionId);
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
|
mActivity.hideSoftKeyboard();
|
||||||
|
mEtBaseSearchCancel.clearFocus();
|
||||||
|
mKeywords = v.getText().toString();
|
||||||
|
doRefresh();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mTvBaseSearchCancel.setOnClickListener(v -> {
|
||||||
|
mEtBaseSearchCancel.setText("");
|
||||||
|
mEtBaseSearchCancel.clearFocus();
|
||||||
|
mTvStartDate.setText("");
|
||||||
|
mTvEndDate.setText("");
|
||||||
|
mKeywords = "";
|
||||||
|
doRefresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doResetCondition() {
|
||||||
|
//重置搜索条件
|
||||||
|
refreshPageState(STATE_LOAD_LOADING);
|
||||||
|
mEtBaseSearchCancel.setText("");
|
||||||
|
mTvStartDate.setText("");
|
||||||
|
mTvEndDate.setText("");
|
||||||
|
doRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间选择
|
||||||
|
*/
|
||||||
|
private void onShowDate(int i) {
|
||||||
|
TimePickerView mTimePickerView = new TimePickerBuilder(mActivity, (date, v) -> {
|
||||||
|
switch (i) {
|
||||||
|
case 1:
|
||||||
|
mTvStartDate.setText(TimeUtils.dateToString(date));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//判断时间大小
|
||||||
|
String start = mTvStartDate.getText().toString().trim();
|
||||||
|
int span = TimeUtils.compareDate(date, TimeUtils.stringToDate(start));
|
||||||
|
if (span >= 0) {
|
||||||
|
mTvEndDate.setText(TimeUtils.dateToString(date));
|
||||||
|
refreshPageState(STATE_LOAD_LOADING);
|
||||||
|
doRefresh();
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("结束时间须大于开始时间");
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
mTimePickerView.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新页面
|
||||||
|
*
|
||||||
|
* @param state 页面状态码
|
||||||
|
*/
|
||||||
|
public void refreshPageState(int state) {
|
||||||
|
switch (state) {
|
||||||
|
case STATE_LOAD_LOADING://加载中
|
||||||
|
mLoading.setVisibility(View.VISIBLE);
|
||||||
|
mIvData.setVisibility(View.GONE);
|
||||||
|
mTvHint.setVisibility(View.VISIBLE);
|
||||||
|
mTvHint.setText(getResources().getString(com.tenlionsoft.baselib.R.string.loading));
|
||||||
|
mRlvContent.setVisibility(View.INVISIBLE);
|
||||||
|
break;
|
||||||
|
case STATE_LOAD_SUCCESS://加载成功
|
||||||
|
mLoading.setVisibility(View.GONE);
|
||||||
|
mIvData.setVisibility(View.GONE);
|
||||||
|
mTvHint.setVisibility(View.GONE);
|
||||||
|
mRlvContent.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
case STATE_LOAD_EMPTY://空数据
|
||||||
|
mLoading.setVisibility(View.GONE);
|
||||||
|
mIvData.setVisibility(View.VISIBLE);
|
||||||
|
mIvData.setBackgroundResource(com.tenlionsoft.baselib.R.drawable.ic_empty_data);
|
||||||
|
mTvHint.setVisibility(View.VISIBLE);
|
||||||
|
mTvHint.setText(getResources().getString(com.tenlionsoft.baselib.R.string.empty_data));
|
||||||
|
mRlvContent.setVisibility(View.INVISIBLE);
|
||||||
|
break;
|
||||||
|
case STATE_LOAD_ERROR:
|
||||||
|
mLoading.setVisibility(View.GONE);
|
||||||
|
mIvData.setVisibility(View.VISIBLE);
|
||||||
|
mTvHint.setVisibility(View.VISIBLE);
|
||||||
|
mIvData.setBackgroundResource(com.tenlionsoft.baselib.R.drawable.ic_load_error);
|
||||||
|
mTvHint.setText(getResources().getString(com.tenlionsoft.baselib.R.string.loading_error));
|
||||||
|
mRlvContent.setVisibility(View.INVISIBLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载更多
|
||||||
|
*/
|
||||||
|
private void doLoadMore() {
|
||||||
|
getNoticeList(mCurrentPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新
|
||||||
|
*/
|
||||||
|
private void doRefresh() {
|
||||||
|
mDatas.clear();
|
||||||
|
mAdapter.setData(mDatas);
|
||||||
|
getNoticeList(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我接受的工作
|
||||||
|
*/
|
||||||
|
private void getNoticeList(int currentPage) {
|
||||||
|
mCurrentPage = currentPage;
|
||||||
|
String start = mTvStartDate.getText().toString().trim();
|
||||||
|
String end = mTvEndDate.getText().toString().trim();
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.getNoticeList(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());
|
||||||
|
} 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 {
|
||||||
|
mSrlContent.finishRefresh();
|
||||||
|
mSrlContent.finishLoadMore();
|
||||||
|
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 onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadMoreData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
133
oamodule/src/main/res/layout/fragment_notice_detail.xml
Normal file
133
oamodule/src/main/res/layout/fragment_notice_detail.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/gray_f0"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="none"
|
||||||
|
tools:context=".activity.notify.NoticeDetailActivity">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/text_16"
|
||||||
|
tools:text="通知公告通知公告通知公告通知公告通知公告通知公告通知公告通知公告" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:textSize="@dimen/text_12"
|
||||||
|
tools:text="发布时间:2022-22-22 12:12:12" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_toRightOf="@id/tv_time"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:src="@drawable/ic_read_num_hint" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="@dimen/text_12"
|
||||||
|
tools:text="129" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_type"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/text_12"
|
||||||
|
tools:text="类型" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textSize="@dimen/text_12"
|
||||||
|
tools:text="等级" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_read_state"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:text="已读"
|
||||||
|
android:textColor="@color/red_ff"
|
||||||
|
android:textSize="@dimen/text_12" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<com.tenlionsoft.baselib.core.widget.views.NestedScrollWebView
|
||||||
|
android:id="@+id/nsw_web"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="200dp" />
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rlv_files"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
120
oamodule/src/main/res/layout/fragment_notice_list.xml
Normal file
120
oamodule/src/main/res/layout/fragment_notice_list.xml
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/gray_f0"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
tools:context=".activity.meeting.MeetingCenterActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<include layout="@layout/layout_base_search_cancel" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/shp_rectangle_white_5"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_start_date"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableLeft="@drawable/ic_arrow_cir"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="开始日期"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="至"
|
||||||
|
android:textColor="@color/black" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_end_date"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="结束日期"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@color/white">
|
||||||
|
|
||||||
|
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||||
|
android:id="@+id/srl_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rlv_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:padding="5dp"
|
||||||
|
tools:listitem="@layout/item_notice" />
|
||||||
|
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/pb_loading"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:indeterminateBehavior="repeat"
|
||||||
|
android:indeterminateDrawable="@drawable/anim_loading" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_empty_data"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_error_hint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
tools:text="加载数据失败" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user