<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cheoldong Choi on Medium]]></title>
        <description><![CDATA[Stories by Cheoldong Choi on Medium]]></description>
        <link>https://medium.com/@cheoldongchoi?source=rss-1708e1779c0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*V90yCtgrl0rBw5N6.</url>
            <title>Stories by Cheoldong Choi on Medium</title>
            <link>https://medium.com/@cheoldongchoi?source=rss-1708e1779c0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 13:12:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cheoldongchoi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[IntDef, StringDef 사용법]]></title>
            <link>https://medium.com/@cheoldongchoi/intdef-stringdef-%EC%82%AC%EC%9A%A9%EB%B2%95-6331f4af62a2?source=rss-1708e1779c0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6331f4af62a2</guid>
            <category><![CDATA[stringdef]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Cheoldong Choi]]></dc:creator>
            <pubDate>Tue, 25 Feb 2020 01:25:27 GMT</pubDate>
            <atom:updated>2020-02-25T01:25:27.204Z</atom:updated>
            <content:encoded><![CDATA[<p>안드로이드에서는 enum 사용에 대해 보통 비추천을 하고 있기 때문에 숫자 또는 문자열로 기준 값을 정의 한 뒤 이를 기준으로 값을 비교 하는 형태가 주인데 문제는 enum 과 같이 딱 떨어지는 값이 아니다 보니 <br>예외 상황이 발생될 가능성이 존재하게 된다. (직접 입력한다던가…)<br> <br>이를 보안하기 위해 사용할 수 있는 것이 <a href="http://twitter.com/IntDef">@IntDef</a> 또는 <a href="http://twitter.com/StringDef">@StringDef</a> 로 지정하여 사용하는 것인데 이에 대한 예제는 아래와 같다.</p><pre>interface IWindowDelegate {<br>    companion object {<br>        const val WINDOW = 0<br>        const val POPUP_WINDOW = 1<br>    }<br>}</pre><pre><a href="http://twitter.com/IntDef">@IntDef</a>(value = [<br>    IWindowDelegate.WINDOW,<br>    IWindowDelegate.POPUP_WINDOW<br>])<br>annotation class WindowDelegateType</pre><p>가령 윈도우가 두가지 타입이 존재하고 이를 IntDef 를 통해 선언하였다면 <br>아래와 같이 사용가능 하다.</p><pre><a href="http://twitter.com/WindowDelegateType">@WindowDelegateType</a><br>val type: Int</pre><p>지정후에는 IntDef 내의 값이 아니라면 에디터에서 오류를 발생하므로 범위내의 값만 입력할 수 있다. <br> <br>참고 링크 : <a href="https://android.jlelse.eu/android-performance-avoid-using-enum-on-android-326be0794dc3">https://android.jlelse.eu/android-performance-avoid-using-enum-on-android-326be0794dc3</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6331f4af62a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[requestLegacyExternalStorage]]></title>
            <link>https://medium.com/@cheoldongchoi/requestlegacyexternalstorage-d879ee1b79a3?source=rss-1708e1779c0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d879ee1b79a3</guid>
            <dc:creator><![CDATA[Cheoldong Choi]]></dc:creator>
            <pubDate>Tue, 24 Sep 2019 00:48:27 GMT</pubDate>
            <atom:updated>2019-09-24T00:54:03.775Z</atom:updated>
            <content:encoded><![CDATA[<p>android 10 beta 3 를 확인 한 뒤 정식 발표 이후 Scoped Storage 가 어떻게 변경되었나 확인해보았는데 예외 처리 하는 attribute 값이 변경되어 있다.</p><pre>android:requestLegacyExternalStorage=&quot;<strong>true</strong>&quot;</pre><p>AndroidManifest.xml 파일의 <strong>application</strong> element 내에 해당 값을 넣어주면 android 10 타깃이더라도 예전 형태로 사용할 수 있다.</p><p>추가적으로 requestLegacyExternalStorage=”true” 사용 없이 처리를 해볼까 싶어서 관련 내용을 찾아보고 진행 해보았는데</p><blockquote>How to save an image in Android Q using MediaStore?<br>- <a href="https://stackoverflow.com/questions/56904485/how-to-save-an-image-in-android-q-using-mediastore">https://stackoverflow.com/questions/56904485/how-to-save-an-image-in-android-q-using-mediastore</a></blockquote><p>webview 에서 pictures 내에 이미지를 불러들이 방법이 있나?<br>그리고 pictures 에 저장된 이미지에 exif 를 수정할 수 있나? <br>라는 문제가 다가 왔는데 =_ = 일단 답 없음을 파악하고</p><p>webview 에서 Pictures 에 이미지를 불러들이는 방법은 일단 포기 했고</p><p>ExifInterface 클래스의 경우 androidx 개발 진에게 ExifInterface 관련 리포트를 남기곤 =_ = 대기중 이다.</p><p>답 나오기 전까진 android:requestLegacyExternalStorage=”true” 를 유지 하는걸로 일단 결정 완료.</p><p>끝</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d879ee1b79a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Could not determine the dependencies of task In project ‘app’ a resolved Google Play services…]]></title>
            <link>https://medium.com/@cheoldongchoi/could-not-determine-the-dependencies-of-task-in-project-app-a-resolved-google-play-services-212fe64028ae?source=rss-1708e1779c0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/212fe64028ae</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Cheoldong Choi]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 00:28:54 GMT</pubDate>
            <atom:updated>2019-09-18T00:28:54.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Could not determine the dependencies of task In project ‘app’ a resolved Google Play services library dependency depends on another at an exact version</h3><p>간만에 라이브러리 버전을 변경하곤 맞이 하는 오류 메시지 =_ =</p><p>한번에 되는게 없군 하곤 뒤적 뒤적 오류 메시지를 확인하는데</p><blockquote>* What went wrong:</blockquote><blockquote>Could not determine the dependencies of task ‘:app:compileDebugAidl’.</blockquote><blockquote>&gt; In project ‘app’ a resolved Google Play services library dependency depends on another at an exact version (e.g. “[1.2.0</blockquote><blockquote>-alpha02]”, but isn’t being resolved to that version. Behavior exhibited by the library will be unknown.</blockquote><blockquote>Dependency failing: androidx.fragment:fragment-testing:1.2.0-alpha02 -&gt; androidx.fragment:fragment-ktx@[1.2.0-alpha02],</blockquote><blockquote>but fragment-ktx version was 1.2.0-alpha03.</blockquote><blockquote>The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art</blockquote><blockquote>ifact with the issue.</blockquote><blockquote>— Project ‘app’ depends onto androidx.fragment:fragment-ktx@{strictly 1.2.0-alpha03}</blockquote><blockquote>— Project ‘app’ depends onto androidx.navigation:navigation-fragment-ktx@{strictly 2.2.0-alpha02}</blockquote><blockquote>— Project ‘app’ depends onto androidx.fragment:fragment-testing@1.2.0-alpha02</blockquote><blockquote>— Project ‘app’ depends onto androidx.navigation:navigation-fragment-ktx@2.2.0-alpha02</blockquote><blockquote>— Project ‘app’ depends onto androidx.fragment:fragment-testing@{strictly 1.2.0-alpha02}</blockquote><blockquote>For extended debugging info execute Gradle from the command line with ./gradlew — info :app:assembleDebug to see the dep</blockquote><blockquote>endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://</blockquote><blockquote><a href="http://github.com/google/play-services-plugins">github.com/google/play-services-plugins</a> and disable by adding “googleServices { disableVersionCheck = false }” to your b</blockquote><blockquote>uild.gradle file.</blockquote><p>구글 서비스쪽이랑 내가 선택한 라이브러리의 버전이 충돌이 나는 듯 싶은데 어떻게 해결해야 하나 하고 뒤적거리던 차에 오류 문구중에 발견한 한줄 되시겠다.</p><blockquote>adding “googleServices { disableVersionCheck = false }” to your build.gradle file.</blockquote><p>그러곤 잠시 고민끝에 app level build.gradle 가장 하단에 코드를 아래와 같이 넣었다.</p><pre>apply <strong>plugin</strong>: <strong>‘com.google.gms.google-services’</strong></pre><pre>googleServices { disableVersionCheck = <strong>true</strong> } // here!!</pre><p>끝.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=212fe64028ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[를 사용하려고 하는데 컴파일 오류가 발생되어 오류 로그를 보니]]></title>
            <link>https://medium.com/@cheoldongchoi/%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EB%A0%A4%EA%B3%A0-%ED%95%98%EB%8A%94%EB%8D%B0-%EC%BB%B4%ED%8C%8C%EC%9D%BC-%EC%98%A4%EB%A5%98%EA%B0%80-%EB%B0%9C%EC%83%9D%EB%90%98%EC%96%B4-%EC%98%A4%EB%A5%98-%EB%A1%9C%EA%B7%B8%EB%A5%BC-%EB%B3%B4%EB%8B%88-767ab816dd6f?source=rss-1708e1779c0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/767ab816dd6f</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Cheoldong Choi]]></dc:creator>
            <pubDate>Tue, 10 Sep 2019 01:27:39 GMT</pubDate>
            <atom:updated>2019-09-10T03:26:21.666Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Kotlin: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper ‘-jvm-target’ option</blockquote><p>응? JVM 타깃을 변경해달라고? 난 이미 gradle 에 지정해뒀는데? 하고 봤더니 코틀린 옵션은 별도였군</p><p>맥 기준 <strong>Preferences -&gt; Kotlin Compiler -&gt; Target JVM version </strong>을 1.6 에서 1.8 로 변경한 뒤 Android Studio 를 다시 시작 한다.<strong> <em>(안하면 적용 안됨)</em></strong></p><p>그러고 프로젝트 다시 구동해보니 이상 무!</p><p>끝.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=767ab816dd6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OnBackPressedDispatcher 이용]]></title>
            <link>https://medium.com/@cheoldongchoi/onbackpresseddispatcher-%EC%9D%B4%EC%9A%A9-593810739a0e?source=rss-1708e1779c0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/593810739a0e</guid>
            <dc:creator><![CDATA[Cheoldong Choi]]></dc:creator>
            <pubDate>Mon, 09 Sep 2019 01:26:45 GMT</pubDate>
            <atom:updated>2019-09-09T01:26:45.254Z</atom:updated>
            <content:encoded><![CDATA[<p>기존에 Fragment 에서 h/w back key 를 이용하기 위해 OnBackPressedListener 를 생성 한 뒤</p><pre><strong>interface</strong> OnBackPressedListener {</pre><pre><strong>    fun</strong> onBackPressed(): Boolean</pre><pre>}</pre><p>activity 에는 아래와 같이 설정 하고</p><pre><strong>override fun</strong> onBackPressed() {</pre><pre><em>    // 현재 fragment 가 OnBackPressedListener 를 상속 받고 return true <br>    // 를 하면 인터페이스에서 h/w backkey 를 처리한 것으로 본다.</em></pre><pre><strong>    val</strong> fragment = <em>supportFragmentManager</em>.<em>current</em></pre><pre><strong>    if</strong> (fragment != <strong>null</strong> &amp;&amp; fragment <strong>is</strong> OnBackPressedListener &amp;&amp;<br>        fragment.onBackPressed()) {</pre><pre><strong>        return</strong></pre><pre>    }</pre><pre><strong>    if</strong> (<strong>mBackPressed</strong>.onBackPressed()) {</pre><pre><strong>        super</strong>.onBackPressed()</pre><pre>    }</pre><pre>}</pre><p>Fragment 에는 OnBackPressedListener 상속해서 내부적인 이벤트가 존재하면 onBackPressed 에서 true 를 반환해서 처리하고 그게 아니면 activity 에서 처리하도록 false 를 전달했는데</p><pre><strong>override fun</strong> onBackPressed(): Boolean {</pre><pre><strong>    if</strong> (<strong>mIssueViewModel</strong>.<strong>viewRealtimeIssue</strong>.<em>isVisible</em>()) {</pre><pre>        // TODO </pre><pre><strong>        return true // 내부에서 back key를 처리 함</strong></pre><pre>    }</pre><pre><strong>    return false // activity 에서 back key 를 처리하도록 false 전달</strong></pre><pre>}</pre><p>새롭게 나온 OnBackPressedDispatcher 를 이용하려면 어떻게 해야하나? 기존의 인터페이스를 어떻게 살릴까 하고 잠시 뒤적여 본 결과 Activity 에서는 아래와 같이 설정하고</p><pre><strong>override fun</strong> onBackPressed() {</pre><pre><strong>    if</strong> (!<em>onBackPressedDispatcher</em>.hasEnabledCallbacks()) {</pre><pre><strong>        mBackPressed</strong>.onBackPressed()</pre><pre><strong>        return</strong></pre><pre>    }</pre><pre><strong>    super</strong>.onBackPressed()</pre><pre>}</pre><p>Fragment 의 Base Class 에서 아래와 같이 설정하는 식으로 했더니만 기존의 방식을 이용하면서 신규 방식도 적용되도록 코드를 완성 시켰다.</p><pre><strong>private var</strong> <strong>mOnBackPressedCallback</strong>: OnBackPressedCallback? = <strong>null</strong></pre><pre><strong>    private fun</strong> initBackPressedDispatcher() {</pre><pre><strong>        if</strong> (<strong>this is</strong> OnBackPressedListener) {</pre><pre><strong>            mOnBackPressedCallback</strong> = <strong>object</strong>: <br>                                     OnBackPressedCallback(<strong>false</strong>) {</pre><pre><strong>            override fun</strong> handleOnBackPressed() {</pre><pre><strong>                mOnBackPressedCallback</strong>?.<em>isEnabled</em> = !onBackPressed()</pre><pre>            }</pre><pre>        }</pre><pre><strong>        mOnBackPressedCallback</strong>?.<em>let</em> <strong>{</strong></pre><pre>            requireActivity().<em>onBackPressedDispatcher</em>.addCallback(<br>                                              <strong>this</strong>@BaseFragment, <strong>it</strong>)</pre><pre><strong>        }</strong></pre><pre>    }</pre><pre>}</pre><p>다만 다른점은 이전에는 onBackPressed 를 처음 전달 받기 위해서는 mOnBackPressedCallback?.isEnabled 값을 true 로 지정해야 한다는 점이 다르다. +_ + 그게 좀 귀찮긴 하지만 어쨋든 변화에 적응은 해야 되니 후…</p><pre><strong>protected fun</strong> backPressedCallback(enableCallback: Boolean = <strong>true</strong>) {</pre><pre>    mOnBackPressedCallback?.isEnabled = enableCallback</pre><pre>}</pre><p>암튼 그렇고 좀 더 깊게 보자면 새로운 Back Pressed Callback 은 <a href="http://androidx.activity.componentactivit/">androidx.activity.ComponentActivit</a>y 에 구현되어 있는데</p><p>주요 코드는 아래와 같다.</p><pre><strong>private final</strong> OnBackPressedDispatcher <strong>mOnBackPressedDispatcher</strong> =<br>    <strong>new</strong> OnBackPressedDispatcher(<strong>new</strong> Runnable() {</pre><pre>        @Override</pre><pre><strong>        public void</strong> run() {</pre><pre>            ComponentActivity.<strong>super</strong>.onBackPressed();</pre><pre>        }</pre><pre>    });</pre><pre>    @Override</pre><pre>    @MainThread</pre><pre><strong>    public void</strong> onBackPressed() {</pre><pre><strong>        mOnBackPressedDispatcher</strong>.onBackPressed();</pre><pre>    }</pre><pre>    @NonNull</pre><pre>    @Override</pre><pre><strong>    public final</strong> OnBackPressedDispatcher getOnBackPressedDispatcher() {</pre><pre><strong>        return</strong> <strong>mOnBackPressedDispatcher</strong>;</pre><pre>    }</pre><p>보통 사용하는 AppCompatActivity 의 상속 순서는 FragmentActivity -&gt; ComponentActivity 순</p><p>이며 H/W 키에 의해 onBackPressed() 가 호출 되는데 onBackPressed 의 내부 코드를 보면 아래의 형태를 가진다.</p><pre><strong>mOnBackPressedDispatcher</strong>.onBackPressed();</pre><p>즉 OnBackPressedDispatcher 에 등록되어 있는 Callback 을 호출하는 형태인데 callback 에 enabled 값을 참조하여</p><pre>@MainThread</pre><pre><strong>public void</strong> onBackPressed() {</pre><pre>    Iterator iterator = <strong>mOnBackPressedCallbacks</strong>.descendingIterator();</pre><pre><strong>    while</strong> (iterator.hasNext()) {</pre><pre>        OnBackPressedCallback callback = iterator.next();</pre><pre><strong>        if</strong> (callback.isEnabled()) {</pre><pre>            callback.handleOnBackPressed();</pre><pre><strong>            return</strong>;</pre><pre>        }</pre><pre>    }</pre><pre><strong>    if</strong> (<strong>mFallbackOnBackPressed</strong> != <strong>null</strong>) {</pre><pre><strong>        mFallbackOnBackPressed</strong>.run();</pre><pre>    }</pre><pre>}</pre><p>콜백을 받을지 말지를 정의 할 수 있다.</p><p>등록되어 있는 모든 콜백의 enabled 값이 false 면 OnBackPressedDispatcher 초기화 코드인 <strong>mFallbackOnBackPressed</strong> 를 실행하게 된다.</p><p>이후 ComponentActivity 의 하위?(부모) 클래스의 onBackPressed 를 호출하게 된다.</p><p>끝.</p><p>ps. 근데 구글아… 이거 좀 -_ — 설계 잘못된거 같은데…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=593810739a0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>