It is now impossible to delete the current editable item in the roles view in the profile page. Fixing #89
This commit is contained in:
parent
a4e3774739
commit
d716891453
|
@ -1355,6 +1355,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
|
|
||||||
private class EditableAboutViewHolder extends BaseViewHolder {
|
private class EditableAboutViewHolder extends BaseViewHolder {
|
||||||
private EditText title;
|
private EditText title;
|
||||||
|
private boolean titleHasFocus, valueHasFocus;
|
||||||
private EditText value;
|
private EditText value;
|
||||||
|
|
||||||
public EditableAboutViewHolder(){
|
public EditableAboutViewHolder(){
|
||||||
|
@ -1366,7 +1367,19 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
title.addTextChangedListener(new SimpleTextWatcher(e->item.name=e.toString()));
|
title.addTextChangedListener(new SimpleTextWatcher(e->item.name=e.toString()));
|
||||||
|
title.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
titleHasFocus = hasFocus;
|
||||||
|
}
|
||||||
|
});
|
||||||
value.addTextChangedListener(new SimpleTextWatcher(e->item.value=e.toString()));
|
value.addTextChangedListener(new SimpleTextWatcher(e->item.value=e.toString()));
|
||||||
|
value.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
valueHasFocus = hasFocus;
|
||||||
|
}
|
||||||
|
});
|
||||||
findViewById(R.id.remove_row_btn).setOnClickListener(this::onRemoveRowClick);
|
findViewById(R.id.remove_row_btn).setOnClickListener(this::onRemoveRowClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1377,6 +1390,10 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRemoveRowClick(View v){
|
private void onRemoveRowClick(View v){
|
||||||
|
if(titleHasFocus || valueHasFocus){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int pos=getAbsoluteAdapterPosition();
|
int pos=getAbsoluteAdapterPosition();
|
||||||
metadataListData.remove(pos);
|
metadataListData.remove(pos);
|
||||||
adapter.notifyItemRemoved(pos);
|
adapter.notifyItemRemoved(pos);
|
||||||
|
|
Loading…
Reference in New Issue