From c4ad9f457f41cbc86391e0099629cd94a235258a Mon Sep 17 00:00:00 2001
From: Soren Stoutner <soren@stoutner.com>
Date: Fri, 15 Jul 2016 13:44:38 -0700
Subject: [PATCH] Add the ability to create and edit bookmark folders.

---
 .idea/dictionaries/soren.xml                  |   2 +
 app/src/main/AndroidManifest.xml              |  54 +--
 app/src/main/assets/about_licenses.html       |  42 ++-
 .../assets/images/ic_create_new_folder.png    | Bin 0 -> 911 bytes
 app/src/main/assets/images/ic_folder.png      | Bin 0 -> 811 bytes
 .../main/assets/images/ic_folder_special.png  | Bin 0 -> 1572 bytes
 .../privacybrowser/BookmarksActivity.java     | 355 ++++++++++++++----
 .../BookmarksDatabaseHandler.java             | 195 ++++++++--
 .../BookmarksDatabaseViewActivity.java        | 144 +++++++
 .../privacybrowser/CreateBookmark.java        |  52 +--
 .../privacybrowser/CreateBookmarkFolder.java  | 120 ++++++
 .../CreateHomeScreenShortcut.java             |  36 +-
 .../stoutner/privacybrowser/EditBookmark.java |  75 ++--
 .../privacybrowser/EditBookmarkFolder.java    | 143 +++++++
 .../privacybrowser/MainWebViewActivity.java   |  14 +-
 .../stoutner/privacybrowser/MoveToFolder.java |  25 ++
 .../res/drawable-hdpi/folder_blue_bitmap.png  | Bin 0 -> 613 bytes
 .../res/drawable-mdpi/folder_blue_bitmap.png  | Bin 0 -> 480 bytes
 .../res/drawable-xhdpi/folder_blue_bitmap.png | Bin 0 -> 895 bytes
 .../drawable-xxhdpi/folder_blue_bitmap.png    | Bin 0 -> 1168 bytes
 app/src/main/res/drawable/back.xml            |   4 +-
 app/src/main/res/drawable/create_folder.xml   |  15 +
 app/src/main/res/drawable/edit.xml            |   4 +-
 app/src/main/res/drawable/exit.xml            |   4 +-
 app/src/main/res/drawable/folder.xml          |  14 +
 app/src/main/res/drawable/forward.xml         |   4 +-
 .../drawable/move_bookmark_down_disabled.xml  |   2 +-
 .../drawable/move_bookmark_down_enabled.xml   |   2 +-
 .../drawable/move_bookmark_up_disabled.xml    |   2 +-
 .../res/drawable/move_bookmark_up_enabled.xml |   2 +-
 app/src/main/res/drawable/move_to_folder.xml  |  15 +
 .../layout/bookmarks_coordinatorlayout.xml    |  14 +-
 ...kmarks_database_view_coordinatorlayout.xml |  58 +++
 .../bookmarks_database_view_linearlayout.xml  | 110 ++++++
 .../layout/bookmarks_item_linearlayout.xml    |   4 +-
 .../res/layout/create_bookmark_dialog.xml     |   8 +-
 .../layout/create_bookmark_folder_dialog.xml  | 113 ++++++
 .../create_home_screen_shortcut_dialog.xml    |  38 +-
 .../main/res/layout/edit_bookmark_dialog.xml  |  84 +++--
 .../layout/edit_bookmark_folder_dialog.xml    | 130 +++++++
 .../main/res/menu/bookmarks_context_menu.xml  |  13 +-
 .../main/res/menu/bookmarks_options_menu.xml  |  15 +-
 app/src/main/res/values/colors.xml            |   4 +-
 app/src/main/res/values/strings.xml           |  20 +-
 44 files changed, 1622 insertions(+), 314 deletions(-)
 create mode 100644 app/src/main/assets/images/ic_create_new_folder.png
 create mode 100644 app/src/main/assets/images/ic_folder.png
 create mode 100644 app/src/main/assets/images/ic_folder_special.png
 create mode 100644 app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseViewActivity.java
 create mode 100644 app/src/main/java/com/stoutner/privacybrowser/CreateBookmarkFolder.java
 create mode 100644 app/src/main/java/com/stoutner/privacybrowser/EditBookmarkFolder.java
 create mode 100644 app/src/main/java/com/stoutner/privacybrowser/MoveToFolder.java
 create mode 100644 app/src/main/res/drawable-hdpi/folder_blue_bitmap.png
 create mode 100644 app/src/main/res/drawable-mdpi/folder_blue_bitmap.png
 create mode 100644 app/src/main/res/drawable-xhdpi/folder_blue_bitmap.png
 create mode 100644 app/src/main/res/drawable-xxhdpi/folder_blue_bitmap.png
 create mode 100644 app/src/main/res/drawable/create_folder.xml
 create mode 100644 app/src/main/res/drawable/folder.xml
 create mode 100644 app/src/main/res/drawable/move_to_folder.xml
 create mode 100644 app/src/main/res/layout/bookmarks_database_view_coordinatorlayout.xml
 create mode 100644 app/src/main/res/layout/bookmarks_database_view_linearlayout.xml
 create mode 100644 app/src/main/res/layout/create_bookmark_folder_dialog.xml
 create mode 100644 app/src/main/res/layout/edit_bookmark_folder_dialog.xml

diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml
index 2d91de18..f6e91ca9 100644
--- a/.idea/dictionaries/soren.xml
+++ b/.idea/dictionaries/soren.xml
@@ -35,6 +35,8 @@
       <w>orbot</w>
       <w>panopticlick</w>
       <w>parentfolder</w>
+      <w>radiobutton</w>
+      <w>radiogroup</w>
       <w>redmine</w>
       <w>referer</w>
       <w>relativelayout</w>
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 17fb93ab..60d1f3aa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,7 +28,7 @@
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
 
 
-    <!-- For API >= 23, app data is automatically backed up to Google cloud servers unless android:allowBackup="false" and android:fullBackupContent="false" is set. -->
+    <!-- For API >= 23, app data is automatically backed up to Google cloud servers unless `android:allowBackup="false"` and `android:fullBackupContent="false"` is set. -->
     <application
         android:label="@string/privacy_browser"
         android:icon="@mipmap/privacy_browser"
@@ -36,16 +36,16 @@
         android:allowBackup="false"
         android:fullBackupContent="false" >
 
-        <!-- If android:name="android.webkit.WebView.MetricsOptOut" is not "true" then WebViews will upload metrics to Google.
-          https://developer.android.com/reference/android/webkit/WebView.html -->
+        <!-- If `android:name="android.webkit.WebView.MetricsOptOut"` is not `true` then WebViews will upload metrics to Google.
+            https://developer.android.com/reference/android/webkit/WebView.html -->
         <meta-data
             android:name="android.webkit.WebView.MetricsOptOut"
             android:value="true" />
 
-        <!-- android:configChanges="orientation|screenSize" makes the activity not reload when the orientation changes, which preserves scroll location in the WebView.
-          android:launchMode="singleTask" makes the app launch in a new task instead of inside the task of the program that sends it an intent.
-          It also makes it reuse an existing Privacy Browser activity if available instead of launching a new one.
-          android:persistableMode="persistNever" removes Privacy Browser from the recents screen on a device reboot. -->
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes, which preserves scroll location in the WebView.
+            `android:launchMode="singleTask"` makes the app launch in a new task instead of inside the task of the program that sends it an intent.
+            It also makes it reuse an existing Privacy Browser activity if available instead of launching a new one.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
         <activity
             android:name=".MainWebViewActivity"
             android:label="@string/privacy_browser"
@@ -58,7 +58,7 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
 
-            <!-- android.intent.action.VIEW with the two data schemes enables processing of web intents. -->
+            <!-- `android.intent.action.VIEW` with the two data schemes enables processing of web intents. -->
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.BROWSABLE" />
@@ -69,48 +69,54 @@
         </activity>
 
 
-        <!-- android:configChanges="orientation|screenSize" makes the activity not reload when the orientation changes.
-          android:persistableMode="persistNever" removes Privacy Browser from the recents screen on a device reboot. -->
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
         <activity
             android:name=".BookmarksActivity"
             android:label="@string/bookmarks"
             android:theme="@style/PrivacyBrowser.SecondaryActivity"
             android:parentActivityName=".MainWebViewActivity"
             android:configChanges="orientation|screenSize"
-            android:persistableMode="persistNever" >
-        </activity>
+            android:persistableMode="persistNever" />
+
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
+        <activity
+            android:name=".BookmarksDatabaseViewActivity"
+            android:label="@string/bookmarks_database_view"
+            android:theme="@style/PrivacyBrowser.SecondaryActivity"
+            android:parentActivityName=".BookmarksActivity"
+            android:configChanges="orientation|screenSize"
+            android:persistableMode="persistNever" />
 
-        <!-- android:configChanges="orientation|screenSize" makes the activity not reload when the orientation changes.
-          android:persistableMode="persistNever" removes Privacy Browser from the recents screen on a device reboot. -->
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
         <activity
             android:name=".SettingsActivity"
             android:label="@string/privacy_browser_settings"
             android:theme="@style/Settings"
             android:parentActivityName=".MainWebViewActivity"
             android:configChanges="orientation|screenSize"
-            android:persistableMode="persistNever" >
-        </activity>
+            android:persistableMode="persistNever" />
 
-        <!-- android:configChanges="orientation|screenSize" makes the activity not reload when the orientation changes.
-          android:persistableMode="persistNever" removes Privacy Browser from the recents screen on a device reboot. -->
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
         <activity
             android:name=".GuideActivity"
             android:label="@string/privacy_browser_guide"
             android:theme="@style/PrivacyBrowser.SecondaryActivity"
             android:parentActivityName=".MainWebViewActivity"
             android:configChanges="orientation|screenSize"
-            android:persistableMode="persistNever" >
-        </activity>
+            android:persistableMode="persistNever" />
 
