Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
“jdsjlzx” committed Jan 30, 2018
1 parent dca2dfe commit f630aa6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ public void onScrolled(int dx, int dy) {
if (!mLoadingData) {
mLoadingData = true;
mLoadMoreFooter.onLoading();
mLoadMoreListener.onLoadMore();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ public void onScrolled(int dx, int dy) {
if (!mLoadingData) {
mLoadingData = true;
mLoadMoreFooter.onLoading();
mLoadMoreListener.onLoadMore();
}

}
Expand Down
20 changes: 0 additions & 20 deletions app/src/main/java/com/lzx/demo/adapter/DataAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,12 @@ public void onBindItemHolder(SuperViewHolder holder, int position) {
ItemModel item = mDataList.get(position);

TextView titleText = holder.getView(R.id.info_text);
EditText titleEditor = holder.getView(R.id.info_edtor);
titleText.setText(item.title);
titleEditor.addTextChangedListener(textWatcher);
}

@Override
public void onViewRecycled(SuperViewHolder holder) {
super.onViewRecycled(holder);
EditText titleEditor = holder.getView(R.id.info_edtor);
titleEditor.removeTextChangedListener(textWatcher);
}

TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

@Override
public void afterTextChanged(Editable s) {

}
};
}
2 changes: 2 additions & 0 deletions app/src/main/java/com/lzx/demo/base/BaseMainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;

import com.lzx.demo.ItemDecoration.DividerDecoration;
Expand Down Expand Up @@ -60,6 +61,7 @@ protected void onCreate(Bundle savedInstanceState) {
.build();
mRecyclerView.addItemDecoration(divider);


}

private static class ListItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void onScrollStateChanged(int state) {
//设置底部加载颜色
mRecyclerView.setFooterViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white);
//设置底部加载文字提示
mRecyclerView.setFooterViewHint("拼命加载中","已经全部为你呈现了","网络不给力啊,点击再试一次吧");
mRecyclerView.setFooterViewHint("拼命加载中","我是有底线的","网络不给力啊,点击再试一次吧");

mRecyclerView.refresh();

Expand Down
10 changes: 1 addition & 9 deletions app/src/main/res/layout/sample_item_text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,5 @@
android:textColor="@color/color_00"
android:text="22222"
android:textSize="@dimen/dp_14"/>
<EditText
android:id="@+id/info_edtor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="@dimen/dp_10"
android:textColor="@color/color_00"
android:text="22222"
android:textSize="@dimen/dp_14"/>

</LinearLayout>

0 comments on commit f630aa6

Please sign in to comment.