1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +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

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