update summary change no matter whether summary is equal

Since the method parameter tile and tile in adpater is the same
instance, it is useless to check whether summary has changed.

Test: Run SettingsRoboTests
The function used in notifySummaryChanged already has testcases
in DashboardDataTest

Change-Id: I8c8969fcd2c89f368ca507808910fc7a9852f192
This commit is contained in:
jackqdyulei
2016-10-28 13:23:10 -07:00
parent 301fe80fa7
commit f6979e257c

View File

@@ -163,15 +163,11 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
public void notifySummaryChanged(Tile tile) { public void notifySummaryChanged(Tile tile) {
final int position = mDashboardData.getPositionByTile(tile); final int position = mDashboardData.getPositionByTile(tile);
if (position != DashboardData.POSITION_NOT_FOUND) { if (position != DashboardData.POSITION_NOT_FOUND) {
final Tile targetTile = (Tile) mDashboardData.getItemEntityByPosition(position);
if (!TextUtils.equals(tile.summary, targetTile.summary)) {
// Since usually tile in parameter and tile in mCategories are same instance, // Since usually tile in parameter and tile in mCategories are same instance,
// which is hard to be detected by DiffUtil, so we notifyItemChanged directly. // which is hard to be detected by DiffUtil, so we notifyItemChanged directly.
notifyItemChanged(position); notifyItemChanged(position);
} }
} }
}
// TODO: move this method to SuggestionParser or some other util class // TODO: move this method to SuggestionParser or some other util class
public void disableSuggestion(Tile suggestion) { public void disableSuggestion(Tile suggestion) {