]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java
Finish creating the bookmark drawer. https://redmine.stoutner.com/issues/132
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / CreateBookmarkFolderDialog.java
index 2a324b5bbc44a6b874fb55a91cea9bd05ad92e56..7954478e623745ccf8d57885c26ca37eca861fad 100644 (file)
@@ -38,8 +38,8 @@ import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ImageView;
 
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.R;
+import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 public class CreateBookmarkFolderDialog extends AppCompatDialogFragment {
@@ -113,16 +113,17 @@ 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.
+        // Get handles for the views in the dialog.
         final Button createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
         EditText folderNameEditText = (EditText) alertDialog.findViewById(R.id.create_folder_name_edittext);
+        ImageView webPageIconImageView = (ImageView) alertDialog.findViewById(R.id.create_folder_web_page_icon);
 
         // Initially disable the create button.
         createButton.setEnabled(false);
 
+        // 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);
+
         // Enable the create button if the new folder name is unique.
         folderNameEditText.addTextChangedListener(new TextWatcher() {
             @Override
@@ -166,7 +167,6 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment {
         });
 
         // Display the current favorite icon.
-        ImageView webPageIconImageView = (ImageView) alertDialog.findViewById(R.id.create_folder_web_page_icon);
         webPageIconImageView.setImageBitmap(MainWebViewActivity.favoriteIconBitmap);
 
         // `onCreateDialog()` requires the return of an `AlertDialog`.