Skip to content

Commit

Permalink
Disable map tab if no MapBox key
Browse files Browse the repository at this point in the history
Prepare for 2.0.1.4
  • Loading branch information
gerhardol committed Jul 20, 2019
1 parent 496202b commit 6f75f8d
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 37 deletions.
19 changes: 14 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,36 @@ android.applicationVariants.all {
if (rootProject.file("mapbox.properties").exists()) {
// https://www.mapbox.com/account/
props.load(new FileInputStream(rootProject.file("mapbox.properties")))
buildConfigField 'int', 'MAPBOX_ENABLED', "1"
buildConfigField 'String', 'MAPBOX_ACCESS_TOKEN', props.mapboxAccessToken
}
else {
// Invalid token, no map
buildConfigField 'String', 'MAPBOX_ACCESS_TOKEN', '"pk.eyJ1IjoiY3FucXJkIiwiYSI6ImJmYjcxNDkyZjJiNzllMzYxYjA0NjA1YTI0Mzg4ODA4In0.N9lbcSp06JqIpFSP5X44Fw"'
buildConfigField 'int', 'MAPBOX_ENABLED', "0"
buildConfigField 'String', 'MAPBOX_ACCESS_TOKEN', '""'
}

if (rootProject.file("runalyze.properties").exists()) {
// Contact Runalyze team at https://forum.runalyze.com/
props.load(new FileInputStream(rootProject.file("runalyze.properties")))
buildConfigField 'int', 'RUNALYZE_ENABLED', "1"
buildConfigField 'String', 'RUNALYZE_ID', props.CLIENT_ID
buildConfigField 'String', 'RUNALYZE_SECRET', props.CLIENT_SECRET
}
else {
// Demo, used to testing.runalyze.com
// Demo, connect to testing.runalyze.com
buildConfigField 'int', 'RUNALYZE_ENABLED', "0"
buildConfigField 'String', 'RUNALYZE_ID', "\"8_2jx5jt9r39ic40ooc80c8c0884okgk0owsowg808c4csg8ko8g\""
buildConfigField 'String', 'RUNALYZE_SECRET', "\"1v7d6nwe1v9c8skok44g0gc8cc04cc0wwwo8swwgckoogwsww4\""
buildConfigField 'String', 'RUNALYZE_ID', '"8_2jx5jt9r39ic40ooc80c8c0884okgk0owsowg808c4csg8ko8g"'
buildConfigField 'String', 'RUNALYZE_SECRET', '"1v7d6nwe1v9c8skok44g0gc8cc04cc0wwwo8swwgckoogwsww4"'
}

if (rootProject.file("dropbox.properties").exists()) {
// Create an app at https://www.dropbox.com/developers/apps/
// Dropbox API, App folder -> create app
// Enable additional users, Redirect URI:http://localhost:8080/runnerup/dropbox, Disallow implicit grant
// Set branding icon
// Create dropbox.properties with two lines:
// CLIENT_ID="replace_dropbox_id"
// CLIENT_SECRET="replace_dropbox_secret"
props.load(new FileInputStream(rootProject.file("dropbox.properties")))
buildConfigField 'int', 'DROPBOX_ENABLED', "1"
buildConfigField 'String', 'DROPBOX_ID', props.CLIENT_ID
Expand Down
28 changes: 14 additions & 14 deletions app/res/layout/detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@
android:layout_weight="1" />
</LinearLayout>

<include
android:id="@+id/tab_map"
layout="@layout/map_area"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<LinearLayout
android:id="@+id/tab_graph"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1"
android:layout_margin="@dimen/activity_margin"/>

<LinearLayout
android:id="@+id/tab_upload"
android:layout_width="match_parent"
Expand All @@ -178,20 +192,6 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>

<LinearLayout
android:id="@+id/tab_graph"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1"
android:layout_margin="@dimen/activity_margin"/>

<include
android:id="@+id/tab_map"
layout="@layout/map_area"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</LinearLayout>
</TabHost>
Expand Down
236 changes: 236 additions & 0 deletions app/res/layout/detail_nomap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2012 - 2013 [email protected]
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<LinearLayout
android:id="@+id/appbarlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:orientation="vertical"
tools:ignore="UnusedAttribute">

<android.support.v7.widget.Toolbar
android:id="@+id/actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="48dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">

<TextView
android:id="@+id/activity_distance"
style="@style/AppBarStatisticsText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="center" />

<View
android:layout_width="1dp"
android:layout_height="16dp"
android:background="@android:color/white" />

<TextView
android:id="@+id/activity_time"
style="@style/AppBarStatisticsText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="center" />

<View
android:id="@+id/activity_pace_separator"
android:layout_width="1dp"
android:layout_height="16dp"
android:gravity="center"
android:background="@android:color/white" />

<TextView
android:id="@+id/activity_pace"
style="@style/AppBarStatisticsText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>

<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/buttons"
android:layout_below="@id/appbarlayout">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/tab_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="@dimen/activity_margin">

<org.runnerup.widget.TitleSpinner
android:id="@+id/summary_sport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1px"
android:entries="@array/sportEntries"
android:prompt="@string/Type"
android:text="@string/Sport" />

<EditText
android:id="@+id/notes_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|left"
android:hint="@string/Notes_about_your_workout"
android:inputType="textCapSentences|textMultiLine"
android:minLines="4"
android:singleLine="false"
tools:ignore="AutoFill" />

<LinearLayout
android:id="@+id/hrzonesBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
android:visibility="gone">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/Heartrate_zones_distribution"
android:textAlignment="center"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/tab_lap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:layout_margin="@dimen/activity_margin">

<ListView
android:id="@+id/laplist"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>

<LinearLayout
android:id="@+id/tab_graph"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1"
android:layout_margin="@dimen/activity_margin"/>

<LinearLayout
android:id="@+id/tab_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:layout_margin="@dimen/activity_margin">

<ListView
android:id="@+id/report_list"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>

<LinearLayout
android:id="@+id/buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">

<Button
android:id="@+id/resume_button"
style="@style/ButtonText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_blue"
android:drawablePadding="-32dp"
android:drawableRight="@drawable/ic_av_play_arrow"
android:text="@string/Resume" />

<Button
android:id="@+id/upload_button"
style="@style/ButtonText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_blue"
android:singleLine="false"
android:text="@string/Upload_activity" />

<Button
android:id="@+id/save_button"
style="@style/ButtonText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_green"
android:text="@string/Save_activity" />

<Button
android:id="@+id/discard_button"
style="@style/ButtonText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_red"
android:text="@string/Discard_activity" />
</LinearLayout>

</RelativeLayout>
Loading

0 comments on commit 6f75f8d

Please sign in to comment.