From b783a97c1dd342cea2f2faeb3aa51efd86a3c380 Mon Sep 17 00:00:00 2001 From: kimsubeen Date: Wed, 6 Jul 2022 17:08:45 +0900 Subject: [PATCH] =?UTF-8?q?[feature/#4]=20icon=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teampome/pome/FriendPageIconFactory.kt | 26 +++++++++ .../java/com/teampome/pome/MainActivity.kt | 25 ++++++++- app/src/main/res/layout/activity_main.xml | 56 ++++++++++++++++--- 3 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 app/src/main/java/com/teampome/pome/FriendPageIconFactory.kt diff --git a/app/src/main/java/com/teampome/pome/FriendPageIconFactory.kt b/app/src/main/java/com/teampome/pome/FriendPageIconFactory.kt new file mode 100644 index 00000000..79b383d5 --- /dev/null +++ b/app/src/main/java/com/teampome/pome/FriendPageIconFactory.kt @@ -0,0 +1,26 @@ +package com.teampome.pome + +import android.content.Context +import androidx.lifecycle.LifecycleOwner +import com.skydoves.balloon.ArrowOrientation +import com.skydoves.balloon.Balloon +import com.skydoves.balloon.BalloonAnimation + +class FriendPageIconFactory : Balloon.Factory() { + override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon { + return Balloon.Builder(context) + .setWidthRatio(0.8f) + .setHeight(50) + .setWidth(400) + .setIsVisibleArrow(false) + .setArrowOrientation(ArrowOrientation.LEFT) + .setCornerRadius(8f) + .setAlpha(0.9f) + .setTextIsHtml(true) + .setLayout(R.layout.item_icon_list) + .setBackgroundColorResource(R.color.white) + .setBalloonAnimation(BalloonAnimation.CIRCULAR) + .setLifecycleOwner(lifecycle) + .build() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/teampome/pome/MainActivity.kt b/app/src/main/java/com/teampome/pome/MainActivity.kt index c1489b52..de0ce054 100644 --- a/app/src/main/java/com/teampome/pome/MainActivity.kt +++ b/app/src/main/java/com/teampome/pome/MainActivity.kt @@ -2,12 +2,33 @@ package com.teampome.pome import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.widget.ImageView +import com.skydoves.balloon.* +import com.teampome.pome.databinding.ActivityMainBinding import timber.log.Timber class MainActivity : AppCompatActivity() { + private lateinit var binding: ActivityMainBinding + private val iconBalloon by balloon() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) Timber.d("example") + iconClickEvent() + + } + + private fun iconClickEvent() { + binding.ivIcon.setOnClickListener { + iconBalloon.showAlignBottom(it) + } + val button: ImageView = + iconBalloon.getContentView().findViewById(R.id.iv_first) + button.setOnClickListener { + binding.ivIcon.setImageResource(R.drawable.ic_what_mint) + iconBalloon.dismiss() + } + } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4fc24441..a14fe3df 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,13 +6,55 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - + android:layout_marginHorizontal="20dp" + android:layout_marginTop="30dp" + android:background="@drawable/background" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + + \ No newline at end of file