Commit f2299776 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

#909 enabled scrollbars with decreased size for mobile.

parent 7ebd1bc1
......@@ -725,12 +725,4 @@ public abstract class AbstractMenu extends Stack implements Disposable {
}
};
//////////////////////////// MENU SCROLL
public ScrollPane getScrollPaneByDevice(Actor widget){
if(TablexiaSettings.getInstance().getPlatform() != TablexiaSettings.Platform.DESKTOP)
return new ScrollPane(widget);
return new ScrollPaneWithBars(widget, false, true);
}
}
......@@ -41,6 +41,7 @@ import cz.nic.tablexia.menu.AbstractMenu;
import cz.nic.tablexia.menu.IMenuItem;
import cz.nic.tablexia.menu.main.user.UserSelectBox;
import cz.nic.tablexia.util.ui.dialog.TablexiaComponentDialog;
import cz.nic.tablexia.util.ui.scrollpane.ScrollPaneWithBars;
/**
* MainMenu container
......@@ -121,7 +122,7 @@ public class MainMenu extends AbstractMenu {
Table layoutTable = new Table();
UserSelectBox userSelectBox = new UserSelectBox(SELECTBOX_USER_HEIGHT);
scrollPane = getScrollPaneByDevice(mainMenuVerticalGroup);
scrollPane = new ScrollPaneWithBars(mainMenuVerticalGroup, false, true);
scrollPane.setFillParent(true);
scrollPaneContainer = new Container();
......
......@@ -68,6 +68,7 @@ import cz.nic.tablexia.util.ui.dialog.components.TextContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.TwoButtonContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.UserUuidSyncDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.ViewportMaximumSizeComponent;
import cz.nic.tablexia.util.ui.scrollpane.ScrollPaneWithBars;
/**
* UserMenu container
......@@ -228,7 +229,7 @@ public class UserMenu extends AbstractMenu {
menuItemsLayout.expand().fill();
}
scrollPane = getScrollPaneByDevice(menuItemsLayout);
scrollPane = new ScrollPaneWithBars(menuItemsLayout, false, true);
scrollPane.setFillParent(true);
container = new Container<>(scrollPane).fill();
container.align(Align.top);
......
......@@ -24,13 +24,16 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
/**
* Created by drahomir on 4/4/16.
*/
public class ScrollPaneWithBorders extends SpecialScrollPane{
private static final float SCROLL_SIZE = 10f;
private static final float DESKTOP_SCROLL_SIZE = 10f;
private static final float DEFAULT_SCROLL_SIZE = 3f;
private static final Color SCROLL_COLOR = new Color(0.f,0,0,0.1f);
private static final Color KNOB_COLOR = new Color(0,0,0,0.35f);
......@@ -72,7 +75,7 @@ public class ScrollPaneWithBorders extends SpecialScrollPane{
private TextureRegionDrawable getScrollRegionDrawable(Color color){
TextureRegionDrawable regionDrawable = new TextureRegionDrawable(ApplicationAtlasManager.getInstance().getColorTextureRegion(color));
regionDrawable.setMinHeight(SCROLL_SIZE);
regionDrawable.setMinHeight(TablexiaSettings.getInstance().isRunningOnMobileDevice() ? DEFAULT_SCROLL_SIZE : DESKTOP_SCROLL_SIZE);
return regionDrawable;
}
......
......@@ -22,6 +22,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
public class ScrollPaneWithBars extends ScrollPane {
......@@ -30,12 +31,16 @@ public class ScrollPaneWithBars extends ScrollPane {
HORIZONTAL, VERTICAL
}
private static final float SCROLL_SIZE = 10f;
private static final float DESKTOP_SCROLL_SIZE = 10f;
private static final float DEFAULT_SCROLL_SIZE = 3f;
private static final Color SCROLL_COLOR = new Color(0.f,0,0,0.1f);
private static final Color KNOB_COLOR = new Color(0,0,0,0.35f);
private float scrollSize;
public ScrollPaneWithBars(Actor widget, boolean hBar, boolean vBar) {
super(widget);
this.scrollSize = TablexiaSettings.getInstance().isRunningOnMobileDevice() ? DEFAULT_SCROLL_SIZE : DESKTOP_SCROLL_SIZE;
this.setStyle(initScrollPaneStyle(hBar, vBar));
this.setFadeScrollBars(false);
}
......@@ -59,8 +64,8 @@ public class ScrollPaneWithBars extends ScrollPane {
private TextureRegionDrawable getScrollRegionDrawable(Color color, ScrollPaneWithBars.OrientationType orientation){
TextureRegionDrawable regionDrawable = new TextureRegionDrawable(ApplicationAtlasManager.getInstance().getColorTextureRegion(color));
if(orientation == ScrollPaneWithBars.OrientationType.HORIZONTAL) regionDrawable.setMinHeight(SCROLL_SIZE);
else regionDrawable.setMinWidth(SCROLL_SIZE);
if(orientation == ScrollPaneWithBars.OrientationType.HORIZONTAL) regionDrawable.setMinHeight(scrollSize);
else regionDrawable.setMinWidth(scrollSize);
return regionDrawable;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment