osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.66k stars 1.02k forks source link

Allow to add panels full width #21130

Closed vshcherb closed 1 week ago

vshcherb commented 1 week ago
  1. Plus rename class to ButtonPositionSize -> WidgetPositionSize
  2. Create unit test for this case

    
    public static void main(String[] args) {
        List<ButtonPositionSize> lst = defaultLayoutExample();
        for (ButtonPositionSize b : lst) {
            System.out.println(b);
        }
        System.out.println("--------");
        ButtonPositionSize.computeNonOverlap(0, lst);
        for (ButtonPositionSize b : lst) {
            System.out.println(b);
        }   
    }
    
    public static List<ButtonPositionSize> defaultLayoutExample() {
        List<ButtonPositionSize> lst = new ArrayList<ButtonPositionSize>();
        lst.add(new ButtonPositionSize("topPanel", 7, ButtonPositionSize.POS_FULL_WIDTH, ButtonPositionSize.POS_TOP).
                setMoveDescendantsVertical());
    
        lst.add(new ButtonPositionSize("leftWid", 7, ButtonPositionSize.POS_LEFT, ButtonPositionSize.POS_TOP).
                setMoveDescendantsVertical().setSize(10, 10));
    
        lst.add(new ButtonPositionSize("zoomOut", 7, false, false).setMoveVertical());
        lst.add(new ButtonPositionSize("zoomIn", 7, false, false).setMoveVertical());
        lst.add(new ButtonPositionSize("myLoc", 7, false, false).setMoveHorizontal());
    
        lst.add(new ButtonPositionSize("drawer", 7, true, false).setMoveHorizontal());
        lst.add(new ButtonPositionSize("navigation", 7, true, false).setMoveHorizontal());
        lst.add(new ButtonPositionSize("ruler", 10, true, false).setMoveHorizontal());
    
        lst.add(new ButtonPositionSize("configMap", 6, true, true).setMoveHorizontal());
        lst.add(new ButtonPositionSize("search", 6, true, true).setMoveHorizontal());
        lst.add(new ButtonPositionSize("compass", 6, true, true).setMoveVertical());
        return lst;
    }