]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Speed up the moving of bookmarks. https://redmine.stoutner.com/issues/48.
authorSoren Stoutner <soren@stoutner.com>
Fri, 22 Sep 2017 16:27:11 +0000 (09:27 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 22 Sep 2017 16:27:11 +0000 (09:27 -0700)
app/src/main/assets/de/about_changelog_dark.html
app/src/main/assets/de/about_changelog_light.html
app/src/main/assets/en/about_changelog_dark.html
app/src/main/assets/en/about_changelog_light.html
app/src/main/assets/es/about_changelog_dark.html
app/src/main/assets/es/about_changelog_light.html
app/src/main/assets/it/about_changelog_dark.html
app/src/main/assets/it/about_changelog_light.html
app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java
fastlane/metadata/android/es/changelogs/26.txt

index 9c62d7c3d07674facc2972935a60701c013f2c3f..d83d57489cef0585bb9884078bf7d09902ad1d5d 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3>2.6 (version code 26)</h3>
-        <p>18. September 2017 - Mindest-API 19, Ziel-API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18. September 2017</a> - Mindest-API 19, Ziel-API 25</p>
         <ul>
             <li>Add <a href="https://redmine.stoutner.com/issues/145">night mode rendering</a>.</li>
             <li>Update the dark theme rendering of the <a href="https://redmine.stoutner.com/issues/150">About and Guide sections</a>.</li>
index 7939dea7d26a09a4e0e8c2cfb2946fae3fc6a792..3f10b8d0fed48e60225b9fc2b85bbcfff03336db 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3>2.6 (version code 26)</h3>
-        <p>18. September 2017 - Mindest-API 19, Ziel-API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18. September 2017</a> - Mindest-API 19, Ziel-API 25</p>
         <ul>
             <li>Add <a href="https://redmine.stoutner.com/issues/145">night mode rendering</a>.</li>
             <li>Update the dark theme rendering of the <a href="https://redmine.stoutner.com/issues/150">About and Guide sections</a>.</li>
index d78d63a049e031184583850d9c3f0281eba640df..5356ac4621a71285f500ac77ba7506cfdcabe944 100644 (file)
@@ -25,7 +25,7 @@
 
     <body>
         <h3>2.6 (version code 26)</h3>
-        <p>18 September 2017 - minimum API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 September 2017</a> - minimum API 19, target API 25</p>
         <ul>
             <li>Add <a href="https://redmine.stoutner.com/issues/145">night mode rendering</a>.</li>
             <li>Update the dark theme rendering of the <a href="https://redmine.stoutner.com/issues/150">About and Guide sections</a>.</li>
index 147473bd324d27350e4184fad22ae8670dc94ce1..938135e28f2afda456edd2302755bc44a35a66d8 100644 (file)
@@ -25,7 +25,7 @@
 
     <body>
         <h3>2.6 (version code 26)</h3>
-        <p>18 September 2017 - minimum API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 September 2017</a> - minimum API 19, target API 25</p>
         <ul>
             <li>Add <a href="https://redmine.stoutner.com/issues/145">night mode rendering</a>.</li>
             <li>Update the dark theme rendering of the <a href="https://redmine.stoutner.com/issues/150">About and Guide sections</a>.</li>
index c2792b7c09e5f53fead2893d65f8a80c69ea4e8e..8d7febbce10f7d259270204a031d3afd83eb12c2 100644 (file)
 
     <body>
         <h3>2.6 (código de versión 26)</h3>
-        <p>18 de septiembre de 2017 - API mínimo 19, API dirigido 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 de septiembre de 2017</a> - API mínimo 19, API dirigido 25</p>
         <ul>
-            <li>Añadir <a href="https:/ight /redmine.stoutner.com/issues/145">renderizado en modo nocturno</a>.</li>
-            <li>Actualizar el renderizado del tema oscuro de las<a href="https://redmine.stoutner.com/issues/150">secciones Acerca de y Guía</a></li>
-            <li>Añadir soporte para <a href="https://redmine.stoutner.com/issues/52">autenticación HTTP </a>.</li>
-            <li><a href="https://redmine.stoutner.com/issues/178">Colorear el Nombre Común</a>en el cuadro de diálogo Ver certificado SSL.</li>
+            <li>Añadir <a href="https://redmine.stoutner.com/issues/145">renderizado en modo nocturno</a>.</li>
+            <li>Actualizar el renderizado del tema oscuro de las <a href="https://redmine.stoutner.com/issues/150">secciones Acerca de y Guía</a>.</li>
+            <li>Añadir soporte para <a href="https://redmine.stoutner.com/issues/52">autenticación HTTP</a>.</li>
+            <li><a href="https://redmine.stoutner.com/issues/178">Colorear el Nombre Común</a> en el cuadro de diálogo Ver certificado SSL.</li>
             <li>Traducción al español actualizada proporcionada por <a href="mailto:emails@joseleon.me">Jose A. León Becerra</a>.</li>
             <li>Traducción al italiano actualizada proporcionada por Francesco Buratti.</li>
         </ul>
index 602f9fa05c09bbbccfacc02f9eef6b37eb688df3..8ce36216194f8ac0767a18e1af1b495752f0a3ce 100644 (file)
 
     <body>
         <h3>2.6 (código de versión 26)</h3>
-        <p>18 de septiembre de 2017 - API mínimo 19, API dirigido 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 de septiembre de 2017</a> - API mínimo 19, API dirigido 25</p>
         <ul>
-            <li>Añadir <a href="https:/ight /redmine.stoutner.com/issues/145">renderizado en modo nocturno</a>.</li>
-            <li>Actualizar el renderizado del tema oscuro de las<a href="https://redmine.stoutner.com/issues/150">secciones Acerca de y Guía</a></li>
-            <li>Añadir soporte para <a href="https://redmine.stoutner.com/issues/52">autenticación HTTP </a>.</li>
-            <li><a href="https://redmine.stoutner.com/issues/178">Colorear el Nombre Común</a>en el cuadro de diálogo Ver certificado SSL.</li>
+            <li>Añadir <a href="https://redmine.stoutner.com/issues/145">renderizado en modo nocturno</a>.</li>
+            <li>Actualizar el renderizado del tema oscuro de las <a href="https://redmine.stoutner.com/issues/150">secciones Acerca de y Guía</a>.</li>
+            <li>Añadir soporte para <a href="https://redmine.stoutner.com/issues/52">autenticación HTTP</a>.</li>
+            <li><a href="https://redmine.stoutner.com/issues/178">Colorear el Nombre Común</a> en el cuadro de diálogo Ver certificado SSL.</li>
             <li>Traducción al español actualizada proporcionada por <a href="mailto:emails@joseleon.me">Jose A. León Becerra</a>.</li>
             <li>Traducción al italiano actualizada proporcionada por Francesco Buratti.</li>
         </ul>
index 83e8411f8d271b780d96dbbedc93f4c0cdf61ad3..39e4cb89b722dce4feb19320ade96180d336b6a7 100644 (file)
@@ -27,7 +27,7 @@
 
     <body>
         <h3>2.6 (versione codice 26)</h3>
-        <p>18 Settembre 2017 - minima API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 Settembre 2017</a> - minima API 19, target API 25</p>
         <ul>
             <li>Aggiunta la <a href="https://redmine.stoutner.com/issues/145">Modalità Notte</a>.</li>
             <li>Aggiornamento dell'aspetto del tema “Dark” delle <a href="https://redmine.stoutner.com/issues/150">sezioni “Informazioni” e “Guida”</a>.</li>
index 74f53cbd96bacfbe5ac19079493feccb1a097fd7..39ad3d45d0704474862cd6a1d22878d7c1e32fbe 100644 (file)
@@ -27,7 +27,7 @@
 
     <body>
         <h3>2.6 (versione codice 26)</h3>
-        <p>18 Settembre 2017 - minima API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=ecd1f67963852c0523c42ce1326b78cb7a71f053">18 Settembre 2017</a> - minima API 19, target API 25</p>
         <ul>
             <li>Aggiunta la <a href="https://redmine.stoutner.com/issues/145">Modalità Notte</a>.</li>
             <li>Aggiornamento dell'aspetto del tema “Dark” delle <a href="https://redmine.stoutner.com/issues/150">sezioni “Informazioni” e “Guida”</a>.</li>
index cdd9049813c3bd9c6ec4665cc244057450b37e54..5e9d9fafe657201d25b3a9f663b82a541d389e02 100644 (file)
@@ -110,7 +110,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
         // Set the content view.
         setContentView(R.layout.bookmarks_coordinatorlayout);
 
-        // We need to use the `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21.
+        // 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);
 
@@ -281,45 +281,46 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
 
             @Override
             public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+                // Get the menu item ID.
                 int menuItemId = item.getItemId();
 
-                // `numberOfBookmarks` is used in `R.id.move_bookmark_up_enabled`, `R.id.move_bookmark_down_enabled`, and `R.id.context_menu_select_all_bookmarks`.
+                // Instantiate the common variables.
                 int numberOfBookmarks;
-
-                // `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`, `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:
-                        // Get the selected bookmark database ID.
-                        selectedBookmarkLongArray = bookmarksListView.getCheckedItemIds();
-                        selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
+                        // Get the array of checked bookmarks.
+                        bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
+
+                        // Store the position of the selected bookmark.
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
 
                         // Initialize `selectedBookmarkNewPosition`.
                         selectedBookmarkNewPosition = 0;
 
+                        // Iterate through the bookmarks.
                         for (int i = 0; i < bookmarksListView.getCount(); i++) {
-                            int databaseId = (int) bookmarksListView.getItemIdAtPosition(i);
-                            int nextBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i + 1);
-
-                            if (databaseId == selectedBookmarkDatabaseId || nextBookmarkDatabaseId == selectedBookmarkDatabaseId) {
-                                if (databaseId == selectedBookmarkDatabaseId) {
-                                    // Move the selected bookmark up one and store the new bookmark position.
-                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i - 1);
-                                    selectedBookmarkNewPosition = i - 1;
-                                } else {  // Move the bookmark above the selected bookmark down one.
-                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i + 1);
+                            // Get the database ID for the current bookmark.
+                            int currentBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i);
+
+                            // Update the display order for the current bookmark.
+                            if (i == selectedBookmarkPosition) {  // The current bookmark is the selected bookmark.
+                                // Move the current bookmark up one.
+                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i - 1);
+                                selectedBookmarkNewPosition = i - 1;
+                            } else if ((i + 1) == selectedBookmarkPosition){  // The current bookmark is immediately above the selected bookmark.
+                                // Move the current bookmark down one.
+                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i + 1);
+                            } else {  // The current bookmark is not changing positions.
+                                // Move `bookmarksCursor` to the current bookmark position.
+                                bookmarksCursor.moveToPosition(i);
+
+                                // Update the display order only if it is not correct in the database.
+                                if (bookmarksCursor.getInt(bookmarksCursor.getColumnIndex(BookmarksDatabaseHelper.DISPLAY_ORDER)) != i) {
+                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i);
                                 }