-        <!-- android:configChanges="orientation|screenSize" makes the activity not reload when the orientation changes.
-          android:persistableMode="persistNever" removes Privacy Browser from the recents screen on a device reboot. -->
+        <!-- `android:configChanges="orientation|screenSize"` makes the activity not reload when the orientation changes.
+            `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. -->
         <activity
             android:name=".AboutActivity"
             android:label="@string/about_privacy_browser"
             android:theme="@style/PrivacyBrowser.SecondaryActivity"
             android:parentActivityName=".MainWebViewActivity"
             android:configChanges="orientation|screenSize"
-            android:persistableMode="persistNever" >
-        </activity>
+            android:persistableMode="persistNever" />
     </application>
 </manifest>
diff --git a/app/src/main/assets/about_licenses.html b/app/src/main/assets/about_licenses.html
index 63e79966..f09fbb42 100644
--- a/app/src/main/assets/about_licenses.html
+++ b/app/src/main/assets/about_licenses.html
@@ -23,8 +23,10 @@
         color: 0D4781;
     }
 
-    img.center {
+    img.icon {
         vertical-align: middle;
+        height: 32;
+        width: 32;
     }
 
     img.left {
@@ -55,37 +57,43 @@
     <img class="left" src="images/javascript_enabled.png" height="32" width="32">
     are derived from ic_security and ic_language. Modifications were made by Soren Stoutner in 2016.</p>
 
-<p><img class="center" src="images/ic_language.png" height="32" width="32"> ic_language.</p>
+<p><img class="icon" src="images/ic_language.png"> ic_language.</p>
 
-<p><img class="center" src="images/ic_home.png" height="32" width="32"> ic_home.</p>
+<p><img class="icon" src="images/ic_home.png"> ic_home.</p>
 
-<p><img class="center" src="images/ic_arrow_back.png" height="32" width="32"> ic_arrow_back.</p>
+<p><img class="icon" src="images/ic_arrow_back.png"> ic_arrow_back.</p>
 
-<p><img class="center" src="images/ic_arrow_forward.png" height="32" width="32"> ic_arrow_forward.</p>
+<p><img class="icon" src="images/ic_arrow_forward.png"> ic_arrow_forward.</p>
 
-<p><img class="center" src="images/ic_bookmark_border.png" height="32" width="32"> ic_bookmark_border.</p>
+<p><img class="icon" src="images/ic_bookmark_border.png"> ic_bookmark_border.</p>
 
-<p><img class="center" src="images/ic_file_download.png" height="32" width="32"> ic_file_download.</p>
+<p><img class="icon" src="images/ic_file_download.png"> ic_file_download.</p>
 
-<p><img class="center" src="images/ic_settings.png" height="32" width="32"> ic_settings.</p>
+<p><img class="icon" src="images/ic_settings.png"> ic_settings.</p>
 
-<p><img class="center" src="images/ic_import_contacts.png" height="32" width="32"> ic_import_contacts.</p>
+<p><img class="icon" src="images/ic_import_contacts.png"> ic_import_contacts.</p>
 
-<p><img class="center" src="images/ic_info_outline.png" height="32" width="32"> ic_info_outline.</p>
+<p><img class="icon" src="images/ic_info_outline.png"> ic_info_outline.</p>
 
-<p><img class="center" src="images/ic_exit_to_app.png" height="32" width="32"> ic_exit_to_app.</p>
+<p><img class="icon" src="images/ic_exit_to_app.png"> ic_exit_to_app.</p>
 
-<p><img class="center" src="images/ic_add.png" height="32" width="32"> ic_add.</p>
+<p><img class="icon" src="images/ic_add.png"> ic_add.</p>
 
-<p><img class="center" src="images/ic_vertical_align_top.png" height="32" width="32"> ic_vertical_align_top</p>
+<p><img class="icon" src="images/ic_vertical_align_top.png"> ic_vertical_align_top</p>
 
-<p><img class="center" src="images/ic_vertical_align_bottom.png" height="32" width="32"> ic_vertical_align_bottom</p>
+<p><img class="icon" src="images/ic_vertical_align_bottom.png"> ic_vertical_align_bottom</p>
 
-<p><img class="center" src="images/ic_edit.png" height="32" width="32"> ic_edit.</p>
+<p><img class="icon" src="images/ic_folder.png"> ic_folder</p>
 
-<p><img class="center" src="images/ic_delete.png" height="32" width="32"> ic_download.</p>
+<p><img class="icon" src="images/ic_create_new_folder.png"> ic_create_new_folder</p>
 
-<p><img class="center" src="images/ic_select_all.png" height="32" width="32"> ic_select_all</p>
+<p><img class="icon" src="images/ic_folder_special.png"> ic_folder_special</p>
+
+<p><img class="icon" src="images/ic_edit.png"> ic_edit.</p>
+
+<p><img class="icon" src="images/ic_delete.png"> ic_download.</p>
+
+<p><img class="icon" src="images/ic_select_all.png"> ic_select_all</p>
 <hr/>
 
 <h3>GNU General Public License</h3>
diff --git a/app/src/main/assets/images/ic_create_new_folder.png b/app/src/main/assets/images/ic_create_new_folder.png
new file mode 100644
index 0000000000000000000000000000000000000000..db0234d7b9e35cae4e5e159ebd095d6679b87741
GIT binary patch
literal 911
zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSEX7WqAsj$Z!;#Vf<Z~8yL>4nJ
zsJsMW#sHP)KY)UgC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NHH)l^LV;A
zhE&XXdv|wMNT5jjM}4=W++{+_5&|x7_9QHx(Xc2Xiko>~6MsU|bfdZZ8tfb{-H7zi
zGR>@Ez39ZF=6JDUrAs%bN5PCYw$C@IZ{8=b<576-%)Fcb*Q_}+$H!rkiYGFvzUSe)
z-I&XVaq<BRgRskQzh#S7gjDb<$}q|?%|0-narMt<a@!d67~X5{zu2~*;q?Krr{*^V
zL<*#CEckQm*%c>Yf0vNcQ|<>i2b{<~m7g+o*80DaoM{t3&CXEQc*5{u>L+OsgXgLF
zIlq7lDo@SN3S7~7zVt!ngUVp;z)7VEycMiAkMHNFtevs!Px+dyo9{80SLNQy`<5yb
zeO=mp)%jGb*n~#A@9FhxPX}@;A9(Zadht&6=Oqlh+ae#tz4QFXA)(jbm~5&3gk{0j
z%-~vS=6BEMB(O`^8C$YjGxN;%KG1oknfJg4$%Vyd-GrD8<{S&=FJY7LV-M!v!pxG+
z&}7VT&=SaC_t@_8e73^UX<Ta!XESn~V*tq&bMTzw6PSaS8?%Jr$)5T5*B1SIkhJVk
z?bb3|$0ZCaxS0j!I42a8H9X*PC}2~tfOC~<eeSRnY(Ml<{>2~TRU+Yy!J_Z77aiK!
zyVLon|1q7&ZprhZFZ-|h^X;-{BFcWC>+~*tWe9y5<8LtG{qyo<hD))E?`JjG9#k~2
zNQc_LV-7=(={BybZ=+u|S~5nwPFB=<oD5`6{u`JeY%yi8%+{CU1u{Qo78Urh|6tVl
zzFBGOE7s20{6C!^Og{7Y>b~W^_YY>D`aiYr>fW%-hpfAc4@^JAf92PHJLdH2H_>bJ
z81GBhIfPZ^GMZPvi(uAcdatE-XH{H&<LBLPLX-KJix0T<vqqi0V)Y@Rn*UeW^#cZ6
zG0e*vCLf6K-M)IR-Nj1Bcd8qh{^;$NK}njERCrtVPcK`wo$KsfTVUp4@O1TaS?83{
F1OR<_b`byo

literal 0
HcmV?d00001

diff --git a/app/src/main/assets/images/ic_folder.png b/app/src/main/assets/images/ic_folder.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1b3183d365f66c024c6151436dfd12ccb49cdbf
GIT binary patch
literal 811
zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSEX7WqAsj$Z!;#Vf<Z~8yL>4nJ
zsJsMW#sHP)KY)UgC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NHH)lt?+bl
z45^s&_O7*mNT5jDL-9`YEd53|-l?}{&3LeM<HBtp%_F3IbvAC<yx|Lf#4SlvLyu<r
zgBkis8Y*fxRvz7`C}{D!;M~o_HSZ^{$vdCI|2lc&3{5r_&q>Ir<jL7DUu-rX5Gs(K
z!G7-Rmp!p-na^w8S3IQoKyU-+pP3t~jP9HkJ0SXi`>S*=hgJkrUBLc>Z3~*XeV(1T
zzkVLyr^y^&r~TqB6$&Y8|J7^4BD!};oiKm&Kg$;{EZoyS77OttO#IbbEEG~Q`IoOT
zi>-F0c7<ex?G@K6r_?quu3=o?5IRetKWXN#{Tr{n`^9nR#`;Wl%dmoN>-qbx%zu4=
z{XyY%bq&r2waYqZ^)_F6dXO!lY7IlVxBQd&4KEFuZP=fA$%P0tT-@ecx{cwEer1Dj
z!mm5pmT&kBYS%HQ-<C6DxSY<m<I1-Uj5GW`=ko7j_E|2R%WuVaNV1`TO<|6;gN3?-
z1+&08h8AOnhcQftEnzZ@9M6R$&T&FzcpNOIA1Lqx>tW<bXE?NzrLC9=qz5Pi)UIkU
zM_6GFSO#dYUgN_#Fd2rHVosjtEFe7)E4>qNSQ+EVP{&us{WW*@+k=xBYTgzIUcI<0
zTy^$enGLLS^!D`~+rm7Dv2Lqnj1gm5LwRi8lEA$SQ$H`P;j9U)h<hx($9=U)ylTF0
z+}``UbN}w-sFDBK8p(cLY{QQ7+rLV?pT+my(!Z6J^*i3*tyJ_!&57>l_VxY;o-$XN
z&X|0_`N3^F@hxpDc^@#c-WU02Ut4>qoF`(Dq%-${pY!I0@6Nrn=j3L#HO%{8$GM{<
e9~DpGhx&)LocV9>Oj!&}*bJVoelF{r5}E+ecuL3s

literal 0
HcmV?d00001

diff --git a/app/src/main/assets/images/ic_folder_special.png b/app/src/main/assets/images/ic_folder_special.png
new file mode 100644
index 0000000000000000000000000000000000000000..2eef308a3714d5ba413493e557191d82a2f71f08
GIT binary patch
literal 1572
zcmV+<2HW|GP)<h;3K|Lk000e1NJLTq004jh004jp1^@s6!#-il00004b3#c}2nYxW
zd<bNS00009a7bBm001QE001QE0Z=68_y7O^8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H11))hqK~#90?cG~w99100@$WX)Xj-&hQk#gP*gSYc48=;N1)+Tq
z>`S1Ch);qbiXwtO)<@qo#G+Px5k%CAiufP}FKLWgm5LWEUJ-0!Vo~BHjZs@4{u_5!
zH`#M$=FFL$`F-HfWIH?O%${G)&di>f1rZSu5fKp)5fKp)5fKp)5fKp)5$SrhjMmcw
zYyq|b1Hk%>)|=Ejz=M(7Pzk31_X0D(iGr2;!)>+zTn2na{Ek)#BG?A}Li`R^2qL%;
zm?eJ4`jiKPyb={PPW%qlND#?R;&-G%5Ya2d@5Ho4ZwCqW0rSM~K#c^ETtWPf(?}4}
zb;R#9g&<?AJeFM>tQGOxNBj`_lplaYz$kDn*`3OFvMZyFP|2>m3tY2Or*+~p0!Z;}
z2HwI(vP2Ys?$?9u%j{0_WCfr+b^{~6Pf`HNqXvv&=WCoP0Oc|W+~)HH1)zLx@L5;^
zD4$J0zw5#ZK>5_LIU7zCfOHn?rDz6R7gPY!c@B6!b|cz2*>%B_Lbjp;#;_sxrq~Th
zN&!gjL*QWj=Yzmi5!;fO-U5<)sOjg2qqQO>1t6JOU|-Yk&tf0db{z#EnMZ+zrr#HV
z$0M~R6$QZGpTOQWk3UlXzpkPH_}d2@Y4i9r@IuaQNlgLpH<s}K3P}O*a|pZid^wZA
z2RXGR6AFNzQHN#r1aC!#6aaTWVuyR3JcHdYp(`i=?)K7p=(n6dfF}dDB{K?uo4>GQ
ze^-0xl0!lTz|D)m_a4hn0WSw?OQsY6H%Sify5f*fp9VJkj-BJ5!FKqLV(0gd00$DR
zZydM-I2YIeoQ+M@ItROp+M4uDPOr=XSj0MV7VF5P_1|aek1cibbp7A?0Bu<5kgyL6
z#Q=?Ptj7Y<Uw>>v{jq*LCV7O?ZPx}a05=ACCGs_bjZQw>zRPvxW!?wq1)iq6Zw7G}
zHs#FgVvkU|Z3Jj8PXMd4e@TMr!6um`-Cm6V|8WcODsWothB#OYyae2yM`cwB0Kg7l
z0ysZ*Lsl?|UG9B-UKLg;005U`pXLq6Zb%zZ+E%pyK!m?C2RpEH4Y`j_RSW>+{65>k
z(*DWmF)FWW0HCp_JxZL{p@tozMm<8QasZaxi5+X7nq!?y=O_~0)+I{{fEfYaAfInK
zISbfNLC#Vt01cb5IekL`>lgyw1GWaN!;1pY>LTFEfa@Qw*HIV>!2eAKTz8U>m4i|M
zT784x%pYG<z_$U{?@a+{^>#_>aHasXQUEG$q9k=VQve!%20qWBp3i`va;V3N0?;r4
z9M7Si6NEj|@S*@TB<Yl^>%~`L_5&1v2A^Z}0pKyLBPX%j#hvHz{6g&qxa#IPft|_%
z_C?s8ti~p4&b3*`Z`h}My$<W?1&#&W9_KlMKFS<`afj{Sj_ts8TGyAjO*T0YaC<Z<
z)YD2s@<wck-w#~ku&#~R7i@M~z7TH%3V><1Q?>>h(my5Hkh&fC2%B)yZZ>jZb_89O
z^)28yaAwnX*6Q2(U50f`0k_in2X_YWcc5+3K7dF0xM>@Qv7tFsUGLL+*!W4HdbAJV
zVFDWgMzMSTrurVf4mM$jjZa}0fkxjCDD&09u7-fGfpt06R|9Sac2a;liYWlLvlhd;
zh;{!<Zvhpj092d;P;m-C#rXu_*I=!Xtj)PD=o5gc1PzfmocpTgvC=;5Zd!R>Lnr>`
zu{(?%b6MDD1enJ@;gVu|4ad$0|DC|D{9c@j3EoF<68{4nmG<TJ<-09A7hreVjJ>fc
zt>q{=UU<5d_VeOY;*>ceTylOX@I}gotE4Z7fr~rzRWQB4J=o2dW4{npE7QQ;q`Zl=
z&v}5AtOB-R!_Xi$*+H^5gPr6V$L=YZ$CXSXA|fIpA|fIpA|fIpA|fIpA|fJEbpHU3
WuhL&|k-W?R0000<MNUMnLSTZ_)5szK

literal 0
HcmV?d00001

diff --git a/app/src/main/java/com/stoutner/privacybrowser/BookmarksActivity.java b/app/src/main/java/com/stoutner/privacybrowser/BookmarksActivity.java
index 75a34021..ca004072 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/BookmarksActivity.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/BookmarksActivity.java
@@ -22,15 +22,19 @@ package com.stoutner.privacybrowser;
 import android.app.Activity;
 import android.app.DialogFragment;
 import android.content.Context;
+import android.content.Intent;
 import android.database.Cursor;
+import android.database.DatabaseUtils;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.Typeface;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.support.design.widget.FloatingActionButton;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.NavUtils;
+import android.support.v4.content.ContextCompat;
 import android.support.v4.widget.CursorAdapter;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
@@ -47,11 +51,14 @@ import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.ListView;
+import android.widget.RadioButton;
 import android.widget.TextView;
 
 import java.io.ByteArrayOutputStream;
 
-public class BookmarksActivity extends AppCompatActivity implements CreateBookmark.CreateBookmarkListener, EditBookmark.EditBookmarkListener {
+public class BookmarksActivity extends AppCompatActivity implements CreateBookmark.CreateBookmarkListener,
+        CreateBookmarkFolder.CreateBookmarkFolderListener, EditBookmark.EditBookmarkListener,
+        EditBookmarkFolder.EditBookmarkFolderListener {
     // `bookmarksDatabaseHandler` is public static so it can be accessed from EditBookmark.  It is also used in `onCreate()`,
     // `onCreateBookmarkCreate()`, `updateBookmarksListView()`, and `updateBookmarksListViewExcept()`.
     public static BookmarksDatabaseHandler bookmarksDatabaseHandler;
@@ -60,34 +67,50 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
     // It is also used in `onCreate()`, `updateBookmarksListView()`, and `updateBookmarksListViewExcept()`.
     public static ListView bookmarksListView;
 
+    // `currentFolder` is used in `onCreate`, `onOptionsItemSelected()`, `onCreateBookmarkCreate`, `onCreateBookmarkFolderCreate`, and `onEditBookmarkSave`.
+    private String currentFolder;
+
     // `contextualActionMode` is used in `onCreate()` and `onEditBookmarkSave()`.
     private ActionMode contextualActionMode;
 
     // `selectedBookmarkPosition` is used in `onCreate()` and `onEditBookarkSave()`.
     private int selectedBookmarkPosition;
 
+    // `appBar` is used in `onCreate()` and `updateBookmarksListView()`.
+    private ActionBar appBar;
+
+    // `bookmarksCursor` is used in `onCreate()`, `updateBookmarksListView()`, and `updateBookmarksListViewExcept()`.
+    private Cursor bookmarksCursor;
+
+    // `oldFolderName` is used in `onCreate()` and `onEditBookmarkFolderSave()`.
+    private String oldFolderNameString;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.bookmarks_coordinatorlayout);
 
-        // We need to use the SupportActionBar from android.support.v7.app.ActionBar until the minimum API is >= 21.
+        // We need to use the `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21.
         final Toolbar bookmarksAppBar = (Toolbar) findViewById(R.id.bookmarks_toolbar);
         setSupportActionBar(bookmarksAppBar);
 
-        // Display the home arrow on supportAppBar.
-        final ActionBar appBar = getSupportActionBar();
+        // Display the home arrow on `SupportActionBar`.
+        appBar = getSupportActionBar();
         assert appBar != null;// This assert removes the incorrect warning in Android Studio on the following line that appBar might be null.
         appBar.setDisplayHomeAsUpEnabled(true);
 
+
         // Initialize the database handler and the ListView.
         // `this` specifies the context.  The two `null`s do not specify the database name or a `CursorFactory`.
-        // The `0` is to specify a database version, but that is set instead using a constant in BookmarksDatabaseHandler.
+        // The `0` is to specify a database version, but that is set instead using a constant in `BookmarksDatabaseHandler`.
         bookmarksDatabaseHandler = new BookmarksDatabaseHandler(this, null, null, 0);
         bookmarksListView = (ListView) findViewById(R.id.bookmarks_listview);
 
+        // Set currentFolder to the home folder, which is null in the database.
+        currentFolder = "";
+
         // Display the bookmarks in the ListView.
-        updateBookmarksListView();
+        updateBookmarksListView(currentFolder);
 
         // Set a listener so that tapping a list item loads the URL.  We need to store the activity
         // in a variable so that we can return to the parent activity after loading the URL.
@@ -98,12 +121,28 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // Convert the id from long to int to match the format of the bookmarks database.
                 int databaseID = (int) id;
 
-                // Get the bookmark URL and assign it to formattedUrlString.
-                MainWebViewActivity.formattedUrlString = bookmarksDatabaseHandler.getBookmarkURL(databaseID);
+                // Get the bookmark `Cursor` and move it to the first row.
+                Cursor bookmarkCursor = bookmarksDatabaseHandler.getBookmarkCursor(databaseID);
+                bookmarkCursor.moveToFirst();
+
+                // If the bookmark is a folder load its contents into the ListView.
+                if (bookmarkCursor.getInt(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.IS_FOLDER)) == 1) {
+                    // Update `currentFolder`.
+                    currentFolder = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME));
+
+                    // Reload the ListView with `currentFolder`.
+                    updateBookmarksListView(currentFolder);
+                } else {  // Load the URL into `mainWebView`.
+                    // Get the bookmark URL and assign it to formattedUrlString.
+                    MainWebViewActivity.formattedUrlString = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_URL));
+
+                    //  Load formattedUrlString and return to the main activity.
+                    MainWebViewActivity.mainWebView.loadUrl(MainWebViewActivity.formattedUrlString);
+                    NavUtils.navigateUpFromSameTask(bookmarksActivity);
+                }
 
-                //  Load formattedUrlString and return to the main activity.
-                MainWebViewActivity.mainWebView.loadUrl(MainWebViewActivity.formattedUrlString);
-                NavUtils.navigateUpFromSameTask(bookmarksActivity);
+                // Close the `Cursor`.
+                bookmarkCursor.close();
             }
         });
 
@@ -125,7 +164,14 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
             public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                 // Inflate the menu for the contextual app bar and set the title.
                 getMenuInflater().inflate(R.menu.bookmarks_context_menu, menu);
-                mode.setTitle(R.string.bookmarks);
+
+                // Set the title.
+                if (currentFolder.isEmpty()) {
+                    // Use `R.string.bookmarks` if we are in the home folder.
+                    mode.setTitle(R.string.bookmarks);
+                } else {  // Use the current folder name as the title.
+                    mode.setTitle(currentFolder);
+                }
 
                 // Get a handle for MenuItems we need to selectively disable.
                 moveBookmarkUpMenuItem = menu.findItem(R.id.move_bookmark_up);
@@ -202,12 +248,14 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // `numberOfBookmarks` is used in `R.id.move_bookmark_up_enabled`, `R.id.move_bookmark_down_enabled`, and `R.id.context_menu_select_all_bookmarks`.
                 int numberOfBookmarks;
 
-                // `selectedBookmarkLongArray` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
+                // `selectedBookmarkLongArray` is used in `R.id.move_bookmark_up`, `R.id.move_bookmark_down`, and `R.id.edit_bookmark`.
                 long[]selectedBookmarkLongArray;
-                // `selectedBookmarkDatabaseId` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
+                // `selectedBookmarkDatabaseId` is used in `R.id.move_bookmark_up`, `R.id.move_bookmark_down`, and `R.id.edit_bookmark`.
                 int selectedBookmarkDatabaseId;
                 // `selectedBookmarkNewPosition` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
                 int selectedBookmarkNewPosition;
+                // `bookmarkPositionSparseBooleanArray` is used in `R.id.edit_bookmark` and `R.id.delete_bookmark`.
+                SparseBooleanArray bookmarkPositionSparseBooleanArray;
 
                 switch (menuItemId) {
                     case R.id.move_bookmark_up:
@@ -238,7 +286,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         }
 
                         // Refresh the ListView.
-                        updateBookmarksListView();
+                        updateBookmarksListView(currentFolder);
 
                         // Select the previously selected bookmark in the new location.
                         bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true);
@@ -275,7 +323,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         }
 
                         // Refresh the ListView.
-                        updateBookmarksListView();
+                        updateBookmarksListView(currentFolder);
 
                         // Select the previously selected bookmark in the new location.
                         bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true);
@@ -284,22 +332,44 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         break;
 
                     case R.id.edit_bookmark:
+                        // Get a handle for `contextualActionMode` so we can close it when `editBookmarkDialog` is finished.
+                        contextualActionMode = mode;
+
                         // Get a handle for `selectedBookmarkPosition` so we can scroll to it after refreshing the ListView.
-                        SparseBooleanArray bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
+                        bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
                         selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
 
-                        // Get a handle for `contextualActionMode` so we can close it when `editBookmarkDialog` is finished.
-                        contextualActionMode = mode;
+                        // Move to the selected database ID and find out if it is a folder.
+                        bookmarksCursor.moveToPosition(selectedBookmarkPosition);
+                        boolean isFolder = (bookmarksCursor.getInt(bookmarksCursor.getColumnIndex(BookmarksDatabaseHandler.IS_FOLDER)) == 1);
 
-                        // Show the `EditBookmark` `AlertDialog` and name the instance `@string/edit_bookmark`.
-                        DialogFragment editBookmarkDialog = new EditBookmark();
-                        editBookmarkDialog.show(getFragmentManager(), "@string/edit_bookmark");
+                        if (isFolder) {
+                            // Save the current folder name.
+                            oldFolderNameString = bookmarksCursor.getString(bookmarksCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME));
+
+                            // Show the `EditBookmarkFolder` `AlertDialog` and name the instance `@string/edit_folder`.
+                            DialogFragment editFolderDialog = new EditBookmarkFolder();
+                            editFolderDialog.show(getFragmentManager(), getResources().getString(R.string.edit_folder));
+                        } else {
+                            // Show the `EditBookmark` `AlertDialog` and name the instance `@string/edit_bookmark`.
+                            DialogFragment editBookmarkDialog = new EditBookmark();
+                            editBookmarkDialog.show(getFragmentManager(), getResources().getString(R.string.edit_bookmark));
+                        }
                         break;
 
                     case R.id.delete_bookmark:
                         // Get an array of the selected rows.
                         final long[] selectedBookmarksLongArray = bookmarksListView.getCheckedItemIds();
 
+                        // Get a handle for `selectedBookmarkPosition` so we can scroll to it after refreshing the ListView.
+                        bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
+
+                        updateBookmarksListViewExcept(selectedBookmarksLongArray, currentFolder);
+
+                        // Scroll to where the deleted bookmark was located.
+                        bookmarksListView.setSelection(selectedBookmarkPosition);
+
                         String snackbarMessage;
 
                         // Determine how many items are in the array and prepare an appropriate Snackbar message.
@@ -309,8 +379,6 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                             snackbarMessage = selectedBookmarksLongArray.length + " " + getString(R.string.bookmarks_deleted);
                         }
 
-                        updateBookmarksListViewExcept(selectedBookmarksLongArray);
-
                         // Show a SnackBar.
                         Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), snackbarMessage, Snackbar.LENGTH_LONG)
                                 .setAction(R.string.undo, new View.OnClickListener() {
@@ -326,7 +394,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                                             // The user pushed the "Undo" button.
                                             case Snackbar.Callback.DISMISS_EVENT_ACTION:
                                                 // Refresh the ListView to show the rows again.
-                                                updateBookmarksListView();
+                                                updateBookmarksListView(currentFolder);
 
                                                 break;
 
@@ -376,7 +444,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
             public void onClick(View view) {
                 // Show the `CreateBookmark` `AlertDialog` and name the instance `@string/create_bookmark`.
                 DialogFragment createBookmarkDialog = new CreateBookmark();
-                createBookmarkDialog.show(getFragmentManager(), "@string/create_bookmark");
+                createBookmarkDialog.show(getFragmentManager(), getResources().getString(R.string.create_bookmark));
             }
         });
     }
