본문 바로가기
[Effective Java] toString 메소드는 항상 오버라이드 하자. [Effective Java] toString 메소드는 항상 오버라이드 하자. - 일반적인 toString() 메소드는 "ClassName@HashCode" 와 같은 형식으로 표시된다. - toString 의 보편적 계약은 간결해야 하지만 사람이 읽기 쉬운 형태의 정보 표현이어야 한다 - 가능하다면 toString 메소드에서는 객체의 모든 중요한 정보를 반환해야 한다. - toString 에서 출력하는 문자열이 한 눈에 무엇인지 파악하기 어렵다면, 문서화를 정확히 해야 한다. className, default, Effective JAVA, hashcode, human readable, override, toString, [Effective Java] toString 메소드는 항상 오버라이드 하자., 간결.. 2016. 10. 7.
[Effective Java] equals 메소드를 오버라이드 할 때는 hashCode 메소드도 항상 같이 오버라이드 하자. equals 메소드를 오버라이드 할 때는 hashCode 메소드도 항상 같이 오버라이드 하자. - equals 메소드를 오버라이드 하는 모든 클래스에서는 반드시 hashCode 메소드도 오버라이드 해야 한다. 그렇게 하지 않으면 Object.hashCode 메소드의 보편적 계약을 위반하게 되어, HashMap 과 HashSet 및 HashTable 을 포함하는 모든 hash 기반 컬렉션들에서 제대로 작동 안 할 수 있다. - HashCode 의 메소드 명세 계약 사항은 아래와 같다. 1. equals 메소드에서 비교하는 객체의 값이 변경되지 않는다면, 여러번 호출해도 일관성 있는 정수를 반환해야 한다. ( 단 어플리케이션이 재실행 될 때까지 같을 필요는 없다. ) 2. equals 메소드 호출 결과 두 .. 2016. 10. 5.
[android] PageTransformer 와 함께 하는 ViewPager 의 화려한 animation [android] PageTransformer 와 함께 하는 ViewPager 의 화려한 animation 참조 : https://medium.com/@BashaChris/the-android-viewpager-has-become-a-fairly-popular-component-among-android-apps-its-simple-6bca403b16d4 -ViewPager.PageTransformater interface 를 구현하면 매번 screen transition 이 발생할 때마다 tansformPage() 함수가 불린다. -position 값은 screen 의 center 로 부터 해당 page 가 어디에 위치하느냐를 나타낸다.page 가 screen 전체를 가득 채웠을 때에는 0 값을 가진다... 2016. 10. 4.
[python3] 뇌를 자극하는 파이썬 - 코딩을 배우기 전에 읽는 컴퓨터 구조론 [python3] 뇌를 자극하는 파이썬 - 코딩을 배우기 전에 읽는 컴퓨터 구조론 -책을 읽으며 Remind 하는 내용, 핵심 내용, 모르던 내용을 정리한 것입니다. 예문 및 자세한 설명은 책을 구매하여 보세요~ 2.1. 폰 노이만 구조 -최초 컴퓨터는 애니악(ENIAC, Electronic Numerical Integrator and Computer) 였는데, 애니악은 명령어를 기억하고 있지 않기 때문에 프로그램을 변경할 때마다 수많은 케이블을 뽑아 다른 위치에 꽂고 스위치를 내리고 올리는 작업을 해야 했다. 그래서 폰 노이만은 에드박(EDVAC, Electronic Discrete Variable Automatic Computer) 를 개발했다.에드박은 명령어를 기억 장치에 내장하고 있기 때문에 프로.. 2016. 9. 27.
[android] RecyclerView 에 대한 맛보기 이야기 [android] RecyclerView 에 대한 맛보기 이야기 참조 : https://www.bignerdranch.com/blog/recyclerview-part-1-fundamentals-for-listview-experts/ -RecyclerView 는 ListView 에 대비하여 다음과 같은 일들을 하지 않는다. 1. List Item 들을 화면에 배치하지 않는다. -> LayoutManager 가 이 일을 맡아서 한다.2. View 들의 animation 을 관장하지 않는다. -> ItemAnimator 가 이 일을 맡아서 한다.3. Scrolling 외의 touch event 를 관장하지 않는다. -RecyclerView 는 가급적 listview 본연의 일에만 집중하고 view, anima.. 2016. 9. 23.
[android] button 에 shake anim 효과 주기 [android] button 에 shake anim 효과 주기 참조 : http://frogermcs.github.io/InstaMaterial-concept-part-3-feed-and-comments-buttons/ CycleInterpolator 는 api level 1 부터 있던 녀석.정해진 숫자의 cycle 로 animation 을 반복한다.변경은 사인 곡선을 따른다. btn.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake_anim)); Android, anim, animation, animationutils, api level, Button, cycleinterpolator, cycles.. 2016. 9. 22.
[iOS] keyboard type 바꾸기 [iOS] keyboard type 바꾸기 -UIKeyboardType enum 으로 다음과 같은 것들이 정의된다. typedef NS_ENUM(NSInteger, UIKeyboardType) { UIKeyboardTypeDefault, UIKeyboardTypeASCIICapable, UIKeyboardTypeNumbersAndPunctuation, UIKeyboardTypeURL, UIKeyboardTypeNumberPad, UIKeyboardTypePhonePad, UIKeyboardTypeNamePhonePad, UIKeyboardTypeEmailAddress, UIKeyboardTypeDecimalPad NS_ENUM_AVAILABLE_IOS(4_1), UIKeyboardTypeTwitter N.. 2016. 9. 19.
[android] Render thread & Ripple ( Ripple 흉내내기 ) [android] Render thread & Ripple ( Ripple 흉내내기 ) 참조 : http://frogermcs.github.io/InstaMaterial-concept-part-3-feed-and-comments-buttons/ -Animation 등이 조금 더 general 하게 발전하면서, 모든 View operation 을 UI Thread ( Main Thread ) 에서만 처리하던 것이 문제가 되고 있다. 그래서 롤리팝에서부터는 Render thread 라는 게 생겨나서 rendering 과 main thread 가 분리되었다.Main thread 에서 atomic animation 을 만들어서 render thread 로 넘긴다.그래서 Rendering thread 에서 ani.. 2016. 9. 8.
[android] ViewAnimator 뭐하는 녀석이야? [android] ViewAnimator 뭐하는 녀석이야? - ViewAnimator 는 FrameLayout 을 상속한 녀석으로 view 간의 switching 이 있을 때 animation 을 하는 녀석. -ViewAnimator 안에 view 들을 넣고, viewAnimator.showPrevious() 나 viewAnimator.showNext() 를 호출하면, child view 들이 순차적으로 animation 하며 나타났다 사라졌다 한다. -index 를 통해서도 view 의 visibility 를 control 할 수 있다.viewAnimator.setDisplayChild( int index ) -animation 은 setInAnimation() 과 setOutAnimation() 을 .. 2016. 9. 5.
반응형