X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FCreateBookmarkFolderDialog.java;h=dfe6cbd8a1a861b66ffedac5bd36ceab0df878a3;hb=871520acac2bd75f528e943c1b2a650017c852b9;hp=2a324b5bbc44a6b874fb55a91cea9bd05ad92e56;hpb=42c6627eecfbe6145ab1167d32b1c9ebf71bc9ce;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java index 2a324b5b..dfe6cbd8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java @@ -38,9 +38,9 @@ import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; +import com.stoutner.privacybrowser.activities.BookmarksActivity; import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; -import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. @@ -113,9 +113,6 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { // The `AlertDialog` must be shown before items in the alert dialog can be modified. alertDialog.show(); - // 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 handle for the create button. final Button createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); EditText folderNameEditText = (EditText) alertDialog.findViewById(R.id.create_folder_name_edittext); @@ -141,7 +138,7 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { String folderName = s.toString(); // Check if a folder with the name already exists. - Cursor folderExistsCursor = bookmarksDatabaseHelper.getFolderCursor(folderName); + Cursor folderExistsCursor = BookmarksActivity.bookmarksDatabaseHelper.getFolderCursor(folderName); // Enable the create button if the new folder name is not empty and doesn't already exist. createButton.setEnabled(!folderName.isEmpty() && (folderExistsCursor.getCount() == 0));