Skip to content

Commit

Permalink
[Feat] 특수문자 처리 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
kimdahyee committed Mar 30, 2021
1 parent 65d188f commit e10620f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package place.pic.data.remote.response

import android.os.Build
import android.text.Html
import androidx.annotation.RequiresApi
import place.pic.data.entity.PlaceGridItem

/**
Expand All @@ -14,10 +17,11 @@ data class PlaceGridItemResponse(
val likeCnt: Int,
val subwayName: List<String>
) {
@RequiresApi(Build.VERSION_CODES.N)
fun toPlaceGridItem() = PlaceGridItem(
imageUrl = placeImageUrl,
placeIdx = placeIdx,
placeName = placeName,
placeName = Html.fromHtml(placeName, Html.FROM_HTML_MODE_LEGACY).toString(),
likeCount = likeCnt,
subwayName = subwayName
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package place.pic.data.remote.response

import android.os.Build
import android.text.Html
import androidx.annotation.RequiresApi
import place.pic.data.entity.Place
import place.pic.data.entity.PlaceGridItem
import java.util.*
Expand Down Expand Up @@ -28,9 +31,10 @@ data class PlaceItemResponse(
val likeCnt: Int,
val commentCnt: Int
) {
@RequiresApi(Build.VERSION_CODES.N)
fun toPlace() = Place(
id = placeIdx,
name = placeName,
name = Html.fromHtml(placeName, Html.FROM_HTML_MODE_LEGACY).toString(),
imageUrl = imageUrl.getOrElse(0) { "" },
subways = subway.map { it.toSubway() },
keywordTags = tag.map { it.toKeywordTag() },
Expand All @@ -41,10 +45,11 @@ data class PlaceItemResponse(
commentCnt = commentCnt
)

@RequiresApi(Build.VERSION_CODES.N)
fun toPlaceGridItem() = PlaceGridItem(
imageUrl = imageUrl.getOrElse(0) { "" },
placeIdx = placeIdx,
placeName = placeName,
placeName = Html.fromHtml(placeName, Html.FROM_HTML_MODE_LEGACY).toString(),
likeCount = likeCount,
subwayName = subway.map { it.subwayName }
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package place.pic.ui.main.detail

import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.text.Html
import android.view.View
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.bumptech.glide.Glide
import com.naver.maps.geometry.LatLng
Expand Down Expand Up @@ -227,15 +230,16 @@ class DetailViewActivity : AppCompatActivity(), View.OnClickListener,OnMapReadyC
}

/*서버 연결시 뷰에 뿌려주는 함수 작업.*/
@RequiresApi(Build.VERSION_CODES.N)
private fun bindingDetail(detailResponse: DetailResponse) {
//본격 개막장 함수
insertUploadUserDataInView(detailResponse.uploader)
insertImageInViewPager(detailResponse.imageUrl)
insertKeywordInDetailChip(detailResponse.keyword)
insertDateTime(detailResponse.placeCreatedAt.toLong())
val title = detailResponse.placeName
tv_detail_title.text = title
tv_detail_top_title.text = title
tv_detail_title.text = Html.fromHtml(title, Html.FROM_HTML_MODE_LEGACY).toString()
tv_detail_top_title.text = Html.fromHtml(title, Html.FROM_HTML_MODE_LEGACY).toString()
tv_detail_content.text = detailResponse.placeReview
insertCategory(detailResponse.categoryIdx)
tv_detail_subway_info.text = detailStringForm(detailResponse.subway, "/")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package place.pic.ui.search.place

import android.graphics.Color
import android.os.Build
import android.text.Html
import android.view.View
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.graphics.createBitmap
import androidx.core.view.isVisible
Expand All @@ -22,8 +25,9 @@ class PlaceSearchViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
private val alreadyInView = itemView.findViewById<View>(R.id.view_already)
private val alreadyInText = itemView.findViewById<TextView>(R.id.tv_already)

@RequiresApi(Build.VERSION_CODES.N)
fun bind(placeSearchData : PlaceSearchData) {
placeName.text = placeSearchData.placeName
placeName.text = Html.fromHtml(placeSearchData.placeName, Html.FROM_HTML_MODE_LEGACY).toString()
placeLocation.text = placeSearchData.placeLocation

if (placeSearchData.alreadyIn) { // 이미 등록된 view
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/place/pic/ui/upload/UploadPlaceViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package place.pic.ui.upload

import android.content.Context
import android.content.Intent
import android.os.Build
import android.text.Html
import androidx.annotation.RequiresApi
import androidx.annotation.StringRes
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_upload_place.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools">

<data>

<import type="android.text.Html" />
<import type="android.view.View" />

<variable
Expand Down Expand Up @@ -96,7 +96,7 @@
android:layout_marginTop="16dp"
android:fontFamily="@font/noto_sans_bold"
android:gravity="top"
android:text="@{viewModel.placeTitle}"
android:text="@{Html.fromHtml(viewModel.placeTitle, Html.FROM_HTML_MODE_LEGACY).toString()}"
android:textColor="@color/black36"
android:textSize="22dp"
android:textStyle="bold"
Expand Down

0 comments on commit e10620f

Please sign in to comment.