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:
parent
2db6151b21
commit
ba3a866690
1 changed files with 14 additions and 13 deletions
|
@ -363,15 +363,14 @@ public class FileChooserActivity extends Activity {
|
||||||
mHistory = savedInstanceState.getParcelable(_History);
|
mHistory = savedInstanceState.getParcelable(_History);
|
||||||
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());
|
mViewGoBack.setEnabled(idx > 0);
|
||||||
mViewGoBack.setEnabled(idx > 0);
|
mViewGoForward.setEnabled(idx >= 0 && idx < history.size() - 1);
|
||||||
mViewGoForward.setEnabled(idx >= 0 && idx < history.size() - 1);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// full history
|
// full history
|
||||||
if (savedInstanceState != null && savedInstanceState.get(_FullHistory) instanceof HistoryStore<?>)
|
if (savedInstanceState != null && savedInstanceState.get(_FullHistory) instanceof HistoryStore<?>)
|
||||||
|
@ -1362,6 +1361,11 @@ public class FileChooserActivity extends Activity {
|
||||||
* navigation buttons
|
* navigation buttons
|
||||||
*/
|
*/
|
||||||
createLocationButtons(path);
|
createLocationButtons(path);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* update UI elements
|
||||||
|
*/
|
||||||
|
updateUI(path);
|
||||||
|
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
listener.onFinish(true, path);
|
listener.onFinish(true, path);
|
||||||
|
@ -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(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue