Skip to content

기능추가 : 롱클릭 링크 공유, 좋아요(즐겨찾기)#22

Open
Onedelay wants to merge 4 commits into
boostcampth:masterfrom
Onedelay:master
Open

기능추가 : 롱클릭 링크 공유, 좋아요(즐겨찾기)#22
Onedelay wants to merge 4 commits into
boostcampth:masterfrom
Onedelay:master

Conversation

@Onedelay

Copy link
Copy Markdown

개요

  • 아이템 롱클릭 시 공유 기능
  • 영화 좋아요 기능(즐겨찾기)

작업사항

  • 리사이클러뷰 아이템 레이아웃 변경(linear -> constraint)
  • Room DB 추가
    • FavoriteEntity - primary key는 titledirector
  • AsyncTask
    • Room 쿼리 작업을 위한 AsyncTask
    • 즐겨찾기 된 영화를 DB와 비교하기 위한 AsyncTask
  • 즐겨찾기 목록은 옵션메뉴의 ★을 클릭하여 화면 전환
    gif1

}
}
}
return instance;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단 한개의 Instance만 생성되는 것을 보장하기 위해 getInstance 함수가 thread safe하도록 구현된 것으로 확인됩니다.

getInstance 함수 앞에 단순히 synchronized를 붙이는 방법이 존재하지만, 해당 방법은
Multi Thread 환경에서 성능 이슈가 발생될 수 있는 방법입니다.

그렇기에, 현재 코드에서는 성능 이슈가 발생되는 것을 고려하여
DCL(Double Checking Locking) 방법을 사용한 것으로 확인됩니다. 👍

다만, private static AppDatabase instance; 코드에서 volatile 키워드가 누락되어 있으니, 확인 부탁드립니다.

void setAdapterView(AdapterContract.View adapterView);
void setAdapterModel(AdapterContract.Model<FavoriteEntity> adapterModel);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 이러한 제한때문에 불필요한 코드가 많이 들어간다고 느꼈습니다.
최소한의 규칙을 유지하면서 유연한 구조를 가지려면 고민이 많이 필요할 것 같습니다..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants