Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/#4] 이모지 추가 기능 연습 #5

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
dataBinding true
}
}

dependencies {
Expand Down Expand Up @@ -79,4 +83,7 @@ dependencies {

// Timber
implementation 'com.jakewharton.timber:timber:5.0.1'

//balloon message
implementation "com.github.skydoves:balloon:1.3.6"
}
26 changes: 26 additions & 0 deletions app/src/main/java/com/teampome/pome/FriendPageIconFactory.kt
Original file line number Diff line number Diff line change
@@ -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()
}
}
25 changes: 23 additions & 2 deletions app/src/main/java/com/teampome/pome/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<FriendPageIconFactory>()
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()
}

}
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<padding android:bottom="15dp" android:left="20dp" android:right="20dp" android:top="15dp"/>
<stroke
android:color="@color/black"
android:width="1dp"/>
<corners android:radius="10dp"/>
</shape>
Binary file added app/src/main/res/drawable/ic_what_mint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/iconbackground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<padding android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp"/>
<stroke
android:color="@color/white"
android:width="1dp"/>
<corners android:radius="150dp"/>
</shape>
56 changes: 49 additions & 7 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,55 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_marginHorizontal="20dp"
android:layout_marginTop="30dp"
android:background="@drawable/background"
app:layout_constraintTop_toTopOf="parent">


<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="이름"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="50,000원"
android:textSize="20sp"
android:layout_marginTop="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_name"
/>

<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="출근길에는 커피가 필수지"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_price"
android:layout_marginTop="15dp"
/>
<ImageView
android:id="@+id/iv_icon"
android:layout_width="30dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1"
android:src="@drawable/ic_launcher_background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_content"
android:layout_marginTop="15dp"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
49 changes: 49 additions & 0 deletions app/src/main/res/layout/item_icon_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<LinearLayout
android:layout_marginTop="5dp"
android:id="@id/layout"
android:layout_width="200dp"
android:layout_height="0dp"
android:background="@color/white"
android:layout_marginBottom="15dp"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/iv_first"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:src="@drawable/ic_what_mint"
app:layout_constraintDimensionRatio="1" />

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:src="@drawable/ic_what_mint"
app:layout_constraintDimensionRatio="1" />

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:src="@drawable/ic_what_mint"
app:layout_constraintDimensionRatio="1" />

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:src="@drawable/ic_what_mint"
app:layout_constraintDimensionRatio="1" />

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>