@@ -42,6 +42,7 @@ import joshuatee.wx.settings.NotificationPreferences
4242import joshuatee.wx.settings.RadarPreferences
4343import joshuatee.wx.settings.UIPreferences
4444import joshuatee.wx.settings.UtilityHomeScreen
45+ import joshuatee.wx.util.HttpUnsafe
4546import okhttp3.Interceptor
4647import okhttp3.OkHttpClient
4748import org.acra.BuildConfig
@@ -102,13 +103,26 @@ class MyApplication : Application() {
102103 val res = resources
103104 dm = res.displayMetrics
104105 UIPreferences .deviceScale = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , 1f , dm)
105- UIPreferences .padding = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , res.getDimension(R .dimen.padding_dynamic_tv), dm).toInt()
106- UIPreferences .paddingSettings = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , res.getDimension(R .dimen.padding_dynamic_tv_settings), dm).toInt()
107- UIPreferences .paddingSmall = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , res.getDimension(R .dimen.padding_dynamic_tv_small), dm).toInt()
106+ UIPreferences .padding = TypedValue .applyDimension(
107+ TypedValue .COMPLEX_UNIT_DIP ,
108+ res.getDimension(R .dimen.padding_dynamic_tv),
109+ dm
110+ ).toInt()
111+ UIPreferences .paddingSettings = TypedValue .applyDimension(
112+ TypedValue .COMPLEX_UNIT_DIP ,
113+ res.getDimension(R .dimen.padding_dynamic_tv_settings),
114+ dm
115+ ).toInt()
116+ UIPreferences .paddingSmall = TypedValue .applyDimension(
117+ TypedValue .COMPLEX_UNIT_DIP ,
118+ res.getDimension(R .dimen.padding_dynamic_tv_small),
119+ dm
120+ ).toInt()
108121 UIPreferences .lLpadding = res.getDimension(R .dimen.padding_ll)
109122 val tv = TypedValue ()
110123 if (theme.resolveAttribute(android.R .attr.actionBarSize, tv, true )) {
111- UIPreferences .actionBarHeight = TypedValue .complexToDimensionPixelSize(tv.data, res.displayMetrics)
124+ UIPreferences .actionBarHeight =
125+ TypedValue .complexToDimensionPixelSize(tv.data, res.displayMetrics)
112126 }
113127 initPreferences(this )
114128 Location .refreshLocationData(this )
@@ -130,10 +144,12 @@ class MyApplication : Application() {
130144 response
131145 }
132146 val httpClient = OkHttpClient .Builder ()
133- .connectTimeout(15 , TimeUnit .SECONDS )
134- .readTimeout(15 , TimeUnit .SECONDS )
135- .addInterceptor(okHttp3Interceptor)
136- .build()
147+ .connectTimeout(15 , TimeUnit .SECONDS )
148+ .readTimeout(15 , TimeUnit .SECONDS )
149+ .addInterceptor(okHttp3Interceptor)
150+ .build()
151+
152+ val httpClientUnsafe = HttpUnsafe .getUnsafeOkHttpClient()
137153
138154 lateinit var preferences: SharedPreferences
139155 private lateinit var preferencesTelecine: SharedPreferences
@@ -149,13 +165,22 @@ class MyApplication : Application() {
149165 RadarPreferences .radarGeometrySetColors()
150166 NotificationPreferences .initPreferences()
151167 NexradUtil .colorPaletteProducts.forEach {
152- ColorPalette .radarColorPalette[it] = getInitialPreferenceString(" RADAR_COLOR_PALETTE_$it " , " CODENH" )
153- ColorPalette .radarColorPaletteList[it] = getInitialPreferenceString(" RADAR_COLOR_PALETTE_" + it + " _LIST" , " " )
168+ ColorPalette .radarColorPalette[it] =
169+ getInitialPreferenceString(" RADAR_COLOR_PALETTE_$it " , " CODENH" )
170+ ColorPalette .radarColorPaletteList[it] =
171+ getInitialPreferenceString(" RADAR_COLOR_PALETTE_" + it + " _LIST" , " " )
154172 }
155- UIPreferences .cardCorners = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , preferences.getInt(" CARD_CORNER_RADIUS" , 0 ).toFloat(), dm)
156- UIPreferences .telecineVideoSizePercentage = preferencesTelecine.getInt(" video-size" , 100 )
157- UIPreferences .telecineSwitchShowCountdown = preferencesTelecine.getBoolean(" show-countdown" , false )
158- UIPreferences .telecineSwitchRecordingNotification = preferencesTelecine.getBoolean(" recording-notification" , false )
173+ UIPreferences .cardCorners = TypedValue .applyDimension(
174+ TypedValue .COMPLEX_UNIT_DIP ,
175+ preferences.getInt(" CARD_CORNER_RADIUS" , 0 ).toFloat(),
176+ dm
177+ )
178+ UIPreferences .telecineVideoSizePercentage =
179+ preferencesTelecine.getInt(" video-size" , 100 )
180+ UIPreferences .telecineSwitchShowCountdown =
181+ preferencesTelecine.getBoolean(" show-countdown" , false )
182+ UIPreferences .telecineSwitchRecordingNotification =
183+ preferencesTelecine.getBoolean(" recording-notification" , false )
159184 Location .currentLocationStr = getInitialPreferenceString(" CURRENT_LOC_FRAGMENT" , " 1" )
160185 PolygonWatch .load(context)
161186 }
0 commit comments