Skip to content

Commit

Permalink
修正为module
Browse files Browse the repository at this point in the history
  • Loading branch information
crazysunj committed Sep 21, 2018
1 parent 45373f6 commit 8bb5f9f
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public int getSpanSize(int position) {
list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
}

@SuppressLint("CheckResult")
Expand All @@ -97,7 +97,7 @@ public void click1(View view) {
.subscribeOn(Schedulers.io())
.subscribe(list -> {
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
});

}
Expand All @@ -113,7 +113,7 @@ public void click2(View view) {
list.add(new SecondItem(String.format(Locale.getDefault(), "我是第二种类型%d", i), 6 + i));
}
textView2.setText(String.format(Locale.getDefault(), "类型2的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderSecondItem(String.format(Locale.getDefault(), "我是第二种类型的头,点击次数:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_SENCOND);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderSecondItem(String.format(Locale.getDefault(), "我是第二种类型的头,点击次数:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_SENCOND);
}, 2000);

}
Expand All @@ -125,7 +125,7 @@ public void click2(View view) {
public void click3(View view) {

helper.notifyLoadingHeaderChanged(SimpleHelper.LEVEL_THIRD);
textView3.postDelayed(() -> helper.notifyMoudleHeaderChanged(new HeaderThirdItem(String.format(Locale.getDefault(), "我是第三种类型的头,点击次数:%d", refreshThirdCount++), IDUtil.getId()), SimpleHelper.LEVEL_THIRD), 2000);
textView3.postDelayed(() -> helper.notifyModuleHeaderChanged(new HeaderThirdItem(String.format(Locale.getDefault(), "我是第三种类型的头,点击次数:%d", refreshThirdCount++), IDUtil.getId()), SimpleHelper.LEVEL_THIRD), 2000);
}

public void click4(View view) {
Expand All @@ -139,7 +139,7 @@ public void click4(View view) {
list.add(new FourthItem(String.format(Locale.getDefault(), "我是第四种类型%d", i), 18 + i));
}
textView4.setText(String.format(Locale.getDefault(), "类型4的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
}, 2000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
}, 3000);
}

Expand All @@ -86,7 +86,7 @@ public void click1(View view) {
.subscribeOn(Schedulers.io())
.subscribe(list -> {
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
});
}

Expand All @@ -101,7 +101,7 @@ public void click2(View view) {
list.add(new SecondItem(String.format(Locale.getDefault(), "我是第二种类型%d", i), 6 + i));
}
textView2.setText(String.format(Locale.getDefault(), "类型2的数量:%d", list.size()));
helper.notifyMoudleDataChanged(list, SimpleHelper.LEVEL_SENCOND);
helper.notifyModuleDataChanged(list, SimpleHelper.LEVEL_SENCOND);
}, 2000);

}
Expand All @@ -113,7 +113,7 @@ public void click2(View view) {
public void click3(View view) {

helper.notifyLoadingHeaderChanged(SimpleHelper.LEVEL_THIRD);
textView3.postDelayed(() -> helper.notifyMoudleHeaderChanged(new HeaderThirdItem(String.format(Locale.getDefault(), "我是第三种类型的头,点击次数:%d", refreshThirdCount++), IDUtil.getId()), SimpleHelper.LEVEL_THIRD), 2000);
textView3.postDelayed(() -> helper.notifyModuleHeaderChanged(new HeaderThirdItem(String.format(Locale.getDefault(), "我是第三种类型的头,点击次数:%d", refreshThirdCount++), IDUtil.getId()), SimpleHelper.LEVEL_THIRD), 2000);
}

public void click4(View view) {
Expand All @@ -127,7 +127,7 @@ public void click4(View view) {
list.add(new FourthItem(String.format(Locale.getDefault(), "我是第四种类型%d", i), 18 + i));
}
textView4.setText(String.format(Locale.getDefault(), "类型4的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
}, 2000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void click2(View view) {
return;
}
String[] split = types.split(",");
helper.clearMoudle(get(split));
helper.clearModule(get(split));
}

private int[] get(String[] split) {
Expand All @@ -106,7 +106,7 @@ public void click3(View view) {
return;
}
String[] split = types.split(",");
helper.remainMoudle(get(split));
helper.remainModule(get(split));
}

public void click4(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void click(View view) {
for (int i = 0, size = rand + 1; i < size; i++) {
list.add(new FirstItem(String.format(Locale.getDefault(), "我是第一种类型%d", i)));
}
helper.notifyMoudleDataChanged(list, 0);
helper.notifyModuleDataChanged(list, 0);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new SecondItem(String.format(Locale.getDefault(), "我是第二种类型%d", i), 6 + i));
}
textView2.setText(String.format(Locale.getDefault(), "类型2的数量:%d", list.size()));
helper.notifyMoudleDataChanged(list, 1);
helper.notifyModuleDataChanged(list, 1);
}, 2000);
} else if (id == R.id.retry && type == 3) {
helper.notifyLoadingDataAndHeaderChanged(3, 3);
Expand All @@ -77,7 +77,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new FourthItem(String.format(Locale.getDefault(), "我是第四种类型%d", i), 18 + i));
}
textView4.setText(String.format(Locale.getDefault(), "类型4的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), 3);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), 3);
}, 2000);
}
});
Expand All @@ -91,7 +91,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new FirstItem(String.format(Locale.getDefault(), "我是第一种类型%d", i), i));
}
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), 0);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), 0);

}, 2000);

