Android: Call notifyItemChanged after file picker

This commit is contained in:
JosJuice 2020-11-07 15:23:26 +01:00
parent 62e6bedd25
commit 713d309386
2 changed files with 10 additions and 4 deletions

View File

@ -279,16 +279,18 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
dialog.show();
}
public void onFilePickerDirectoryClick(SettingsItem item)
public void onFilePickerDirectoryClick(SettingsItem item, int position)
{
mClickedItem = item;
mClickedPosition = position;
FileBrowserHelper.openDirectoryPicker(mView.getActivity(), FileBrowserHelper.GAME_EXTENSIONS);
}
public void onFilePickerFileClick(SettingsItem item)
public void onFilePickerFileClick(SettingsItem item, int position)
{
mClickedItem = item;
mClickedPosition = position;
FilePicker filePicker = (FilePicker) item;
switch (filePicker.getRequestType())
@ -320,7 +322,10 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
FilePicker filePicker = (FilePicker) mClickedItem;
if (!filePicker.getSelectedValue(mView.getSettings()).equals(selectedFile))
{
notifyItemChanged(mClickedPosition);
mView.onSettingChanged();
}
filePicker.setSelectedValue(mView.getSettings(), selectedFile);

View File

@ -71,13 +71,14 @@ public final class FilePickerViewHolder extends SettingViewHolder
return;
}
int position = getAdapterPosition();
if (mFilePicker.getRequestType() == MainPresenter.REQUEST_DIRECTORY)
{
getAdapter().onFilePickerDirectoryClick(mItem);
getAdapter().onFilePickerDirectoryClick(mItem, position);
}
else
{
getAdapter().onFilePickerFileClick(mItem);
getAdapter().onFilePickerFileClick(mItem, position);
}
setStyle(mTextSettingName, mItem);