封版羽声,作为最后的基础版
@@ -11,12 +11,12 @@ import java.util.List;
|
||||
public class NewsContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
void getOfficialNoticeList(List<NewsDataBean> newsDataBeans);
|
||||
void getOfficialNoticeList(NewsDataBean newsDataBeans);
|
||||
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getOfficialNotice(String page,String page_limit,String type);
|
||||
void getOfficialNotice();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.example.modulenews.adapter.FragmentAdapter;
|
||||
import com.example.modulenews.contacts.NewsContacts;
|
||||
import com.example.modulenews.databinding.FragmentNewsBinding;
|
||||
import com.example.modulenews.presenter.NewsPresenter;
|
||||
import com.qxcm.moduleutil.activity.news.OfficialNoticeActivity;
|
||||
import com.qxcm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
@@ -43,6 +44,13 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
|
||||
@Override
|
||||
protected void initData () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.getOfficialNotice();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,6 +66,7 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
// FragmentAdapter fragmentAdapter = new FragmentAdapter(this);
|
||||
// fragmentAdapter.setFragmentList(fragments);
|
||||
// mBinding.viewPager.setOffscreenPageLimit(2);
|
||||
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(fragments, getChildFragmentManager()));
|
||||
mBinding.viewPager.setCurrentItem(0, false);
|
||||
|
||||
@@ -71,6 +80,24 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rlSystem.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent=new Intent(getActivity(), OfficialNoticeActivity.class);
|
||||
intent.putExtra("type", "1");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rlOfficial.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent=new Intent(getActivity(), OfficialNoticeActivity.class);
|
||||
intent.putExtra("type", "2");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +118,26 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
|
||||
|
||||
@Override
|
||||
public void getOfficialNoticeList(List<NewsDataBean> newsDataBeans) {
|
||||
|
||||
public void getOfficialNoticeList(NewsDataBean newsDataBeans) {
|
||||
if (newsDataBeans.getAnnouncement_last_message()!=null){
|
||||
mBinding.tvNr.setText(newsDataBeans.getAnnouncement_last_message().getContent()!=null?newsDataBeans.getAnnouncement_last_message().getContent():"");
|
||||
}else {
|
||||
mBinding.tvNr.setText("");
|
||||
}
|
||||
if (newsDataBeans.getSystem_last_message()!=null){
|
||||
mBinding.tvXtNr.setText(newsDataBeans.getSystem_last_message().getContent()!=null?newsDataBeans.getSystem_last_message().getContent():"");
|
||||
}else {
|
||||
mBinding.tvXtNr.setText("");
|
||||
}
|
||||
if (newsDataBeans.getSystem_no_read_count()>0) {
|
||||
mBinding.tvXtCount.setText(newsDataBeans.getSystem_no_read_count()+"");
|
||||
}else {
|
||||
mBinding.tvXtCount.setVisibility(View.GONE);
|
||||
}
|
||||
if (newsDataBeans.getAnnouncement_read_count()>0) {
|
||||
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
|
||||
}else {
|
||||
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,46 +18,17 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOfficialNotice(String page, String page_limit, String type) {
|
||||
// api.getOfficialNotice(page, page_limit, type, new BaseObserver<List<NewsDataBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<NewsDataBean> newsDataBeans) {
|
||||
// MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
// }
|
||||
// });
|
||||
public void getOfficialNotice() {
|
||||
api.getOfficialNotice( new BaseObserver<NewsDataBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
List<NewsDataBean> newsDataBeans= new ArrayList<>();
|
||||
if (type.equals("1")){
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("系统消息"+i);
|
||||
newsDataBean.setContent("系统消息"+i);
|
||||
newsDataBean.setType("1");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
@Override
|
||||
public void onNext(NewsDataBean newsDataBeans) {
|
||||
MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
}
|
||||
}else {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("官方公告"+i);
|
||||
newsDataBean.setContent("官方公告"+i);
|
||||
newsDataBean.setType("2");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,118 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="@dimen/dp_11"
|
||||
android:src="@mipmap/notifi"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_official"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_gg"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@mipmap/gg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gfgg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:text="官方公告"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_gfgg"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="Chat with your friends"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
|
||||
android:id="@+id/tv_official_count"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
tools:text="1"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/conversation_list_divide_line_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@color/conversation_divide_line_color"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_system"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_12">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_xt"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@mipmap/xt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_xtx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_toEndOf="@+id/im_xt"
|
||||
android:text="系统消息"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_xt_nr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_xtx"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/im_xt"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="Chat with your friends"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
|
||||
android:id="@+id/tv_xt_count"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
tools:text="1"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.qxcm.moduleutil.widget.ScrollViewPager
|
||||
android:id="@+id/view_pager"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |