Skip to content

Commit

Permalink
fix(editor): fix #420
Browse files Browse the repository at this point in the history
  • Loading branch information
dingyi222666 authored and Rosemoe committed Jan 30, 2024
1 parent f79b612 commit 10edbb3
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@

import android.animation.LayoutTransition;
import android.content.Context;
import android.graphics.Outline;
import android.graphics.drawable.GradientDrawable;
import android.os.SystemClock;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
Expand Down Expand Up @@ -115,6 +117,8 @@ public View inflate(@NonNull Context context) {

rootLayout.setBackground(gd);

setRootViewOutlineProvider(rootView);

listView.setDividerHeight(0);
setLoading(true);

Expand All @@ -127,6 +131,8 @@ public View inflate(@NonNull Context context) {
}
});



return rootLayout;
}

Expand All @@ -137,6 +143,8 @@ public void onApplyColorScheme(@NonNull EditorColorScheme colorScheme) {
gd.setStroke(1, colorScheme.getColor(EditorColorScheme.COMPLETION_WND_CORNER));
gd.setColor(colorScheme.getColor(EditorColorScheme.COMPLETION_WND_BACKGROUND));
rootView.setBackground(gd);

setRootViewOutlineProvider(rootView);
}

@Override
Expand Down Expand Up @@ -170,6 +178,16 @@ private void performScrollList(int offset) {
ev.recycle();
}

private void setRootViewOutlineProvider(View rootView) {
rootView.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, view.getContext().getResources().getDisplayMetrics()));
}
});
rootView.setClipToOutline(true);
}

@Override
public void ensureListPositionVisible(int position, int increment) {
listView.post(() -> {
Expand Down

0 comments on commit 10edbb3

Please # to comment.