-                            } else {
-                                // Reset the rest of the bookmarks' DISPLAY_ORDER to match the position in the ListView.
-                                // This isn't necessary, but it clears out any stray values that might have crept into the database.
-                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i);
                             }
                         }
 
@@ -335,29 +336,36 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         break;
 
                     case R.id.move_bookmark_down:
-                        // Get the selected bookmark database ID.
-                        selectedBookmarkLongArray = bookmarksListView.getCheckedItemIds();
-                        selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
+                        // Get the array of checked bookmarks.
+                        bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
+
+                        // Store the position of the selected bookmark.
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
 
                         // Initialize `selectedBookmarkNewPosition`.
                         selectedBookmarkNewPosition = 0;
 
+                        // Iterate through the bookmarks.
                         for (int i = 0; i <bookmarksListView.getCount(); i++) {
-                            int databaseId = (int) bookmarksListView.getItemIdAtPosition(i);
-                            int previousBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i - 1);
-
-                            if (databaseId == selectedBookmarkDatabaseId || previousBookmarkDatabaseId == selectedBookmarkDatabaseId) {
-                                if (databaseId == selectedBookmarkDatabaseId) {
-                                    // Move the selected bookmark down one and store the new bookmark position.
-                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i + 1);
-                                    selectedBookmarkNewPosition = i + 1;
-                                } else {  // Move the bookmark below the selected bookmark up one.
-                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i - 1);
+                            // Get the database ID for the current bookmark.
+                            int currentBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i);
+
+                            // Update the display order for the current bookmark.
+                            if (i == selectedBookmarkPosition) {  // The current bookmark is the selected bookmark.
+                                // Move the current bookmark down one.
+                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i + 1);
+                                selectedBookmarkNewPosition = i + 1;
+                            } else if ((i - 1) == selectedBookmarkPosition) {  // The current bookmark is immediately below the selected bookmark.
+                                // Move the bookmark below the selected bookmark up one.
+                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i - 1);
+                            } else {  // The current bookmark is not changing positions.
+                                // Move `bookmarksCursor` to the current bookmark position.
+                                bookmarksCursor.moveToPosition(i);
+
+                                // Update the display order only if it is not correct in the database.
+                                if (bookmarksCursor.getInt(bookmarksCursor.getColumnIndex(BookmarksDatabaseHelper.DISPLAY_ORDER)) != i) {
+                                    bookmarksDatabaseHelper.updateBookmarkDisplayOrder(currentBookmarkDatabaseId, i);
                                 }
-                            } else {
-                                // Reset the rest of the bookmark' DISPLAY_ORDER to match the position in the ListView.
-                                // This isn't necessary, but it clears out any stray values that might have crept into the database.
-                                bookmarksDatabaseHelper.updateBookmarkDisplayOrder(databaseId, i);
                             }
                         }
 
