some finishing tablet adaptations + constraint layout - yay

This commit is contained in:
y20k 2017-12-19 16:52:01 +01:00
parent bbf018d5b8
commit 3bf409dbbf
7 changed files with 234 additions and 229 deletions

View file

@ -26,6 +26,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.design.widget.BottomSheetBehavior;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
@ -37,7 +38,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
@ -80,10 +80,10 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
private IMapController mController;
private ItemizedIconOverlay mTrackOverlay;
private DropdownAdapter mDropdownAdapter;
private LinearLayout mTrackManagementLayout;
private ConstraintLayout mTrackManagementLayout;
private Spinner mDropdown;
private View mStatisticsSheet;
private ImageView mStatisticsIcon;
private ImageButton mStatisticsIcon;
private TextView mStatisticsHeadline;
private TextView mDistanceView;
private TextView mStepsView;
@ -188,7 +188,7 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
}
// get views for track selector
mTrackManagementLayout = (LinearLayout) mRootView.findViewById(R.id.track_management_layout);
mTrackManagementLayout = (ConstraintLayout) mRootView.findViewById(R.id.track_management_layout);
mDropdown = (Spinner) mRootView.findViewById(R.id.track_selector);
// attach listeners to export and delete buttons

View file

@ -3,7 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivityMapFragment">
@ -12,59 +11,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- MAP VIEW -->
<!-- OSM MAP -->
<org.osmdroid.views.MapView
android:id="@+id/track_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/descr_map_last_track" />
<!-- OPTIONAL ONBOARDING -->
<include layout="@layout/fragment_main_track_onboarding" />
<!-- TRACK SELECTION -->
<LinearLayout
android:id="@+id/track_management_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:orientation="horizontal"
android:background="@color/trackbook_white">
<Spinner
android:id="@+id/track_selector"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start|center"
android:theme="@style/TrackbookAppTheme.PopupOverlay"
android:contentDescription="@string/descr_track_selector" />
<ImageButton
android:visibility="visible"
android:id="@+id/export_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_file_download_grey_24dp"
android:background="@android:color/transparent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:contentDescription="@string/descr_export_button" />
<ImageButton
android:visibility="visible"
android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:src="@drawable/ic_delete_forever_grey_24dp"
android:background="@android:color/transparent"
android:contentDescription="@string/descr_delete_button" />
</LinearLayout>
<!-- TRACK MANAGEMENT -->
<include layout="@layout/fragment_main_track_management" />
</RelativeLayout>
@ -73,7 +33,7 @@
android:id="@+id/statistics_sheet"
android:layout_width="@dimen/bottom_sheet_width"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_gravity="center_horizontal"
android:background="@color/trackbook_white"
app:behavior_hideable="false"
app:behavior_peekHeight="112dp"
@ -83,181 +43,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:id="@+id/statistics_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:orientation="horizontal">
<TextView
android:id="@+id/statistics_headline"
android:layout_width="0dp"
android:layout_height="match_parent"
android:textAppearance="@android:style/TextAppearance.Medium"
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:id="@+id/statistics_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end|center"
android:contentDescription="@string/descr_statistics_sheet_icon"
app:srcCompat="@drawable/ic_info_grey_24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_distance"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_distance_value" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_steps"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_steps_value" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_waypoints"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints_value" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="8dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_duration"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_duration_value" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_recording_start"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_recording_start_value" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginBottom="48dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="@string/statistics_sheet_p_recording_stop"
android:textAppearance="@android:style/TextAppearance.Small"
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"
android:contentDescription="@string/descr_statistics_sheet_p_recording_end_value" />
</LinearLayout>
</LinearLayout>
<!-- STATISTICS -->
<include layout="@layout/fragment_main_track_statistics" />
</ScrollView>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/track_management_layout"
android:layout_width="@dimen/bottom_sheet_width"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@color/trackbook_white">
<Spinner
android:id="@+id/track_selector"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/export_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/export_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@color/trackbook_transparent"
android:contentDescription="@string/descr_export_button"
app:layout_constraintBottom_toBottomOf="@+id/track_selector"
app:layout_constraintEnd_toStartOf="@+id/delete_button"
app:layout_constraintTop_toTopOf="@+id/track_selector"
app:srcCompat="@drawable/ic_file_download_grey_24dp" />
<ImageButton
android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@color/trackbook_transparent"
android:contentDescription="@string/descr_delete_button"
app:layout_constraintBottom_toBottomOf="@+id/export_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/export_button"
app:srcCompat="@drawable/ic_delete_forever_grey_24dp" />
</android.support.constraint.ConstraintLayout>

