/** * Import all data from somewhere on shared storage; ask user to disambiguate if necessary * * <p>return void */ private void importData() { // Find all possible files (CSV in bookCatalogue directory) ArrayList<File> files = StorageUtils.findExportFiles(); // If none, exit with message if (files == null || files.size() == 0) { Toast.makeText(this, R.string.no_export_files_found, Toast.LENGTH_LONG).show(); return; } else { if (files.size() == 1) { // If only 1, just use it importData(files.get(0).getAbsolutePath()); } else { // If more than one, ask user which file // ENHANCE: Consider asking about importing cover images. StandardDialogs.selectFileDialog( getLayoutInflater(), getString(R.string.more_than_one_export_file_blah), files, new SimpleDialogOnClickListener() { @Override public void onClick(SimpleDialogItem item) { SimpleDialogFileItem fileItem = (SimpleDialogFileItem) item; importData(fileItem.getFile().getAbsolutePath()); } }); } } }
/** * Check that goodreads is authorized for this app, and optionally allow user to request auth or * more info * * @return Flag indicating OK */ private boolean checkGoodreadsAuth() { // Make sure GR is authorized for this app GoodreadsManager grMgr = new GoodreadsManager(); if (!grMgr.hasCredentials()) { StandardDialogs.goodreadsAuthAlert(this); return false; } if (!grMgr.hasValidCredentials()) { StandardDialogs.goodreadsAuthAlert(this); return false; } return true; }