// Saves the repository to the database private boolean saveRepository() { String encrypted_username = new String(encrypt_helper.encrypt(username.getText().toString())); String encrypted_password = new String(encrypt_helper.encrypt(password.getText().toString())); Beans.RepositoryBean cur_repo = Beans.RepositoryBean.getInstance( edit_repo, repo_name.getText().toString(), url.getText().toString(), repo_types.getSelectedItemPosition(), repo_auth.getSelectedItemPosition(), encrypted_username, encrypted_password, new String(encrypt_helper.encrypt(key.getText().toString())), encrypt_helper); // Make sure edit mode is not on if (!edit_mode) { // Attempt to add the repository to the application if (!db_helper.insert(cur_repo)) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.add_repo_adding_error_title); alert.setMessage("Could not add repository to the list"); alert.setPositiveButton(android.R.string.ok, null); alert.show(); return false; } Toast.makeText(this, R.string.add_repo_added_repo, 1000).show(); } else { // Attempt to update the repository in the database if (!db_helper.update(cur_repo)) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.add_repo_adding_error_title); alert.setMessage("Could not update repository"); alert.setPositiveButton(android.R.string.ok, null); alert.show(); return false; } Toast.makeText(this, R.string.add_repo_updated_repo, 1000).show(); } return true; }