Skip to content

Commit 7fbfb04

Browse files
committed
55976-elys
1 parent 0f51051 commit 7fbfb04

File tree

16 files changed

+187
-181
lines changed

16 files changed

+187
-181
lines changed

DOC/Todo.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# TODOs
22

33
## Sep 2025
4+
add keyboard shortcuts for animation to GOES/Mosaic
5+
key cntrl-N does not work in chromeOS
46
getter/setter consistency
57
ObjectLocation fix handling of notif vars
68
UtilityStorePreferences.setDefaults use Utility.writePref

app/src/main/java/joshuatee/wx/externalColorChooser/ColorPicker.kt

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import android.view.MotionEvent
3030
import android.view.View
3131
import kotlin.math.*
3232
import joshuatee.wx.R
33+
import androidx.core.content.withStyledAttributes
3334

3435
/**
3536
* Displays a holo-themed color picker.
@@ -300,41 +301,41 @@ class ColorPicker : View {
300301
private var oldSelectedListenerColor: Int = 0
301302

302303
private fun init(attrs: AttributeSet?, defStyle: Int) {
303-
val a = context.obtainStyledAttributes(
304+
context.withStyledAttributes(
304305
attrs,
305306
R.styleable.ColorPicker, defStyle, 0
306-
)
307-
val b = context.resources
307+
) {
308+
val b = context.resources
309+
310+
mColorWheelThickness = getDimensionPixelSize(
311+
R.styleable.ColorPicker_color_wheel_thickness,
312+
b.getDimensionPixelSize(R.dimen.color_wheel_thickness)
313+
)
314+
mColorWheelRadius = getDimensionPixelSize(
315+
R.styleable.ColorPicker_color_wheel_radius,
316+
b.getDimensionPixelSize(R.dimen.color_wheel_radius)
317+
)
318+
mPreferredColorWheelRadius = mColorWheelRadius
319+
mColorCenterRadius = getDimensionPixelSize(
320+
R.styleable.ColorPicker_color_center_radius,
321+
b.getDimensionPixelSize(R.dimen.color_center_radius)
322+
)
323+
mPreferredColorCenterRadius = mColorCenterRadius
324+
mColorCenterHaloRadius = getDimensionPixelSize(
325+
R.styleable.ColorPicker_color_center_halo_radius,
326+
b.getDimensionPixelSize(R.dimen.color_center_halo_radius)
327+
)
328+
mPreferredColorCenterHaloRadius = mColorCenterHaloRadius
329+
mColorPointerRadius = getDimensionPixelSize(
330+
R.styleable.ColorPicker_color_pointer_radius,
331+
b.getDimensionPixelSize(R.dimen.color_pointer_radius)
332+
)
333+
mColorPointerHaloRadius = getDimensionPixelSize(
334+
R.styleable.ColorPicker_color_pointer_halo_radius,
335+
b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius)
336+
)
308337

309-
mColorWheelThickness = a.getDimensionPixelSize(
310-
R.styleable.ColorPicker_color_wheel_thickness,
311-
b.getDimensionPixelSize(R.dimen.color_wheel_thickness)
312-
)
313-
mColorWheelRadius = a.getDimensionPixelSize(
314-
R.styleable.ColorPicker_color_wheel_radius,
315-
b.getDimensionPixelSize(R.dimen.color_wheel_radius)
316-
)
317-
mPreferredColorWheelRadius = mColorWheelRadius
318-
mColorCenterRadius = a.getDimensionPixelSize(
319-
R.styleable.ColorPicker_color_center_radius,
320-
b.getDimensionPixelSize(R.dimen.color_center_radius)
321-
)
322-
mPreferredColorCenterRadius = mColorCenterRadius
323-
mColorCenterHaloRadius = a.getDimensionPixelSize(
324-
R.styleable.ColorPicker_color_center_halo_radius,
325-
b.getDimensionPixelSize(R.dimen.color_center_halo_radius)
326-
)
327-
mPreferredColorCenterHaloRadius = mColorCenterHaloRadius
328-
mColorPointerRadius = a.getDimensionPixelSize(
329-
R.styleable.ColorPicker_color_pointer_radius,
330-
b.getDimensionPixelSize(R.dimen.color_pointer_radius)
331-
)
332-
mColorPointerHaloRadius = a.getDimensionPixelSize(
333-
R.styleable.ColorPicker_color_pointer_halo_radius,
334-
b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius)
335-
)
336-
337-
a.recycle()
338+
}
338339
mAngle = (-PI / 2).toFloat()
339340
val s = SweepGradient(0f, 0f, COLORS, null)
340341
mColorWheelPaint = Paint(Paint.ANTI_ALIAS_FLAG)

app/src/main/java/joshuatee/wx/externalColorChooser/OpacityBar.kt

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import android.view.View
3232
import joshuatee.wx.R
3333
import kotlin.math.min
3434
import kotlin.math.roundToInt
35+
import androidx.core.content.withStyledAttributes
3536

3637
@Suppress("SpellCheckingInspection")
3738
class OpacityBar : View {
@@ -168,34 +169,34 @@ class OpacityBar : View {
168169
}
169170

170171
private fun init(attrs: AttributeSet?, defStyle: Int) {
171-
val a = context.obtainStyledAttributes(
172+
context.withStyledAttributes(
172173
attrs,
173174
R.styleable.OpacityBar, defStyle, 0
174-
)
175-
val b = context.resources
175+
) {
176+
val b = context.resources
176177

177-
mBarThickness = a.getDimensionPixelSize(
178-
R.styleable.OpacityBar_obar_thickness,
179-
b.getDimensionPixelSize(R.dimen.bar_thickness)
180-
)
181-
mBarLength = a.getDimensionPixelSize(
182-
R.styleable.OpacityBar_obar_length,
183-
b.getDimensionPixelSize(R.dimen.bar_length)
184-
)
185-
mPreferredBarLength = mBarLength
186-
mBarPointerRadius = a.getDimensionPixelSize(
187-
R.styleable.OpacityBar_obar_pointer_radius,
188-
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
189-
)
190-
mBarPointerHaloRadius = a.getDimensionPixelSize(
191-
R.styleable.OpacityBar_obar_pointer_halo_radius,
192-
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
193-
)
194-
mOrientation = a.getBoolean(
195-
R.styleable.OpacityBar_obar_orientation_horizontal, ORIENTATION_DEFAULT
196-
)
178+
mBarThickness = getDimensionPixelSize(
179+
R.styleable.OpacityBar_obar_thickness,
180+
b.getDimensionPixelSize(R.dimen.bar_thickness)
181+
)
182+
mBarLength = getDimensionPixelSize(
183+
R.styleable.OpacityBar_obar_length,
184+
b.getDimensionPixelSize(R.dimen.bar_length)
185+
)
186+
mPreferredBarLength = mBarLength
187+
mBarPointerRadius = getDimensionPixelSize(
188+
R.styleable.OpacityBar_obar_pointer_radius,
189+
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
190+
)
191+
mBarPointerHaloRadius = getDimensionPixelSize(
192+
R.styleable.OpacityBar_obar_pointer_halo_radius,
193+
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
194+
)
195+
mOrientation = getBoolean(
196+
R.styleable.OpacityBar_obar_orientation_horizontal, ORIENTATION_DEFAULT
197+
)
197198

198-
a.recycle()
199+
}
199200

200201
mBarPaint = Paint(Paint.ANTI_ALIAS_FLAG)
201202
mBarPaint!!.shader = shader

app/src/main/java/joshuatee/wx/externalColorChooser/SVBar.kt

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import android.view.View
3232
import joshuatee.wx.R
3333
import kotlin.math.min
3434
import kotlin.math.roundToInt
35+
import androidx.core.content.withStyledAttributes
3536

3637
@Suppress("SpellCheckingInspection")
3738
class SVBar : View {
@@ -145,30 +146,30 @@ class SVBar : View {
145146
}
146147

147148
private fun init(attrs: AttributeSet?, defStyle: Int) {
148-
val a = context.obtainStyledAttributes(attrs, R.styleable.SVBar, defStyle, 0)
149-
val b = context.resources
150-
mBarThickness = a.getDimensionPixelSize(
151-
R.styleable.SVBar_bar_thickness_svbar,
152-
b.getDimensionPixelSize(R.dimen.bar_thickness)
153-
)
154-
mBarLength = a.getDimensionPixelSize(
155-
R.styleable.SVBar_bar_length_svbar,
156-
b.getDimensionPixelSize(R.dimen.bar_length)
157-
)
158-
mPreferredBarLength = mBarLength
159-
mBarPointerRadius = a.getDimensionPixelSize(
160-
R.styleable.SVBar_bar_pointer_radius_svbar,
161-
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
162-
)
163-
mBarPointerHaloRadius = a.getDimensionPixelSize(
164-
R.styleable.SVBar_bar_pointer_halo_radius_svbar,
165-
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
166-
)
167-
mOrientation = a.getBoolean(
168-
R.styleable.SVBar_bar_orientation_horizontal_svbar, ORIENTATION_DEFAULT
169-
)
149+
context.withStyledAttributes(attrs, R.styleable.SVBar, defStyle, 0) {
150+
val b = context.resources
151+
mBarThickness = getDimensionPixelSize(
152+
R.styleable.SVBar_bar_thickness_svbar,
153+
b.getDimensionPixelSize(R.dimen.bar_thickness)
154+
)
155+
mBarLength = getDimensionPixelSize(
156+
R.styleable.SVBar_bar_length_svbar,
157+
b.getDimensionPixelSize(R.dimen.bar_length)
158+
)
159+
mPreferredBarLength = mBarLength
160+
mBarPointerRadius = getDimensionPixelSize(
161+
R.styleable.SVBar_bar_pointer_radius_svbar,
162+
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
163+
)
164+
mBarPointerHaloRadius = getDimensionPixelSize(
165+
R.styleable.SVBar_bar_pointer_halo_radius_svbar,
166+
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
167+
)
168+
mOrientation = getBoolean(
169+
R.styleable.SVBar_bar_orientation_horizontal_svbar, ORIENTATION_DEFAULT
170+
)
170171

171-
a.recycle()
172+
}
172173

173174
mBarPaint = Paint(Paint.ANTI_ALIAS_FLAG)
174175
mBarPaint!!.shader = shader

app/src/main/java/joshuatee/wx/externalColorChooser/SaturationBar.kt

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import android.view.View
3232
import joshuatee.wx.R
3333
import kotlin.math.min
3434
import kotlin.math.roundToInt
35+
import androidx.core.content.withStyledAttributes
3536

3637
class SaturationBar : View {
3738

@@ -167,34 +168,34 @@ class SaturationBar : View {
167168
}
168169

169170
private fun init(attrs: AttributeSet?, defStyle: Int) {
170-
val a = context.obtainStyledAttributes(
171+
context.withStyledAttributes(
171172
attrs,
172173
R.styleable.SaturationBar, defStyle, 0
173-
)
174-
val b = context.resources
174+
) {
175+
val b = context.resources
175176

176-
mBarThickness = a.getDimensionPixelSize(
177-
R.styleable.SaturationBar_bar_thickness,
178-
b.getDimensionPixelSize(R.dimen.bar_thickness)
179-
)
180-
mBarLength = a.getDimensionPixelSize(
181-
R.styleable.SaturationBar_bar_length,
182-
b.getDimensionPixelSize(R.dimen.bar_length)
183-
)
184-
mPreferredBarLength = mBarLength
185-
mBarPointerRadius = a.getDimensionPixelSize(
186-
R.styleable.SaturationBar_bar_pointer_radius,
187-
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
188-
)
189-
mBarPointerHaloRadius = a.getDimensionPixelSize(
190-
R.styleable.SaturationBar_bar_pointer_halo_radius,
191-
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
192-
)
193-
mOrientation = a.getBoolean(
194-
R.styleable.SaturationBar_bar_orientation_horizontal, ORIENTATION_DEFAULT
195-
)
177+
mBarThickness = getDimensionPixelSize(
178+
R.styleable.SaturationBar_bar_thickness,
179+
b.getDimensionPixelSize(R.dimen.bar_thickness)
180+
)
181+
mBarLength = getDimensionPixelSize(
182+
R.styleable.SaturationBar_bar_length,
183+
b.getDimensionPixelSize(R.dimen.bar_length)
184+
)
185+
mPreferredBarLength = mBarLength
186+
mBarPointerRadius = getDimensionPixelSize(
187+
R.styleable.SaturationBar_bar_pointer_radius,
188+
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
189+
)
190+
mBarPointerHaloRadius = getDimensionPixelSize(
191+
R.styleable.SaturationBar_bar_pointer_halo_radius,
192+
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
193+
)
194+
mOrientation = getBoolean(
195+
R.styleable.SaturationBar_bar_orientation_horizontal, ORIENTATION_DEFAULT
196+
)
196197

197-
a.recycle()
198+
}
198199

199200
mBarPaint = Paint(Paint.ANTI_ALIAS_FLAG)
200201
mBarPaint!!.shader = shader

app/src/main/java/joshuatee/wx/externalColorChooser/ValueBar.kt

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import android.view.View
3232
import joshuatee.wx.R
3333
import kotlin.math.min
3434
import kotlin.math.roundToInt
35+
import androidx.core.content.withStyledAttributes
3536

3637
class ValueBar : View {
3738

@@ -167,28 +168,31 @@ class ValueBar : View {
167168
}
168169

169170
private fun init(attrs: AttributeSet?, defStyle: Int) {
170-
val a = context.obtainStyledAttributes(attrs, R.styleable.ValueBar, defStyle, 0)
171-
val b = context.resources
172-
mBarThickness = a.getDimensionPixelSize(
173-
R.styleable.ValueBar_bar_thickness_vbar,
174-
b.getDimensionPixelSize(R.dimen.bar_thickness)
175-
)
176-
mBarLength = a.getDimensionPixelSize(
177-
R.styleable.ValueBar_bar_length_vbar,
178-
b.getDimensionPixelSize(R.dimen.bar_length)
179-
)
180-
mPreferredBarLength = mBarLength
181-
mBarPointerRadius = a.getDimensionPixelSize(
182-
R.styleable.ValueBar_bar_pointer_radius_vbar,
183-
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
184-
)
185-
mBarPointerHaloRadius = a.getDimensionPixelSize(
186-
R.styleable.ValueBar_bar_pointer_halo_radius_vbar,
187-
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
188-
)
189-
mOrientation =
190-
a.getBoolean(R.styleable.ValueBar_bar_orientation_horizontal_vbar, ORIENTATION_DEFAULT)
191-
a.recycle()
171+
context.withStyledAttributes(attrs, R.styleable.ValueBar, defStyle, 0) {
172+
val b = context.resources
173+
mBarThickness = getDimensionPixelSize(
174+
R.styleable.ValueBar_bar_thickness_vbar,
175+
b.getDimensionPixelSize(R.dimen.bar_thickness)
176+
)
177+
mBarLength = getDimensionPixelSize(
178+
R.styleable.ValueBar_bar_length_vbar,
179+
b.getDimensionPixelSize(R.dimen.bar_length)
180+
)
181+
mPreferredBarLength = mBarLength
182+
mBarPointerRadius = getDimensionPixelSize(
183+
R.styleable.ValueBar_bar_pointer_radius_vbar,
184+
b.getDimensionPixelSize(R.dimen.bar_pointer_radius)
185+
)
186+
mBarPointerHaloRadius = getDimensionPixelSize(
187+
R.styleable.ValueBar_bar_pointer_halo_radius_vbar,
188+
b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius)
189+
)
190+
mOrientation =
191+
getBoolean(
192+
R.styleable.ValueBar_bar_orientation_horizontal_vbar,
193+
ORIENTATION_DEFAULT
194+
)
195+
}
192196
mBarPaint = Paint(Paint.ANTI_ALIAS_FLAG)
193197
mBarPaint!!.shader = shader
194198
mBarPointerPosition = mBarPointerHaloRadius

app/src/main/java/joshuatee/wx/fragments/LocationFragment.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import joshuatee.wx.settings.Location
4949
import joshuatee.wx.settings.RadarPreferences
5050
import joshuatee.wx.settings.UIPreferences
5151
import joshuatee.wx.settings.UtilityHomeScreen
52-
import joshuatee.wx.ui.CanadaLegal
5352
import joshuatee.wx.ui.Card
5453
import joshuatee.wx.ui.CardCurrentConditions
5554
import joshuatee.wx.ui.CardHazards
@@ -338,7 +337,6 @@ class LocationFragment : Fragment() {
338337

339338
private fun getRadar(idx: Int) {
340339
// if radarForLocation is not equal to -1 it means the user has a radar for the current location (default)
341-
//if (radarForLocation != -1)
342340
if (radarForLocationIndex != -1 && !radarLocationChangedList[radarForLocationIndex]) {
343341
nexradState.wxglRenders[radarForLocationIndex].state.rid = Location.radarSite
344342
}
@@ -545,9 +543,6 @@ class LocationFragment : Fragment() {
545543
if (isAdded) {
546544
if (UIPreferences.homescreenFav.contains("TXT-7DAY")) {
547545
sevenDayCollection?.update(sevenDay, Location.latLon, Location.isUS)
548-
if (!Location.isUS) {
549-
CanadaLegal(activityReference, boxForecast!!, "")
550-
}
551546
}
552547
}
553548
}

app/src/main/java/joshuatee/wx/fragments/MiscFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class MiscFragment : Fragment() {
166166
"wxogl", "Single pane nexrad radar"
167167
)
168168
}
169-
Location.checkCurrentLocationValidity()
169+
// Location.checkCurrentLocationValidity()
170170
hm["wxoglquad"] = TileObject(
171171
R.drawable.wxoglquadpane,
172172
WXGLRadarActivityMultiPane::class.java,

0 commit comments

Comments
 (0)