From c88b8eaa9acb28761f4774ae01896968b78b6f08 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Fri, 12 May 2017 15:26:16 +0200 Subject: [PATCH] make buttons scrollable for small heights --- .../info/nightscout/androidaps/Constants.java | 3 +- .../plugins/Overview/OverviewFragment.java | 12 +- .../layout/overview_fragment_smallheight.xml | 407 ++++++++++++++++++ 3 files changed, 420 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/overview_fragment_smallheight.xml diff --git a/app/src/main/java/info/nightscout/androidaps/Constants.java b/app/src/main/java/info/nightscout/androidaps/Constants.java index ade1571bae..51f27d84a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/Constants.java +++ b/app/src/main/java/info/nightscout/androidaps/Constants.java @@ -58,8 +58,9 @@ public class Constants { //NSClientInternal public static final int MAX_LOG_LINES = 100; - //Screen: Threshold for width to go into small width layout + //Screen: Threshold for width/height to go into small width/height layout public static final int SMALL_WIDTH = 320; + public static final int SMALL_HEIGHT = 320; //Autosens public static final double DEVIATION_TO_BE_EQUAL = 2.0; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index ba57435c7c..1ad5f46b5b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -168,6 +168,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, Button quickWizardButton; boolean smallWidth; + boolean smallHeight; + private int rangeToDisplay = 6; // for graph @@ -197,9 +199,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, final DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); int screen_width = dm.widthPixels; + int screen_height = dm.heightPixels; smallWidth = screen_width < Constants.SMALL_WIDTH; + smallHeight = screen_height < Constants.SMALL_HEIGHT; - View view = inflater.inflate(R.layout.overview_fragment, container, false); + View view; + + if(smallHeight){ + view = inflater.inflate(R.layout.overview_fragment_smallheight, container, false); + } else { + view = inflater.inflate(R.layout.overview_fragment, container, false); + } bgView = (TextView) view.findViewById(R.id.overview_bg); arrowView = (TextView) view.findViewById(R.id.overview_arrow); diff --git a/app/src/main/res/layout/overview_fragment_smallheight.xml b/app/src/main/res/layout/overview_fragment_smallheight.xml new file mode 100644 index 0000000000..deacdc16ea --- /dev/null +++ b/app/src/main/res/layout/overview_fragment_smallheight.xml @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +