From 5dc07012d2a8a40337d396fb1375ec080ca5171e Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sun, 30 Apr 2017 21:34:30 +0200 Subject: [PATCH] overview smallscreen --- .../plugins/Overview/OverviewFragment.java | 13 +++++++++++++ app/src/main/res/layout/overview_fragment.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) 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 8befbc1ede..45d248e6db 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 @@ -18,6 +18,8 @@ import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; +import android.util.DisplayMetrics; +import android.util.TypedValue; import android.view.ContextMenu; import android.view.HapticFeedbackConstants; import android.view.LayoutInflater; @@ -165,6 +167,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, Button acceptTempButton; Button quickWizardButton; + boolean smallWidth; + Handler sLoopHandler = new Handler(); Runnable sRefreshLoop = null; @@ -187,10 +191,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + //check screen width + final DisplayMetrics dm = new DisplayMetrics(); + getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); + int screen_width = dm.widthPixels; + smallWidth = screen_width < 320; + View 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); + if(smallWidth){ + arrowView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 35); + } timeAgoView = (TextView) view.findViewById(R.id.overview_timeago); deltaView = (TextView) view.findViewById(R.id.overview_delta); avgdeltaView = (TextView) view.findViewById(R.id.overview_avgdelta); diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index d49eb16eb5..3200fe5014 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -105,7 +105,7 @@ android:layout_marginTop="-15dp" android:gravity="center_vertical" android:paddingLeft="-5dp" - android:paddingRight="-10dp" + android:paddingRight="-5dp" android:text="→" android:textSize="70dp" android:textStyle="bold" />