@@ -402,7 +470,21 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
 
         switch (menuItemId) {
             case android.R.id.home:
-                NavUtils.navigateUpFromSameTask(this);
+                // Exit BookmarksActivity if currently at the home folder.
+                if (currentFolder.isEmpty()) {
+                    NavUtils.navigateUpFromSameTask(this);
+                } else {  // Navigate up one folder.
+                    // Place the former parent folder in `currentFolder`.
+                    currentFolder = bookmarksDatabaseHandler.getParentFolder(currentFolder);
+
+                    updateBookmarksListView(currentFolder);
+                }
+                break;
+
+            case R.id.create_folder:
+                // Show the `CreateBookmarkFolder` `AlertDialog` and name the instance `@string/create_folder`.
+                DialogFragment createBookmarkFolderDialog = new CreateBookmarkFolder();
+                createBookmarkFolderDialog.show(getFragmentManager(), getResources().getString(R.string.create_folder));
                 break;
 
             case R.id.options_menu_select_all_bookmarks:
@@ -412,21 +494,27 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                     bookmarksListView.setItemChecked(i, true);
                 }
                 break;
+
+            case R.id.bookmarks_database_view:
+                // Launch `BookmarksDatabaseViewActivity`.
+                Intent bookmarksDatabaseViewIntent = new Intent(this, BookmarksDatabaseViewActivity.class);
+                startActivity(bookmarksDatabaseViewIntent);
+                break;
         }
         return true;
     }
 
     @Override
-    public void onCreateBookmarkCancel(DialogFragment createBookmarkDialogFragment) {
+    public void onCancelCreateBookmark(DialogFragment dialogFragment) {
         // Do nothing because the user selected `Cancel`.
     }
 
     @Override
-    public void onCreateBookmarkCreate(DialogFragment createBookmarkDialogFragment) {
+    public void onCreateBookmark(DialogFragment dialogFragment) {
         // Get the `EditText`s from the `createBookmarkDialogFragment` and extract the strings.
-        EditText createBookmarkNameEditText = (EditText) createBookmarkDialogFragment.getDialog().findViewById(R.id.create_bookmark_name_edittext);
+        EditText createBookmarkNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.create_bookmark_name_edittext);
         String bookmarkNameString = createBookmarkNameEditText.getText().toString();
-        EditText createBookmarkUrlEditText = (EditText) createBookmarkDialogFragment.getDialog().findViewById(R.id.create_bookmark_url_edittext);
+        EditText createBookmarkUrlEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.create_bookmark_url_edittext);
         String bookmarkUrlString = createBookmarkUrlEditText.getText().toString();
 
         // Convert the favoriteIcon Bitmap to a byte array.  `0` is for lossless compression (the only option for a PNG).
@@ -438,63 +526,175 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
         int newBookmarkDisplayOrder = bookmarksListView.getCount();
 
         // Create the bookmark.
-        bookmarksDatabaseHandler.createBookmark(bookmarkNameString, bookmarkUrlString, newBookmarkDisplayOrder, favoriteIconByteArray);
+        bookmarksDatabaseHandler.createBookmark(bookmarkNameString, bookmarkUrlString, newBookmarkDisplayOrder, currentFolder, favoriteIconByteArray);
 
         // Refresh the ListView.  `setSelection` scrolls to the bottom of the list.
-        updateBookmarksListView();
-        bookmarksListView.setSelection(bookmarksListView.getCount());
+        updateBookmarksListView(currentFolder);
+        bookmarksListView.setSelection(newBookmarkDisplayOrder);
     }
 
     @Override
-    public void onEditBookmarkCancel(DialogFragment editBookmarkDialogFragment) {
+    public void onCancelCreateBookmarkFolder(DialogFragment dialogFragment) {
         // Do nothing because the user selected `Cancel`.
     }
 
     @Override
-    public void onEditBookmarkSave(DialogFragment editBookmarkDialogFragment) {
-        // Get the `EditText`s from the `editBookmarkDialogFragment` and extract the strings.
-        EditText editBookmarkNameEditText = (EditText) editBookmarkDialogFragment.getDialog().findViewById(R.id.edit_bookmark_name_edittext);
-        String bookmarkNameString = editBookmarkNameEditText.getText().toString();
-        EditText editBookmarkUrlEditText = (EditText) editBookmarkDialogFragment.getDialog().findViewById(R.id.edit_bookmark_url_edittext);
-        String bookmarkUrlString = editBookmarkUrlEditText.getText().toString();
+    public void onCreateBookmarkFolder(DialogFragment dialogFragment) {
+        // Get `create_folder_name_edit_text` and extract the string.
+        EditText createFolderNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.create_folder_name_edittext);
+        String folderNameString = createFolderNameEditText.getText().toString();
+
+        // Check to see if the folder already exists.
+        Cursor bookmarkFolderCursor = bookmarksDatabaseHandler.getFolderCursor(folderNameString);
+        int existingFoldersWithNewName = bookmarkFolderCursor.getCount();
+        bookmarkFolderCursor.close();
+        if (folderNameString.isEmpty() || (existingFoldersWithNewName > 0)) {
+            String cannotCreateFolder = getResources().getString(R.string.cannot_create_folder) + " \"" + folderNameString + "\"";
+            Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), cannotCreateFolder, Snackbar.LENGTH_INDEFINITE).show();
+        } else {  // Create the folder.
+            // Get the new folder icon.
+            RadioButton defaultFolderIconRadioButton = (RadioButton) dialogFragment.getDialog().findViewById(R.id.create_folder_default_icon_radiobuttion);
+            Bitmap folderIconBitmap;
+            if (defaultFolderIconRadioButton.isChecked()) {
+                // Get the default folder icon drawable and convert it to a `Bitmap`.  `this` specifies the current context.
+                Drawable folderIconDrawable = ContextCompat.getDrawable(this, R.drawable.folder_blue_bitmap);
+                BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable;
+                folderIconBitmap = folderIconBitmapDrawable.getBitmap();
+            } else {
+                folderIconBitmap = MainWebViewActivity.favoriteIcon;
+            }
 
-        CheckBox useNewFavoriteIconBitmap = (CheckBox) editBookmarkDialogFragment.getDialog().findViewById(R.id.edit_bookmark_use_new_favorite_icon_checkbox);
-        byte[] favoriteIconByteArray;
+            // Convert the folder `Bitmap` to a byte array.  `0` is for lossless compression (the only option for a PNG).
+            ByteArrayOutputStream folderIconByteArrayOutputStream = new ByteArrayOutputStream();
+            folderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, folderIconByteArrayOutputStream);
+            byte[] folderIconByteArray = folderIconByteArrayOutputStream.toByteArray();
+
+            // Move all the bookmarks down one in the display order.
+            for (int i = 0; i < bookmarksListView.getCount(); i++) {
+                int databaseId = (int) bookmarksListView.getItemIdAtPosition(i);
+                bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i + 1);
+            }
 
+            // Create the folder, placing it at the top of the ListView
+            bookmarksDatabaseHandler.createFolder(folderNameString, 0, currentFolder, folderIconByteArray);
+
+            // Refresh the ListView.
+            updateBookmarksListView(currentFolder);
+        }
+    }
+
+    @Override
+    public void onCancelEditBookmark(DialogFragment dialogFragment) {
+        // Do nothing because the user selected `Cancel`.
+    }
+
+    @Override
+    public void onSaveEditBookmark(DialogFragment dialogFragment) {
         // Get a long array with the the databaseId of the selected bookmark and convert it to an `int`.
         long[] selectedBookmarksLongArray = bookmarksListView.getCheckedItemIds();
         int selectedBookmarkDatabaseId = (int) selectedBookmarksLongArray[0];
 
-        if (useNewFavoriteIconBitmap.isChecked()) {
-            // Get the new favorite icon from the Dialog and convert it into a Bitmap.
-            ImageView newFavoriteIconImageView = (ImageView) editBookmarkDialogFragment.getDialog().findViewById(R.id.edit_bookmark_new_favorite_icon);
-            Drawable favoriteIconDrawable = newFavoriteIconImageView.getDrawable();
-            Bitmap favoriteIconBitmap = ((BitmapDrawable) favoriteIconDrawable).getBitmap();
+        // Get the `EditText`s from the `editBookmarkDialogFragment` and extract the strings.
+        EditText editBookmarkNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.edit_bookmark_name_edittext);
+        String bookmarkNameString = editBookmarkNameEditText.getText().toString();
+        EditText editBookmarkUrlEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.edit_bookmark_url_edittext);
+        String bookmarkUrlString = editBookmarkUrlEditText.getText().toString();
 
-            // Convert the new `favoriteIconBitmap` into a Byte Array.
-            ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
-            favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
-            favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray();
+        // Get `edit_bookmark_current_icon_radiobutton`.
+        RadioButton currentBookmarkIconRadioButton = (RadioButton) dialogFragment.getDialog().findViewById(R.id.edit_bookmark_current_icon_radiobutton);
 
-            //  Update the bookmark and the favorite icon.
-            bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, favoriteIconByteArray);
-        } else {  // Update the bookmark without changing the favorite icon.
+        if (currentBookmarkIconRadioButton.isChecked()) {  // Update the bookmark without changing the favorite icon.
             bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString);
+        } else {  // Update the bookmark and the favorite icon.
+            // Get the new favorite icon from the `Dialog` and convert it into a `Bitmap`.
+            ImageView newFavoriteIconImageView = (ImageView) dialogFragment.getDialog().findViewById(R.id.edit_bookmark_web_page_favorite_icon);
+            Drawable newFavoriteIconDrawable = newFavoriteIconImageView.getDrawable();
+            Bitmap newFavoriteIconBitmap = ((BitmapDrawable) newFavoriteIconDrawable).getBitmap();
+
+            // Convert `newFavoriteIconBitmap` into a Byte Array.
+            ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
+            newFavoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream);
+            byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray();
+
+            //  Update the bookmark and the favorite icon.
+            bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, newFavoriteIconByteArray);
         }
 
         // Close the contextual action mode.
         contextualActionMode.finish();
 
-        // Refresh the `ListView`.  `setSelection` scrolls to that position.
-        updateBookmarksListView();
+        // Refresh the `ListView`.  `setSelection` scrolls to the position of the bookmark that was edited.
+        updateBookmarksListView(currentFolder);
         bookmarksListView.setSelection(selectedBookmarkPosition);
     }
 
-    private void updateBookmarksListView() {
-        // Get a Cursor with the current contents of the bookmarks database.
-        final Cursor bookmarksCursor = bookmarksDatabaseHandler.getAllBookmarksCursor();
+    @Override
+    public void onCancelEditBookmarkFolder(DialogFragment dialogFragment) {
+        // Do nothing because the user selected `Cancel`.
+    }
+
+    @Override
+    public void onSaveEditBookmarkFolder(DialogFragment dialogFragment) {
+        // Get the new folder name.
+        EditText editFolderNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.edit_folder_name_edittext);
+        String newFolderNameString = editFolderNameEditText.getText().toString();
+
+        // Check to see if the new folder name is unique.
+        Cursor bookmarkFolderCursor = bookmarksDatabaseHandler.getFolderCursor(newFolderNameString);
+        int existingFoldersWithNewName = bookmarkFolderCursor.getCount();
+        bookmarkFolderCursor.close();
+        if ( ((existingFoldersWithNewName == 0) || newFolderNameString.equals(oldFolderNameString)) && !newFolderNameString.isEmpty()) {
+            // Get a long array with the the databaseId of the selected folder and convert it to an `int`.
+            long[] selectedFolderLongArray = bookmarksListView.getCheckedItemIds();
+            int selectedFolderDatabaseId = (int) selectedFolderLongArray[0];
+
+            // Get the `RadioButtons` from the `Dialog`.
+            RadioButton currentFolderIconRadioButton = (RadioButton) dialogFragment.getDialog().findViewById(R.id.edit_folder_current_icon_radiobutton);
+            RadioButton defaultFolderIconRadioButton = (RadioButton) dialogFragment.getDialog().findViewById(R.id.edit_folder_default_icon_radiobutton);
+            Bitmap folderIconBitmap;
+
+            // Prepare the favorite icon.
+            if (currentFolderIconRadioButton.isChecked()) {
+                // Update the folder name if it has changed.
+                if (!newFolderNameString.equals(oldFolderNameString)) {
+                    bookmarksDatabaseHandler.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString);
+
+                    // Refresh the `ListView`.  `setSelection` scrolls to the position of the folder that was edited.
+                    updateBookmarksListView(currentFolder);
+                    bookmarksListView.setSelection(selectedBookmarkPosition);
+                }
+            } else {  // Prepare the new favorite icon.
+                if (defaultFolderIconRadioButton.isChecked()) {
+                    // Get the default folder icon drawable and convert it to a `Bitmap`.  `this` specifies the current context.
+                    Drawable folderIconDrawable = ContextCompat.getDrawable(this, R.drawable.folder_blue_bitmap);
+                    BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable;
+                    folderIconBitmap = folderIconBitmapDrawable.getBitmap();
+                } else {  // Use the web page favorite icon.
+                    folderIconBitmap = MainWebViewActivity.favoriteIcon;
+                }
+
+                // Convert the folder `Bitmap` to a byte array.  `0` is for lossless compression (the only option for a PNG).
+                ByteArrayOutputStream folderIconByteArrayOutputStream = new ByteArrayOutputStream();
+                folderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, folderIconByteArrayOutputStream);
+                byte[] folderIconByteArray = folderIconByteArrayOutputStream.toByteArray();
+
+                bookmarksDatabaseHandler.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString, folderIconByteArray);
+
+                // Refresh the `ListView`.  `setSelection` scrolls to the position of the folder that was edited.
+                updateBookmarksListView(currentFolder);
+                bookmarksListView.setSelection(selectedBookmarkPosition);
+            }
+        } else {  // Don't edit the folder because the new name is not unique.
+            String cannot_rename_folder = getResources().getString(R.string.cannot_rename_folder) + " \"" + newFolderNameString + "\"";
+            Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), cannot_rename_folder, Snackbar.LENGTH_INDEFINITE).show();
+        }
+    }
+
+    private void updateBookmarksListView(String folderName) {
+        // Get a `Cursor` with the current contents of the bookmarks database.
+        bookmarksCursor = bookmarksDatabaseHandler.getAllBookmarksCursorByDisplayOrder(folderName);
 
-        // Setup bookmarksCursorAdapter with `this` context.  The `false` disables autoRequery.
+        // Setup `bookmarksCursorAdapter` with `this` context.  The `false` disables autoRequery.
         CursorAdapter bookmarksCursorAdapter = new CursorAdapter(this, bookmarksCursor, false) {
             @Override
             public View newView(Context context, Cursor cursor, ViewGroup parent) {
@@ -518,20 +718,34 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // Get the bookmark name from the cursor and display it in `bookmarkNameTextView`.
                 String bookmarkNameString = cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME));
                 TextView bookmarkNameTextView = (TextView) view.findViewById(R.id.bookmark_name);
-                assert bookmarkNameTextView != null;  // This assert removes the warning that bookmarkNameTextView might be null.
                 bookmarkNameTextView.setText(bookmarkNameString);
+
+                // Make the font bold for folders.
+                if (cursor.getInt(cursor.getColumnIndex(BookmarksDatabaseHandler.IS_FOLDER)) == 1) {
+                    // The first argument is `null` because we don't want to chage the font.
+                    bookmarkNameTextView.setTypeface(null, Typeface.BOLD);
+                } else {  // Reset the font to default.
+                    bookmarkNameTextView.setTypeface(Typeface.DEFAULT);
+                }
             }
         };
 
         // Update the ListView.
         bookmarksListView.setAdapter(bookmarksCursorAdapter);
+
+        // Set the AppBar title.
+        if (currentFolder.isEmpty()) {
+            appBar.setTitle(R.string.bookmarks);
+        } else {
+            appBar.setTitle(currentFolder);
+        }
     }
 
-    private void updateBookmarksListViewExcept(long[] exceptIdLongArray) {
-        // Get a Cursor with the current contents of the bookmarks database except for the specified database IDs.
-        final Cursor bookmarksCursor = bookmarksDatabaseHandler.getBookmarksCursorExcept(exceptIdLongArray);
+    private void updateBookmarksListViewExcept(long[] exceptIdLongArray, String folderName) {
+        // Get a `Cursor` with the current contents of the bookmarks database except for the specified database IDs.
+        bookmarksCursor = bookmarksDatabaseHandler.getBookmarksCursorExcept(exceptIdLongArray, folderName);
 
-        // Setup bookmarksCursorAdapter with `this` context.  The `false` disables autoRequery.
+        // Setup `bookmarksCursorAdapter` with `this` context.  The `false` disables autoRequery.
         CursorAdapter bookmarksCursorAdapter = new CursorAdapter(this, bookmarksCursor, false) {
             @Override
             public View newView(Context context, Cursor cursor, ViewGroup parent) {
@@ -555,8 +769,15 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // Get the bookmark name from the cursor and display it in `bookmarkNameTextView`.
                 String bookmarkNameString = cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME));
                 TextView bookmarkNameTextView = (TextView) view.findViewById(R.id.bookmark_name);
-                assert bookmarkNameTextView != null;  // This assert removes the warning that bookmarkNameTextView might be null.
                 bookmarkNameTextView.setText(bookmarkNameString);
+
+                // Make the font bold for folders.
+                if (cursor.getInt(cursor.getColumnIndex(BookmarksDatabaseHandler.IS_FOLDER)) == 1) {
+                    // The first argument is `null` because we don't want to chage the font.
+                    bookmarkNameTextView.setTypeface(null, Typeface.BOLD);
+                } else {  // Reset the font to default.
+                    bookmarkNameTextView.setTypeface(Typeface.DEFAULT);
+                }
             }
         };
 
diff --git a/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseHandler.java b/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseHandler.java
index 5a5a025a..bc17bc7d 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseHandler.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseHandler.java
@@ -22,8 +22,10 @@ package com.stoutner.privacybrowser;
 import android.content.ContentValues;
 import android.content.Context;
 import android.database.Cursor;
+import android.database.DatabaseUtils;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
+import android.provider.ContactsContract;
 
 public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
     private static final int SCHEMA_VERSION = 1;
@@ -62,21 +64,41 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Code for upgrading the database will be added here when the schema version > 1.
     }
 