Expand All @@ -104,7 +104,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), 2);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), 2);
}, 3000);
}

Expand All @@ -114,15 +114,15 @@ public void click1(View view) {
helper.notifyLoadingDataAndHeaderChanged(0, 1);
textView1.postDelayed(() -> {
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", 1));
helper.notifyMoudleDataAndHeaderChanged(new FirstItem("我是新刷新的条目" + refreshFirstCount, System.currentTimeMillis()), new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), 0);
helper.notifyModuleDataAndHeaderChanged(new FirstItem("我是新刷新的条目" + refreshFirstCount, System.currentTimeMillis()), new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), 0);
}, 2000);

}

public void click2(View view) {

helper.notifyLoadingDataChanged(1, 2);
textView2.postDelayed(() -> helper.notifyMoudleErrorChanged(1), 2000);
textView2.postDelayed(() -> helper.notifyModuleErrorChanged(1), 2000);

}

Expand All @@ -133,12 +133,12 @@ public void click2(View view) {
public void click3(View view) {

helper.notifyLoadingDataAndHeaderChanged(2, 1);
textView3.postDelayed(() -> helper.notifyMoudleEmptyChanged(emptyEntity, 2), 2000);
textView3.postDelayed(() -> helper.notifyModuleEmptyChanged(emptyEntity, 2), 2000);
}

public void click4(View view) {

helper.notifyLoadingDataAndHeaderChanged(3, 3);
textView4.postDelayed(() -> helper.notifyMoudleErrorChanged(errorfourthEntity, 3), 2000);
textView4.postDelayed(() -> helper.notifyModuleErrorChanged(errorfourthEntity, 3), 2000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ private MultiHeaderEntity getChangeItem(int itemType) {

public void click5(View view) {

helper.clearMoudle(0);
helper.clearModule(0);
}

public void click6(View view) {

helper.clearMoudle(1);
helper.clearModule(1);
}

public void click7(View view) {
helper.clearMoudle(2);
helper.clearModule(2);

}

public void click8(View view) {

helper.clearMoudle(3);
helper.clearModule(3);
}

public void click9(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ private void refresh() {
}
textView4.setText(String.format(Locale.getDefault(), "类型4的数量:%d", list4.size()));

helper.notifyMoudleDataAndHeaderChanged(list1, new HeaderFirstItem("我是第一种类型头" + random.nextInt(100), timeMillis + 100), SimpleHelper.LEVEL_FIRST);
helper.notifyMoudleDataAndHeaderChanged(list2, new HeaderSecondItem("我是第二种类型头" + random.nextInt(100), timeMillis + 200), SimpleHelper.LEVEL_SENCOND);
helper.notifyMoudleDataAndHeaderChanged(list3, new HeaderThirdItem("我是第三种类型头" + random.nextInt(100), timeMillis + 300), SimpleHelper.LEVEL_THIRD);
helper.notifyMoudleDataAndHeaderChanged(list4, new HeaderFourthItem("我是第四种类型头" + random.nextInt(100), timeMillis + 400), SimpleHelper.LEVEL_FOURTH);
helper.notifyModuleDataAndHeaderChanged(list1, new HeaderFirstItem("我是第一种类型头" + random.nextInt(100), timeMillis + 100), SimpleHelper.LEVEL_FIRST);
helper.notifyModuleDataAndHeaderChanged(list2, new HeaderSecondItem("我是第二种类型头" + random.nextInt(100), timeMillis + 200), SimpleHelper.LEVEL_SENCOND);
helper.notifyModuleDataAndHeaderChanged(list3, new HeaderThirdItem("我是第三种类型头" + random.nextInt(100), timeMillis + 300), SimpleHelper.LEVEL_THIRD);
helper.notifyModuleDataAndHeaderChanged(list4, new HeaderFourthItem("我是第四种类型头" + random.nextInt(100), timeMillis + 400), SimpleHelper.LEVEL_FOURTH);
}

public void click(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new SecondItem(String.format(Locale.getDefault(), "我是第二种类型%d", i), 6 + i));
}
textView2.setText(String.format(Locale.getDefault(), "类型2的数量:%d", list.size()));
helper.notifyMoudleDataChanged(list, SimpleHelper.LEVEL_SENCOND);
helper.notifyModuleDataChanged(list, SimpleHelper.LEVEL_SENCOND);
}, 2000);
} else if (id == R.id.retry && type == SimpleHelper.LEVEL_FOURTH) {
helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_FOURTH, 3);
Expand All @@ -77,7 +77,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new FourthItem(String.format(Locale.getDefault(), "我是第四种类型%d", i), 18 + i));
}
textView4.setText(String.format(Locale.getDefault(), "类型4的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFourthItem(String.format(Locale.getDefault(), "我是第四种类型的头,数量:%d", list.size()), IDUtil.getId()), SimpleHelper.LEVEL_FOURTH);
}, 2000);
}
});
Expand All @@ -91,7 +91,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new FirstItem(String.format(Locale.getDefault(), "我是第一种类型%d", i), i));
}
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);

}, 2000);

