- 부모뷰가 자식 뷰의 터치이벤트를 가로채지 못하게 하는 함수 (requestDisallowInterceptTouchEvent)
(리사이클러뷰안에 웹뷰의 줌 이벤트가 있는 경우 리사이클러뷰의 스크롤 이벤트가 줌 터치이벤트를 가로채는 경우가 있어서 사용함)
requestDisallowInterceptTouchEvent(true)
//true: 부모뷰가 터치이벤트 가로채지 못함
//false: 부모뷰가 터치이벤트 가로챌 수 있음
- 부모뷰가 자식 뷰의 터치이벤트를 가로채지 못하게 하는 함수 (requestDisallowInterceptTouchEvent)
(리사이클러뷰안에 웹뷰의 줌 이벤트가 있는 경우 리사이클러뷰의 스크롤 이벤트가 줌 터치이벤트를 가로채는 경우가 있어서 사용함)
requestDisallowInterceptTouchEvent(true)
//true: 부모뷰가 터치이벤트 가로채지 못함
//false: 부모뷰가 터치이벤트 가로챌 수 있음
EditText에 실시간으로 입력된 값에따라 특정 이벤트를 발생시키거나 뷰를 보이게해야 할 때가 있다. 그런경우 TextWatcher라는 Interface를 사용하여 EditText에 실시간으로 입력된 값을 받아 올 수 있다.
editText.addTextChangedListener(object : TextWatcher {
override fun **afterTextChanged**(s: Editable?) {
// text가 변경된 후 호출
// s에는 변경 후의 문자열이 담겨 있다.
}
override fun **beforeTextChanged**(s: CharSequence?, start: Int, count: Int, after: Int) {
// text가 변경되기 전 호출
// s에는 변경 전 문자열이 담겨 있다.
}
override fun **onTextChanged**(s: CharSequence?, start: Int, before: Int, count: Int) {
// text가 바뀔 때마다 호출된다.
checkEmail()
}
})
afterTextChanged(s : Editable?) {}
beforeTextChanged(s : CharSequence?, start: Int, count: Int, after: Int )
onTextChanged(s : CharSequence?, start: Int, before: Int, count: Int)
[Android][XML]ConstraintLayout ChainStyle 정리 (0) | 2025.05.28 |
---|---|
[Android][XML][EditText] 페이지 진입 시 키보드가 자동으로 올라오는 문제 (0) | 2025.05.28 |
[Android][Kotlin][EditText] 커서를 맨 끝으로 이동 (setSelection) (0) | 2025.05.28 |
[Android][XML][EditText] EditText에 입력된 Text값에 따라 실시간으로 관찰(TextWatcher) (0) | 2025.05.28 |
'com.google.android.exoplayer:exoplayer:2.8.4’에서 2.9.1로 업데이트를 하려고 했으나 찾아보니
exoplayer는 더이상 업데이트 되지않고 deprecated됐다.
공식적으로 media3를 권장하고 있다.
Deprecated | Changed | |
SimpleExoPlayer | ExoPlayer | |
Player.EventListener | Player.Listener | |
override fun onTimelineChanged(timeline: Timeline?, manifest: Any?, reason: Int) | override fun onTimelineChanged(timeline: Timeline, reason: Int) | |
override fun onTracksChanged( trackGroups: TrackGroupArray?, trackSelections: TrackSelectionArray?) |
override fun onTracksChanged(tracks: Tracks) | |
override fun onLoadingChanged(isLoading: Boolean) | override fun onIsLoadingChanged(isLoading: Boolean) | |
override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) | override fun onPlaybackStateChanged(playbackState: Int) //재생상태 변화 감지 onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) //재생 준비 상태 감지 |
두개로 분리 |
override fun onPlayerError(error: ExoPlaybackException?) | override fun onPlayerError(error: PlaybackException) | |
override fun onPositionDiscontinuity(reason: Int) | override fun onPositionDiscontinuity( oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int) |
|
override fun onSeekProcessed() | onSeekStarted onSeekCompleted |
onSeekProcessed에서 onSeekStarted onSeekCompleted 두 상태로 변경 |
DefaultBandwidthMeter | DefaultBandwidthMeter.Builder(exoPlayerView.context).build() 또는 BandwidthMeter |
TrackSelector에서 자동으로 측정하는 방식으로 변경되어 설정할 필요 없음 |
val videoTrackSelectionFactory = AdaptiveTrackSelection.Factory(bandwidthMeter) val trackSelector = DefaultTrackSelector(videoTrackSelectionFactory) |
val trackSelector = DefaultTrackSelector(exoPlayerView.context) | AdaptiveTrackSelection 제거 DefaultTrackSelector로 통합 |
ExoPlayerFactory.newSimpleInstance(exoPlayerView.context, trackSelector) | ExoPlayer.Builder(context).setTrackSelector(trackSelector).build() | newSimpleInstance 제거 |
val bandwidthMeter = DefaultBandwidthMeter() defaultDatasourceFactory = DefaultDataSourceFactory (context, bandwidthMeter, DefaultHttpDataSourceFactory(userAgent, bandwidthMeter)) |
val defaultHttpDataSourceFactory = DefaultHttpDataSource.Factory().setUserAgent(userAgent)defaultDatasourceFactory = DefaultDataSource.Factory(context, defaultHttpDataSourceFactory) | DefaultDataSourceFactory → DefaultHttpDataSource + DefaultDataSource.Factory |
prepare(mediaSource) | setMediaSource(mediaSource) | |
SimpleExoPlayer.VideoListener | ExoPlayer.Listener | |
addVideoListener | addListener | |
override fun onVideoSizeChanged( width: Int, height: Int, unappliedRotationDegrees: Int, pixelWidthHeightRatio: Float) |
override fun onVideoSizeChanged(videoSize: VideoSize) | videoSize.width videoSize.height 등으로 사용 변경 |
ExtractorMediaSource.Factory(DefaultHttpDataSourceFactory(userAgent)) .createMediaSource(uri) | ProgressiveMediaSource.Factory(dataSourceFactory) .createMediaSource(MediaItem.fromUri(uri)) |
|
setControllerVisibilityListener { visibility -> | exoPlayerView.setControllerVisibilityListener(object : PlayerView.ControllerVisibilityListener { override fun onVisibilityChanged(visibility: Int) | override fun onVisibilityChanged 추가 |
//변경 예시
private MediaSource buildMediaSource(Uri uri) {
String userAgent = Util.getUserAgent(context, "userAgent");
DefaultHttpDataSource.Factory dataSourceFactory = new DefaultHttpDataSource.Factory().setUserAgent(userAgent);
// Uri를 MediaItem으로 변환
MediaItem mediaItem = new MediaItem.Builder().setUri(uri).build();
if (uri.getLastPathSegment().contains("mp3") || uri.getLastPathSegment().contains("mp4")) {
return new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem);
} else if (uri.getLastPathSegment().contains("m3u8")) {
return new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem);
} else {
return new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem);
}
}
Exo Controller 내부 Id
[Android][Kotlin][유효성 검사] 정규 표현식 (0) | 2025.05.28 |
---|---|
[Android]화면 절전모드 On,Off (0) | 2025.05.19 |
[Android][Kotlin]이메일 유효성 검사 (0) | 2025.05.19 |
[Android][Kotlin]Bitmap (0) | 2025.04.30 |
[Android][Kotlin]Array와 ArrayList 차이 (0) | 2025.04.30 |
- 현재 연결된 git주소 확인
git remote -v
- 기존 연결을 끊고 새로운 git주소 추가
git remote remove origin
git remote add origin https://gitUrl.git
- 프로젝트 폴더에 깃 생성
git init
- 변경된 모든 소스 추가
git add.
- Commit 하기 (로컬 저장소에 저장)
git commit -m '커밋 메세지'
- Push하기 (원격 저장소에 저장)
git push 원격 저장소명 브랜치 이름
ex) git push origin(원격 저장소 명) main(브랜치 이름)
- Commit 취소
git reset --soft HEAD^
commit된 파일 전부 최소 후 stage된 상태로 working directory에 저장
git reset HEAD~2
가장 최근에 올라간 commit파일 2개만 취소
- Commit된 메세지 수정
git commit --amend -m "수정할 메세지 내용"
- AndroidStudio에 연동된 Github e-mail, name확인 하기
git config user.name
git config user.email
- AndroidStudio에 연동된 Github e-mail, name 변경하기
git config --global credential.username "변경할 이름 입력"
git config --global credential.useremail "변경할 이메일 입력"
[Android][Git] Git 용어 정리 (0) | 2025.05.30 |
---|