Add default height states for gpx menu tabs
This commit is contained in:
parent
b3a712c47a
commit
12c3851c5b
2 changed files with 38 additions and 1 deletions
|
@ -946,6 +946,11 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
protected void runLayoutListener() {
|
protected void runLayoutListener() {
|
||||||
|
runLayoutListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
|
protected void runLayoutListener(final Runnable runnable) {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@ -974,6 +979,9 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
int menuState = getCurrentMenuState();
|
int menuState = getCurrentMenuState();
|
||||||
listener.onContextMenuStateChanged(ContextMenuFragment.this, menuState, menuState);
|
listener.onContextMenuStateChanged(ContextMenuFragment.this, menuState, menuState);
|
||||||
}
|
}
|
||||||
|
if (runnable != null) {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -270,7 +270,18 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
setupButtons(view);
|
setupButtons(view);
|
||||||
runLayoutListener();
|
runLayoutListener(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (menuType == TrackMenuType.OPTIONS) {
|
||||||
|
openMenuFullScreen();
|
||||||
|
} else if (menuType == TrackMenuType.OVERVIEW) {
|
||||||
|
openMenuHeaderOnly();
|
||||||
|
} else {
|
||||||
|
openMenuHalfScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -837,6 +848,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
menuType = type;
|
menuType = type;
|
||||||
setupCards();
|
setupCards();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
|
updateMenuState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -845,6 +857,23 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void updateMenuState() {
|
||||||
|
runLayoutListener(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (menuType == TrackMenuType.OPTIONS) {
|
||||||
|
openMenuFullScreen();
|
||||||
|
} else if (menuType == TrackMenuType.OVERVIEW) {
|
||||||
|
openMenuHeaderOnly();
|
||||||
|
} else {
|
||||||
|
openMenuHalfScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateContent() {
|
public void updateContent() {
|
||||||
if (segmentsCard != null) {
|
if (segmentsCard != null) {
|
||||||
|
|
Loading…
Reference in a new issue