changed layout and behavior of statistics sheet - plus: some accessibility descriptions
This commit is contained in:
parent
4905e4258d
commit
c19cf469d3
10 changed files with 159 additions and 36 deletions
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "24.0.3"
|
||||
buildToolsVersion '25.0.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.y20k.trackbook"
|
||||
|
@ -21,10 +21,10 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:25.0.0'
|
||||
compile 'com.android.support:design:25.0.0'
|
||||
compile 'com.android.support:appcompat-v7:25.0.1'
|
||||
compile 'com.android.support:design:25.0.1'
|
||||
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'
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ import android.app.Activity;
|
|||
import android.location.Location;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.BottomSheetBehavior;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -59,6 +61,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
|||
private MapView mMapView;
|
||||
private IMapController mController;
|
||||
private ItemizedIconOverlay mTrackOverlay;
|
||||
private View mStaticticsView;
|
||||
private TextView mDistanceView;
|
||||
private TextView mStepsView;
|
||||
private TextView mWaypointsView;
|
||||
|
@ -66,6 +69,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
|||
private TextView mRecordingStartView;
|
||||
private TextView mRecordingStopView;
|
||||
private View mStatisticsSheet;
|
||||
private Snackbar mStatisticsSnackbar;
|
||||
private BottomSheetBehavior mStatisticsSheetBehavior;
|
||||
private Track mTrack;
|
||||
|
||||
|
@ -120,13 +124,14 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
|||
|
||||
|
||||
// get views
|
||||
mStaticticsView = 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);
|
||||
mDurationView = (TextView) mRootView.findViewById(R.id.statistics_data_duration);
|
||||
mRecordingStartView = (TextView) mRootView.findViewById(R.id.statistics_data_recording_start);
|
||||
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) {
|
||||
// load track and display map and statistics
|
||||
|
@ -139,7 +144,46 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
|||
|
||||
// show statistics sheet
|
||||
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;
|
||||
}
|
||||
|
|
9
app/src/main/res/drawable/ic_statistics_white_48dp.xml
Normal file
9
app/src/main/res/drawable/ic_statistics_white_48dp.xml
Normal 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>
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
<org.osmdroid.views.MapView android:id="@+id/map"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/descr_map_current_track" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -8,39 +8,59 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivityMapFragment">
|
||||
|
||||
|
||||
<!-- MAP VIEW -->
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/track_map"
|
||||
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 -->
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:id="@+id/statistic_sheet"
|
||||
android:id="@+id/statistics_sheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:clipToPadding="true"
|
||||
android:background="@color/trackbook_grey_85percent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/trackbook_blue_85percent"
|
||||
app:behavior_hideable="true"
|
||||
app:behavior_peekHeight="132dp"
|
||||
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
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:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAppearance="@android:style/TextAppearance.Large.Inverse"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/statistics_sheet_h1_statistics"/>
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="8dp">
|
||||
<TextView
|
||||
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
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -52,13 +72,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_distance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
|
@ -71,13 +93,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_steps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
|
@ -90,13 +114,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_waypoints"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
|
@ -109,13 +135,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
|
@ -128,13 +156,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_recording_start"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
|
@ -147,18 +177,19 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
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
|
||||
android:id="@+id/statistics_data_recording_stop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -90,4 +90,22 @@
|
|||
<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>
|
||||
|
||||
<!-- 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>
|
|
@ -3,4 +3,5 @@
|
|||
(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). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
<dimen name="bottom_sheet_width">600dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<color name="trackbook_blue">#FF2095F2</color>
|
||||
<color name="trackbook_blue_dark">#FF12537F</color>
|
||||
<color name="trackbook_blue_85percent">#D92095F2</color>
|
||||
|
||||
<color name="trackbook_white">#FFFFFFFF</color>
|
||||
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
<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 -->
|
||||
</resources>
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
<string name="statistics_sheet_p_recording_start">Recording started:</string>
|
||||
<string name="statistics_sheet_p_recording_stop">Recording stopped:</string>
|
||||
|
||||
|
||||
<!-- onboarding layout -->
|
||||
<string name="layout_onboarding_h1_welcome">Hello</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_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>
|
||||
|
|
Loading…
Reference in a new issue