mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
fixed possible NPE + formatting
This commit is contained in:
parent
68eada9752
commit
95743e388b
1 changed files with 28 additions and 27 deletions
|
@ -309,7 +309,7 @@ public class FileChooserActivity extends Activity {
|
|||
* THEME
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
if (getIntent().hasExtra(_Theme)) {
|
||||
int theme;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
|
@ -320,7 +320,7 @@ public class FileChooserActivity extends Activity {
|
|||
theme = getIntent().getIntExtra(_Theme, android.R.style.Theme);
|
||||
setTheme(theme);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.afc_file_chooser);
|
||||
|
@ -351,10 +351,10 @@ public class FileChooserActivity extends Activity {
|
|||
mViewSort = (ImageView) findViewById(R.id.afc_filechooser_activity_button_sort);
|
||||
mViewFoldersView = (ImageView) findViewById(R.id.afc_filechooser_activity_button_folders_view);
|
||||
mViewCreateFolder = (ImageView) findViewById(R.id.afc_filechooser_activity_button_create_folder);
|
||||
if (!getIntent().getBooleanExtra(_ShowNewFolderButton, true)) {
|
||||
mViewCreateFolder.setVisibility(View.GONE);
|
||||
}
|
||||
mFilenameRegexp = getIntent().getStringExtra(_FilenameRegExp);
|
||||
if (!getIntent().getBooleanExtra(_ShowNewFolderButton, true)) {
|
||||
mViewCreateFolder.setVisibility(View.GONE);
|
||||
}
|
||||
mFilenameRegexp = getIntent().getStringExtra(_FilenameRegExp);
|
||||
mViewGoBack = (ImageView) findViewById(R.id.afc_filechooser_activity_button_go_back);
|
||||
mViewGoForward = (ImageView) findViewById(R.id.afc_filechooser_activity_button_go_forward);
|
||||
mViewLocations = (ViewGroup) findViewById(R.id.afc_filechooser_activity_view_locations);
|
||||
|
@ -458,10 +458,10 @@ public class FileChooserActivity extends Activity {
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
IFile currentLoc = getLocation();
|
||||
if (currentLoc == null || mHistory == null) {
|
||||
super.onBackPressed();
|
||||
return;
|
||||
}
|
||||
if (currentLoc == null || mHistory == null) {
|
||||
super.onBackPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
IFile preLoc = null;
|
||||
while (currentLoc.equalsToPath(preLoc = mHistory.prevOf(currentLoc)))
|
||||
|
@ -1048,13 +1048,14 @@ public class FileChooserActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
|
||||
final IFileProvider fileProvider = mFileProvider;
|
||||
if (fileProvider == null) {
|
||||
return;
|
||||
}
|
||||
final IFileProvider fileProvider = mFileProvider;
|
||||
final IFile location = getLocation();
|
||||
if (fileProvider == null || location == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFile dir = fileProvider.fromPath(String
|
||||
.format("%s/%s", getLocation().getAbsolutePath(), name));
|
||||
.format("%s/%s", location.getAbsolutePath(), name));
|
||||
if (dir.mkdir()) {
|
||||
Dlg.toast(FileChooserActivity.this, getString(R.string.afc_msg_done), Dlg._LengthShort);
|
||||
setLocation(getLocation(), null);
|
||||
|
@ -1509,13 +1510,13 @@ public class FileChooserActivity extends Activity {
|
|||
}
|
||||
break;
|
||||
case DirectoriesOnly:
|
||||
{
|
||||
{
|
||||
final File file = (File)getLocation();
|
||||
if (file != null && file.canWrite()) {
|
||||
returnPath = getLocation().getAbsolutePath();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case FilesAndDirectories:
|
||||
if(files == null || files.isEmpty()){
|
||||
returnPath = getLocation().getAbsolutePath();
|
||||
|
@ -1676,9 +1677,9 @@ public class FileChooserActivity extends Activity {
|
|||
final boolean isDirectoryWriteable = ((File)dir).canWrite();
|
||||
mViewCreateFolder.setEnabled(isDirectoryWriteable);
|
||||
mBtnOk.setEnabled(
|
||||
isDirectoryWriteable ||
|
||||
mFileProvider.getFilterMode() == IFileProvider.FilterMode.AnyDirectories
|
||||
);
|
||||
isDirectoryWriteable ||
|
||||
mFileProvider.getFilterMode() == IFileProvider.FilterMode.AnyDirectories
|
||||
);
|
||||
}
|
||||
|
||||
private final View.OnLongClickListener mBtnGoBackForwardOnLongClickListener = new View.OnLongClickListener() {
|
||||
|
@ -1909,16 +1910,16 @@ public class FileChooserActivity extends Activity {
|
|||
else {
|
||||
if (mIsMultiSelection) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsSaveDialog) {
|
||||
doCheckSaveasFilenameAndFinish(data.getFile().getName());
|
||||
} else {
|
||||
final IFileAdapter.Bag bag = (IFileAdapter.Bag)view.getTag();
|
||||
if (bag != null && bag.mIsAccessible) {
|
||||
doFinish(data.getFile());
|
||||
}
|
||||
}
|
||||
final IFileAdapter.Bag bag = (IFileAdapter.Bag)view.getTag();
|
||||
if (bag != null && bag.mIsAccessible) {
|
||||
doFinish(data.getFile());
|
||||
}
|
||||
}
|
||||
}// single tap to choose files
|
||||
}// onItemClick()
|
||||
};// mViewFilesOnItemClickListener
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue