import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import com.stoutner.privacybrowser.R;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
import com.stoutner.privacybrowser.R;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
-public class EditBookmarkFolderDialog extends AppCompatDialogFragment {
+public class EditBookmarkFolderDialog extends DialogFragment {
+ // Instantiate the class variable.
+ private EditBookmarkFolderListener editBookmarkFolderListener;
+
// The public interface is used to send information back to the parent activity.
public interface EditBookmarkFolderListener {
// The public interface is used to send information back to the parent activity.
public interface EditBookmarkFolderListener {
- // 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.