Android: Call notifyItemChanged after file picker
This commit is contained in:
parent
62e6bedd25
commit
713d309386
|
@ -279,16 +279,18 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFilePickerDirectoryClick(SettingsItem item)
|
public void onFilePickerDirectoryClick(SettingsItem item, int position)
|
||||||
{
|
{
|
||||||
mClickedItem = item;
|
mClickedItem = item;
|
||||||
|
mClickedPosition = position;
|
||||||
|
|
||||||
FileBrowserHelper.openDirectoryPicker(mView.getActivity(), FileBrowserHelper.GAME_EXTENSIONS);
|
FileBrowserHelper.openDirectoryPicker(mView.getActivity(), FileBrowserHelper.GAME_EXTENSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFilePickerFileClick(SettingsItem item)
|
public void onFilePickerFileClick(SettingsItem item, int position)
|
||||||
{
|
{
|
||||||
mClickedItem = item;
|
mClickedItem = item;
|
||||||
|
mClickedPosition = position;
|
||||||
FilePicker filePicker = (FilePicker) item;
|
FilePicker filePicker = (FilePicker) item;
|
||||||
|
|
||||||
switch (filePicker.getRequestType())
|
switch (filePicker.getRequestType())
|
||||||
|
@ -320,7 +322,10 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||||
FilePicker filePicker = (FilePicker) mClickedItem;
|
FilePicker filePicker = (FilePicker) mClickedItem;
|
||||||
|
|
||||||
if (!filePicker.getSelectedValue(mView.getSettings()).equals(selectedFile))
|
if (!filePicker.getSelectedValue(mView.getSettings()).equals(selectedFile))
|
||||||
|
{
|
||||||
|
notifyItemChanged(mClickedPosition);
|
||||||
mView.onSettingChanged();
|
mView.onSettingChanged();
|
||||||
|
}
|
||||||
|
|
||||||
filePicker.setSelectedValue(mView.getSettings(), selectedFile);
|
filePicker.setSelectedValue(mView.getSettings(), selectedFile);
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,14 @@ public final class FilePickerViewHolder extends SettingViewHolder
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int position = getAdapterPosition();
|
||||||
if (mFilePicker.getRequestType() == MainPresenter.REQUEST_DIRECTORY)
|
if (mFilePicker.getRequestType() == MainPresenter.REQUEST_DIRECTORY)
|
||||||
{
|
{
|
||||||
getAdapter().onFilePickerDirectoryClick(mItem);
|
getAdapter().onFilePickerDirectoryClick(mItem, position);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getAdapter().onFilePickerFileClick(mItem);
|
getAdapter().onFilePickerFileClick(mItem, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
setStyle(mTextSettingName, mItem);
|
setStyle(mTextSettingName, mItem);
|
||||||
|
|
Loading…
Reference in New Issue