Expand All @@ -104,7 +104,7 @@ protected void onCreate(Bundle savedInstanceState) {
list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD);
}, 3000);
}

Expand All @@ -114,15 +114,15 @@ public void click1(View view) {
helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_FIRST, 1);
textView1.postDelayed(() -> {
textView1.setText(String.format(Locale.getDefault(), "类型1的数量:%d", 1));
helper.notifyMoudleDataAndHeaderChanged(new FirstItem("我是新刷新的条目" + refreshFirstCount, System.currentTimeMillis()), new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
helper.notifyModuleDataAndHeaderChanged(new FirstItem("我是新刷新的条目" + refreshFirstCount, System.currentTimeMillis()), new HeaderFirstItem(String.format(Locale.getDefault(), "我是第一种类型的头,点击次数:%d", refreshFirstCount++), IDUtil.getId()), SimpleHelper.LEVEL_FIRST);
}, 2000);

}

public void click2(View view) {

helper.notifyLoadingDataChanged(SimpleHelper.LEVEL_SENCOND, 2);
textView2.postDelayed(() -> helper.notifyMoudleErrorChanged(SimpleHelper.LEVEL_SENCOND), 2000);
textView2.postDelayed(() -> helper.notifyModuleErrorChanged(SimpleHelper.LEVEL_SENCOND), 2000);

}

Expand All @@ -131,12 +131,12 @@ public void click2(View view) {
public void click3(View view) {

helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_THIRD, 1);
textView3.postDelayed(() -> helper.notifyMoudleEmptyChanged(emptyEntity, SimpleHelper.LEVEL_THIRD), 2000);
textView3.postDelayed(() -> helper.notifyModuleEmptyChanged(emptyEntity, SimpleHelper.LEVEL_THIRD), 2000);
}

public void click4(View view) {

helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_FOURTH, 3);
textView4.postDelayed(() -> helper.notifyMoudleErrorChanged(errorfourthEntity, SimpleHelper.LEVEL_FOURTH), 2000);
textView4.postDelayed(() -> helper.notifyModuleErrorChanged(errorfourthEntity, SimpleHelper.LEVEL_FOURTH), 2000);
}
}
Loading

0 comments on commit 8bb5f9f

Please sign in to comment.