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