반응형
private fun resizeBitMap(uri: Uri, resize: Int): Bitmap? {
    var resizeBitmap: Bitmap? = null
    val ratioTemp = 2

    val options = BitmapFactory.Options()
    try {
        BitmapFactory.decodeStream(
            applicationContext.contentResolver.openInputStream(uri),
            null,
            options
        )
        var width = options.outWidth
        var height = options.outHeight
        var sampleSize = 1

        while (true) {
            if (width / ratioTemp < resize || height / ratioTemp < resize) break

            width /= ratioTemp
            height /= ratioTemp
            sampleSize *= ratioTemp
        }

        options.inSampleSize = sampleSize
        val bitmap = BitmapFactory.decodeStream(
            applicationContext.contentResolver.openInputStream(uri),
            null,
            options
        )
        resizeBitmap = bitmap

    } catch (e: FileNotFoundException) {
        e.printStackTrace()
    }

    return resizeBitmap
}
반응형
반응형

@Header 어노테이션 

 

1. 헤더 어노테이션을 추가하여 전송.

 

interface api {

@GET("/api/itemlist")

  fun itemList(

  @Header("token") token: String?,

  @Query("wid") wid : Int ): Call<List<ItemListResponseData>>

}

 

 

 

2. Interceptor를 이용하여 전송 

https://blog.codavel.com/how-to-create-an-http-interceptor-for-an-android-app-using-okhttp3

class AppInterceptor : Interceptor {

@Throws(IOException::class)

override fun intercept(chain: Interceptor.Chain) : Response = with(chain) {

                 val newRequest = request().newBuilder()

                .addHeader("(Key)", "(Value)")

                .build()

 

                proceed(newRequest)

   }

}

 

 

반응형
반응형

<style name="AlertDialogTheme" parent="android:Theme.Dialog">

    <item name="android:textSize">14sp</item>

</style>

 

 

ContextThemeWrapper cw = new ContextThemeWrapper( this, R.style.AlertDialogTheme );

AlertDialog.Builder b = new AlertDialog.Builder(cw);



출처: https://ondestroy.tistory.com/entry/AlertDialogBuilder-안에-텍스트-사이즈-조절하기 [OnCreate]

반응형

+ Recent posts