新闻接口修改

This commit is contained in:
itgaojian 2023-03-10 11:41:44 +08:00
parent dbb19590d3
commit 34e2a6d41e
3 changed files with 27 additions and 12 deletions

View File

@ -227,7 +227,7 @@ public class NewsSearchActivity extends BaseActivity {
* 保存查询的关键字
*/
private void doSaveKeywords() {
String params = String.format(getResources().getString(R.string.big_data_str), "QUERY", mKeywords, "END");
String params = String.format(getResources().getString(R.string.big_data_str), "QUERY", mKeywords, "新闻");
bigDataRead(params);
}

View File

@ -65,6 +65,7 @@ public class NewsFragment extends BaseFragment {
private Disposable mD1;
private Disposable mD2;
private Disposable mDMenu;
private boolean mIsAll;
@Override
protected void setDataToView(View dataView) {
@ -73,6 +74,7 @@ public class NewsFragment extends BaseFragment {
mAdapter = new NewsAdapter(mActivity, mNewsDatas);
mType = getArguments().getString("type");
mPId = getArguments().getString("pId");
mIsAll = getArguments().getBoolean("isAll", false);
mCurrentPage = 1;
mTotalPage = 0;
mNewsDatas.clear();
@ -88,7 +90,9 @@ public class NewsFragment extends BaseFragment {
.adapter(mAdapter)
.load(R.layout.item_skeleton_news)
.show();
getNewsSubMenu(mType);
if (!mIsAll) {
getNewsSubMenu(mType);
}
if (!TextUtils.isEmpty(UserLgUtils.getToken())) {
getNewsListByTypeToken(mCurrentPage);
@ -154,7 +158,7 @@ public class NewsFragment extends BaseFragment {
private void getNewsListByTypeToken(int page) {
RetrofitManager.getInstance()
.create(HomeApi.class)
.getNewsListByToken(mType, "", page + "", UserLgUtils.getToken())
.getNewsListByToken(mIsAll ? "" : mType, mIsAll ? mType : "", page + "", UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NewsItemBean>() {
@ -262,7 +266,7 @@ public class NewsFragment extends BaseFragment {
private void getNewsListByType(int page) {
RetrofitManager.getInstance()
.create(HomeApi.class)
.getNewsList(mType, "",page + "")
.getNewsList(mIsAll ? "" : mType, mIsAll ? mType : "", page + "")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NewsItemBean>() {

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -9,13 +8,25 @@
android:theme="@style/Theme.AppCompat"
tools:ignore="MissingDefaultResource">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_menu"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_news_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_news_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>