Hide icon when swiping
This commit is contained in:
parent
afc32a880e
commit
78bec6ec55
2 changed files with 21 additions and 4 deletions
|
@ -14,6 +14,7 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerDateViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersHistoryAdapter;
|
||||
|
||||
public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHelper.MapMarkerChangedListener {
|
||||
|
@ -81,6 +83,17 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
private Bitmap deleteBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_delete_dark);
|
||||
private Bitmap resetBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_reset_to_default_dark);
|
||||
|
||||
@Override
|
||||
public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (viewHolder instanceof MapMarkerDateViewHolder) {
|
||||
return 0;
|
||||
}
|
||||
if (viewHolder instanceof MapMarkerItemViewHolder) {
|
||||
((MapMarkerItemViewHolder) viewHolder).setOptionsButtonVisibility(View.GONE);
|
||||
}
|
||||
return super.getSwipeDirs(recyclerView, viewHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
|
||||
return false;
|
||||
|
@ -107,11 +120,11 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (viewHolder instanceof MapMarkerDateViewHolder) {
|
||||
return 0;
|
||||
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (viewHolder instanceof MapMarkerItemViewHolder) {
|
||||
((MapMarkerItemViewHolder) viewHolder).setOptionsButtonVisibility(View.VISIBLE);
|
||||
}
|
||||
return super.getSwipeDirs(recyclerView, viewHolder);
|
||||
super.clearView(recyclerView, viewHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,4 +30,8 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
|
|||
description = (TextView) view.findViewById(R.id.map_marker_description);
|
||||
optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button);
|
||||
}
|
||||
|
||||
public void setOptionsButtonVisibility(int visibility) {
|
||||
optionsBtn.setVisibility(visibility);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue