diff --git a/app/src/main/java/org/y20k/trackbook/MainActivity.java b/app/src/main/java/org/y20k/trackbook/MainActivity.java
index 01cfda9..13458e2 100755
--- a/app/src/main/java/org/y20k/trackbook/MainActivity.java
+++ b/app/src/main/java/org/y20k/trackbook/MainActivity.java
@@ -445,7 +445,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
} else {
// point to the on main onboarding layout
- setContentView(R.layout.activity_main_onboarding);
+ setContentView(R.layout.main_onboarding);
// show the okay button and attach listener
Button okayButton = (Button) findViewById(R.id.button_okay);
diff --git a/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java b/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java
index 621d830..f54dd9d 100755
--- a/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java
+++ b/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java
@@ -100,9 +100,8 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
private TextView mPositiveElevationView;
private TextView mNegativeElevationView;
private Group mElevationDataViews;
+ private Group mStatisticsHeaderViews;
private BottomSheetBehavior mStatisticsSheetBehavior;
- private int mCurrentLengthUnit;
- private int mOppositeLengthUnit;
private int mCurrentTrack;
private Track mTrack;
private BroadcastReceiver mTrackSavedReceiver;
@@ -225,6 +224,7 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
mPositiveElevationView = (TextView) mRootView.findViewById(R.id.statistics_data_positive_elevation);
mNegativeElevationView = (TextView) mRootView.findViewById(R.id.statistics_data_negative_elevation);
mElevationDataViews = (Group) mRootView.findViewById(R.id.elevation_data);
+ mStatisticsHeaderViews = (Group) mRootView.findViewById(R.id.statistics_header);
// display map and statistics
@@ -245,23 +245,17 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
mStatisticsSheetBehavior = BottomSheetBehavior.from(mStatisticsSheet);
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
mStatisticsSheetBehavior.setBottomSheetCallback(getStatisticsSheetCallback());
- // todo attach listener to title and (i)icon
-// mStatisticsView.setOnClickListener(new View.OnClickListener() {
-// @Override
-// public void onClick(View view) {
-// if (mStatisticsSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
-// mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
-// } else {
-// mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
-// }
-// }
-// });
// attach listener for taps on elevation views
attachTapListenerToElevationViews();
- // attach listener for taps on statistics
- attachTapListenerToStatisticsSheet();
+ // attach listener for taps on statistics sheet header
+ attachTapListenerToStatisticHeaderViews();
+
+ // attach listener for taps on statistics - for US and other states plagued by Imperial units
+ if (LengthUnitHelper.getUnitSystem() == IMPERIAL) {
+ attachTapListenerToStatisticsSheet();
+ }
return mRootView;
}
@@ -605,6 +599,24 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
}
+ /* Add tap listener to statistic header views */
+ private void attachTapListenerToStatisticHeaderViews() {
+ int referencedIds[] = mStatisticsHeaderViews.getReferencedIds();
+ for (int id : referencedIds) {
+ mRootView.findViewById(id).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (mStatisticsSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
+ mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
+ } else {
+ mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
+ }
+ }
+ });
+ }
+ }
+
+
/* Add tap listener to statistics sheet */
private void attachTapListenerToStatisticsSheet() {
mStatisticsView.setOnTouchListener(new View.OnTouchListener() {
diff --git a/app/src/main/res/layout/fragment_main_track.xml b/app/src/main/res/layout/fragment_main_track.xml
index 2e94360..cc0d944 100644
--- a/app/src/main/res/layout/fragment_main_track.xml
+++ b/app/src/main/res/layout/fragment_main_track.xml
@@ -21,10 +21,10 @@
android:contentDescription="@string/descr_map_last_track" />
-
+
-
+
@@ -44,7 +44,7 @@
android:layout_height="match_parent">
-
+
diff --git a/app/src/main/res/layout/activity_main_onboarding.xml b/app/src/main/res/layout/main_onboarding.xml
similarity index 100%
rename from app/src/main/res/layout/activity_main_onboarding.xml
rename to app/src/main/res/layout/main_onboarding.xml
diff --git a/app/src/main/res/layout/fragment_main_track_management.xml b/app/src/main/res/layout/track_management.xml
similarity index 100%
rename from app/src/main/res/layout/fragment_main_track_management.xml
rename to app/src/main/res/layout/track_management.xml
diff --git a/app/src/main/res/layout/fragment_main_track_onboarding.xml b/app/src/main/res/layout/track_onboarding.xml
similarity index 100%
rename from app/src/main/res/layout/fragment_main_track_onboarding.xml
rename to app/src/main/res/layout/track_onboarding.xml
diff --git a/app/src/main/res/layout/fragment_main_track_statistics.xml b/app/src/main/res/layout/track_statistics.xml
similarity index 97%
rename from app/src/main/res/layout/fragment_main_track_statistics.xml
rename to app/src/main/res/layout/track_statistics.xml
index 9eece5c..121f18f 100644
--- a/app/src/main/res/layout/fragment_main_track_statistics.xml
+++ b/app/src/main/res/layout/track_statistics.xml
@@ -2,10 +2,10 @@
+ android:layout_height="match_parent"
+ android:clickable="true"
+ android:focusable="true">
+
+
@@ -98,9 +104,9 @@
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints"
+ android:text="@string/statistics_sheet_p_waypoints"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_waypoints"
app:layout_constraintStart_toStartOf="@+id/statistics_p_steps"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_steps" />
@@ -123,9 +129,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_duration"
+ android:text="@string/statistics_sheet_p_duration"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_duration"
app:layout_constraintStart_toStartOf="@+id/statistics_p_waypoints"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_waypoints" />
@@ -148,9 +154,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_recording_start"
+ android:text="@string/statistics_sheet_p_recording_start"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_recording_start"
app:layout_constraintStart_toStartOf="@+id/statistics_p_duration"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_duration" />
@@ -173,9 +179,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_recording_end"
+ android:text="@string/statistics_sheet_p_recording_stop"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_recording_stop"
app:layout_constraintStart_toStartOf="@+id/statistics_p_recording_start"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_recording_start" />
@@ -198,9 +204,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_positive_elevation"
+ android:text="@string/statistics_sheet_p_positive_elevation"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_positive_elevation"
app:layout_constraintStart_toStartOf="@+id/statistics_p_recording_stop"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_recording_stop" />
@@ -209,9 +215,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
+ android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_default_data"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_positive_elevation"
app:layout_constraintStart_toEndOf="@+id/statistics_p_positive_elevation"
app:layout_constraintTop_toTopOf="@+id/statistics_p_positive_elevation" />
@@ -222,9 +228,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_negative_elevation"
+ android:text="@string/statistics_sheet_p_negative_elevation"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_negative_elevation"
app:layout_constraintStart_toStartOf="@+id/statistics_p_positive_elevation"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_positive_elevation" />
@@ -233,9 +239,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
+ android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_default_data"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_negative_elevation"
app:layout_constraintStart_toEndOf="@+id/statistics_p_negative_elevation"
app:layout_constraintTop_toTopOf="@+id/statistics_p_negative_elevation" />
@@ -246,9 +252,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_max_altitude"
+ android:text="@string/statistics_sheet_p_max_altitude"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_max_altitude"
app:layout_constraintStart_toStartOf="@+id/statistics_p_negative_elevation"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_negative_elevation" />
@@ -257,9 +263,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
+ android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_default_data"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_max_altitude"
app:layout_constraintStart_toEndOf="@+id/statistics_p_max_altitude"
app:layout_constraintTop_toTopOf="@+id/statistics_p_max_altitude" />
@@ -268,13 +274,11 @@
android:id="@+id/statistics_p_min_altitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_min_altitude"
+ android:text="@string/statistics_sheet_p_min_altitude"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_min_altitude"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/statistics_p_max_altitude"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_max_altitude" />
@@ -283,9 +287,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
+ android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/statistic_sheet_text"
- android:text="@string/statistics_sheet_p_default_data"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_min_altitude"
app:layout_constraintStart_toEndOf="@+id/statistics_p_min_altitude"
app:layout_constraintTop_toTopOf="@+id/statistics_p_min_altitude" />