-    public void createBookmark(String bookmarkName, String bookmarkURL, int displayOrder, byte[] favoriteIcon) {
+    public void createBookmark(String bookmarkName, String bookmarkURL, int displayOrder, String parentFolder, byte[] favoriteIcon) {
         ContentValues bookmarkContentValues = new ContentValues();
 
         // ID is created automatically.
         bookmarkContentValues.put(DISPLAY_ORDER, displayOrder);
         bookmarkContentValues.put(BOOKMARK_NAME, bookmarkName);
         bookmarkContentValues.put(BOOKMARK_URL, bookmarkURL);
-        bookmarkContentValues.put(PARENT_FOLDER, "");
+        bookmarkContentValues.put(PARENT_FOLDER, parentFolder);
         bookmarkContentValues.put(IS_FOLDER, false);
         bookmarkContentValues.put(FAVORITE_ICON, favoriteIcon);
 
         // Get a writable database handle.
         SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
 
-        // The second argument is "null", which makes it so that completely null rows cannot be created.  Not a problem in our case.
+        // The second argument is `null`, which makes it so that completely null rows cannot be created.  Not a problem in our case.
+        bookmarksDatabase.insert(BOOKMARKS_TABLE, null, bookmarkContentValues);
+
+        // Close the database handle.
+        bookmarksDatabase.close();
+    }
+
+    public void createFolder(String folderName, int displayOrder, String parentFolder, byte[] favoriteIcon) {
+        ContentValues bookmarkContentValues = new ContentValues();
+
+        // ID is created automatically.
+        bookmarkContentValues.put(DISPLAY_ORDER, displayOrder);
+        bookmarkContentValues.put(BOOKMARK_NAME, folderName);
+        bookmarkContentValues.put(PARENT_FOLDER, parentFolder);
+        bookmarkContentValues.put(IS_FOLDER, true);
+        bookmarkContentValues.put(FAVORITE_ICON, favoriteIcon);
+
+        // Get a writable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
+
+        // The second argument is `null`, which makes it so that completely null rows cannot be created.  Not a problem in our case.
         bookmarksDatabase.insert(BOOKMARKS_TABLE, null, bookmarkContentValues);
 
         // Close the database handle.
@@ -87,38 +109,54 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Get a readable database handle.
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
-        // Prepare the SQL statement to get the cursor for `databaseId`
+        // Prepare the SQL statement to get the `Cursor` for `databaseId`
         final String GET_ONE_BOOKMARK = "Select * FROM " + BOOKMARKS_TABLE +
                 " WHERE " + _ID + " = " + databaseId;
 
-        // Return the results as a `Cursor`.  The second argument is `null` because there are no selectionArgs.
+        // Return the results as a `Cursor`.  The second argument is `null` because there are no `selectionArgs`.
         // We can't close the `Cursor` because we need to use it in the parent activity.
         return bookmarksDatabase.rawQuery(GET_ONE_BOOKMARK, null);
     }
 
-    public Cursor getBookmarksCursorExcept(long[] exceptIdLongArray) {
+    public Cursor getFolderCursor(String folderName) {
         // Get a readable database handle.
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
-        // Prepare a string that contains the comma-separated list of IDs not to get.
-        String doNotGetIdsString = "";
-        // Extract the array to `doNotGetIdsString`.
-        for (long databaseIdLong : exceptIdLongArray) {
-            // If this is the first number, only add the number.
-            if (doNotGetIdsString.isEmpty()) {
-                doNotGetIdsString = String.valueOf(databaseIdLong);
-            } else {  // If there already is a number in the string, place a `,` before the number.
-                doNotGetIdsString = doNotGetIdsString + "," + databaseIdLong;
-            }
-        }
+        // SQL escape `folderName`.
+        folderName = DatabaseUtils.sqlEscapeString(folderName);
 
-        // Prepare the SQL statement to select all items except those with the specified IDs.
-        final String GET_All_BOOKMARKS_EXCEPT_SPECIFIED = "Select * FROM " + BOOKMARKS_TABLE +
-                " WHERE " + _ID + " NOT IN (" + doNotGetIdsString + ") ORDER BY " + DISPLAY_ORDER + " ASC";
+        // Prepare the SQL statement to get the `Cursor` for the folder.
+        final String GET_FOLDER = "Select * FROM " + BOOKMARKS_TABLE +
+                " WHERE " + BOOKMARK_NAME + " = " + folderName +
+                " AND " + IS_FOLDER + " = " + 1;
 
-        // Return the results as a `Cursor`.  The second argument is `null` because there are no selectionArgs.
+        // Return the results as a `Cursor`.  The second argument is `null` because there are no `selectionArgs`.
         // We can't close the `Cursor` because we need to use it in the parent activity.
-        return bookmarksDatabase.rawQuery(GET_All_BOOKMARKS_EXCEPT_SPECIFIED, null);
+        return bookmarksDatabase.rawQuery(GET_FOLDER, null);
+    }
+
+    public String getParentFolder(String currentFolder) {
+        // Get a readable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
+
+        // SQL escape `currentFolder`.
+        currentFolder = DatabaseUtils.sqlEscapeString(currentFolder);
+
+        // Prepare the SQL statement to get the parent folder.
+        final String GET_PARENT_FOLDER = "Select * FROM " + BOOKMARKS_TABLE +
+                " WHERE " + IS_FOLDER + " = " + 1 + " AND " + BOOKMARK_NAME + " = " + currentFolder;
+
+        // The second argument is `null` because there are no `selectionArgs`.
+        Cursor bookmarkCursor = bookmarksDatabase.rawQuery(GET_PARENT_FOLDER, null);
+        bookmarkCursor.moveToFirst();
+
+        // Store the name of the parent folder.
+        String parentFolder = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(PARENT_FOLDER));
+
+        // Close the `Cursor`.
+        bookmarkCursor.close();
+
+        return parentFolder;
     }
 
     public Cursor getAllBookmarksCursor() {
@@ -126,35 +164,55 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
         // Get everything in the BOOKMARKS_TABLE.
-        final String GET_ALL_BOOKMARKS = "Select * FROM " + BOOKMARKS_TABLE + " ORDER BY " + DISPLAY_ORDER + " ASC";
+        final String GET_ALL_BOOKMARKS = "Select * FROM " + BOOKMARKS_TABLE;
 
         // Return the results as a Cursor.  The second argument is `null` because there are no selectionArgs.
         // We can't close the Cursor because we need to use it in the parent activity.
         return bookmarksDatabase.rawQuery(GET_ALL_BOOKMARKS, null);
     }
 
-    public String getBookmarkURL(int databaseId) {
+    public Cursor getAllBookmarksCursorByDisplayOrder(String folderName) {
         // Get a readable database handle.
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
-        // Prepare the SQL statement to get the row for the selected databaseId.
-        final String GET_BOOKMARK_URL = "Select * FROM " + BOOKMARKS_TABLE +
-                " WHERE " + _ID + " = " + databaseId;
+        // SQL escape `folderName`.
+        folderName = DatabaseUtils.sqlEscapeString(folderName);
 
-        // Save the results as Cursor and move it to the first (only) row.  The second argument is "null" because there are no selectionArgs.
-        Cursor bookmarksCursor = bookmarksDatabase.rawQuery(GET_BOOKMARK_URL, null);
-        bookmarksCursor.moveToFirst();
+        // Get everything in the BOOKMARKS_TABLE.
+        final String GET_ALL_BOOKMARKS = "Select * FROM " + BOOKMARKS_TABLE +
+                " WHERE " + PARENT_FOLDER + " = " + folderName + " ORDER BY " + DISPLAY_ORDER + " ASC";
 
-        // Get the int that identifies the "BOOKMARK_URL" column and save the string as bookmarkURL.
-        int urlColumnInt = bookmarksCursor.getColumnIndex(BOOKMARK_URL);
-        String bookmarkURLString = bookmarksCursor.getString(urlColumnInt);
+        // Return the results as a Cursor.  The second argument is `null` because there are no selectionArgs.
+        // We can't close the Cursor because we need to use it in the parent activity.
+        return bookmarksDatabase.rawQuery(GET_ALL_BOOKMARKS, null);
+    }
 
-        // Close the Cursor and the database handle.
-        bookmarksCursor.close();
-        bookmarksDatabase.close();
+    public Cursor getBookmarksCursorExcept(long[] exceptIdLongArray, String folderName) {
+        // Get a readable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
-        // Return the bookmarkURLString.
-        return bookmarkURLString;
+        // Prepare a string that contains the comma-separated list of IDs not to get.
+        String doNotGetIdsString = "";
+        // Extract the array to `doNotGetIdsString`.
+        for (long databaseIdLong : exceptIdLongArray) {
+            // If this is the first number, only add the number.
+            if (doNotGetIdsString.isEmpty()) {
+                doNotGetIdsString = String.valueOf(databaseIdLong);
+            } else {  // If there already is a number in the string, place a `,` before the number.
+                doNotGetIdsString = doNotGetIdsString + "," + databaseIdLong;
+            }
+        }
+
+        // SQL escape `folderName`.
+        folderName = DatabaseUtils.sqlEscapeString(folderName);
+
+        // Prepare the SQL statement to select all items except those with the specified IDs.
+        final String GET_All_BOOKMARKS_EXCEPT_SPECIFIED = "Select * FROM " + BOOKMARKS_TABLE +
+                " WHERE " + PARENT_FOLDER + " = " + folderName + " AND " + _ID + " NOT IN (" + doNotGetIdsString + ") ORDER BY " + DISPLAY_ORDER + " ASC";
+
+        // Return the results as a `Cursor`.  The second argument is `null` because there are no selectionArgs.
+        // We can't close the `Cursor` because we need to use it in the parent activity.
+        return bookmarksDatabase.rawQuery(GET_All_BOOKMARKS_EXCEPT_SPECIFIED, null);
     }
 
     public void updateBookmark(int databaseId, String bookmarkName, String bookmarkUrl) {
@@ -167,7 +225,7 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Get a writable database handle.
         SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
 
-        // Update the database.  The last argument is `null` because there are no `whereArgs`.
+        // Update the bookmark.  The last argument is `null` because there are no `whereArgs`.
         bookmarksDatabase.update(BOOKMARKS_TABLE, bookmarkContentValues, _ID + " = " + databaseId, null);
 
         // Close the database handle.
@@ -185,13 +243,70 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Get a writable database handle.
         SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
 
-        // Update the database.  The last argument is `null` because there are no `whereArgs`.
+        // Update the bookmark.  The last argument is `null` because there are no `whereArgs`.
         bookmarksDatabase.update(BOOKMARKS_TABLE, bookmarkContentValues, _ID + " = " + databaseId, null);
 
         // Close the database handle.
         bookmarksDatabase.close();
     }
 
+    public void updateFolder(int databaseId, String oldFolderName, String newFolderName) {
+        // Get a writable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
+
+        // Update the folder first.  Store the updated values in `folderContentValues`.
+        ContentValues folderContentValues = new ContentValues();
+
+        folderContentValues.put(BOOKMARK_NAME, newFolderName);
+
+        // Run the update on the folder.  The last argument is `null` because there are no `whereArgs`.
+        bookmarksDatabase.update(BOOKMARKS_TABLE, folderContentValues, _ID + " = " + databaseId, null);
+
+
+        // Update the bookmarks inside the folder with the new parent folder name.
+        ContentValues bookmarkContentValues = new ContentValues();
+
+        bookmarkContentValues.put(PARENT_FOLDER, newFolderName);
+
+        // SQL escape `oldFolderName`.
+        oldFolderName = DatabaseUtils.sqlEscapeString(oldFolderName);
+
+        // Run the update on the bookmarks.  The last argument is `null` because there are no `whereArgs`.
+        bookmarksDatabase.update(BOOKMARKS_TABLE, bookmarkContentValues, PARENT_FOLDER + " = " + oldFolderName, null);
+
+        // Close the database handle.
+        bookmarksDatabase.close();
+    }
+
+    public void updateFolder(int databaseId, String oldFolderName, String newFolderName, byte[] folderIcon) {
+        // Get a writable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
+
+        // Update the folder first.  Store the updated values in `folderContentValues`.
+        ContentValues folderContentValues = new ContentValues();
+
+        folderContentValues.put(BOOKMARK_NAME, newFolderName);
+        folderContentValues.put(FAVORITE_ICON, folderIcon);
+
+        // Run the update on the folder.  The last argument is `null` because there are no `whereArgs`.
+        bookmarksDatabase.update(BOOKMARKS_TABLE, folderContentValues, _ID + " = " + databaseId, null);
+
+
+        // Update the bookmarks inside the folder with the new parent folder name.
+        ContentValues bookmarkContentValues = new ContentValues();
+
+        bookmarkContentValues.put(PARENT_FOLDER, newFolderName);
+
+        // SQL escape `oldFolderName`.
+        oldFolderName = DatabaseUtils.sqlEscapeString(oldFolderName);
+
+        // Run the update on the bookmarks.  The last argument is `null` because there are no `whereArgs`.
+        bookmarksDatabase.update(BOOKMARKS_TABLE, bookmarkContentValues, PARENT_FOLDER + " = " + oldFolderName, null);
+
+        // Close the database handle.
+        bookmarksDatabase.close();
+    }
+
     public void updateBookmarkDisplayOrder(int databaseId, int displayOrder) {
         // Store the updated values in `bookmarkContentValues`.
         ContentValues bookmarkContentValues = new ContentValues();
diff --git a/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseViewActivity.java
new file mode 100644
index 00000000..00bad900
--- /dev/null
+++ b/app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseViewActivity.java
@@ -0,0 +1,144 @@
+/**
+ * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.widget.CursorAdapter;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class BookmarksDatabaseViewActivity extends AppCompatActivity {
+    // `bookmarksDatabaseHandler` is used in `onCreate()` and `updateBookmarksListView()`.
+    BookmarksDatabaseHandler bookmarksDatabaseHandler;
+
+    // `bookmarksListView` is used in `onCreate()` and `updateBookmarksListView()`.
+    ListView bookmarksListView;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.bookmarks_database_view_coordinatorlayout);
+
+        // We need to use the `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21.
+        final Toolbar bookmarksDatabaseViewAppBar = (Toolbar) findViewById(R.id.bookmarks_database_view_toolbar);
+        setSupportActionBar(bookmarksDatabaseViewAppBar);
+
+        // Display the home arrow on `SupportActionBar`.
+        final ActionBar appBar = getSupportActionBar();
+        assert appBar != null;  // This assert removes the incorrect warning in Android Studio on the following line that appBar might be null.
+        appBar.setDisplayHomeAsUpEnabled(true);
+
+        // Initialize the database handler and the ListView.
+        // `this` specifies the context.  The two `null`s do not specify the database name or a `CursorFactory`.
+        // The `0` is to specify a database version, but that is set instead using a constant in `BookmarksDatabaseHandler`.
+        bookmarksDatabaseHandler = new BookmarksDatabaseHandler(this, null, null, 0);
+        bookmarksListView = (ListView) findViewById(R.id.bookmarks_database_view_listview);
+
+        // Display the bookmarks in the ListView.
+        updateBookmarksListView();
+
+    }
+
+    private void updateBookmarksListView() {
+        // Get a `Cursor` with the current contents of the bookmarks database.
+        final Cursor bookmarksCursor = bookmarksDatabaseHandler.getAllBookmarksCursor();
+
+        // Setup `bookmarksCursorAdapter` with `this` context.  The `false` disables autoRequery.
+        CursorAdapter bookmarksCursorAdapter = new CursorAdapter(this, bookmarksCursor, false) {
+            @Override
+            public View newView(Context context, Cursor cursor, ViewGroup parent) {
+                // Inflate the individual item layout.  `false` does not attach it to the root.
+                return getLayoutInflater().inflate(R.layout.bookmarks_database_view_linearlayout, parent, false);
+            }
+
+            @Override
+            public void bindView(View view, Context context, Cursor cursor) {
+                boolean isFolder = (cursor.getInt(cursor.getColumnIndex(BookmarksDatabaseHandler.IS_FOLDER)) == 1);
+
+                // Get the database ID from the `Cursor` and display it in `bookmarkDatabaseIdTextView`.
+                int bookmarkDatabaseId = cursor.getInt(cursor.getColumnIndex(BookmarksDatabaseHandler._ID));
+                TextView bookmarkDatabaseIdTextView = (TextView) view.findViewById(R.id.bookmarks_database_view_database_id);
+                bookmarkDatabaseIdTextView.setText(String.valueOf(bookmarkDatabaseId));
+
+                // Get the favorite icon byte array from the `Cursor`.
+                byte[] favoriteIconByteArray = cursor.getBlob(cursor.getColumnIndex(BookmarksDatabaseHandler.FAVORITE_ICON));
+                // Convert the byte array to a `Bitmap` beginning at the beginning at the first byte and ending at the last.
+                Bitmap favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.length);
+                // Display the bitmap in `bookmarkFavoriteIcon`.
+                ImageView bookmarkFavoriteIcon = (ImageView) view.findViewById(R.id.bookmarks_database_view_favorite_icon);
+                bookmarkFavoriteIcon.setImageBitmap(favoriteIconBitmap);
+
+                // Get the bookmark name from the `Cursor` and display it in `bookmarkNameTextView`.
+                String bookmarkNameString = cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME));
+                TextView bookmarkNameTextView = (TextView) view.findViewById(R.id.bookmarks_database_view_bookmark_name);
+                bookmarkNameTextView.setText(bookmarkNameString);
+                // Make the font bold for folders.
+                if (isFolder) {
+                    // The first argument is `null` because we don't want to chage the font.
+                    bookmarkNameTextView.setTypeface(null, Typeface.BOLD);
+                } else {  // Reset the font to default.
+                    bookmarkNameTextView.setTypeface(Typeface.DEFAULT);
+                }
+
+                // Get the display order from the `Cursor` and display it in `bookmarkDisplayOrderTextView`.
+                int bookmarkDisplayOrder = cursor.getInt(cursor.getColumnIndex(BookmarksDatabaseHandler.DISPLAY_ORDER));
+                TextView bookmarkDisplayOrderTextView = (TextView) view.findViewById(R.id.bookmarks_database_view_display_order);
+                bookmarkDisplayOrderTextView.setText(String.valueOf(bookmarkDisplayOrder));
+
+                // Get the parent folder from the `Cursor` and display it in `bookmarkParentFolder`.
+                String bookmarkParentFolder = cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHandler.PARENT_FOLDER));
+                TextView bookmarkParentFolderTextView = (TextView) view.findViewById(R.id.bookmarks_database_view_parent_folder);
+                // Make the folder name gray if it is the home folder.
+                if (bookmarkParentFolder.isEmpty()) {
+                    bookmarkParentFolderTextView.setText(R.string.home_folder);
+                    bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.grey));
+                } else {
+                    bookmarkParentFolderTextView.setText(bookmarkParentFolder);
+                    bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black));
+                }
+
+                // Get the bookmark URL form the `Cursor` and display it in `bookmarkUrlTextView`.
+                String bookmarkUrlString = cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_URL));
+                TextView bookmarkUrlTextView = (TextView) view.findViewById(R.id.bookmarks_database_view_bookmark_url);
+                bookmarkUrlTextView.setText(bookmarkUrlString);
+                if (isFolder) {
+                    bookmarkUrlTextView.setVisibility(View.GONE);
+                } else {
+                    bookmarkUrlTextView.setVisibility(View.VISIBLE);
+                }
+            }
+        };
+
+        // Update the ListView.
+        bookmarksListView.setAdapter(bookmarksCursorAdapter);
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/CreateBookmark.java b/app/src/main/java/com/stoutner/privacybrowser/CreateBookmark.java
index c5acd035..b779709c 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/CreateBookmark.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/CreateBookmark.java
@@ -36,9 +36,9 @@ import android.widget.EditText;
 public class CreateBookmark extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
     public interface CreateBookmarkListener {
-        void onCreateBookmarkCancel(DialogFragment createBookmarkDialogFragment);
+        void onCancelCreateBookmark(DialogFragment dialogFragment);
 
-        void onCreateBookmarkCreate(DialogFragment createBookmarkDialogFragment);
+        void onCreateBookmark(DialogFragment dialogFragment);
     }
 
     // `createBookmarkListener` is used in `onAttach()` and `onCreateDialog()`
@@ -48,7 +48,7 @@ public class CreateBookmark extends DialogFragment {
     public void onAttach(Activity parentActivity) {
         super.onAttach(parentActivity);
 
-        // Get a handle for `CreateBookmarkListener` from the `parentActivity`.
+        // Get a handle for `CreateBookmarkListener` from `parentActivity`.
         try {
             createBookmarkListener = (CreateBookmarkListener) parentActivity;
         } catch(ClassCastException exception) {
@@ -62,51 +62,51 @@ public class CreateBookmark extends DialogFragment {
         Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon);
 
         // Use `AlertDialog.Builder` to create the `AlertDialog`.  The style formats the color of the button text.
-        AlertDialog.Builder createBookmarkDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
-        createBookmarkDialogBuilder.setTitle(R.string.create_bookmark);
-        createBookmarkDialogBuilder.setIcon(favoriteIconDrawable);
-        // The parent view is `null` because it will be assigned by `AlertDialog`.
-        createBookmarkDialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.create_bookmark_dialog, null));
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+        dialogBuilder.setTitle(R.string.create_bookmark);
+        dialogBuilder.setIcon(favoriteIconDrawable);
+        // The parent view is `null` because it will be assigned by the `AlertDialog`.
+        dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.create_bookmark_dialog, null));
 
         // Set an `onClick()` listener for the negative button.
-        createBookmarkDialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
+        dialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 // Return the `DialogFragment` to the parent activity on cancel.
-                createBookmarkListener.onCreateBookmarkCancel(CreateBookmark.this);
+                createBookmarkListener.onCancelCreateBookmark(CreateBookmark.this);
             }
         });
 
         // Set an `onClick()` listener for the positive button.
-        createBookmarkDialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
+        dialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 // Return the `DialogFragment` to the parent activity on create.
-                createBookmarkListener.onCreateBookmarkCreate(CreateBookmark.this);
+                createBookmarkListener.onCreateBookmark(CreateBookmark.this);
             }
         });
 
 
         // Create an `AlertDialog` from the `AlertDialog.Builder`.
-        final AlertDialog createBookmarkDialog = createBookmarkDialogBuilder.create();
+        final AlertDialog alertDialog = dialogBuilder.create();
 
         // Show the keyboard when the `Dialog` is displayed on the screen.
-        createBookmarkDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+        alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 
         // We need to show the `AlertDialog` before we can call `setOnKeyListener()` below.
-        createBookmarkDialog.show();
+        alertDialog.show();
 
         // Allow the `enter` key on the keyboard to create the bookmark from `create_bookmark_name_edittext`.
-        EditText createBookmarkNameEditText = (EditText) createBookmarkDialog.findViewById(R.id.create_bookmark_name_edittext);
-        assert createBookmarkNameEditText != null;  // Remove the warning below that createBookmarkNameEditText might be null.
+        EditText createBookmarkNameEditText = (EditText) alertDialog.findViewById(R.id.create_bookmark_name_edittext);
+        assert createBookmarkNameEditText != null;  // Remove the warning below that `createBookmarkNameEditText` might be `null`.
         createBookmarkNameEditText.setOnKeyListener(new View.OnKeyListener() {
             public boolean onKey(View v, int keyCode, KeyEvent event) {
-                // If the event is a key-down on the `enter` button, select the PositiveButton `Create`.
+                // If the event is a key-down on the `enter` button, select the `PositiveButton` `Create`.
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
-                    // Trigger `createBookmarkListener` and return the DialogFragment to the parent activity.
-                    createBookmarkListener.onCreateBookmarkCreate(CreateBookmark.this);
+                    // Trigger `createBookmarkListener` and return the `DialogFragment` to the parent activity.
+                    createBookmarkListener.onCreateBookmark(CreateBookmark.this);
                     // Manually dismiss the `AlertDialog`.
-                    createBookmarkDialog.dismiss();
+                    alertDialog.dismiss();
                     // Consume the event.
                     return true;
                 } else {  // If any other key was pressed, do not consume the event.
@@ -116,8 +116,8 @@ public class CreateBookmark extends DialogFragment {
         });
 
         // Set the formattedUrlString as the initial text of `create_bookmark_url_edittext`.
-        EditText createBookmarkUrlEditText = (EditText) createBookmarkDialog.findViewById(R.id.create_bookmark_url_edittext);
-        assert createBookmarkUrlEditText != null;// Remove the warning below that `createBookmarkUrlEditText` might be null.
+        EditText createBookmarkUrlEditText = (EditText) alertDialog.findViewById(R.id.create_bookmark_url_edittext);
+        assert createBookmarkUrlEditText != null;// Remove the warning below that `createBookmarkUrlEditText` might be `null`.
         createBookmarkUrlEditText.setText(MainWebViewActivity.formattedUrlString);
 
         // Allow the `enter` key on the keyboard to create the bookmark from `create_bookmark_url_edittext`.
@@ -126,9 +126,9 @@ public class CreateBookmark extends DialogFragment {
                 // If the event is a key-down on the "enter" button, select the PositiveButton "Create".
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                     // Trigger `createBookmarkListener` and return the DialogFragment to the parent activity.
-                    createBookmarkListener.onCreateBookmarkCreate(CreateBookmark.this);
+                    createBookmarkListener.onCreateBookmark(CreateBookmark.this);
                     // Manually dismiss the `AlertDialog`.
-                    createBookmarkDialog.dismiss();
+                    alertDialog.dismiss();
                     // Consume the event.
                     return true;
                 } else { // If any other key was pressed, do not consume the event.
@@ -138,6 +138,6 @@ public class CreateBookmark extends DialogFragment {
         });
 
         // `onCreateDialog()` requires the return of an `AlertDialog`.
-        return createBookmarkDialog;
+        return alertDialog;
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/CreateBookmarkFolder.java b/app/src/main/java/com/stoutner/privacybrowser/CreateBookmarkFolder.java
new file mode 100644
index 00000000..0847ce3f
--- /dev/null
+++ b/app/src/main/java/com/stoutner/privacybrowser/CreateBookmarkFolder.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+// If we don't use `android.support.v7.app.AlertDialog` instead of `android.app.AlertDialog` then the dialog will be covered by the keyboard.
+import android.support.v7.app.AlertDialog;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+public class CreateBookmarkFolder extends DialogFragment {
+    // The public interface is used to send information back to the parent activity.
+    public interface CreateBookmarkFolderListener {
+        void onCancelCreateBookmarkFolder(DialogFragment dialogFragment);
+
+        void onCreateBookmarkFolder(DialogFragment dialogFragment);
+    }
+
+    // `createBookmarkFolderListener` is used in `onAttach()` and `onCreateDialog`.
+    private CreateBookmarkFolderListener createBookmarkFolderListener;
+
+    public void onAttach(Activity parentActivity) {
+        super.onAttach(parentActivity);
+
+        // Get a handle for `createBookmarkFolderListener` from `parentActivity`.
+        try {
+            createBookmarkFolderListener = (CreateBookmarkFolderListener) parentActivity;
+        } catch(ClassCastException exception) {
+            throw new ClassCastException(parentActivity.toString() + " must implement CreateBookmarkFolderListener.");
+        }
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        // Use `AlertDialog.Builder` to create the `AlertDialog`.  The style formats the color of the button text.
+        final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+        dialogBuilder.setTitle(R.string.create_folder);
+        // The parent view is `null` because it will be assigned by the `AlertDialog`.
+        dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.create_bookmark_folder_dialog, null));
+
+        // Set an `onClick()` listener for the negative button.
+        dialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                // Return the `DialogFragment` to the parent activity on cancel.
+                createBookmarkFolderListener.onCancelCreateBookmarkFolder(CreateBookmarkFolder.this);
+            }
+        });
+
+        // Set an `onClick()` listener fo the positive button.
+        dialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                // Return the `DialogFragment` to the parent activity on create.
+                createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolder.this);
+            }
+        });
+
+
+        // Create an `AlertDialog` from the `AlertDialog.Builder`.
+        final AlertDialog alertDialog = dialogBuilder.create();
+
+        // Show the keyboard when the `Dialog` is displayed on the screen.
+        alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+
+        // We need to show the `AlertDialog` before we can call `setOnKeyListener()` below.
+        alertDialog.show();
+
+        // Allow the `enter` key on the keyboard to create the folder from `create_folder_name_edittext`.
+        EditText createFolderNameEditText = (EditText) alertDialog.findViewById(R.id.create_folder_name_edittext);
+        assert createFolderNameEditText != null;  // Remove the warning below that `createFolderNameEditText` might be `null`.
+        createFolderNameEditText.setOnKeyListener(new View.OnKeyListener() {
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`.
+                if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
+                    // Trigger `createBookmarkFolderListener` and return the `DialogFragment` to the parent activity.
+                    createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolder.this);
+                    // Manually dismiss the `AlertDialog`.
+                    alertDialog.dismiss();
+                    // Consume the event.
+                    return true;
+                } else {  // If any other key was pressed do not consume the event.
+                    return false;
+                }
+            }
+        });
+
+        // Display the current favorite icon.
+        ImageView webPageIconImageView = (ImageView) alertDialog.findViewById(R.id.create_folder_web_page_icon);
+        assert webPageIconImageView != null;  // Remove the warning that `webPageIconImageView` may be null.
+        webPageIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon);
+
+        // `onCreateDialog()` requires the return of an `AlertDialog`.
+        return alertDialog;
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/CreateHomeScreenShortcut.java b/app/src/main/java/com/stoutner/privacybrowser/CreateHomeScreenShortcut.java
index 71e84ab3..4a6b2fa7 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/CreateHomeScreenShortcut.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/CreateHomeScreenShortcut.java
@@ -37,9 +37,9 @@ import android.widget.EditText;
 public class CreateHomeScreenShortcut extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
     public interface CreateHomeScreenSchortcutListener {
-        void onCreateHomeScreenShortcutCancel(DialogFragment dialogFragment);
+        void onCancelCreateHomeScreenShortcut(DialogFragment dialogFragment);
 
-        void onCreateHomeScreenShortcutCreate(DialogFragment dialogFragment);
+        void onCreateHomeScreenShortcut(DialogFragment dialogFragment);
     }
 
     //createHomeScreenShortcutListener is used in onAttach and and onCreateDialog.
@@ -64,50 +64,50 @@ public class CreateHomeScreenShortcut extends DialogFragment {
         LayoutInflater customDialogInflater = getActivity().getLayoutInflater();
 
         // Use AlertDialog.Builder to create the AlertDialog.  The style formats the color of the button text.
-        AlertDialog.Builder createHomeScreenShorcutDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
-        createHomeScreenShorcutDialogBuilder.setTitle(R.string.create_shortcut);
-        createHomeScreenShorcutDialogBuilder.setIcon(favoriteIconDrawable);
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+        dialogBuilder.setTitle(R.string.create_shortcut);
+        dialogBuilder.setIcon(favoriteIconDrawable);
         // The parent view is "null" because it will be assigned by AlertDialog.
-        createHomeScreenShorcutDialogBuilder.setView(customDialogInflater.inflate(R.layout.create_home_screen_shortcut_dialog, null));
+        dialogBuilder.setView(customDialogInflater.inflate(R.layout.create_home_screen_shortcut_dialog, null));
 
         // Set an onClick listener on the negative button.
-        createHomeScreenShorcutDialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
+        dialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
-                createHomeScreenShortcutListener.onCreateHomeScreenShortcutCancel(CreateHomeScreenShortcut.this);
+                createHomeScreenShortcutListener.onCancelCreateHomeScreenShortcut(CreateHomeScreenShortcut.this);
             }
         });
 
         // Set an onClick listener on the positive button.
-        createHomeScreenShorcutDialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
+        dialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
-                createHomeScreenShortcutListener.onCreateHomeScreenShortcutCreate(CreateHomeScreenShortcut.this);
+                createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcut.this);
             }
         });
 
 
         // Create an AlertDialog from the AlertDialogBuilder.
-        final AlertDialog createHomeScreenShortcutAlertDialog = createHomeScreenShorcutDialogBuilder.create();
+        final AlertDialog alertDialog = dialogBuilder.create();
 
         // Show the keyboard when the Dialog is displayed on the screen.
-        createHomeScreenShortcutAlertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+        alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 
         // We need to show the AlertDialog before we can call setOnKeyListener() below.
-        createHomeScreenShortcutAlertDialog.show();
+        alertDialog.show();
 
         // Allow the "enter" key on the keyboard to create the shortcut.
-        EditText shortcutNameEditText = (EditText) createHomeScreenShortcutAlertDialog.findViewById(R.id.shortcut_name_edittext);
+        EditText shortcutNameEditText = (EditText) alertDialog.findViewById(R.id.shortcut_name_edittext);
         assert shortcutNameEditText != null;  // Remove the warning below that shortcutNameEditText might be null.
         shortcutNameEditText.setOnKeyListener(new View.OnKeyListener() {
             public boolean onKey(View v, int keyCode, KeyEvent event) {
                 // If the event is a key-down on the "enter" button, select the PositiveButton "Create".
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                     // Trigger the create listener.
-                    createHomeScreenShortcutListener.onCreateHomeScreenShortcutCreate(CreateHomeScreenShortcut.this);
+                    createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcut.this);
 
-                    // Manually dismiss the AlertDialog.
-                    createHomeScreenShortcutAlertDialog.dismiss();
+                    // Manually dismiss `alertDialog`.
+                    alertDialog.dismiss();
 
                     // Consume the event.
                     return true;
@@ -118,6 +118,6 @@ public class CreateHomeScreenShortcut extends DialogFragment {
         });
 
         // onCreateDialog requires the return of an AlertDialog.
-        return createHomeScreenShortcutAlertDialog;
+        return alertDialog;
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/EditBookmark.java b/app/src/main/java/com/stoutner/privacybrowser/EditBookmark.java
index 8eee58d6..8343ace2 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/EditBookmark.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/EditBookmark.java
@@ -40,9 +40,9 @@ import android.widget.ImageView;
 public class EditBookmark extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
     public interface EditBookmarkListener {
-        void onEditBookmarkCancel(DialogFragment editBookmarkDialogFragment);
+        void onCancelEditBookmark(DialogFragment dialogFragment);
 
-        void onEditBookmarkSave(DialogFragment editBookmarkDialogFragment);
+        void onSaveEditBookmark(DialogFragment dialogFragment);
     }
 
     // `editBookmarkListener` is used in `onAttach()` and `onCreateDialog()`
@@ -51,7 +51,7 @@ public class EditBookmark extends DialogFragment {
     public void onAttach(Activity parentActivity) {
         super.onAttach(parentActivity);
 
-        // Get a handle for `EditBookmarkListener` from the `parentActivity`.
+        // Get a handle for `EditBookmarkListener` from `parentActivity`.
         try {
             editBookmarkListener = (EditBookmarkListener) parentActivity;
         } catch(ClassCastException exception) {
@@ -62,62 +62,63 @@ public class EditBookmark extends DialogFragment {
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
         // Get a long array with the the databaseId of the selected bookmark and convert it to an `int`.
-        long[] selectedBookmarksLongArray = BookmarksActivity.bookmarksListView.getCheckedItemIds();
-        int selectedBookmarkDatabaseId = (int) selectedBookmarksLongArray[0];
+        long[] selectedBookmarkLongArray = BookmarksActivity.bookmarksListView.getCheckedItemIds();
+        int selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
 
         // Get a `Cursor` with the specified bookmark and move it to the first position.
         Cursor bookmarkCursor = BookmarksActivity.bookmarksDatabaseHandler.getBookmarkCursor(selectedBookmarkDatabaseId);
         bookmarkCursor.moveToFirst();
 
-        // Get the favorite icon byte array from the `Cursor`.
-        byte[] favoriteIconByteArray = bookmarkCursor.getBlob(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.FAVORITE_ICON));
-        // Convert the byte array to a `Bitmap` beginning at the first byte and ending at the last.
-        Bitmap favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.length);
-        // Convert the `Bitmap` to a `Drawable`.
-        Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), favoriteIconBitmap);
-
         // Use `AlertDialog.Builder` to create the `AlertDialog`.  The style formats the color of the button text.
-        AlertDialog.Builder editBookmarkDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
-        editBookmarkDialogBuilder.setTitle(R.string.edit_bookmark);
-        editBookmarkDialogBuilder.setIcon(favoriteIconDrawable);
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+        dialogBuilder.setTitle(R.string.edit_bookmark);
         // The parent view is `null` because it will be assigned by `AlertDialog`.
-        editBookmarkDialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.edit_bookmark_dialog, null));
+        dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.edit_bookmark_dialog, null));
 
         // Set an `onClick()` listener for the negative button.
-        editBookmarkDialogBuilder.setNegativeButton(R.string.cancel, new Dialog.OnClickListener() {
+        dialogBuilder.setNegativeButton(R.string.cancel, new Dialog.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 // Return the `DialogFragment` to the parent activity on cancel.
-                editBookmarkListener.onEditBookmarkCancel(EditBookmark.this);
+                editBookmarkListener.onCancelEditBookmark(EditBookmark.this);
             }
         });
 
         // Set the `onClick()` listener fo the positive button.
-        editBookmarkDialogBuilder.setPositiveButton(R.string.save, new Dialog.OnClickListener() {
+        dialogBuilder.setPositiveButton(R.string.save, new Dialog.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 // Return the `DialogFragment` to the parent activity on save.
-                editBookmarkListener.onEditBookmarkSave(EditBookmark.this);
+                editBookmarkListener.onSaveEditBookmark(EditBookmark.this);
             }
         });
 
 
         // Create an `AlertDialog` from the `AlertDialog.Builder`.
-        final AlertDialog editBookmarkDialog = editBookmarkDialogBuilder.create();
+        final AlertDialog alertDialog = dialogBuilder.create();
 
         // Show the keyboard when the `Dialog` is displayed on the screen.
-        editBookmarkDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+        alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 
-        // We need to show the `AlertDialog` before we can call `setOnKeyListener()` below.
-        editBookmarkDialog.show();
+        // We need to show the `AlertDialog` before we can modify items in the layout.
+        alertDialog.show();
 
-        // Get a `Drawable` of the favorite icon from `mainWebView` and display it in `edit_bookmark_new_favorite_icon`.
-        ImageView newFavoriteIcon = (ImageView) editBookmarkDialog.findViewById(R.id.edit_bookmark_new_favorite_icon);
-        assert newFavoriteIcon != null;  // Remove the warning below that `newFavoriteIcon` might be null.
-        newFavoriteIcon.setImageBitmap(MainWebViewActivity.favoriteIcon);
+        // Get the current favorite icon byte array from the `Cursor`.
+        byte[] currentIconByteArray = bookmarkCursor.getBlob(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.FAVORITE_ICON));
+        // Convert the byte array to a `Bitmap` beginning at the first byte and ending at the last.
+        Bitmap currentIconBitmap = BitmapFactory.decodeByteArray(currentIconByteArray, 0, currentIconByteArray.length);
+        // Display `currentIconBitmap` in `edit_bookmark_current_icon`.
+        ImageView currentIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_bookmark_current_icon);
+        assert currentIconImageView != null;  // Remove the warning below that `currentIconImageView` might be null;
+        currentIconImageView.setImageBitmap(currentIconBitmap);
+
+        // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_bookmark_web_page_favorite_icon`.
+        ImageView newFavoriteIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_bookmark_web_page_favorite_icon);
+        assert newFavoriteIconImageView != null;  // Remove the warning below that `newFavoriteIcon` might be null.
+        newFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon);
 
         // Load the text for `edit_bookmark_name_edittext`.
-        EditText bookmarkNameEditText = (EditText) editBookmarkDialog.findViewById(R.id.edit_bookmark_name_edittext);
+        EditText bookmarkNameEditText = (EditText) alertDialog.findViewById(R.id.edit_bookmark_name_edittext);
         assert bookmarkNameEditText != null;  // Remove the warning below that `bookmarkNameEditText` might be null.
         bookmarkNameEditText.setText(bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME)));
 
@@ -127,9 +128,9 @@ public class EditBookmark extends DialogFragment {
                 // If the event is a key-down on the "enter" button, select the PositiveButton `Save`.
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                     // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
-                    editBookmarkListener.onEditBookmarkSave(EditBookmark.this);
-                    // Manually dismiss the `AlertDialog`.
-                    editBookmarkDialog.dismiss();
+                    editBookmarkListener.onSaveEditBookmark(EditBookmark.this);
+                    // Manually dismiss `alertDialog`.
+                    alertDialog.dismiss();
                     // Consume the event.
                     return true;
                 } else {  // If any other key was pressed, do not consume the event.
@@ -138,8 +139,8 @@ public class EditBookmark extends DialogFragment {
             }
         });
 
-        // Load the text for `create_bookmark_url_edittext`.
-        EditText bookmarkUrlEditText = (EditText) editBookmarkDialog.findViewById(R.id.edit_bookmark_url_edittext);
+        // Load the text for `edit_bookmark_url_edittext`.
+        EditText bookmarkUrlEditText = (EditText) alertDialog.findViewById(R.id.edit_bookmark_url_edittext);
         assert bookmarkUrlEditText != null;// Remove the warning below that `bookmarkUrlEditText` might be null.
         bookmarkUrlEditText.setText(bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_URL)));
 
@@ -149,9 +150,9 @@ public class EditBookmark extends DialogFragment {
                 // If the event is a key-down on the `enter` button, select the PositiveButton `Save`.
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                     // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
-                    editBookmarkListener.onEditBookmarkSave(EditBookmark.this);
+                    editBookmarkListener.onSaveEditBookmark(EditBookmark.this);
                     // Manually dismiss the `AlertDialog`.
-                    editBookmarkDialog.dismiss();
+                    alertDialog.dismiss();
                     // Consume the event.
                     return true;
                 } else { // If any other key was pressed, do not consume the event.
@@ -161,6 +162,6 @@ public class EditBookmark extends DialogFragment {
         });
 
         // `onCreateDialog` requires the return of an `AlertDialog`.
-        return editBookmarkDialog;
+        return alertDialog;
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/EditBookmarkFolder.java b/app/src/main/java/com/stoutner/privacybrowser/EditBookmarkFolder.java
new file mode 100644
index 00000000..c27b963d
--- /dev/null
+++ b/app/src/main/java/com/stoutner/privacybrowser/EditBookmarkFolder.java
@@ -0,0 +1,143 @@
+/**
+ * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+// If we don't use `android.support.v7.app.AlertDialog` instead of `android.app.AlertDialog` then the dialog will be covered by the keyboard.
+import android.support.v7.app.AlertDialog;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+public class EditBookmarkFolder extends DialogFragment {
+    // The public interface is used to send information back to the parent activity.
+    public interface EditBookmarkFolderListener {
+        void onCancelEditBookmarkFolder(DialogFragment dialogFragment);
+
+        void onSaveEditBookmarkFolder(DialogFragment dialogFragment);
+    }
+
+    // `editFolderListener` is used in `onAttach()` and `onCreateDialog`.
+    private EditBookmarkFolderListener editBookmarkFolderListener;
+
+    public void onAttach(Activity parentActivity) {
+        super.onAttach(parentActivity);
+
+        // Get a handle for `EditFolderListener` from `parentActivity`.
+        try {
+            editBookmarkFolderListener = (EditBookmarkFolderListener) parentActivity;
+        } catch(ClassCastException exception) {
+            throw new ClassCastException(parentActivity.toString() + " must implement EditBookmarkFolderListener.");
+        }
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        // Get a long array with the the databaseId of the selected bookmark and convert it to an `int`.
+        long[] selectedBookmarkLongArray = BookmarksActivity.bookmarksListView.getCheckedItemIds();
+        int selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
+
+        // Get a `Cursor` with the specified bookmark and move it to the first position.
+        Cursor bookmarkCursor = BookmarksActivity.bookmarksDatabaseHandler.getBookmarkCursor(selectedBookmarkDatabaseId);
+        bookmarkCursor.moveToFirst();
+
+        // Use `AlertDialog.Builder` to create the `AlertDialog`.  The style formats the color of the button text.
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+        dialogBuilder.setTitle(R.string.edit_folder);
+        // The parent view is `null` because it will be assigned by `AlertDialog`.
+        dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.edit_bookmark_folder_dialog, null));
+
+        // Set an `onClick()` listener for the negative button.
+        dialogBuilder.setNegativeButton(R.string.cancel, new Dialog.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                // Return the `DialogFragment` to the parent activity on cancel.
+                editBookmarkFolderListener.onCancelEditBookmarkFolder(EditBookmarkFolder.this);
+            }
+        });
+
+        // Set the `onClick()` listener fo the positive button.
+        dialogBuilder.setPositiveButton(R.string.save, new Dialog.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                // Return the `DialogFragment` to the parent activity on save.
+                editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolder.this);
+            }
+        });
+
+
+        // Create an `AlertDialog` from the `AlertDialog.Builder`.
+        final AlertDialog alertDialog = dialogBuilder.create();
+
+        // Show the keyboard when the `Dialog` is displayed on the screen.
+        alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+
+        // We need to show the `AlertDialog` before we can modify items in the layout.
+        alertDialog.show();
+
+        // Get the current favorite icon byte array from the `Cursor`.
+        byte[] currentIconByteArray = bookmarkCursor.getBlob(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.FAVORITE_ICON));
+        // Convert the byte array to a `Bitmap` beginning at the first byte and ending at the last.
+        Bitmap currentIconBitmap = BitmapFactory.decodeByteArray(currentIconByteArray, 0, currentIconByteArray.length);
+        // Display `currentIconBitmap` in `edit_folder_current_icon`.
+        ImageView currentIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_folder_current_icon);
+        assert currentIconImageView != null;  // Remove the warning below that `currentIconImageView` might be null.
+        currentIconImageView.setImageBitmap(currentIconBitmap);
+
+        // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_folder_web_page_favorite_icon`.
+        ImageView webPageFavoriteIcon = (ImageView) alertDialog.findViewById(R.id.edit_folder_web_page_favorite_icon);
+        assert webPageFavoriteIcon != null;  // Remove the warning below that `webPageFavoriteIcon` might be null.
+        webPageFavoriteIcon.setImageBitmap(MainWebViewActivity.favoriteIcon);
+
+        // Load the text for `edit_folder_name_edittext`.
+        EditText folderNameEditText = (EditText) alertDialog.findViewById(R.id.edit_folder_name_edittext);
+        assert folderNameEditText != null;  // Remove the warning below that `bookmarkNameEditText` might be null.
+        folderNameEditText.setText(bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHandler.BOOKMARK_NAME)));
+
+        // Allow the `enter` key on the keyboard to save the bookmark from `edit_bookmark_name_edittext`.
+        folderNameEditText.setOnKeyListener(new View.OnKeyListener() {
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                // If the event is a key-down on the "enter" button, select the PositiveButton `Save`.
+                if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
+                    // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
+                    editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolder.this);
+                    // Manually dismiss the `AlertDialog`.
+                    alertDialog.dismiss();
+                    // Consume the event.
+                    return true;
+                } else {  // If any other key was pressed, do not consume the event.
+                    return false;
+                }
+            }
+        });
+
+        // `onCreateDialog` requires the return of an `AlertDialog`.
+        return alertDialog;
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java
index e59168fe..f10c2e45 100644
--- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java
+++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java
@@ -65,7 +65,7 @@ import java.net.URLEncoder;
 
 // We need to use AppCompatActivity from android.support.v7.app.AppCompatActivity to have access to the SupportActionBar until the minimum API is >= 21.
 public class MainWebViewActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, CreateHomeScreenShortcut.CreateHomeScreenSchortcutListener {
-    // `favoriteIcon` is public static so it can be accessed from `CreateHomeScreenShortcut`, `BookmarksActivity`, and `EditBookmark`.
+    // `favoriteIcon` is public static so it can be accessed from `CreateHomeScreenShortcut`, `BookmarksActivity`, `CreateBookmark`, `CreateBookmarkFolder`, and `EditBookmark`.
     // It is also used in `onCreate()` and `onCreateHomeScreenShortcutCreate()`.
     public static Bitmap favoriteIcon;
 
@@ -629,7 +629,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
             case R.id.addToHomescreen:
                 // Show the CreateHomeScreenShortcut AlertDialog and name this instance "@string/create_shortcut".
                 DialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcut();
-                createHomeScreenShortcutDialogFragment.show(getFragmentManager(), "@string/create_shortcut");
+                createHomeScreenShortcutDialogFragment.show(getFragmentManager(), getResources().getString(R.string.create_shortcut));
 
                 //Everything else will be handled by CreateHomeScreenShortcut and the associated listeners below.
                 return true;
@@ -684,19 +684,19 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                 break;
 
             case R.id.settings:
-                // Launch SettingsActivity.
+                // Launch `SettingsActivity`.
                 Intent settingsIntent = new Intent(this, SettingsActivity.class);
                 startActivity(settingsIntent);
                 break;
 
             case R.id.guide:
-                // Launch GuideActivity.
+                // Launch `GuideActivity`.
                 Intent guideIntent = new Intent(this, GuideActivity.class);
                 startActivity(guideIntent);
                 break;
 
             case R.id.about:
-                // Launch AboutActivity.
+                // Launch `AboutActivity`.
                 Intent aboutIntent = new Intent(this, AboutActivity.class);
                 startActivity(aboutIntent);
                 break;
@@ -765,12 +765,12 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
     }
 
     @Override
-    public void onCreateHomeScreenShortcutCancel(DialogFragment dialogFragment) {
+    public void onCancelCreateHomeScreenShortcut(DialogFragment dialogFragment) {
         // Do nothing because the user selected "Cancel".
     }
 
     @Override
-    public void onCreateHomeScreenShortcutCreate(DialogFragment dialogFragment) {
+    public void onCreateHomeScreenShortcut(DialogFragment dialogFragment) {
         // Get shortcutNameEditText from the alert dialog.
         EditText shortcutNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.shortcut_name_edittext);
 
diff --git a/app/src/main/java/com/stoutner/privacybrowser/MoveToFolder.java b/app/src/main/java/com/stoutner/privacybrowser/MoveToFolder.java
new file mode 100644
index 00000000..2ae2cc65
--- /dev/null
+++ b/app/src/main/java/com/stoutner/privacybrowser/MoveToFolder.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser;
+
+import android.app.DialogFragment;
+
+public class MoveToFolder extends DialogFragment {
+}
diff --git a/app/src/main/res/drawable-hdpi/folder_blue_bitmap.png b/app/src/main/res/drawable-hdpi/folder_blue_bitmap.png
new file mode 100644
index 0000000000000000000000000000000000000000..0b5f491180076a3715a20bda96e0f6111f9aaac3
GIT binary patch
literal 613
zcmeAS@N?(olHy`uVBq!ia0vp^4nS<o!3HGN@AGX0QY^(zo*^7SP{WbZ0pxQQctjR6
zFo>ywFr#OX$_JpJWQl7;NpOBzNqJ&XDnogBxn5>oc5!lIL8@MUQTpt6Hc|`>jE_8B
z978f1-%j7}9~>xh-2S<klP0&@;r>ktPLCQ?EoKO~xrm3Sn+1!pv(M^V=kcGR;L?U&
z-U5f1&TKjH<bhJJqk_&-mqWHZw^%s%RNh)osJ4Gxee!qRJ#+QvchzGQtT+F4n(Mc?
zhuOB_f=G(})5>p~r>r)4UU}A;q3vGH`xQ(5?G&u89$HbWZnV?-_l`TedS*Xn=(B#!
zy|%WJq4vSm^?YaE^lUSGp5~Fi(dOZvHEJ^|ADEc#v^L)}HQ`x(p{D-N7UTETmeH@Z
z>#AoJyxVHgYS?@y?_-^2^qs1t3ALOr^+U28j%oZC_%X+2f|k2q$>X?XxtY)Jewcr(
z6e#z~!HTmp`Vhb4r>oz0uK(~}TR?(e^zWr`jr~pgg$tNUB)lU7yyyOMSM+me*1NBl
z@2tlVS}9q=$kE)l?C*y=o|h8+86K#-;pF%vQ_vaFu(iQ-BSWvZK~56mHKuDvm^uhB
zWfOE0e02^)9heot@L;Vf&qux=xw(la<~iTkvdtjnZs+vMY;Nr%n;)zy-kEyAHGAd~
z!5<;Iy=yEQ)>S<#^-%5jU>N-V%;BlY1=}|Kjrn+4;jzQ}tG~-7M1L$*nq9Q)^VLfy
dydEF3+#685aguD>PhgT@@O1TaS?83{1OWFa2a5mz

literal 0
HcmV?d00001

diff --git a/app/src/main/res/drawable-mdpi/folder_blue_bitmap.png b/app/src/main/res/drawable-mdpi/folder_blue_bitmap.png
new file mode 100644
index 0000000000000000000000000000000000000000..2e8e77df5ddc3539eb897d6d15859ee8be445c3c
GIT binary patch
literal 480
zcmeAS@N?(olHy`uVBq!ia0vp^20*OF!3HFodL<Zv6icy_X9x!n)NrJ90QsB+9+AZi
z3<7gNm{IMll?hN#vcxr_Bsf2<q&%@Gm7%=6TrV>(yEr+qAXP8FD1G)j8z}|`##m1m
z$B>BDw==E1nH@#k&d)Wys9^ST(y2qITn=8luW)1K0tGD&O_td@)2?-8h-UjHE=_v=
z{>14+$DA&Bxpt_jRq57DX`1cZ##?-<@#iz^GjZF14xC!DZ_6?z%LEw-C5}UtMh|sE
zwj1X+eq*;1ni{gNre}kQ*P^0{GT)w6sU}{kOEul{iQ&+j$KJn7avoP1Y&m0Z!1X$@
zUCSugf6u(HPEJ8}FC`^j2K`%Fvq3y;hJ)?3y8XK>XH@-)_5Qh3O@ROP1i1@rwjZOI
zXK(*Kvt5JhPe7*Nd^4t`-JTAc3^Q{jZ|hn)hCEl+U0{%9vTMFTgZN8nh61K-hA!1?
zzaFzG^$Kt3l}@^C!FYRz<OU$eH=bjM;<ipO!z6e5i-tDFtZmUH4p$XqZsiGz1ZvjU
z8vcB$v>{{nh5r{G-97i@(|3O#)w%1}tjORyA@pV9`rjr2r?^^w-|bWu_{$Pr7IyD%
TclQopY%qAb`njxgN@xNAyvf1f

literal 0
HcmV?d00001

diff --git a/app/src/main/res/drawable-xhdpi/folder_blue_bitmap.png b/app/src/main/res/drawable-xhdpi/folder_blue_bitmap.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab7a3083fe349b8b3d70e4f75e7e87ced7006a7c
GIT binary patch
literal 895
zcmeAS@N?(olHy`uVBq!ia0vp^2|(=2!3HEFS0!EmQY^(zo*^7SP{WbZ0pxQQctjR6
zFeqApFr(`<!vvt9WQl7;NpOBzNqJ&XDnogBxn5>oc5!lIL8@MUQTpt6Hc|`>On*FG
z978JRyuEwcJETyA{loj8y~ZM`DR#%>wg_w%i}F}qwySg2Qm237sXsEVo@<F|={Cr?
z8JuykdEUC)Eh|#`oH!hfUDZt4Cda*>BbJuw>-q4E`SW?_^Pa`c(EomVXM44|@`**C
z&SbO}X9!Q7VRfZzkyB&Aw&G&fM#Ja&CaS-r(m(y&{ZnnV-PSu?uHUbgF<#<aFhe+V
zYT!rlS=>8Y-m^|AJ<@$RVh85~2}6G~*4QRyhB?9EOYVjKsTY@Lcx5V58FlyHo*r2h
zaT$h?rSWsbE=pLRk-w6y@h2tyyNjmviK@xAvB|1&Z0i}OY&g8e*F8q#(w}9^-!WUC
ztSXFS)4d@8G-iq7<7(&D66+!^ne_G_-e0A<Z0?n2)vyC~7cgDf<ou`Exvrvcg+N)8
zi}kUzjfr`V`z6>64)9H!yF_)dXNyyC=e_3j_0?fpl5_YDT(eQ*R*+@9<M8S6AJLe+
zFJW?pYdj7r@ixSD<@NW3ZS9wjs66uU`E^0H>93ZYs1LhqSyb|qdv-%ja87XP_Qh}Y
zzcZOJ>O3vz7H?dt`bYABSkVH9pyz!zSOhHZ=WmsDSfb<`#xV8GHl`I@u9PuMzrivg
zk})NWVdh%~quC5b+6`y86gJB`qzOBuu|j2Z6A>~@C+6G`TDFN(VKdW-HDKi{brZGV
z8ktVKDK(kt%P><Er2QtJ!e%6u(+uD;Kr6SkoXmll!KF~lRFOSDt;mt#yyk~KS(Ozc
zvkJI;HZ`+M_puDzd%90Bgy~LU)RTB-gX4U{CQLO=`wI^5eQWtg?m}GI0)|(fUrf(g
zFnIX+&l7)OXB}8@V)2oZKTI3`$QaysRqvUf$NXV}q_%?GndRnNlQvvs53}hw`|bLY
zNtZtgH_T~OIC?sK0gEQ%E+GF#PQCA|<JTiYO8KW-+t&oSCI`F`Uto0qzv|A5oDXWN
okIfP|vDfFs?tNSG!+&!HtvHb9rSeZ3m{}M+UHx3vIVCg!0Fugf8UO$Q

literal 0
HcmV?d00001

diff --git a/app/src/main/res/drawable-xxhdpi/folder_blue_bitmap.png b/app/src/main/res/drawable-xxhdpi/folder_blue_bitmap.png
new file mode 100644
index 0000000000000000000000000000000000000000..8c1be731cd94c3dd66a92360edb68fb46c44e4fb
GIT binary patch
literal 1168
zcmeAS@N?(olHy`uVBq!ia0vp^4M3d6!3HFmm1l+kDVAa<&kznEsNqQI0P;BtJR*x3
z7<9Zrm~pA?w3R?X$r9IylHmNblJdl&REF~Ma=pyF?Be9af>gcyqV(DCY@~n&@p`&A
zhE&XXd&f2>x>SVqL-Bup^^MK}qKZfTlo^}!mK;3PHRI6qD+>iZmMFaFkVr^&@V$KC
ziJ-KEfHaQ}kH&;YidibtrZwt02(xc)U=b?3)1mmveNO+eeLNbfy1ovF>depD?$@k4
z?{5{<w{HEt%{n(GdsS^R(pi-pV8i-?p~0kK-QM-aN*2-4H*Grm+w&vbcSfJcQ~!1R
z^l_5~3<~1O^Zxrb%)AoyX=%Kj)uzO`PxC(XGkxhjU+zA!W>wd8U8b!k!uPIxk)mq9
zBU3hI|L&y>-}iqGR@=DMl=(s7Vw<&#HNKX)uiwB@y*sj@ar-`BGa=jOjJ1ah{8!I?
z9p^po!SRFd4t<mFJ+gPc%!Yb9hMu_hQS+tFgj=m?eiP2bF!S<ff2SwXuMKib))`;@
z{3!ot`?a;rZ_F7PLY5@RE;;LF{yKcQT;=EIey<gN_b%}dm7BUEa3i14<eTS0&U5-T
z?Pu+rr61AWaq(mCudSQ;pVi-;Z@!6##ld}z^N}|{-2UD&vFH0IBqFhaFEOFSbZ6Wn
z6$TaKz<oRm&Rca%jLdw*{90hG(t%ZOfu^DFBmS-bZU>Z&V=P#4_NGRhuY<l;fY*YL
zH{Tz<b15%Bg^_Qc)dKl-r+W{1CH^?|R=xSnN0$kFEg}l}>RTWG{xWmt!Q1|A*0GN4
z{Y?DbZQU<Vwx*ZK@oUXt==<UkykEwm_T`ChjS5^_eOxxa&h;?qHQ(pWFoz*d)>qzZ
z4<ExM%iw)XM{BQjYLuP6n|+df2g|Rk+i!)|Ph&0cJ;pS}x*^%pkKuSo!3@>{p9VXz
z1KTwk&NIb4W+~`n1taT*;yDcGHo{OLXGx#%0ZTC$(rY|d$YgOGj#MuIje8yeLpxZk
zj&nYc;Rd5}hUXTHbCO}`alflILX!JIOn_eFIuyf>A4D=-_5f~^f#y$lKrx(~!EBB5
zgqghz3)1E`oe5!H5c*mqWto)1!=_TMO^OG8F1V!;$*w3Z6(HoGYP_+4)8U$xz){cV
zSx1i-F$%Q4T2d<0HC@4nVG$!k*89|S#<|=0Tt5mNyb@ISB0J%D?}D{gY}acAZ0mM4
zoSAR(W$RmUbM6oBbswr&YWWWA@zm*RJjeRt^Xd2L;oJM~6lw2>I-{4jbdexK{E>OR
zx4ah4H=ixBQfza#b^rTcu?_z|elq0MU^ubWR(9*<el4TQodzbw%P0T;lqxXw%o8WR
zE<=rZYy}by_6_T%9bXa_!M=edA+Uj4Dqz)K>o3d-yKb}AGcnx%G%23{T^O+RVDNPH
Kb6Mw<&;$Tx8uKOq

literal 0
HcmV?d00001

diff --git a/app/src/main/res/drawable/back.xml b/app/src/main/res/drawable/back.xml
index e69b5ad5..a49efd8b 100644
--- a/app/src/main/res/drawable/back.xml
+++ b/app/src/main/res/drawable/back.xml
@@ -3,11 +3,11 @@
 
 <vector
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:autoMirrored="true"
     android:height="24dp"
     android:width="24dp"
     android:viewportHeight="24.0"
-    android:viewportWidth="24.0" >
+    android:viewportWidth="24.0"
+    android:autoMirrored="true" >
 
     <path
         android:fillColor="#FF000000"
diff --git a/app/src/main/res/drawable/create_folder.xml b/app/src/main/res/drawable/create_folder.xml
new file mode 100644
index 00000000..0ac318e1
--- /dev/null
+++ b/app/src/main/res/drawable/create_folder.xml
@@ -0,0 +1,15 @@
+<!-- create_folder.xml comes from the Android Material icon set, where it is called ic_create_new_folder.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0"
+    android:autoMirrored="true" >
+
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M20,6h-8l-2,-2L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM19,14h-3v3h-2v-3h-3v-2h3L14,9h2v3h3v2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/edit.xml b/app/src/main/res/drawable/edit.xml
index d5164881..89a86c32 100644
--- a/app/src/main/res/drawable/edit.xml
+++ b/app/src/main/res/drawable/edit.xml
@@ -3,11 +3,11 @@
 
 <vector
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:autoMirrored="true"
     android:height="24dp"
     android:width="24dp"
     android:viewportHeight="24.0"
-    android:viewportWidth="24.0" >
+    android:viewportWidth="24.0"
+    android:autoMirrored="true" >
 
     <path
         android:fillColor="#FFFFFFFF"
diff --git a/app/src/main/res/drawable/exit.xml b/app/src/main/res/drawable/exit.xml
index 89d4faff..e46cccca 100644
--- a/app/src/main/res/drawable/exit.xml
+++ b/app/src/main/res/drawable/exit.xml
@@ -3,11 +3,11 @@
 
 <vector
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:autoMirrored="true"
     android:height="24dp"
     android:width="24dp"
     android:viewportHeight="24.0"
-    android:viewportWidth="24.0" >
+    android:viewportWidth="24.0"
+    android:autoMirrored="true" >
 
     <path
         android:fillColor="#FF000000"
diff --git a/app/src/main/res/drawable/folder.xml b/app/src/main/res/drawable/folder.xml
new file mode 100644
index 00000000..a6d3d31b
--- /dev/null
+++ b/app/src/main/res/drawable/folder.xml
@@ -0,0 +1,14 @@
+<!-- folder.xml comes from the Android Material icon set, where it is called ic_folder.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <path
+        android:fillColor="#FF9E9E9E"
+        android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/forward.xml b/app/src/main/res/drawable/forward.xml
index e8ccd370..dfa9e066 100644
--- a/app/src/main/res/drawable/forward.xml
+++ b/app/src/main/res/drawable/forward.xml
@@ -3,11 +3,11 @@
 
 <vector
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:autoMirrored="true"
     android:height="24dp"
     android:width="24dp"
     android:viewportHeight="24.0"
-    android:viewportWidth="24.0" >
+    android:viewportWidth="24.0"
+    android:autoMirrored="true" >
 
     <path
         android:fillColor="#FF000000"
diff --git a/app/src/main/res/drawable/move_bookmark_down_disabled.xml b/app/src/main/res/drawable/move_bookmark_down_disabled.xml
index 674fcda7..6934feb5 100644
--- a/app/src/main/res/drawable/move_bookmark_down_disabled.xml
+++ b/app/src/main/res/drawable/move_bookmark_down_disabled.xml
@@ -1,4 +1,4 @@
-<!-- move_bookmark_down_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
+<!-- move_bookmark_down_disabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
   It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
 
 <vector
diff --git a/app/src/main/res/drawable/move_bookmark_down_enabled.xml b/app/src/main/res/drawable/move_bookmark_down_enabled.xml
index 90b5ae1b..b7a2423e 100644
--- a/app/src/main/res/drawable/move_bookmark_down_enabled.xml
+++ b/app/src/main/res/drawable/move_bookmark_down_enabled.xml
@@ -1,4 +1,4 @@
-<!-- move_bookmark_down_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
+<!-- move_bookmark_down_enabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
   It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
 
 <vector
diff --git a/app/src/main/res/drawable/move_bookmark_up_disabled.xml b/app/src/main/res/drawable/move_bookmark_up_disabled.xml
index c38ad46c..4ead123a 100644
--- a/app/src/main/res/drawable/move_bookmark_up_disabled.xml
+++ b/app/src/main/res/drawable/move_bookmark_up_disabled.xml
@@ -1,4 +1,4 @@
-<!-- move_bookmark_up_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
+<!-- move_bookmark_up_disabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
   It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
 
 <vector
diff --git a/app/src/main/res/drawable/move_bookmark_up_enabled.xml b/app/src/main/res/drawable/move_bookmark_up_enabled.xml
index 06c837d5..20a40515 100644
--- a/app/src/main/res/drawable/move_bookmark_up_enabled.xml
+++ b/app/src/main/res/drawable/move_bookmark_up_enabled.xml
@@ -1,4 +1,4 @@
-<!-- move_bookmark_up_enabled_enabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
+<!-- move_bookmark_up_enabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
   It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
 
 <vector
diff --git a/app/src/main/res/drawable/move_to_folder.xml b/app/src/main/res/drawable/move_to_folder.xml
new file mode 100644
index 00000000..9b912bb1
--- /dev/null
+++ b/app/src/main/res/drawable/move_to_folder.xml
@@ -0,0 +1,15 @@
+<!-- move_to_folder.xml comes from the Android Material icon set, where it is called ic_folder_special.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:autoMirrored="true"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M20,6h-8l-2,-2L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,8c0,-1.1 -0.9,-2 -2,-2zM17.94,17L15,15.28 12.06,17l0.78,-3.33 -2.59,-2.24 3.41,-0.29L15,8l1.34,3.14 3.41,0.29 -2.59,2.24 0.78,3.33z"/>
+</vector>
diff --git a/app/src/main/res/layout/bookmarks_coordinatorlayout.xml b/app/src/main/res/layout/bookmarks_coordinatorlayout.xml
index 783a19bc..4ebdaaa5 100644
--- a/app/src/main/res/layout/bookmarks_coordinatorlayout.xml
+++ b/app/src/main/res/layout/bookmarks_coordinatorlayout.xml
@@ -18,9 +18,9 @@
   You should have received a copy of the GNU General Public License
   along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
 
-<!-- android:fitsSystemWindows="true" moves the AppBar below the status bar.
-  When it is specified the theme should include <item name="android:windowTranslucentStatus">true</item>
-  to make the status bar a transparent, darkened overlay. -->
+<!-- `android:fitsSystemWindows="true"` moves the AppBar below the status bar.
+    When it is specified the theme should include `<item name="android:windowTranslucentStatus">true</item>`
+    to make the status bar a transparent, darkened overlay. -->
 <android.support.design.widget.CoordinatorLayout
     android:id="@+id/bookmarks_coordinatorlayout"
     xmlns:android="http://schemas.android.com/apk/res/android"
@@ -29,7 +29,7 @@
     android:layout_width="match_parent"
     android:fitsSystemWindows="true" >
 
-    <!-- the LinearLayout with orientation="vertical" moves the content below the AppBarLayout. -->
+    <!-- the `LinearLayout` with `orientation="vertical"` moves the content below the `AppBarLayout`. -->
     <LinearLayout
         android:layout_height="match_parent"
         android:layout_width="match_parent"
@@ -51,9 +51,9 @@
                 app:popupTheme="@style/LightPopupOverlay" />
         </android.support.design.widget.AppBarLayout>
 
-        <!-- android:choiceMode="multipleChoiceModal" allows the contextual action menu to select more than one item at a time.
-            android:dividerHeight must be specified with android:divider or the height will be 0dp.
-            In our case we want the height to be 0dp. -->
+        <!-- `android:choiceMode="multipleChoiceModal"` allows the contextual action menu to select more than one item at a time.
+            `android:dividerHeight` must be specified with `android:divider` or the height will be `0dp`.
+            In our case we want the height to be `0dp`. -->
         <ListView
             android:id="@+id/bookmarks_listview"
             android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/bookmarks_database_view_coordinatorlayout.xml b/app/src/main/res/layout/bookmarks_database_view_coordinatorlayout.xml
new file mode 100644
index 00000000..2db02819
--- /dev/null
+++ b/app/src/main/res/layout/bookmarks_database_view_coordinatorlayout.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+  Privacy Browser is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<!-- `android:fitsSystemWindows="true"` moves the AppBar below the status bar.
+    When it is specified the theme should include `<item name="android:windowTranslucentStatus">true</item>`
+    to make the status bar a transparent, darkened overlay. -->
+<android.support.design.widget.CoordinatorLayout
+    android:id="@+id/bookmarks_database_view_coordinatorlayout"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:fitsSystemWindows="true" >
+
+    <!-- the `LinearLayout` with `orientation="vertical"` moves the content below the `AppBarLayout`. -->
+    <LinearLayout
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:orientation="vertical" >
+
+        <android.support.design.widget.AppBarLayout
+            android:id="@+id/bookmarks_database_view_appbarlayout"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:theme="@style/AppBarOverlay" >
+
+            <android.support.v7.widget.Toolbar
+                android:id="@+id/bookmarks_database_view_toolbar"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:background="@color/blue"
+                android:theme="@style/DarkAppBar"
+                app:popupTheme="@style/LightPopupOverlay" />
+        </android.support.design.widget.AppBarLayout>
+
+        <ListView
+            android:id="@+id/bookmarks_database_view_listview"
+            android:layout_height="match_parent"
+            android:layout_width="match_parent" />
+    </LinearLayout>
+</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/bookmarks_database_view_linearlayout.xml b/app/src/main/res/layout/bookmarks_database_view_linearlayout.xml
new file mode 100644
index 00000000..f1949e89
--- /dev/null
+++ b/app/src/main/res/layout/bookmarks_database_view_linearlayout.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+  Privacy Browser is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<LinearLayout
+    android:id="@+id/bookmarks_database_view_item_linearlayout"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_height="wrap_content"
+    android:layout_width="match_parent"
+    android:orientation="vertical" >
+
+    <!-- First row. -->
+    <LinearLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_marginTop="10dp"
+        android:layout_marginStart="10dp"
+        android:layout_marginEnd="10dp"
+        android:orientation="horizontal" >
+
+        <TextView
+            android:id="@+id/bookmarks_database_view_database_id"
+            android:layout_height="wrap_content"
+            android:layout_width="50dp"
+            android:layout_marginEnd="10dp"
+            android:gravity="end"
+            android:textColor="@color/grey"
+            android:textSize="22sp" />
+
+        <ImageView
+            android:id="@+id/bookmarks_database_view_favorite_icon"
+            android:layout_width="30dp"
+            android:layout_height="30dp"
+            android:layout_gravity="center_vertical"
+            android:layout_marginEnd="10dp"
+            tools:ignore="ContentDescription" />
+
+        <TextView
+            android:id='@+id/bookmarks_database_view_bookmark_name'
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:textColor="@color/black"
+            android:textSize="22sp"
+            android:singleLine="true" />
+    </LinearLayout>
+
+    <!-- Second row. -->
+    <LinearLayout
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_marginStart="10dp"
+        android:layout_marginEnd="10dp"
+        android:orientation="horizontal" >
+
+        <TextView
+            android:id="@+id/bookmarks_database_view_display_order"
+            android:layout_height="wrap_content"
+            android:layout_width="50dp"
+            android:layout_marginEnd="10dp"
+            android:gravity="end"
+            android:textColor="@color/black"
+            android:textSize="22sp" />
+
+        <ImageView
+            android:layout_height="30dp"
+            android:layout_width="30dp"
+            android:layout_gravity="center_vertical"
+            android:layout_marginEnd="10dp"
+            android:src="@drawable/folder"
+            tools:ignore="ContentDescription" />
+
+        <TextView
+            android:id="@+id/bookmarks_database_view_parent_folder"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:textColor="@color/black"
+            android:textSize="22sp"
+            android:textStyle="italic"
+            android:singleLine="true" />
+    </LinearLayout>
+
+    <!-- Third row. -->
+    <TextView
+        android:id="@+id/bookmarks_database_view_bookmark_url"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_marginBottom="10dp"
+        android:layout_marginStart="13dp"
+        android:layout_marginEnd="10dp"
+        android:textColor="@color/black"
+        android:textSize="22sp"
+        android:singleLine="true" />
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/bookmarks_item_linearlayout.xml b/app/src/main/res/layout/bookmarks_item_linearlayout.xml
index 408844fe..cbb12038 100644
--- a/app/src/main/res/layout/bookmarks_item_linearlayout.xml
+++ b/app/src/main/res/layout/bookmarks_item_linearlayout.xml
@@ -21,11 +21,11 @@
 <LinearLayout
     android:id="@+id/bookmarks_item_linearlayout"
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_height="wrap_content"
     android:layout_width="match_parent"
     android:orientation="horizontal"
-    android:background="@drawable/bookmarks_list_selector"
-    xmlns:tools="http://schemas.android.com/tools">
+    android:background="@drawable/bookmarks_list_selector" >
 
     <ImageView
         android:id="@+id/bookmark_favorite_icon"
diff --git a/app/src/main/res/layout/create_bookmark_dialog.xml b/app/src/main/res/layout/create_bookmark_dialog.xml
index 48e7cc79..49670020 100644
--- a/app/src/main/res/layout/create_bookmark_dialog.xml
+++ b/app/src/main/res/layout/create_bookmark_dialog.xml
@@ -31,11 +31,10 @@
         android:layout_marginTop="12dp"
         android:layout_marginBottom="6dp"
         android:layout_marginStart="4dp"
-        android:layout_marginEnd="4dp">
+        android:layout_marginEnd="4dp" >
 
         <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
-            `android:inputType="textUri"` disables spell check in the EditText.
-            `android:singleLine="true"` is not needed in a Dialog.-->
+            `android:inputType="textUri"` disables spell check in the EditText. -->
         <android.support.design.widget.TextInputEditText
             android:id="@+id/create_bookmark_name_edittext"
             android:layout_height="wrap_content"
@@ -55,8 +54,7 @@
         android:layout_marginEnd="4dp" >
 
         <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
-            `android:inputType="textUri"` disables spell check in the EditText.
-            `android:singleLine="true"` is not needed in a Dialog.-->
+            `android:inputType="textUri"` disables spell check in the EditText.-->
         <EditText
             android:id="@+id/create_bookmark_url_edittext"
             android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/create_bookmark_folder_dialog.xml b/app/src/main/res/layout/create_bookmark_folder_dialog.xml
new file mode 100644
index 00000000..58bb4051
--- /dev/null
+++ b/app/src/main/res/layout/create_bookmark_folder_dialog.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+  Privacy Browser is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_height="wrap_content"
+    android:layout_width="match_parent"
+    android:orientation="vertical" >
+
+    <!-- The icon selection rows. -->
+    <LinearLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:orientation="horizontal">
+
+        <!-- The column displaying the icons. -->
+        <LinearLayout
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:orientation="vertical" >
+
+            <ImageView
+                android:id="@+id/create_folder_default_icon"
+                android:layout_height="30dp"
+                android:layout_width="30dp"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="6dp"
+                android:layout_marginStart="8dp"
+                android:layout_marginEnd="8dp"
+                android:layout_gravity="center_vertical"
+                android:src="@drawable/folder_blue_bitmap"
+                tools:ignore="ContentDescription" />
+
+            <ImageView
+                android:id="@+id/create_folder_web_page_icon"
+                android:layout_height="30dp"
+                android:layout_width="30dp"
+                android:layout_marginTop="6dp"
+                android:layout_marginBottom="6dp"
+                android:layout_marginStart="8dp"
+                android:layout_marginEnd="8dp"
+                android:layout_gravity="center_vertical"
+                tools:ignore="ContentDescription" />
+        </LinearLayout>
+
+        <!-- The column with the `RadioGroup`. -->
+        <RadioGroup
+            android:id="@+id/create_folder_radiogroup"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:checkedButton="@+id/create_folder_default_icon_radiobuttion">
+
+            <RadioButton
+                android:id="@id/create_folder_default_icon_radiobuttion"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="9dp"
+                android:text="@string/default_folder_icon"
+                android:textSize="18sp" />
+
+            <RadioButton
+                android:id="@+id/create_folder_web_page_icon_radiobuttion"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/web_page_favorite_icon"
+                android:textSize="18sp" />
+        </RadioGroup>
+    </LinearLayout>
+
+    <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
+    <android.support.design.widget.TextInputLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_marginTop="6dp"
+        android:layout_marginStart="4dp"
+        android:layout_marginEnd="4dp" >
+
+        <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
+            `android:inputType="textUri"` disables spell check in the EditText. -->
+        <android.support.design.widget.TextInputEditText
+            android:id="@+id/create_folder_name_edittext"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:hint="@string/folder_name"
+            android:imeOptions="actionGo"
+            android:inputType="textUri" />
+    </android.support.design.widget.TextInputLayout>
+
+    <TextView
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:gravity="center_horizontal"
+        android:text="@string/folder_names_must_be_unique" />
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/create_home_screen_shortcut_dialog.xml b/app/src/main/res/layout/create_home_screen_shortcut_dialog.xml
index 5e924111..11469aff 100644
--- a/app/src/main/res/layout/create_home_screen_shortcut_dialog.xml
+++ b/app/src/main/res/layout/create_home_screen_shortcut_dialog.xml
@@ -18,25 +18,29 @@
   You should have received a copy of the GNU General Public License
   along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
 
-<RelativeLayout
-    android:id="@+id/create_home_screen_shortcut_dialog_relativelayout"
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_height="wrap_content"
-    android:layout_width="match_parent" >
-
-    <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
-        `android:inputType="textUri"` disables spell check in the EditText.
-        `android:singleLine="true"` is not needed in a Dialog.
-        We can't use `android:imeOptions=flagNoExtractUi"` because it disables tapping to select in landscape orientation on small devices.-->
-    <EditText
-        android:id="@+id/shortcut_name_edittext"
+    android:layout_width="match_parent"
+    android:orientation="vertical" >
+
+    <android.support.design.widget.TextInputLayout
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
         android:layout_marginTop="16dp"
-        android:layout_marginLeft="4dp"
-        android:layout_marginRight="4dp"
-        android:layout_marginBottom="16dp"
-        android:hint="@string/shortcut_name"
-        android:imeOptions="actionGo"
-        android:inputType="textUri" />
-</RelativeLayout>
\ No newline at end of file
+        android:layout_marginBottom="10dp"
+        android:layout_marginStart="4dp"
+        android:layout_marginEnd="4dp" >
+
+        <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
+            `android:inputType="textUri"` disables spell check in the EditText.
+            We can't use `android:imeOptions=flagNoExtractUi"` because it disables tapping to select in landscape orientation on small devices.-->
+        <android.support.design.widget.TextInputEditText
+            android:id="@+id/shortcut_name_edittext"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:hint="@string/shortcut_name"
+            android:imeOptions="actionGo"
+            android:inputType="textUri" />
+    </android.support.design.widget.TextInputLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/edit_bookmark_dialog.xml b/app/src/main/res/layout/edit_bookmark_dialog.xml
index 1768ca08..7bb2e454 100644
--- a/app/src/main/res/layout/edit_bookmark_dialog.xml
+++ b/app/src/main/res/layout/edit_bookmark_dialog.xml
@@ -20,40 +20,66 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:paddingStart="4dp"
-    android:paddingEnd="4dp" >
+    android:orientation="vertical">
 
+    <!-- The icon selection rows. -->
     <LinearLayout
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
-        android:orientation="horizontal"
-        android:paddingTop="12dp"
-        android:paddingBottom="4dp"
-        android:paddingStart="20dp"
-        android:paddingEnd="0dp" >
-
-        <ImageView
-            android:id="@+id/edit_bookmark_new_favorite_icon"
-            android:layout_width="32dp"
-            android:layout_height="32dp"
-            android:contentDescription="@string/new_favorite_icon" />
-
-        <TextView
+        android:orientation="horizontal">
+
+        <!-- The column displaying the icons. -->
+        <LinearLayout
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:text="@string/use_new_icon"
-            android:textColor="@color/black"
-            android:textSize="20sp"
-            android:paddingStart="8dp"
-            android:paddingEnd="4dp" />
-
-        <CheckBox
-            android:id="@+id/edit_bookmark_use_new_favorite_icon_checkbox"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="10dp"
+            android:orientation="vertical" >
+
+            <ImageView
+                android:id="@+id/edit_bookmark_current_icon"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="6dp"
+                android:layout_gravity="center_vertical"
+                tools:ignore="ContentDescription" />
+
+            <ImageView
+                android:id="@+id/edit_bookmark_web_page_favorite_icon"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                android:layout_marginTop="6dp"
+                android:layout_marginBottom="6dp"
+                tools:ignore="ContentDescription" />
+        </LinearLayout>
+
+        <!-- The column with the `RadioGroup`. -->
+        <RadioGroup
             android:layout_height="wrap_content"
-            android:layout_width="wrap_content" />
+            android:layout_width="match_parent"
+            android:checkedButton="@+id/edit_bookmark_current_icon_radiobutton" >
+
+            <RadioButton
+                android:id="@id/edit_bookmark_current_icon_radiobutton"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="4dp"
+                android:text="@string/current_bookmark_icon"
+                android:textSize="18sp" />
+
+            <RadioButton
+                android:id="@+id/edit_bookmark_web_page_favorite_icon_radiobutton"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:layout_marginTop="5dp"
+                android:text="@string/web_page_favorite_icon"
+                android:textSize="18sp" />
+        </RadioGroup>
     </LinearLayout>
 
     <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
@@ -61,7 +87,9 @@
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
         android:layout_marginTop="12dp"
-        android:layout_marginBottom="6dp" >
+        android:layout_marginBottom="6dp"
+        android:layout_marginStart="4dp"
+        android:layout_marginEnd="4dp" >
 
         <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
             `android:inputType="textUri"` disables spell check in the EditText.
@@ -80,7 +108,9 @@
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
         android:layout_marginTop="6dp"
-        android:layout_marginBottom="12dp" >
+        android:layout_marginBottom="12dp"
+        android:layout_marginStart="4dp"
+        android:layout_marginEnd="4dp" >
 
         <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
             `android:inputType="textUri"` disables spell check in the EditText.
diff --git a/app/src/main/res/layout/edit_bookmark_folder_dialog.xml b/app/src/main/res/layout/edit_bookmark_folder_dialog.xml
new file mode 100644
index 00000000..2286cbdf
--- /dev/null
+++ b/app/src/main/res/layout/edit_bookmark_folder_dialog.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+  Privacy Browser is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_height="wrap_content"
+    android:layout_width="match_parent"
+    android:orientation="vertical" >
+
+    <!-- The icon selection rows. -->
+    <LinearLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:orientation="horizontal">
+
+        <!-- The column displaying the icons. -->
+        <LinearLayout
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:orientation="vertical"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="10dp" >
+
+            <ImageView
+                android:id="@+id/edit_folder_current_icon"
+                android:layout_height="30dp"
+                android:layout_width="30dp"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="6dp"
+                android:layout_gravity="center_vertical"
+                tools:ignore="ContentDescription" />
+
+            <ImageView
+                android:id="@+id/edit_folder_default_icon"
+                android:layout_height="30dp"
+                android:layout_width="30dp"
+                android:layout_marginTop="6dp"
+                android:layout_marginBottom="6dp"
+                android:layout_gravity="center_vertical"
+                android:src="@drawable/folder_blue_bitmap"
+                tools:ignore="ContentDescription" />
+
+            <ImageView
+                android:id="@+id/edit_folder_web_page_favorite_icon"
+                android:layout_height="30dp"
+                android:layout_width="30dp"
+                android:layout_marginTop="6dp"
+                android:layout_marginBottom="12dp"
+                android:layout_gravity="center_vertical"
+                tools:ignore="ContentDescription" />
+        </LinearLayout>
+
+        <!-- The column with the `RadioGroup`. -->
+        <RadioGroup
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:checkedButton="@+id/edit_folder_current_icon_radiobutton">
+
+            <RadioButton
+                android:id="@id/edit_folder_current_icon_radiobutton"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:layout_marginTop="12dp"
+                android:layout_marginBottom="4dp"
+                android:text="@string/current_folder_icon"
+                android:textSize="18sp"/>
+
+            <RadioButton
+                android:id="@+id/edit_folder_default_icon_radiobutton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="5dp"
+                android:layout_marginBottom="4dp"
+                android:text="@string/default_folder_icon"
+                android:textSize="18sp" />
+
+            <RadioButton
+                android:id="@+id/edit_folder_web_page_icon_radiobutton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="5dp"
+                android:text="@string/web_page_favorite_icon"
+                android:textSize="18sp" />
+        </RadioGroup>
+    </LinearLayout>
+
+    <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
+    <android.support.design.widget.TextInputLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_marginTop="6dp"
+        android:layout_marginBottom="12dp"
+        android:layout_marginStart="4dp"
+        android:layout_marginEnd="4dp" >
+
+        <!-- `android:imeOptions="actionGo"` sets the keyboard to have a "go" key instead of a "new line" key.
+            `android:inputType="textUri"` disables spell check in the EditText. -->
+        <android.support.design.widget.TextInputEditText
+            android:id="@+id/edit_folder_name_edittext"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:hint="@string/folder_name"
+            android:imeOptions="actionGo"
+            android:inputType="textUri" />
+    </android.support.design.widget.TextInputLayout>
+
+    <TextView
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:gravity="center_horizontal"
+        android:text="@string/folder_names_must_be_unique" />
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/menu/bookmarks_context_menu.xml b/app/src/main/res/menu/bookmarks_context_menu.xml
index ba1139ee..1f880e39 100644
--- a/app/src/main/res/menu/bookmarks_context_menu.xml
+++ b/app/src/main/res/menu/bookmarks_context_menu.xml
@@ -36,24 +36,31 @@
         android:icon="@drawable/move_bookmark_down_enabled"
         app:showAsAction="ifRoom" />
 
+    <item
+        android:id="@+id/move_to_folder"
+        android:title="@string/move_to_folder"
+        android:orderInCategory="30"
+        android:icon="@drawable/move_to_folder"
+        app:showAsAction="ifRoom" />
+
     <item
         android:id="@+id/edit_bookmark"
         android:title="@string/edit"
-        android:orderInCategory="30"
+        android:orderInCategory="40"
         android:icon="@drawable/edit"
         app:showAsAction="ifRoom" />
 
     <item
         android:id="@+id/delete_bookmark"
         android:title="@string/delete"
-        android:orderInCategory="40"
+        android:orderInCategory="50"
         android:icon="@drawable/delete"
         app:showAsAction="ifRoom" />
 
     <item
         android:id="@+id/context_menu_select_all_bookmarks"
         android:title="@string/select_all"
-        android:orderInCategory="50"
+        android:orderInCategory="60"
         android:icon="@drawable/select_all"
         app:showAsAction="ifRoom" />
 </menu>
\ No newline at end of file
diff --git a/app/src/main/res/menu/bookmarks_options_menu.xml b/app/src/main/res/menu/bookmarks_options_menu.xml
index 856594ce..41b7b86f 100644
--- a/app/src/main/res/menu/bookmarks_options_menu.xml
+++ b/app/src/main/res/menu/bookmarks_options_menu.xml
@@ -22,10 +22,23 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
+    <item
+        android:id="@+id/create_folder"
+        android:title="@string/create_folder"
+        android:orderInCategory="10"
+        android:icon="@drawable/create_folder"
+        app:showAsAction="ifRoom" />
+
     <item
         android:id="@+id/options_menu_select_all_bookmarks"
         android:title="@string/select_all"
-        android:orderInCategory="10"
+        android:orderInCategory="20"
         android:icon="@drawable/select_all"
         app:showAsAction="ifRoom" />
+
+    <item
+        android:id="@+id/bookmarks_database_view"
+        android:title="@string/database_view"
+        android:orderInCategory="30"
+        app:showAsAction="never" />
 </menu>
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 02fa590f..598c51b7 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -23,9 +23,11 @@
     <color name="black">#FF000000</color>
     <color name="blue">#FF1976D2</color>
     <color name="dark_blue">#FF0D47A1</color>
-    <color name="blue_gray">#FF607d8b</color>
+    <color name="blue_gray">#FF607D8B</color>
+    <color name="grey">#FF9E9E9E</color>
     <color name="green">#FF64DD17</color>
     <color name="light_blue">#FFBBDEFB</color>
+    <color name="medium_light_blue">#FF42A5F5</color>
     <color name="red">#FFD50000</color>
     <color name="white">#FFFFFFFF</color>
     <color name="yellow">#FFFFD600</color>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a4a030e0..42396d59 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -70,18 +70,28 @@
     <string name="create">Create</string>
 
     <!-- Bookmarks. -->
+    <string name="database_view">Database View</string>
     <string name="create_bookmark">Create bookmark</string>
+    <string name="create_folder">Create folder</string>
+    <string name="current_folder_icon">Current folder icon</string>
+    <string name="default_folder_icon">Default folder icon</string>
+    <string name="web_page_favorite_icon">Web page favorite icon</string>
+    <string name="folder_name">Folder name</string>
+    <string name="folder_names_must_be_unique">Folder names must be unique</string>
+    <string name="cannot_create_folder">Cannot create the folder because the name is not unique:</string>
+    <string name="cannot_rename_folder">Cannot rename the folder because the new name is not unique:</string>
     <string name="edit_bookmark">Edit bookmark</string>
+    <string name="edit_folder">Edit folder</string>
+    <string name="move_to_folder">Move to Folder</string>
     <string name="save">Save</string>
     <string name="bookmark_name">Bookmark name</string>
     <string name="bookmark_url">Bookmark URL</string>
-    <string name="new_favorite_icon">New favorite icon</string>
-    <string name="use_new_icon">Use new icon</string>
+    <string name="current_bookmark_icon">Current bookmark icon</string>
 
     <!-- Bookmarks Contextual App Bar. -->
     <string name="selected">Selected</string>
     <string name="move_up">Move Up</string>
-    <string name="move_down">Move down</string>
+    <string name="move_down">Move Down</string>
     <string name="edit">Edit</string>
     <string name="delete">Delete</string>
     <string name="select_all">Select All</string>
@@ -89,6 +99,10 @@
     <string name="bookmarks_deleted">Bookmarks Deleted</string>
     <string name="undo">Undo</string>
 
+    <!-- Bookmarks Database View. -->
+    <string name="bookmarks_database_view">Bookmarks Database View</string>
+    <string name="home_folder">Home folder</string>
+
     <!-- Guide. -->
     <string name="privacy_browser_guide">Privacy Browser Guide</string>
     <string name="overview">Overview</string>
-- 
2.47.2