Skip to content

Commit aad7f8d

Browse files
committed
Widgets: Update app widget size on changing the size of the view
1 parent 2ae3c79 commit aad7f8d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

project/app/src/main/java/com/achep/acdisplay/ui/activities/settings/WidgetPickerActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ private void updateAppWidgetFrameSize() {
335335
int width = mMinWidth + mWidthSeekBar.getProgress();
336336
int height = mMinHeight + mHeightSeekBar.getProgress();
337337
ViewUtils.setSize(mHostView, width, height);
338+
mHostView.updateAppWidgetSize(null, width, height, width, height);
338339
}
339340

340341
private void updateAppWidgetTouchable() {

project/app/src/main/java/com/achep/acdisplay/ui/components/HostWidget.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ private void updateAppWidgetFrameSize() {
179179
int wMin = res.getDimensionPixelSize(R.dimen.scene_min_width);
180180
int wMax = res.getDimensionPixelSize(R.dimen.scene_max_width);
181181
float density = res.getDisplayMetrics().density;
182+
w = Math.round(MathUtils.range(w * density, wMin, wMax));
183+
h = Math.round(MathUtils.range(h * density, hMin, hMax));
182184
// Update size
183-
ViewUtils.setSize(mHostView,
184-
Math.round(MathUtils.range(w * density, wMin, wMax)),
185-
Math.round(MathUtils.range(h * density, hMin, hMax)));
185+
ViewUtils.setSize(mHostView, w, h);
186+
mHostView.updateAppWidgetSize(null, w, h, w, h);
186187
}
187188

188189
private void updateAppWidgetTouchable() {

0 commit comments

Comments
 (0)