addOnGlobalLayoutListener
This commit is contained in:
parent
5782c0100d
commit
908d4d1127
4 changed files with 16 additions and 19 deletions
|
@ -58,7 +58,7 @@ public class BugBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
|
||||
View osmNoteView = View.inflate(UiUtilities.getThemedContext(app, nightMode),
|
||||
R.layout.open_osm_note_text, null);
|
||||
osmNoteView.getViewTreeObserver().addOnScrollChangedListener(getOnGlobalLayoutListener());
|
||||
osmNoteView.getViewTreeObserver().addOnGlobalLayoutListener(getOnGlobalLayoutListener());
|
||||
TextInputLayout textBox = osmNoteView.findViewById(R.id.name_text_box);
|
||||
textBox.setHint(AndroidUtils.addColon(app, R.string.osn_bug_name));
|
||||
ColorStateList colorStateList = ColorStateList.valueOf(ContextCompat
|
||||
|
@ -75,10 +75,9 @@ public class BugBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.content_padding_small)));
|
||||
}
|
||||
|
||||
private ViewTreeObserver.OnScrollChangedListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnScrollChangedListener() {
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
private ViewTreeObserver.OnGlobalLayoutListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override public void onGlobalLayout() {
|
||||
setShadowOnScrollableView();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(app, nightMode);
|
||||
View sendGpxView = themedInflater.inflate(R.layout.send_gpx_fragment, null);
|
||||
sendGpxView.getViewTreeObserver().addOnScrollChangedListener(getOnGlobalLayoutListener());
|
||||
sendGpxView.getViewTreeObserver().addOnGlobalLayoutListener(getOnGlobalLayoutListener());
|
||||
|
||||
tagsField = sendGpxView.findViewById(R.id.tags_field);
|
||||
messageField = sendGpxView.findViewById(R.id.message_field);
|
||||
|
@ -128,10 +128,10 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
items.add(titleItem);
|
||||
}
|
||||
|
||||
private ViewTreeObserver.OnScrollChangedListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnScrollChangedListener() {
|
||||
private ViewTreeObserver.OnGlobalLayoutListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
public void onGlobalLayout() {
|
||||
scrollView = getView().findViewById(R.id.scroll_view);
|
||||
if (scrollView.canScrollVertically(1) || scrollView.canScrollVertically(-1)) {
|
||||
drawTopShadow(false);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
|
|||
|
||||
final View sendOsmNoteView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||
R.layout.send_osm_note_fragment, null);
|
||||
sendOsmNoteView.getViewTreeObserver().addOnScrollChangedListener(getOnGlobalLayoutListener());
|
||||
sendOsmNoteView.getViewTreeObserver().addOnGlobalLayoutListener(getOnGlobalLayoutListener());
|
||||
|
||||
noteText = sendOsmNoteView.findViewById(R.id.note_text);
|
||||
noteText.setText(((OsmNotesPoint) poi[0]).getText());
|
||||
|
@ -150,10 +150,9 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
|
|||
items.add(bottomSheetItem);
|
||||
}
|
||||
|
||||
private ViewTreeObserver.OnScrollChangedListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnScrollChangedListener() {
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
private ViewTreeObserver.OnGlobalLayoutListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override public void onGlobalLayout() {
|
||||
setShadowOnScrollableView();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
final boolean isNightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
final View sendOsmPoiView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||
R.layout.send_poi_fragment, null);
|
||||
sendOsmPoiView.getViewTreeObserver().addOnScrollChangedListener(getOnGlobalLayoutListener());
|
||||
sendOsmPoiView.getViewTreeObserver().addOnGlobalLayoutListener(getOnGlobalLayoutListener());
|
||||
closeChangeSet = sendOsmPoiView.findViewById(R.id.close_change_set_checkbox);
|
||||
messageEditText = sendOsmPoiView.findViewById(R.id.message_field);
|
||||
String defaultChangeSet = createDefaultChangeSet(app);
|
||||
|
@ -106,10 +106,9 @@ public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
items.add(titleItem);
|
||||
}
|
||||
|
||||
private ViewTreeObserver.OnScrollChangedListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnScrollChangedListener() {
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
private ViewTreeObserver.OnGlobalLayoutListener getOnGlobalLayoutListener() {
|
||||
return new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override public void onGlobalLayout() {
|
||||
setShadowOnScrollableView();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue