Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

public class ColorControllerFragment extends DialogFragment {
public FloatingButton floatingActionButton;
Integer color = -1111111;
ImageView rgbWheel;
Button confirmColorButton;
private int _color = -1111111;
private ImageView _rgbWheel;
private Button _confirmColorButton;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -43,35 +43,35 @@ public void onResume() {
}

void configureLayout(View v) {
rgbWheel = v.findViewById(R.id.rgbWheel);
confirmColorButton = v.findViewById(R.id.confirmColorBtn);
_rgbWheel = v.findViewById(R.id.rgbWheel);
_confirmColorButton = v.findViewById(R.id.confirmColorBtn);

rgbWheel.setDrawingCacheEnabled(true);
rgbWheel.buildDrawingCache(true);
rgbWheel.setOnTouchListener(new View.OnTouchListener() {
_rgbWheel.setDrawingCacheEnabled(true);
_rgbWheel.buildDrawingCache(true);
_rgbWheel.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Bitmap bitmap;
if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
bitmap = rgbWheel.getDrawingCache();
bitmap = _rgbWheel.getDrawingCache();

int pixel = bitmap.getPixel((int)event.getX(), (int)event.getY());

int r = Color.red(pixel);
int g = Color.green(pixel);
int b = Color.blue(pixel);

color = Color.rgb(r, g ,b);
confirmColorButton.setBackgroundColor(color);
_color = Color.rgb(r, g ,b);
_confirmColorButton.setBackgroundColor(_color);
}
return true;
}
});

confirmColorButton.setOnClickListener(new View.OnClickListener() {
_confirmColorButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
floatingActionButton.setColor(color);
floatingActionButton.setColor(_color);
dismiss();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class FloatingButton extends FloatingActionButton {
// purple 500
public int _defaultColor = Color.rgb(156, 39, 176);
private int _defaultColor = Color.rgb(156, 39, 176);

public FloatingButton(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Expand Down