@@ -381,13 +389,11 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         break;
 
                     case R.id.edit_bookmark:
-                        // Get a handle for `selectedBookmarkPosition` so we can scroll to it after refreshing the ListView.
+                        // Get the array of checked bookmarks.
                         bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
-                        for (int i = 0; i < bookmarkPositionSparseBooleanArray.size(); i++) {
-                            // Find the bookmark that is selected and save the position to `selectedBookmarkPosition`.
-                            if (bookmarkPositionSparseBooleanArray.valueAt(i))
-                                selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(i);
-                        }
+
+                        // Store the position of the selected bookmark.
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
 
                         // Move to the selected database ID and find out if it is a folder.
                         bookmarksCursor.moveToPosition(selectedBookmarkPosition);
@@ -414,20 +420,18 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         // 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.
+                        // Get the array of checked bookmarks.
                         bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
-                        for (int i = 0; i < bookmarkPositionSparseBooleanArray.size(); i++) {
-                            // Find the bookmark that is selected and save the position to `selectedBookmarkPosition`.
-                            if (bookmarkPositionSparseBooleanArray.valueAt(i))
-                                selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(i);
-                        }
+
+                        // Store the position of the first selected bookmark.
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
 
                         updateBookmarksListViewExcept(selectedBookmarksLongArray, currentFolder);
 
