Show history in groups
This commit is contained in:
parent
bd8040420b
commit
79f2cedc21
2 changed files with 21 additions and 14 deletions
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/show_hide_history_title"
|
android:id="@+id/show_hide_history_title"
|
||||||
android:layout_width="0dp"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:layout_weight="1"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingLeft="56dp"
|
android:paddingLeft="56dp"
|
||||||
android:paddingStart="56dp"
|
android:paddingStart="56dp"
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
|
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
IconsCache iconsCache = app.getIconsCache();
|
||||||
if (holder instanceof MapMarkerItemViewHolder) {
|
if (holder instanceof MapMarkerItemViewHolder) {
|
||||||
final MapMarkerItemViewHolder itemViewHolder = (MapMarkerItemViewHolder) holder;
|
final MapMarkerItemViewHolder itemViewHolder = (MapMarkerItemViewHolder) holder;
|
||||||
|
@ -211,17 +211,24 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
final ShowHideHistoryButton showHideHistoryButton = (ShowHideHistoryButton) getItem(position);
|
final ShowHideHistoryButton showHideHistoryButton = (ShowHideHistoryButton) getItem(position);
|
||||||
final boolean showHistory = showHideHistoryButton.isShowHistory();
|
final boolean showHistory = showHideHistoryButton.isShowHistory();
|
||||||
showHideHistoryViewHolder.title.setText(app.getString(showHistory ? R.string.hide_passed : R.string.show_passed));
|
showHideHistoryViewHolder.title.setText(app.getString(showHistory ? R.string.hide_passed : R.string.show_passed));
|
||||||
// showHideHistoryViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
showHideHistoryViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
// if (showHistory) {
|
List<MapMarker> historyMarkers = showHideHistoryButton.getHistoryMarkers();
|
||||||
// items.removeAll(showHideHistoryButton.getHistoryMarkers());
|
int pos = holder.getAdapterPosition();
|
||||||
// showHideHistoryButton.setShowHistory(false);
|
if (showHistory) {
|
||||||
// } else {
|
showHideHistoryButton.setShowHistory(false);
|
||||||
// items.addAll(holder.getAdapterPosition(), showHideHistoryButton.getHistoryMarkers());
|
notifyItemChanged(pos);
|
||||||
// }
|
items.removeAll(historyMarkers);
|
||||||
// }
|
notifyItemRangeRemoved(pos - historyMarkers.size(), historyMarkers.size());
|
||||||
// });
|
} else {
|
||||||
|
showHideHistoryButton.setShowHistory(true);
|
||||||
|
notifyItemChanged(pos);
|
||||||
|
items.addAll(pos, historyMarkers);
|
||||||
|
notifyItemRangeInserted(pos, historyMarkers.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue