提交 ac8a570b 编写于 作者: J jessyan

Improve Demo

上级 4d9cc56f
......@@ -18,6 +18,7 @@ package me.jessyan.mvparms.demo.app.utils;
import com.jess.arms.mvp.IView;
import com.jess.arms.utils.RxLifecycleUtils;
import com.trello.rxlifecycle2.LifecycleTransformer;
import com.trello.rxlifecycle2.RxLifecycle;
import io.reactivex.Observable;
import io.reactivex.ObservableTransformer;
......@@ -66,12 +67,13 @@ public class RxUtils {
}
/**
* 此接口已废弃
* 此方法已废弃
*
* @param view
* @param <T>
* @return
* @see RxLifecycleUtils 使用此类代替
* @see RxLifecycleUtils 此类可以实现 {@link RxLifecycle} 的所有功能, 使用方法和之前一致
* @deprecated Use {@link RxLifecycleUtils#bindToLifecycle(IView)} instead
*/
@Deprecated
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
......
......@@ -98,7 +98,7 @@ public class UserActivity extends BaseActivity<UserPresenter> implements UserCon
*/
private void initRecyclerView() {
mSwipeRefreshLayout.setOnRefreshListener(this);
ArmsUtils.configRecycleView(mRecyclerView, mLayoutManager);
ArmsUtils.configRecyclerView(mRecyclerView, mLayoutManager);
}
......
/**
* Copyright 2017 JessYan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2017 JessYan
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jess.arms.utils;
import android.app.Activity;
......@@ -399,11 +399,13 @@ public class ArmsUtils {
/**
* 配置 recycleview
* 配置 RecyclerView
*
* @param recyclerView
* @param layoutManager
* @deprecated Use {@link #configRecyclerView(RecyclerView, RecyclerView.LayoutManager)} instead
*/
@Deprecated
public static void configRecycleView(final RecyclerView recyclerView
, RecyclerView.LayoutManager layoutManager) {
recyclerView.setLayoutManager(layoutManager);
......@@ -412,6 +414,20 @@ public class ArmsUtils {
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
/**
* 配置 RecyclerView
*
* @param recyclerView
* @param layoutManager
*/
public static void configRecyclerView(final RecyclerView recyclerView
, RecyclerView.LayoutManager layoutManager) {
recyclerView.setLayoutManager(layoutManager);
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
/**
* 远程遥控 {@link AppManager#killAll()}
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册