changed layout and behavior of statistics sheet - plus: some accessibility descriptions

master
y20k 2016-12-05 15:10:24 +01:00
parent 4905e4258d
commit c19cf469d3
10 changed files with 159 additions and 36 deletions

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 25 compileSdkVersion 25
buildToolsVersion "24.0.3" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
applicationId "org.y20k.trackbook" applicationId "org.y20k.trackbook"
@ -21,10 +21,10 @@ android {
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0' compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.0' compile 'com.android.support:design:25.0.1'
compile 'org.osmdroid:osmdroid-android:5.5:release@aar' compile 'org.osmdroid:osmdroid-android:5.5:release@aar'
compile 'com.google.code.gson:gson:2.7' compile 'com.google.code.gson:gson:2.8.0'
} }

View File

@ -20,8 +20,10 @@ import android.app.Activity;
import android.location.Location; import android.location.Location;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -59,6 +61,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
private MapView mMapView; private MapView mMapView;
private IMapController mController; private IMapController mController;
private ItemizedIconOverlay mTrackOverlay; private ItemizedIconOverlay mTrackOverlay;
private View mStaticticsView;
private TextView mDistanceView; private TextView mDistanceView;
private TextView mStepsView; private TextView mStepsView;
private TextView mWaypointsView; private TextView mWaypointsView;
@ -66,6 +69,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
private TextView mRecordingStartView; private TextView mRecordingStartView;
private TextView mRecordingStopView; private TextView mRecordingStopView;
private View mStatisticsSheet; private View mStatisticsSheet;
private Snackbar mStatisticsSnackbar;
private BottomSheetBehavior mStatisticsSheetBehavior; private BottomSheetBehavior mStatisticsSheetBehavior;
private Track mTrack; private Track mTrack;
@ -120,13 +124,14 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
// get views // get views
mStaticticsView = mRootView.findViewById(R.id.statistics_view);
mDistanceView = (TextView) mRootView.findViewById(R.id.statistics_data_distance); mDistanceView = (TextView) mRootView.findViewById(R.id.statistics_data_distance);
mStepsView = (TextView) mRootView.findViewById(R.id.statistics_data_steps); mStepsView = (TextView) mRootView.findViewById(R.id.statistics_data_steps);
mWaypointsView = (TextView) mRootView.findViewById(R.id.statistics_data_waypoints); mWaypointsView = (TextView) mRootView.findViewById(R.id.statistics_data_waypoints);
mDurationView = (TextView) mRootView.findViewById(R.id.statistics_data_duration); mDurationView = (TextView) mRootView.findViewById(R.id.statistics_data_duration);
mRecordingStartView = (TextView) mRootView.findViewById(R.id.statistics_data_recording_start); mRecordingStartView = (TextView) mRootView.findViewById(R.id.statistics_data_recording_start);
mRecordingStopView = (TextView) mRootView.findViewById(R.id.statistics_data_recording_stop); mRecordingStopView = (TextView) mRootView.findViewById(R.id.statistics_data_recording_stop);
mStatisticsSheet = mRootView.findViewById(R.id.statistic_sheet); mStatisticsSheet = mRootView.findViewById(R.id.statistics_sheet);
if (mTrack == null) { if (mTrack == null) {
// load track and display map and statistics // load track and display map and statistics
@ -139,7 +144,46 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
// show statistics sheet // show statistics sheet
mStatisticsSheetBehavior = BottomSheetBehavior.from(mStatisticsSheet); mStatisticsSheetBehavior = BottomSheetBehavior.from(mStatisticsSheet);
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
mStatisticsSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
// react to state change
switch (newState) {
case BottomSheetBehavior.STATE_EXPANDED:
LogHelper.v(LOG_TAG,"Statistics sheet expanded");
break;
case BottomSheetBehavior.STATE_COLLAPSED:
LogHelper.v(LOG_TAG,"Statistics sheet collapsed");
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
case BottomSheetBehavior.STATE_HIDDEN:
LogHelper.v(LOG_TAG,"Statistics sheet hidden");
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
default:
break;
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
// react to dragging events
}
});
// react to tap on sheet heading
mStaticticsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LogHelper.v(LOG_TAG,"Statistics view tapped");
if (mStatisticsSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
} else {
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
}
});
return mRootView; return mRootView;
} }

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/trackbook_white"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM9,17L7,17v-7h2v7zM13,17h-2L11,7h2v10zM17,17h-2v-4h2v4z"/>
</vector>

View File

@ -11,6 +11,7 @@
<org.osmdroid.views.MapView android:id="@+id/map" <org.osmdroid.views.MapView android:id="@+id/map"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" /> android:layout_height="fill_parent"
android:contentDescription="@string/descr_map_current_track" />
</LinearLayout> </LinearLayout>

