import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
public class EditBookmarkFolderDialog extends AppCompatDialogFragment {
import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
public class EditBookmarkFolderDialog extends AppCompatDialogFragment {
// The public interface is used to send information back to the parent activity.
public interface EditBookmarkFolderListener {
void onSaveBookmarkFolder(AppCompatDialogFragment dialogFragment, int selectedFolderDatabaseId);
}
// The public interface is used to send information back to the parent activity.
public interface EditBookmarkFolderListener {
void onSaveBookmarkFolder(AppCompatDialogFragment dialogFragment, int selectedFolderDatabaseId);
}
- // Get a handle for `EditFolderListener` from `parentActivity`.
- try {
- editBookmarkFolderListener = (EditBookmarkFolderListener) context;
- } catch(ClassCastException exception) {
- throw new ClassCastException(context.toString() + " must implement EditBookmarkFolderListener.");
- }
+ // Get a handle for `EditFolderListener` from the launching context.
+ editBookmarkFolderListener = (EditBookmarkFolderListener) context;
// Remove the incorrect lint warning that `getInt()` might be null.
assert getArguments() != null;
// Store the folder database ID in the class variable.
// Remove the incorrect lint warning that `getInt()` might be null.
assert getArguments() != null;
// Store the folder database ID in the class variable.
// Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`.
final BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0);
// Get a `Cursor` with the selected folder and move it to the first position.
// Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`.
final BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0);
// Get a `Cursor` with the selected folder and move it to the first position.
String newFolderName = folderNameEditText.getText().toString();
// Get a cursor for the new folder name if it exists.
String newFolderName = folderNameEditText.getText().toString();
// Get a cursor for the new folder name if it exists.