The statistics sheet is now scrollable if necessary - for example in landscape view (see issue #8). On larger screen (e.g. tablets) the sheet now has maximum width

This commit is contained in:
y20k 2017-01-20 13:34:37 +01:00
parent 2d2fb7b21f
commit cb56291dee
3 changed files with 164 additions and 154 deletions

View file

@ -141,7 +141,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
// get views
View mStatisticsView = mRootView.findViewById(R.id.statistics_view);
View statisticsView = mRootView.findViewById(R.id.statistics_view);
mDistanceView = (TextView) mRootView.findViewById(R.id.statistics_data_distance);
mStepsView = (TextView) mRootView.findViewById(R.id.statistics_data_steps);
mWaypointsView = (TextView) mRootView.findViewById(R.id.statistics_data_waypoints);
@ -193,7 +193,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
});
// react to tap on sheet heading
mStatisticsView.setOnClickListener(new View.OnClickListener() {
statisticsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LogHelper.v(LOG_TAG,"Statistics view tapped");

View file

@ -18,7 +18,7 @@
<!-- BOTTOM SHEET -->
<android.support.v4.widget.NestedScrollView
android:id="@+id/statistics_sheet"
android:layout_width="match_parent"
android:layout_width="@dimen/bottom_sheet_width"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:background="@color/trackbook_blue_85percent"
@ -26,10 +26,14 @@
app:behavior_peekHeight="132dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
@ -169,7 +173,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp">
android:layout_marginTop="4dp"
android:layout_marginBottom="48dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -188,6 +193,10 @@
</LinearLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

View file

@ -1,8 +1,9 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<item name="custom_match_parent" type="dimen">-1</item> <!-- CUSTOM MATCH_PARENT - see https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<dimen name="bottom_sheet_width">0dp</dimen> <!-- MATCH_PARENT -->
<dimen name="bottom_sheet_width">@dimen/custom_match_parent</dimen>
</resources>