Fix bug with resize frame disappearing.

Currently, if you resize the widget to the top, bottom or right, the
resize frame disappears. This is because the AppWidgetResizeFrame code
relies on the indices of the child elements to find the drag handles.

I updated the code to instead use IDs since that is more robust.

Test: manual
Bug: 182305670
Change-Id: Iaa9d32c9190fb579101914f03d57bb48dcecb88d
This commit is contained in:
Yogisha Dixit
2021-03-16 14:56:42 +00:00
parent 2b30076aba
commit f9954cc4cc
2 changed files with 8 additions and 5 deletions

View File

@@ -20,7 +20,6 @@ import android.util.SizeF;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
@@ -139,10 +138,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
protected void onFinishInflate() {
super.onFinishInflate();
ViewGroup content = (ViewGroup) getChildAt(0);
for (int i = 0; i < HANDLE_COUNT; i ++) {
mDragHandles[i] = content.getChildAt(i);
}
mDragHandles[INDEX_LEFT] = findViewById(R.id.widget_resize_left_handle);
mDragHandles[INDEX_TOP] = findViewById(R.id.widget_resize_top_handle);
mDragHandles[INDEX_RIGHT] = findViewById(R.id.widget_resize_right_handle);
mDragHandles[INDEX_BOTTOM] = findViewById(R.id.widget_resize_bottom_handle);
}
@Override