View file

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/statistics_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/statistics_headline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_headline"
android:text="@string/statistics_sheet_h1_statistics"
android:textAllCaps="true"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/statistics_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/statistics_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@color/trackbook_transparent"
android:contentDescription="@string/descr_statistics_sheet_icon"
app:layout_constraintBottom_toBottomOf="@+id/statistics_headline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/statistics_headline"
app:srcCompat="@drawable/ic_info_grey_24dp" />
<TextView
android:id="@+id/statistics_p_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:contentDescription="@string/descr_statistics_sheet_p_distance"
android:text="@string/statistics_sheet_p_distance"
android:textAppearance="@android:style/TextAppearance.Material.Small"
app:layout_constraintStart_toStartOf="@+id/statistics_headline"
app:layout_constraintTop_toBottomOf="@+id/statistics_headline" />
<TextView
android:id="@+id/statistics_data_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_distance_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_distance"
app:layout_constraintStart_toEndOf="@+id/statistics_p_distance"
app:layout_constraintTop_toTopOf="@+id/statistics_p_distance" />
<TextView
android:id="@+id/statistics_p_steps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_steps"
android:text="@string/statistics_sheet_p_steps"
app:layout_constraintStart_toStartOf="@+id/statistics_p_distance"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_distance" />
<TextView
android:id="@+id/statistics_data_steps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_steps_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_steps"
app:layout_constraintStart_toEndOf="@+id/statistics_p_steps"
app:layout_constraintTop_toTopOf="@+id/statistics_p_steps" />
<TextView
android:id="@+id/statistics_p_waypoints"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints"
android:text="@string/statistics_sheet_p_waypoints"
app:layout_constraintStart_toStartOf="@+id/statistics_p_steps"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_steps" />
<TextView
android:id="@+id/statistics_data_waypoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_waypoints_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_waypoints"
app:layout_constraintStart_toEndOf="@+id/statistics_p_waypoints"
app:layout_constraintTop_toTopOf="@+id/statistics_p_waypoints" />
<TextView
android:id="@+id/statistics_p_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_duration"
android:text="@string/statistics_sheet_p_duration"
app:layout_constraintStart_toStartOf="@+id/statistics_p_waypoints"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_waypoints" />
<TextView
android:id="@+id/statistics_data_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_duration_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_duration"
app:layout_constraintStart_toEndOf="@+id/statistics_p_duration"
app:layout_constraintTop_toTopOf="@+id/statistics_p_duration" />
<TextView
android:id="@+id/statistics_p_recording_start"
android:layout_width="wrap_content"
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"
app:layout_constraintStart_toStartOf="@+id/statistics_p_duration"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_duration" />
<TextView
android:id="@+id/statistics_data_recording_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_recording_start_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_recording_start"
app:layout_constraintStart_toEndOf="@+id/statistics_p_recording_start"
app:layout_constraintTop_toTopOf="@+id/statistics_p_recording_start" />
<TextView
android:id="@+id/statistics_p_recording_stop"
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_recording_end"
android:text="@string/statistics_sheet_p_recording_stop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/statistics_p_recording_start"
app:layout_constraintTop_toBottomOf="@+id/statistics_p_recording_start" />
<TextView
android:id="@+id/statistics_data_recording_stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:contentDescription="@string/descr_statistics_sheet_p_recording_end_value"
android:text="@string/statistics_sheet_p_default_data"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintBottom_toBottomOf="@+id/statistics_p_recording_stop"
app:layout_constraintStart_toEndOf="@+id/statistics_p_recording_stop"
app:layout_constraintTop_toTopOf="@+id/statistics_p_recording_stop" />
</android.support.constraint.ConstraintLayout>

View file

@ -120,7 +120,7 @@
<string name="descr_fab_sub_menu_label_2">Beschreibung des Zurücksetzen-Buttons</string>
<string name="descr_fab_sub_menu_button_2">kleiner Zurücksetzen-Button</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_icon">Informations-Icon</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>

View file

@ -2,6 +2,6 @@
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(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="activity_horizontal_margin">24dp</dimen>
<dimen name="bottom_sheet_width">600dp</dimen>
</resources>

View file

@ -123,7 +123,7 @@
<string name="descr_fab_sub_menu_label_2">Label of the Clear button</string>
<string name="descr_fab_sub_menu_button_2">small Clear button</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_icon">Information icon</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>