mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
ZLAndroidColorUtil is used for more color conversion consistency
This commit is contained in:
parent
dea91bb536
commit
e098f87b15
2 changed files with 14 additions and 11 deletions
|
@ -22,11 +22,14 @@ package org.geometerplus.zlibrary.ui.android.dialogs;
|
|||
import android.content.Context;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import android.graphics.Color;
|
||||
|
||||
import org.geometerplus.zlibrary.core.util.ZLColor;
|
||||
import org.geometerplus.zlibrary.core.dialogs.ZLColorOptionEntry;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.util.ZLAndroidColorUtil;
|
||||
|
||||
class ZLAndroidColorOptionView extends ZLAndroidOptionView {
|
||||
private View myContainer;
|
||||
private ComponentView myRedView;
|
||||
|
@ -179,7 +182,7 @@ class ZLAndroidColorOptionView extends ZLAndroidOptionView {
|
|||
myColorArea = new View(context);
|
||||
layout.setPadding(20, 0, 20, 0);
|
||||
myColorArea.setMinimumHeight(60);
|
||||
myColorArea.setBackgroundColor(0xFF000000 + (color.Red << 16) + (color.Green << 8) + color.Blue);
|
||||
myColorArea.setBackgroundColor(ZLAndroidColorUtil.rgb(color));
|
||||
layout.addView(myColorArea, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT));
|
||||
|
||||
myContainer = layout;
|
||||
|
@ -190,12 +193,11 @@ class ZLAndroidColorOptionView extends ZLAndroidOptionView {
|
|||
|
||||
private void updateColorArea() {
|
||||
if (myColorArea != null) {
|
||||
myColorArea.setBackgroundColor(
|
||||
0xFF000000 |
|
||||
(myRedView.getComponentValue() << 16) |
|
||||
(myGreenView.getComponentValue() << 8) |
|
||||
myColorArea.setBackgroundColor(Color.rgb(
|
||||
myRedView.getComponentValue(),
|
||||
myGreenView.getComponentValue(),
|
||||
myBlueView.getComponentValue()
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +213,7 @@ class ZLAndroidColorOptionView extends ZLAndroidOptionView {
|
|||
myRedView.setComponentValue(color.Red);
|
||||
myGreenView.setComponentValue(color.Green);
|
||||
myBlueView.setComponentValue(color.Blue);
|
||||
myColorArea.setBackgroundColor(0xFF000000 + (color.Red << 16) + (color.Green << 8) + color.Blue);
|
||||
myColorArea.setBackgroundColor(ZLAndroidColorUtil.rgb(color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.geometerplus.zlibrary.core.util.ZLColor;
|
|||
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
|
||||
import org.geometerplus.zlibrary.ui.android.util.ZLAndroidColorUtil;
|
||||
|
||||
public final class ZLAndroidPaintContext extends ZLPaintContext {
|
||||
private Canvas myCanvas;
|
||||
|
@ -82,7 +83,7 @@ public final class ZLAndroidPaintContext extends ZLPaintContext {
|
|||
}
|
||||
|
||||
public void clear(ZLColor color) {
|
||||
myFillPaint.setColor(Color.rgb(color.Red, color.Green, color.Blue));
|
||||
myFillPaint.setColor(ZLAndroidColorUtil.rgb(color));
|
||||
myCanvas.drawRect(0, 0, myWidth + myScrollbarWidth, myHeight, myFillPaint);
|
||||
}
|
||||
|
||||
|
@ -137,17 +138,17 @@ public final class ZLAndroidPaintContext extends ZLPaintContext {
|
|||
}
|
||||
|
||||
public void setTextColor(ZLColor color) {
|
||||
myTextPaint.setColor(Color.rgb(color.Red, color.Green, color.Blue));
|
||||
myTextPaint.setColor(ZLAndroidColorUtil.rgb(color));
|
||||
}
|
||||
|
||||
public void setLineColor(ZLColor color, int style) {
|
||||
// TODO: use style
|
||||
myLinePaint.setColor(Color.rgb(color.Red, color.Green, color.Blue));
|
||||
myLinePaint.setColor(ZLAndroidColorUtil.rgb(color));
|
||||
}
|
||||
|
||||
public void setFillColor(ZLColor color, int style) {
|
||||
// TODO: use style
|
||||
myFillPaint.setColor(Color.rgb(color.Red, color.Green, color.Blue));
|
||||
myFillPaint.setColor(ZLAndroidColorUtil.rgb(color));
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue