From 3796951717d46bb64d403bfbe04b096b91b56c67 Mon Sep 17 00:00:00 2001 From: Lee Yul Date: Fri, 15 Apr 2022 15:48:49 +0900 Subject: [PATCH] app base --- .../com/example/togaether/CustomActivity.java | 1 + .../java/com/example/togaether/PuppyView.java | 12 +++++++++-- app/src/main/res/layout/puppy_view.xml | 21 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/togaether/CustomActivity.java b/app/src/main/java/com/example/togaether/CustomActivity.java index ba54066..68e90b0 100644 --- a/app/src/main/java/com/example/togaether/CustomActivity.java +++ b/app/src/main/java/com/example/togaether/CustomActivity.java @@ -21,6 +21,7 @@ protected void onCreate(Bundle savedInstanceState) { Glide.with(this).load(R.drawable.img_back_cus2).fitCenter().into(imgBack); PuppyView puppyView = new PuppyView(layBack, this); + puppyView.setColor(); imgBack.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override diff --git a/app/src/main/java/com/example/togaether/PuppyView.java b/app/src/main/java/com/example/togaether/PuppyView.java index 68b736f..a733fe7 100644 --- a/app/src/main/java/com/example/togaether/PuppyView.java +++ b/app/src/main/java/com/example/togaether/PuppyView.java @@ -17,7 +17,7 @@ public class PuppyView { LayoutInflater layoutInflater; AppCompatActivity act; View puppyView, puppy; - ImageView imgFace; + ImageView imgFace, imgBody, imgNose, imgMouth, imgEyeLeft, imgEyeRight, imgEarLeft, imgEarRight; int w, h; PuppyView(ViewGroup lay, AppCompatActivity act) { @@ -39,6 +39,13 @@ public void onGlobalLayout() { }); imgFace = (ImageView) puppyView.findViewById(R.id.img_face1); + imgBody = (ImageView) puppyView.findViewById(R.id.img_body); + imgMouth = (ImageView) puppyView.findViewById(R.id.img_mouth); + imgNose = (ImageView) puppyView.findViewById(R.id.img_nose); + imgEarLeft = (ImageView) puppyView.findViewById(R.id.img_ear_left); + imgEarRight = (ImageView) puppyView.findViewById(R.id.img_ear_right); + imgEyeLeft = (ImageView) puppyView.findViewById(R.id.img_eye_left); + imgEyeRight = (ImageView) puppyView.findViewById(R.id.img_eye_right); } public void setPosition(int x, int y) { puppy.setTranslationX((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, x, act.getResources().getDisplayMetrics()) - w/2); //puppy.findViewById(R.id.lay_puppy). @@ -49,6 +56,7 @@ public void setPositionPX(int x, int y) { puppy.setTranslationY(y - h/2); } public void setColor() { - imgFace.setColorFilter(Color.parseColor("#e28743"), PorterDuff.Mode.SRC_IN); + imgFace.setColorFilter(Color.parseColor("#e28743"), PorterDuff.Mode.MULTIPLY); + imgBody.setColorFilter(Color.parseColor("#e28743"), PorterDuff.Mode.MULTIPLY); } } diff --git a/app/src/main/res/layout/puppy_view.xml b/app/src/main/res/layout/puppy_view.xml index 8063b90..bc41352 100644 --- a/app/src/main/res/layout/puppy_view.xml +++ b/app/src/main/res/layout/puppy_view.xml @@ -60,4 +60,25 @@ app:srcCompat="@drawable/img_cus_eye_1" tools:ignore="MissingConstraints" tools:layout_editor_absoluteX="0dp" /> + + + + \ No newline at end of file