View File

@ -8,39 +8,59 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivityMapFragment"> tools:context=".MainActivityMapFragment">
<!-- MAP VIEW --> <!-- MAP VIEW -->
<org.osmdroid.views.MapView <org.osmdroid.views.MapView
android:id="@+id/track_map" android:id="@+id/track_map"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" /> android:layout_height="fill_parent"
android:contentDescription="@string/descr_map_last_track" />
<!-- TODO ADD android:contentDescription="@string/descr_xyz" -->
<!-- BOTTOM SHEET --> <!-- BOTTOM SHEET -->
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:id="@+id/statistic_sheet" android:id="@+id/statistics_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="350dp" android:layout_height="match_parent"
android:clipToPadding="true" android:layout_gravity="bottom"
android:background="@color/trackbook_grey_85percent" android:background="@color/trackbook_blue_85percent"
app:behavior_hideable="true"
app:behavior_peekHeight="132dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"> app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:scrollbars="vertical"> android:scrollbars="vertical">
<TextView <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:orientation="horizontal"
android:textAppearance="@android:style/TextAppearance.Large.Inverse" android:layout_marginBottom="8dp">
android:textStyle="bold" <TextView
android:text="@string/statistics_sheet_h1_statistics"/> android:id="@+id/statistics_view"
android:layout_width="0dp"
android:layout_height="match_parent"
android:textAppearance="@android:style/TextAppearance.Large.Inverse"
android:layout_weight="1"
android:gravity="start|center"
android:textStyle="bold"
android:textAllCaps="true"
android:text="@string/statistics_sheet_h1_statistics"
android:contentDescription="@string/descr_statistics_sheet_headline" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end|center"
android:background="@drawable/ic_statistics_white_48dp"
android:contentDescription="@string/descr_statistics_sheet_icon" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -52,13 +72,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_distance" android:text="@string/statistics_sheet_p_distance"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_distance" />
<TextView <TextView
android:id="@+id/statistics_data_distance" android:id="@+id/statistics_data_distance"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_distance_value" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -71,13 +93,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_steps" android:text="@string/statistics_sheet_p_steps"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_steps" />
<TextView <TextView
android:id="@+id/statistics_data_steps" android:id="@+id/statistics_data_steps"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_steps_value" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -90,13 +114,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_waypoints" android:text="@string/statistics_sheet_p_waypoints"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints" />
<TextView <TextView
android:id="@+id/statistics_data_waypoints" android:id="@+id/statistics_data_waypoints"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints_value" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -109,13 +135,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_duration" android:text="@string/statistics_sheet_p_duration"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_duration" />
<TextView <TextView
android:id="@+id/statistics_data_duration" android:id="@+id/statistics_data_duration"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_duration_value" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -128,13 +156,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_recording_start" android:text="@string/statistics_sheet_p_recording_start"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_recording_start" />
<TextView <TextView
android:id="@+id/statistics_data_recording_start" android:id="@+id/statistics_data_recording_start"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_recording_start_value" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -147,18 +177,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_recording_stop" android:text="@string/statistics_sheet_p_recording_stop"
android:textAppearance="@android:style/TextAppearance.Small.Inverse" /> android:textAppearance="@android:style/TextAppearance.Small.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_recording_end" />
<TextView <TextView
android:id="@+id/statistics_data_recording_stop" android:id="@+id/statistics_data_recording_stop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/statistics_sheet_p_default_data" android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" /> android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:contentDescription="@string/descr_statistics_sheet_p_recording_end_value" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -90,4 +90,22 @@
<string name="infosheet_about_h3_external">Berechtigung WRITE_EXTERNAL_STORAGE</string> <string name="infosheet_about_h3_external">Berechtigung WRITE_EXTERNAL_STORAGE</string>
<string name="infosheet_about_p_external">Trackbook nutzt osmdroid. osmdroid speichert Kartendaten im Externen Speicher von Android. Der Karten-Cache befindet sich im Ordner osmdroid auf der obersten Ebene des für Nutzer sichtbaren Dateisystems.</string> <string name="infosheet_about_p_external">Trackbook nutzt osmdroid. osmdroid speichert Kartendaten im Externen Speicher von Android. Der Karten-Cache befindet sich im Ordner osmdroid auf der obersten Ebene des für Nutzer sichtbaren Dateisystems.</string>
<!-- descriptions -->
<string name="descr_map_current_track">Karte der aktuellen Aufzeichnung</string>
<string name="descr_map_last_track">Karte der letzten Aufzeichnung</string>
<string name="descr_statistics_sheet_headline">Überschrift der Statistik-Einblendung</string>
<string name="descr_statistics_sheet_icon">Icon Balkendiagramm</string>
<string name="descr_statistics_sheet_p_distance">Datenpunkt: Distanz</string>
<string name="descr_statistics_sheet_p_steps">Datenpunkt: Schritte</string>
<string name="descr_statistics_sheet_p_waypoints">Datenpunkt: Wegpunkte</string>
<string name="descr_statistics_sheet_p_duration">Datenpunkt: Dauer</string>
<string name="descr_statistics_sheet_p_recording_start">Datenpunkt: Start der Aufzeichnung</string>
<string name="descr_statistics_sheet_p_recording_end">Datenpunkt: Ende der Aufzeichnung</string>
<string name="descr_statistics_sheet_p_distance_value">Wert: Distanz</string>
<string name="descr_statistics_sheet_p_steps_value">Wert: Schritte</string>
<string name="descr_statistics_sheet_p_waypoints_value">Wert: Wegpunkte</string>
<string name="descr_statistics_sheet_p_duration_value">Wert: Dauer</string>
<string name="descr_statistics_sheet_p_recording_start_value">Wert: Start der Aufzeichnung</string>
<string name="descr_statistics_sheet_p_recording_end_value">Wert: Ende der Aufzeichnung</string>
</resources> </resources>

