[Libreoffice-commits] core.git: android/source

Christian Lohmaier lohmaier+LibreOffice at googlemail.com
Mon Aug 28 17:18:55 UTC 2017


 android/source/src/java/org/libreoffice/ColorPaletteAdapter.java |    4 ++--
 android/source/src/java/org/libreoffice/ColorPickerAdapter.java  |    8 +++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 16be82790aa2b55efbf5788260c88c373402bafb
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Mon Aug 28 19:13:17 2017 +0200

    android: position in RecyclerView must not be treated as fixed
    
    Change-Id: Id7f88b2b1b9913a006b0b73ceb4421b47fccc495

diff --git a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
index d126ef1ed1a5..e5e078934c71 100644
--- a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
+++ b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java
@@ -38,7 +38,7 @@ public class ColorPaletteAdapter extends RecyclerView.Adapter<ColorPaletteAdapte
     }
 
     @Override
-    public void onBindViewHolder(final ColorPaletteViewHolder holder, final int position) {
+    public void onBindViewHolder(final ColorPaletteViewHolder holder, int position) {
 
         holder.colorBox.setBackgroundColor(color_palette[upperSelectedBox][position]);
         if (selectedBox == position) {
@@ -50,7 +50,7 @@ public class ColorPaletteAdapter extends RecyclerView.Adapter<ColorPaletteAdapte
         holder.colorBox.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                setPosition(position);
+                setPosition(holder.getAdapterPosition());
             }
         });
         if (animate) //it will only animate when the upper color box is selected
diff --git a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
index 897084c9e607..8c5f2744bcfe 100644
--- a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
+++ b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java
@@ -39,7 +39,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
     }
 
     @Override
-    public void onBindViewHolder(final ColorPickerViewHolder holder, final int position) {
+    public void onBindViewHolder(final ColorPickerViewHolder holder, int position) {
         holder.colorBox.setBackgroundColor(colorList[position]);
 
         if (selectedBox != position)
@@ -51,12 +51,10 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
         holder.colorBox.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                setPosition(position);
-                colorPaletteListener.applyColor(colorList[position]);
+                setPosition(holder.getAdapterPosition());
+                colorPaletteListener.applyColor(colorList[holder.getAdapterPosition()]);
             }
         });
-
-
     }
 
     @Override


More information about the Libreoffice-commits mailing list