public MutableLiveData<Boolean> editingProfiles = new MutableLiveData<>(false);
private RecyclerView recyclerView;
private ItemTouchHelper rearrangeHelper;
public MutableLiveData<Boolean> editingProfiles = new MutableLiveData<>(false);
private RecyclerView recyclerView;
private ItemTouchHelper rearrangeHelper;
public ProfilesRecyclerViewAdapter() {
debug("flow", "ProfilesRecyclerViewAdapter.new()");
public ProfilesRecyclerViewAdapter() {
debug("flow", "ProfilesRecyclerViewAdapter.new()");
@Override
public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
rearrangeHelper.attachToRecyclerView(null);
@Override
public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
rearrangeHelper.attachToRecyclerView(null);
public void startEditingProfiles() {
if (editingProfiles.getValue()) return;
this.editingProfiles.setValue(true);
public void startEditingProfiles() {
if (editingProfiles.getValue()) return;
this.editingProfiles.setValue(true);
rearrangeHelper.attachToRecyclerView(recyclerView);
}
public void stopEditingProfiles() {
if (!editingProfiles.getValue()) return;
this.editingProfiles.setValue(false);
rearrangeHelper.attachToRecyclerView(recyclerView);
}
public void stopEditingProfiles() {
if (!editingProfiles.getValue()) return;
this.editingProfiles.setValue(false);
boolean wasHidden = holder.mEditButton.getVisibility() == View.GONE;
holder.mRearrangeHandle.setVisibility(View.VISIBLE);
holder.mEditButton.setVisibility(View.VISIBLE);
boolean wasHidden = holder.mEditButton.getVisibility() == View.GONE;
holder.mRearrangeHandle.setVisibility(View.VISIBLE);
holder.mEditButton.setVisibility(View.VISIBLE);
Animation a = AnimationUtils
.loadAnimation(holder.mRearrangeHandle.getContext(), R.anim.fade_in);
holder.mRearrangeHandle.startAnimation(a);
Animation a = AnimationUtils
.loadAnimation(holder.mRearrangeHandle.getContext(), R.anim.fade_in);
holder.mRearrangeHandle.startAnimation(a);
boolean wasShown = holder.mEditButton.getVisibility() == View.VISIBLE;
holder.mRearrangeHandle.setVisibility(View.INVISIBLE);
holder.mEditButton.setVisibility(View.GONE);
boolean wasShown = holder.mEditButton.getVisibility() == View.VISIBLE;
holder.mRearrangeHandle.setVisibility(View.INVISIBLE);
holder.mEditButton.setVisibility(View.GONE);
Animation a = AnimationUtils
.loadAnimation(holder.mRearrangeHandle.getContext(), R.anim.fade_out);
holder.mRearrangeHandle.startAnimation(a);
Animation a = AnimationUtils
.loadAnimation(holder.mRearrangeHandle.getContext(), R.anim.fade_out);
holder.mRearrangeHandle.startAnimation(a);