View File

@ -3,4 +3,5 @@
(such as screen margins) for screens with more than 820dp of available width. This (such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen> <dimen name="activity_horizontal_margin">64dp</dimen>
<dimen name="bottom_sheet_width">600dp</dimen>
</resources> </resources>

View File

@ -8,6 +8,7 @@
<color name="trackbook_blue">#FF2095F2</color> <color name="trackbook_blue">#FF2095F2</color>
<color name="trackbook_blue_dark">#FF12537F</color> <color name="trackbook_blue_dark">#FF12537F</color>
<color name="trackbook_blue_85percent">#D92095F2</color>
<color name="trackbook_white">#FFFFFFFF</color> <color name="trackbook_white">#FFFFFFFF</color>

View File

@ -4,4 +4,5 @@
<dimen name="activity_vertical_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen> <dimen name="appbar_padding_top">8dp</dimen>
<dimen name="bottom_sheet_width">0dp</dimen> <!-- MATCH_PARENT -->
</resources> </resources>

View File

@ -59,7 +59,6 @@
<string name="statistics_sheet_p_recording_start">Recording started:</string> <string name="statistics_sheet_p_recording_start">Recording started:</string>
<string name="statistics_sheet_p_recording_stop">Recording stopped:</string> <string name="statistics_sheet_p_recording_stop">Recording stopped:</string>
<!-- onboarding layout --> <!-- onboarding layout -->
<string name="layout_onboarding_h1_welcome">Hello</string> <string name="layout_onboarding_h1_welcome">Hello</string>
<string name="layout_onboarding_description_app_icon">Trackbook App Icon</string> <string name="layout_onboarding_description_app_icon">Trackbook App Icon</string>
@ -91,4 +90,22 @@
<string name="infosheet_about_h3_external">Permission WRITE_EXTERNAL_STORAGE</string> <string name="infosheet_about_h3_external">Permission WRITE_EXTERNAL_STORAGE</string>
<string name="infosheet_about_p_external">Trackbook uses osmdroid, which caches map tiles on Android\'s external storage. You can find the map cache in the osmdroid folder on the top level of the user-facing file system.</string> <string name="infosheet_about_p_external">Trackbook uses osmdroid, which caches map tiles on Android\'s external storage. You can find the map cache in the osmdroid folder on the top level of the user-facing file system.</string>
<!-- descriptions -->
<string name="descr_map_current_track">Map of the current track</string>
<string name="descr_map_last_track">Map of the last track</string>
<string name="descr_statistics_sheet_headline">Headline of the statistics sheet</string>
<string name="descr_statistics_sheet_icon">Icon of a bar chart</string>
<string name="descr_statistics_sheet_p_distance">Data point: distance</string>
<string name="descr_statistics_sheet_p_steps">Data point: steps</string>
<string name="descr_statistics_sheet_p_waypoints">Data point: waypoints</string>
<string name="descr_statistics_sheet_p_duration">Data point: duration</string>
<string name="descr_statistics_sheet_p_recording_start">Data point: start of recording</string>
<string name="descr_statistics_sheet_p_recording_end">Data point: end of recording</string>
<string name="descr_statistics_sheet_p_distance_value">Value: distance</string>
<string name="descr_statistics_sheet_p_steps_value">Value: steps</string>
<string name="descr_statistics_sheet_p_waypoints_value">Value: waypoints</string>
<string name="descr_statistics_sheet_p_duration_value">Value: duration</string>
<string name="descr_statistics_sheet_p_recording_start_value">Value: start of recording</string>
<string name="descr_statistics_sheet_p_recording_end_value">Value: end of recording</string>
</resources> </resources>