summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-12-12 11:45:05 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2019-12-12 14:30:57 +0100
commit64bf055db690a4475cf49dc03800619674b891c2 (patch)
treef23228d5112e1d3764c79bae6f25950a9210880f /android
parent3bf7a861b37a93e196b2e53eeaa5a561d26ed240 (diff)
tdf#115698 android: Don't modify doc on color palette initialization
Previously, the call to 'ColorPaletteAdapter::setColorPalette' from the 'ColorPickerAdapter' constructur (via 'initializeColorPalette') would not just set the color palette, but also apply the color at index (0, 0) to the current selection, since 'ColorPaleteAdapter::setPosition' calls 'colorPaletteListener.applyColor' after setting the position. This is an undesirable side effect, and led to the situation described in tdf#115698 that cell A1 would always get black background when opening a spreadsheet in the Android viewer, since black is the color at 'color_palette[0][0]' by default and cell A1 is explicitly selected when Calc first opens, s. the 'CalcHeadersController' constructor. For Writer, something similar could be reproduced by selecting a word in a document using long-tap. If experimental editing mode was enabled, that word got black background (other words selected later didn't). To avoid this, make 'ColorPaletteAdapter::setColorPalette' just set the color palette and set back the values that indicate what is selected but don't apply any color. (And make 'setColorPalette' just take the palette as parameter, and set 0 for both start values, as the only caller was doing as well). Change-Id: I0fa720ac6550102701a2c82905c9720aab6daab2 Reviewed-on: https://gerrit.libreoffice.org/85044 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android')
-rw-r--r--android/source/src/java/org/libreoffice/ColorPaletteAdapter.java5
-rw-r--r--android/source/src/java/org/libreoffice/ColorPickerAdapter.java2
2 files changed, 4 insertions, 3 deletions
diff --git a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
index a6d250f6380d..6ec6aa138f66 100644
--- a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
+++ b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
@@ -100,9 +100,10 @@ public class ColorPaletteAdapter extends RecyclerView.Adapter<ColorPaletteAdapte
}
- public void setColorPalette(int[][] color_palette, int position1, int position2) {
+ public void setColorPalette(int[][] color_palette) {
this.color_palette = color_palette;
- setPosition(position1, position2);
+ this.upperSelectedBox = 0;
+ this.selectedBox = 0;
}
private void updateAdapter(){
diff --git a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
index 092de46caec4..c93d5a01bbb4 100644
--- a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
+++ b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
@@ -115,7 +115,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
for (int i = 0; i < 11; i++){
this.colorPalette[i][7] = (Color.rgb(255, 255, 255)); // last one is always white
}
- colorPaletteAdapter.setColorPalette(colorPalette, 0, 0);
+ colorPaletteAdapter.setColorPalette(colorPalette);
}
public void findSelectedTextColor(int color) {