1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 09:49:19 +02:00

Fix a bug with Ok button in FileChooser

This commit is contained in:
Dmitri Yuranov 2014-04-25 14:05:41 +02:00
parent 2db6151b21
commit ba3a866690

View file

@ -363,15 +363,14 @@ public class FileChooserActivity extends Activity {
mHistory = savedInstanceState.getParcelable(_History);
else
mHistory = new HistoryStore<IFile>(DisplayPrefs._DefHistoryCapacity);
mHistory.addListener(new HistoryListener<IFile>() {
@Override
public void onChanged(History<IFile> history) {
int idx = history.indexOf(getLocation());
mViewGoBack.setEnabled(idx > 0);
mViewGoForward.setEnabled(idx >= 0 && idx < history.size() - 1);
}
});
mHistory.addListener(new HistoryListener<IFile>() {
@Override
public void onChanged(History<IFile> history) {
int idx = history.indexOf(getLocation());
mViewGoBack.setEnabled(idx > 0);
mViewGoForward.setEnabled(idx >= 0 && idx < history.size() - 1);
}
});
// full history
if (savedInstanceState != null && savedInstanceState.get(_FullHistory) instanceof HistoryStore<?>)
@ -1362,6 +1361,11 @@ public class FileChooserActivity extends Activity {
* navigation buttons
*/
createLocationButtons(path);
/*
* update UI elements
*/
updateUI(path);
if (listener != null)
listener.onFinish(true, path);
@ -1391,7 +1395,6 @@ public class FileChooserActivity extends Activity {
mHistory.truncateAfter(mLastPath);
mHistory.push(dir);
mFullHistory.push(dir);
checkUIForFolderCreation(dir);
}
}
});
@ -1586,7 +1589,6 @@ public class FileChooserActivity extends Activity {
}
}
});
checkUIForFolderCreation(preLoc);
} else {
mViewGoBack.setEnabled(false);
}
@ -1641,14 +1643,13 @@ public class FileChooserActivity extends Activity {
}
}
});
checkUIForFolderCreation(nextLoc);
} else {
mViewGoForward.setEnabled(false);
}
}
};// mBtnGoForwardOnClickListener
private void checkUIForFolderCreation(IFile dir){
private void updateUI(IFile dir){
final boolean isDirectoryWriteable = ((File)dir).canWrite();
mViewCreateFolder.setEnabled(isDirectoryWriteable);
mBtnOk.setEnabled(