-                        // Scroll to where the deleted bookmark was located.
+                        // Scroll to where the first deleted bookmark was located.
                         bookmarksListView.setSelection(selectedBookmarkPosition - 5);
 
-                        // Initialize `snackbarMessage`.
+                        // Create `snackbarMessage`.
                         String snackbarMessage;
 
                         // Determine how many items are in the array and prepare an appropriate Snackbar message.
@@ -454,7 +458,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                                                 // Refresh the ListView to show the rows again.
                                                 updateBookmarksListView(currentFolder);
 
-                                                // Scroll to where the deleted bookmark was located.
+                                                // Scroll to where the first deleted bookmark was located.
                                                 bookmarksListView.setSelection(selectedBookmarkPosition - 5);
                                                 break;
 
index 8c9d3c23e4af49da04f6d169dc063b97298b6e5a..2e97f15783816157369a4e4c0c2e8969929dd7cd 100644 (file)
@@ -1,6 +1,6 @@
 • Añadir renderizado en modo nocturno.
-• Actualizar el renderizado del tema oscuro de lassecciones Acerca de y Guía
-• Añadir soporte para autenticación HTTP .
-• Colorear el Nombre Comúnen el cuadro de diálogo Ver certificado SSL.
+• Actualizar el renderizado del tema oscuro de las secciones Acerca de y Guía.
+• Añadir soporte para autenticación HTTP.
+• Colorear el Nombre Común en el cuadro de diálogo Ver certificado SSL.
 • Traducción al español actualizada proporcionada por Jose A. León Becerra.
 • Traducción al italiano actualizada proporcionada por Francesco Buratti.