Remove visibility methods from view holder
This commit is contained in:
parent
8eb57b6712
commit
a1d94e8d20
4 changed files with 16 additions and 36 deletions
|
@ -99,7 +99,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
|
||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE && viewHolder instanceof MapMarkerItemViewHolder) {
|
||||
if (!iconHidden && isCurrentlyActive) {
|
||||
((MapMarkerItemViewHolder) viewHolder).setOptionsButtonVisibility(View.GONE);
|
||||
((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.GONE);
|
||||
iconHidden = true;
|
||||
}
|
||||
View itemView = viewHolder.itemView;
|
||||
|
@ -135,7 +135,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
@Override
|
||||
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (viewHolder instanceof MapMarkerItemViewHolder) {
|
||||
((MapMarkerItemViewHolder) viewHolder).setOptionsButtonVisibility(View.VISIBLE);
|
||||
((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.VISIBLE);
|
||||
iconHidden = false;
|
||||
}
|
||||
super.clearView(recyclerView, viewHolder);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
|
|||
final TextView point;
|
||||
final View rightPointSpace;
|
||||
final TextView description;
|
||||
final ImageButton optionsBtn;
|
||||
public final ImageButton optionsBtn;
|
||||
final View divider;
|
||||
final View bottomShadow;
|
||||
|
||||
|
@ -42,25 +42,4 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
|
|||
divider = view.findViewById(R.id.divider);
|
||||
bottomShadow = view.findViewById(R.id.bottom_shadow);
|
||||
}
|
||||
|
||||
public void setOptionsButtonVisibility(int visibility) {
|
||||
optionsBtn.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setIconDirectionVisibility(int visibility) {
|
||||
iconDirection.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setBottomShadowVisibility(int visibility) {
|
||||
bottomShadow.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setPointSpaceVisibility(int visibility) {
|
||||
leftPointSpace.setVisibility(visibility);
|
||||
rightPointSpace.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setDividerVisibility(int visibility) {
|
||||
divider.setVisibility(visibility);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
int markerColor = MapMarker.getColorId(marker.colorIndex);
|
||||
LatLon markerLatLon = new LatLon(marker.getLatitude(), marker.getLongitude());
|
||||
if (showDirectionEnabled && pos < 2) {
|
||||
holder.setIconDirectionVisibility(View.GONE);
|
||||
holder.iconDirection.setVisibility(View.GONE);
|
||||
|
||||
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_arrow_marker_diretion, markerColor));
|
||||
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.markers_top_bar_background));
|
||||
|
@ -107,7 +107,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
drawableResToUpdate = R.drawable.ic_arrow_marker_diretion;
|
||||
markerImageViewToUpdate = holder.icon;
|
||||
} else {
|
||||
holder.setIconDirectionVisibility(View.VISIBLE);
|
||||
holder.iconDirection.setVisibility(View.VISIBLE);
|
||||
|
||||
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, markerColor));
|
||||
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||
|
@ -122,11 +122,11 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
markerImageViewToUpdate = holder.iconDirection;
|
||||
}
|
||||
if (pos == getItemCount() - 1) {
|
||||
holder.setBottomShadowVisibility(View.VISIBLE);
|
||||
holder.setDividerVisibility(View.GONE);
|
||||
holder.bottomShadow.setVisibility(View.VISIBLE);
|
||||
holder.divider.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.setBottomShadowVisibility(View.GONE);
|
||||
holder.setDividerVisibility(View.VISIBLE);
|
||||
holder.bottomShadow.setVisibility(View.GONE);
|
||||
holder.divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
|
|
@ -133,14 +133,15 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
}
|
||||
});
|
||||
itemViewHolder.flagIconLeftSpace.setVisibility(View.VISIBLE);
|
||||
itemViewHolder.setIconDirectionVisibility(View.GONE);
|
||||
itemViewHolder.setPointSpaceVisibility(View.GONE);
|
||||
itemViewHolder.iconDirection.setVisibility(View.GONE);
|
||||
itemViewHolder.leftPointSpace.setVisibility(View.GONE);
|
||||
itemViewHolder.rightPointSpace.setVisibility(View.GONE);
|
||||
if (position == getItemCount() - 1) {
|
||||
((MapMarkerItemViewHolder) holder).setBottomShadowVisibility(View.VISIBLE);
|
||||
((MapMarkerItemViewHolder) holder).setDividerVisibility(View.GONE);
|
||||
itemViewHolder.bottomShadow.setVisibility(View.VISIBLE);
|
||||
itemViewHolder.divider.setVisibility(View.GONE);
|
||||
} else {
|
||||
((MapMarkerItemViewHolder) holder).setBottomShadowVisibility(View.GONE);
|
||||
((MapMarkerItemViewHolder) holder).setDividerVisibility(View.VISIBLE);
|
||||
itemViewHolder.bottomShadow.setVisibility(View.GONE);
|
||||
itemViewHolder.divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (holder instanceof MapMarkerDateViewHolder) {
|
||||
final MapMarkerDateViewHolder dateViewHolder = (MapMarkerDateViewHolder) holder;
|
||||
|
|
Loading…
Reference in a new issue