Commit 311f21cd authored by 陈前's avatar 陈前

公告完成

parent a61f8a73
...@@ -64,6 +64,12 @@ ...@@ -64,6 +64,12 @@
android:name=".ui.settle.SettleActivity" android:name=".ui.settle.SettleActivity"
android:configChanges="keyboard|orientation|screenSize|keyboardHidden" android:configChanges="keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode="adjustUnspecified|stateHidden"/> android:windowSoftInputMode="adjustUnspecified|stateHidden"/>
<activity
android:name=".ui.announcement.AnnouncementActivity"
android:configChanges="keyboard|orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.xingdata.zzdpos.ui.announcement; package com.xingdata.zzdpos.ui.announcement;
import com.xingdata.zzdpos.R; import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity; import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.databinding.ActivityAnnouncementBinding; import com.xingdata.zzdpos.databinding.ActivityAnnouncementBinding;
import com.xingdata.zzdpos.model.Notice;
import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.ui.announcement.fragment.AnnouncementFragment; import com.xingdata.zzdpos.ui.announcement.fragment.AnnouncementFragment;
...@@ -21,23 +22,16 @@ public class AnnouncementActivity extends BaseActivity<AnnouncementPresenter, Ac ...@@ -21,23 +22,16 @@ public class AnnouncementActivity extends BaseActivity<AnnouncementPresenter, Ac
@Override @Override
public void initView() { public void initView() {
// mViewBinding.imgBack.setOnClickListener(view -> { loadRootFragment(R.id.fragment_container, mAnnouncementFragment, false, false);
// finish();
// });
// loadRootFragment(R.id.f_right, mAnnouncementDetailFragment, false, false);
// loadRootFragment(R.id.f_left, mAnnouncementTitleFragment, false, false);
} }
//
//
// @Override // @Override
// public void showAnnouncementDetail(Notice s) { // public void showAnnouncementDetail(Notice s) {
// mAnnouncementDetailFragment.showAnnouncementDetail(s); // mAnnouncementDetailFragment.showAnnouncementDetail(s);
// } // }
//
// @Override @Override
// public void loadNotice(Pager<Notice> noticePager, boolean isRefresh) { public void loadNotice(Pager<Notice> noticePager, boolean isRefresh) {
// mAnnouncementTitleFragment.setData(noticePager, isRefresh); mAnnouncementFragment.setData(noticePager, isRefresh);
// } }
} }
...@@ -3,35 +3,30 @@ package com.xingdata.zzdpos.ui.announcement; ...@@ -3,35 +3,30 @@ package com.xingdata.zzdpos.ui.announcement;
import com.xingdata.zzdpos.base.BasePresenter; import com.xingdata.zzdpos.base.BasePresenter;
import com.xingdata.zzdpos.base.BaseView; import com.xingdata.zzdpos.base.BaseView;
import com.xingdata.zzdpos.model.Notice;
import com.xingdata.zzdpos.model.Pager;
public interface AnnouncementContract { public interface AnnouncementContract {
interface View extends BaseView { interface View extends BaseView {
// /**
// /** * 加载列表
// * 显示公告内容 */
// */ void loadNotice(Pager<Notice> noticePager, boolean isRefresh);
// void showAnnouncementDetail(Notice s);
// /**
// * 加载列表
// */
// void loadNotice(Pager<Notice> noticePager, boolean isRefresh);
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
// /** /**
// * 初始化查询公告列表 * 初始化查询公告列表
// * */
// */ abstract void queryNoticeList();
// abstract void queryNoticeList();
// public abstract void refreshAnnouncement();
// /**
// * 点击公告标题 public abstract void loadMoreAnnouncement();
// */
// abstract void clickTitleItem(Notice notice);
} }
} }
package com.xingdata.zzdpos.ui.announcement; package com.xingdata.zzdpos.ui.announcement;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.api.ApiFactory;
public class AnnouncementPresenter extends AnnouncementContract.Presenter { public class AnnouncementPresenter extends AnnouncementContract.Presenter {
private int nowPageNumber = 1; private int nowPageNumber = 1;
private int nowPageSize = 10; private int nowPageSize = 10;
...@@ -8,26 +11,34 @@ public class AnnouncementPresenter extends AnnouncementContract.Presenter { ...@@ -8,26 +11,34 @@ public class AnnouncementPresenter extends AnnouncementContract.Presenter {
@Override @Override
public void onAttached() { public void onAttached() {
} }
//
// @Override @Override
// public void queryNoticeList() { public void queryNoticeList() {
// ApiFactory.Notice.queryNotice(nowPageNumber, nowPageSize).doFinally(() -> { ApiFactory.Notice.queryNotice(nowPageNumber, nowPageSize).doFinally(() -> {
//// mView.isShowLoading(false); // mView.isShowLoading(false);
// }) })
// .subscribe(noticePager -> { .subscribe(noticePager -> {
// if (noticePager.getTotalRow() == 0) { if (noticePager.getTotalRow() == 0) {
// ToastUtils.showShort("抱歉,暂无公告"); ToastUtils.showShort("抱歉,暂无公告");
// } }
// //判断是否能加载更多 //判断是否能加载更多
// mView.loadNotice(noticePager, nowPageNumber == 1); mView.loadNotice(noticePager, nowPageNumber == 1);
// }, throwable -> { }, throwable -> {
// ToastUtils.showShort(throwable.getMessage()); ToastUtils.showShort(throwable.getMessage());
// }); });
// } }
//
// @Override @Override
// public void clickTitleItem(Notice s) { public void refreshAnnouncement() {
// mView.showAnnouncementDetail(s); this.nowPageNumber = 1;
// } queryNoticeList();
//} }
@Override
public void loadMoreAnnouncement() {
this.nowPageNumber++;
queryNoticeList();
}
} }
\ No newline at end of file
//package com.xingdata.zzdpos.ui.announcement.adapter; package com.xingdata.zzdpos.ui.announcement.adapter;
//
//
//import android.support.annotation.Nullable; import android.support.annotation.Nullable;
//import android.view.View; import android.view.View;
//import android.view.ViewGroup; import android.view.ViewGroup;
//
//import com.blankj.utilcode.util.TimeUtils; import com.blankj.utilcode.util.TimeUtils;
//import com.xingdata.zzdhd.R; import com.xingdata.zzdpos.R;
//import com.xingdata.zzdhd.base.BaseAdapter;
//import com.xingdata.zzdhd.base.BaseViewHolder; import com.xingdata.zzdpos.base.BaseAdapter;
//import com.xingdata.zzdhd.databinding.ItemAnnouncementBinding; import com.xingdata.zzdpos.databinding.ItemAnnouncementDetailBinding;
//import com.xingdata.zzdhd.model.Notice; import com.xingdata.zzdpos.model.Notice;
//
//import java.util.List; import java.util.List;
//
//public class AnnouncementAdapter extends BaseAdapter<Notice, ItemAnnouncementBinding> { public class AnnouncementAdapter extends BaseAdapter<Notice, ItemAnnouncementDetailBinding> {
// public Integer isClickPos =0;
//
// public AnnouncementAdapter(@Nullable List<Notice> data) { public AnnouncementAdapter(@Nullable List<Notice> data) {
// super(R.layout.item_announcement, data); super(R.layout.item_announcement_detail, data);
//
// } }
//
// @Override
// protected void convert(BaseViewHolder helper, Notice item) { @Override
// if (helper.getAdapterPosition()==isClickPos){ protected void convert(ItemAnnouncementDetailBinding mViewBinding, Notice item) {
// helper.getConvertView().findViewById(R.id.line_is_clicked).setVisibility(View.VISIBLE); mViewBinding.date.setText(TimeUtils.millis2String(item.getCreateTime()));
// } mViewBinding.title.setText(item.getNoticeTitle());
// mViewBinding.body.setText(item.getNoticeDesc());
// super.convert(helper, item);
// } }
//
// @Override
// protected void convert(ItemAnnouncementBinding mViewBinding, Notice item) { @Override
// mViewBinding.tvTitle.setText(item.getNoticeTitle()); protected View getItemView(int layoutResId, ViewGroup parent) {
// mViewBinding.tvDate.setText(TimeUtils.millis2String(item.getCreateTime())); return super.getItemView(layoutResId, parent);
// } }
//
//
// @Override }
// protected View getItemView(int layoutResId, ViewGroup parent) {
// return super.getItemView(layoutResId, parent);
// }
//
//
//}
package com.xingdata.zzdpos.ui.announcement.fragment; package com.xingdata.zzdpos.ui.announcement.fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import com.xingdata.zzdpos.R; import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment; import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentAnnouncementBinding; import com.xingdata.zzdpos.databinding.FragmentAnnouncementBinding;
import com.xingdata.zzdpos.model.Notice;
import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.ui.announcement.AnnouncementPresenter; import com.xingdata.zzdpos.ui.announcement.AnnouncementPresenter;
import com.xingdata.zzdpos.ui.announcement.adapter.AnnouncementAdapter;
import java.util.ArrayList;
public class AnnouncementFragment extends BaseFragment<AnnouncementPresenter, FragmentAnnouncementBinding> { public class AnnouncementFragment extends BaseFragment<AnnouncementPresenter, FragmentAnnouncementBinding> {
// private AnnouncementAdapter announcementAdapter; private AnnouncementAdapter announcementAdapter;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
...@@ -22,55 +30,48 @@ public class AnnouncementFragment extends BaseFragment<AnnouncementPresenter, Fr ...@@ -22,55 +30,48 @@ public class AnnouncementFragment extends BaseFragment<AnnouncementPresenter, Fr
@Override @Override
public void initView() { public void initView() {
//
// initRecycler(); initRecycler();
// mPresenter.queryNoticeList(); mPresenter.queryNoticeList();
}
private void initRecycler() {
mViewBinding.announcementRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
announcementAdapter = new AnnouncementAdapter(new ArrayList<>());
announcementAdapter.bindToRecyclerView(mViewBinding.announcementRecycler);
mViewBinding.srlProduct.setOnRefreshListener(this::onRefresh);
announcementAdapter.setOnLoadMoreListener(this::onLoadMore, mViewBinding.announcementRecycler);
} }
private void onRefresh() {
mPresenter.refreshAnnouncement();
}
private void onLoadMore() {
mPresenter.loadMoreAnnouncement();
}
/**
* 设置数据
*
* @param pager 数据
* @param isRefresh 是否刷新
*/
public void setData(Pager<Notice> pager, boolean isRefresh) {
if (isRefresh) {
announcementAdapter.setEnableLoadMore(true);
mViewBinding.srlProduct.setRefreshing(false);
}
if (isRefresh) announcementAdapter.setNewData(pager.getList());
else if (pager.getList().size() > 0) announcementAdapter.addData(pager.getList());
if (pager.isLastPage()) announcementAdapter.loadMoreEnd(isRefresh);
else announcementAdapter.loadMoreComplete();
}
// private void initRecycler() {
// mViewBinding.announcementRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
// announcementAdapter = new AnnouncementAdapter(new ArrayList<>());
// announcementAdapter.bindToRecyclerView(mViewBinding.announcementRecycler);
// announcementAdapter.setOnItemClickListener((adapter, view, position) -> {
// if (announcementAdapter.isClickPos != null) {
// adapter.getViewByPosition(mViewBinding.announcementRecycler, announcementAdapter.isClickPos, R.id.line_is_clicked).setVisibility(View.INVISIBLE);
// }
// view.findViewById(R.id.line_is_clicked).setVisibility(View.VISIBLE);
// announcementAdapter.isClickPos = position;
// clickItem(announcementAdapter.getData().get(position));
// });
//
//
// }
//
//
// private void clickItem(Notice s) {
// mPresenter.clickTitleItem(s);
// }
//
//
// /**
// * 设置数据
// *
// * @param pager 数据
// * @param isRefresh 是否刷新
// */
// public void setData(Pager<Notice> pager, boolean isRefresh) {
// if (isRefresh) {
// announcementAdapter.setEnableLoadMore(true);
// mViewBinding.srlProduct.setRefreshing(false);
// }
// if (isRefresh) announcementAdapter.setNewData(pager.getList());
// else if (pager.getList().size() > 0) announcementAdapter.addData(pager.getList());
// if (pager.isLastPage()) announcementAdapter.loadMoreEnd(isRefresh);
// else announcementAdapter.loadMoreComplete();
//
// //获取第一条的公告
// if (announcementAdapter.getData() != null) {
// clickItem(announcementAdapter.getData().get(0));
// }
// }
//
} }
...@@ -137,7 +137,7 @@ public class LoginActivity extends BaseActivity<LoginPresenter, ActivityLoginBin ...@@ -137,7 +137,7 @@ public class LoginActivity extends BaseActivity<LoginPresenter, ActivityLoginBin
promptDialog.dismiss(); promptDialog.dismiss();
//如果sn已经绑定款台,则直接跳转主页 //如果sn已经绑定款台,则直接跳转主页
if (loginReturnBean.getBindSN()) { if (loginReturnBean.getBindSN()) {
startActivity(new Intent(LoginActivity.this, IntegralActivity.class)); startActivity(new Intent(LoginActivity.this, MainActivity.class));
LoginActivity.this.finish(); LoginActivity.this.finish();
return; return;
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<include
android:id="@+id/ic_title"
layout="@layout/title" />
</FrameLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/gray_zhouyu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ic_title">
</FrameLayout>
</android.support.constraint.ConstraintLayout>
</layout> </layout>
\ No newline at end of file
...@@ -9,29 +9,21 @@ ...@@ -9,29 +9,21 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center"
android:text="@string/announcement_meun"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/srl_product" android:id="@+id/srl_product"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="@dimen/all_margin"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title"> app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/announcement_recycler" android:id="@+id/announcement_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:background="@color/gray_zhouyu" />
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<layout >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_zhouyu"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/all_padding"
android:text="2017-10-10" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="@dimen/all_shape_radius"
android:layout_marginLeft="@dimen/all_margin"
android:layout_marginRight="@dimen/all_margin"
android:layout_marginBottom="@dimen/all_padding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/all_margin"
>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/all_margin"
android:layout_marginEnd="@dimen/all_padding"
android:layout_marginStart="@dimen/all_padding"
android:layout_marginTop="@dimen/all_margin"
android:text="心灵受金华路:糖库心灵受的巅峰之路!"
android:textColor="@color/black_baozheng"
android:textStyle="bold" />
<TextView
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="@dimen/dp_4"
android:paddingStart="@dimen/dp_4"
android:text="ask領導就阿喀琉斯大家阿厤克斯大家阿隆索死啦對啦開始覺得請問哦請假了受打擊啦看到解開了缺點青蛙禮金卡實力坑爹 啊就是了看到薔薇科額的擴大勢力的就喀什燈籠褲幾千萬大家拉薩大家李克强千萬快樂件大事多久啦空間的權威的來擴大是快樂的切阿德 啊時代科技千龍網的!" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</layout>
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
<variable <variable
name="onClickListener" name="onClickListener"
type="com.xingdata.zzdpos.util.OnClickListener"/> type="com.xingdata.zzdpos.util.OnClickListener" />
</data> </data>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/title_height" android:layout_height="?attr/actionBarSize"
android:background="@drawable/singleline_white_gray" android:background="@drawable/singleline_white_gray"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
android:gravity="center" android:gravity="center"
android:onClick="@{onClickListener}" android:onClick="@{onClickListener}"
android:padding="16dp" android:padding="16dp"
android:src="@mipmap/back_black"/> android:src="@mipmap/back_black" />
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:text="标题" android:text="标题"
android:textColor="@color/black_baozheng" android:textColor="@color/black_baozheng"
android:textSize="@dimen/text_secondary_title" android:textSize="@dimen/text_secondary_title" />
android:textStyle="bold"/>
</RelativeLayout> </RelativeLayout>
......
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