In the ChartSettingsDialog, update whether to display speed

or pace when calling onPrepareDialog.

Change the x_axis.png and y_axis.png to white foreground
so they show up on the black background.

Clean up chart_settings.xml
- no need to specify minWidth by placing the title
  inside a TableLayout
- align text to the bottom of the image
This commit is contained in:
Jimmy Shih
2011-12-21 15:23:51 -08:00
parent 828949efa4
commit 5557144728
6 changed files with 133 additions and 118 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 275 B

+76 -106
View File
@@ -17,120 +17,90 @@ limitations under the License.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:minWidth="300dp"
android:orientation="vertical">
<LinearLayout
android:background="@drawable/list_bar"
<TableLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TextView
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_width="fill_parent"
android:text="@string/menu_chart_view_chart_settings"
android:textColor="#fff"
android:textSize="20sp"/>
</LinearLayout>
android:layout_width="fill_parent"
android:shrinkColumns="0"
android:stretchColumns="0">
<TableRow>
<TextView
android:background="@drawable/list_bar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingLeft="10dp"
android:text="@string/menu_chart_view_chart_settings"
android:textColor="@color/white"
android:textSize="20sp"/>
</TableRow>
</TableLayout>
<ScrollView
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent">
<TableLayout
<LinearLayout
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_width="fill_parent"
android:stretchColumns="1">
<TableRow>
<LinearLayout
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/x_axis"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/chart_settings_x_axis"
android:textSize="20sp"/>
</LinearLayout>
<RadioGroup
android:id="@+id/chart_settings_x"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<RadioButton
android:id="@+id/chart_settings_by_distance"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/chart_settings_by_distance"/>
<RadioButton
android:id="@+id/chart_settings_by_time"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/chart_settings_by_time"/>
</RadioGroup>
</LinearLayout>
</TableRow>
<TableRow>
<LinearLayout
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/y_axis"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/chart_settings_y_axis"
android:textSize="20sp" />
</LinearLayout>
<CheckBox
android:id="@+id/chart_settings_elevation"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/stat_elevation"/>
<CheckBox
android:id="@+id/chart_settings_speed"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/stat_speed"/>
<CheckBox
android:id="@+id/chart_settings_power"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_power"/>
<CheckBox
android:id="@+id/chart_settings_cadence"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_cadence"/>
<CheckBox
android:id="@+id/chart_settings_heart_rate"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_heart_rate"/>
</LinearLayout>
</TableRow>
</TableLayout>
android:orientation="vertical"
android:padding="10dp">
<!-- X axis -->
<LinearLayout style="@style/ChartSettingsAxisLayout">
<ImageView
android:src="@drawable/x_axis"
style="@style/ChartSettingsAxisImage"/>
<TextView
android:text="@string/chart_settings_x_axis"
style="@style/ChartSettingsAxisText"/>
</LinearLayout>
<RadioGroup
android:id="@+id/chart_settings_x"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<RadioButton
android:id="@+id/chart_settings_by_distance"
android:text="@string/chart_settings_by_distance"
style="@style/ChartSettingsRadioButton"/>
<RadioButton
android:id="@+id/chart_settings_by_time"
android:text="@string/chart_settings_by_time"
style="@style/ChartSettingsRadioButton"/>
</RadioGroup>
<!-- Y axis -->
<LinearLayout
android:paddingTop="10dp"
style="@style/ChartSettingsAxisLayout">
<ImageView
android:src="@drawable/y_axis"
style="@style/ChartSettingsAxisImage"/>
<TextView
android:text="@string/chart_settings_y_axis"
style="@style/ChartSettingsAxisText"/>
</LinearLayout>
<CheckBox
android:id="@+id/chart_settings_elevation"
android:text="@string/stat_elevation"
style="@style/ChartSettingsCheckbox"/>
<CheckBox
android:id="@+id/chart_settings_speed"
android:text="@string/stat_speed"
style="@style/ChartSettingsCheckbox"/>
<CheckBox
android:id="@+id/chart_settings_power"
android:text="@string/sensor_state_power"
style="@style/ChartSettingsCheckbox"/>
<CheckBox
android:id="@+id/chart_settings_cadence"
android:text="@string/sensor_state_cadence"
style="@style/ChartSettingsCheckbox"/>
<CheckBox
android:id="@+id/chart_settings_heart_rate"
android:text="@string/sensor_state_heart_rate"
style="@style/ChartSettingsCheckbox"/>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
+47 -12
View File
@@ -50,7 +50,7 @@ limitations under the License.
<item name="android:maxLines">2</item>
<item name="android:textSize">14dip</item>
</style>
<!-- Button layout -->
<style name="ButtonLayout">
<item name="android:background">@drawable/list_bar</item>
@@ -61,7 +61,7 @@ limitations under the License.
<item name="android:paddingRight">2dip</item>
<item name="android:paddingTop">4dip</item>
</style>
<!-- Button spacer -->
<style name="ButtonSpacer">
<item name="android:layout_height">wrap_content</item>
@@ -70,7 +70,42 @@ limitations under the License.
<item name="android:orientation">horizontal</item>
<item name="android:visibility">gone</item>
</style>
<!-- Chart settings axis image -->
<style name="ChartSettingsAxisImage">
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- Chart settings axis layout -->
<style name="ChartSettingsAxisLayout">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:orientation">horizontal</item>
</style>
<!-- Chart settings axis text -->
<style name="ChartSettingsAxisText">
<item name="android:gravity">bottom</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:textSize">20sp</item>
</style>
<!-- Chart settings checkbox -->
<style name="ChartSettingsCheckbox">
<item name="android:checked">true</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- Chart settings radio button -->
<style name="ChartSettingsRadioButton">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<style name="SensorStateLabel">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
@@ -95,7 +130,7 @@ limitations under the License.
<item name="android:layout_height">3dip</item>
<item name="android:layout_width">fill_parent</item>
</style>
<!-- The style for a text view for displaying a value on the statistics activity. -->
<style name="StatsRegister" parent="@android:Widget.TextView">
<item name="android:gravity">right</item>
@@ -130,7 +165,7 @@ limitations under the License.
<item name="android:layout_width">5dip</item>
<item name="android:textSize">40sp</item>
</style>
<!-- The style for the unit on the statistics activity. -->
<style name="StatsUnit" parent="@android:Widget.TextView">
<item name="android:gravity">bottom</item>
@@ -147,8 +182,8 @@ limitations under the License.
<item name="android:layout_marginBottom">-9dip</item>
<item name="android:layout_marginTop">-9dip</item>
<item name="android:textColor">@color/stat_label_text</item>
</style>
</style>
<!-- Welcome page TextView -->
<style name="WelcomeTextView">
<item name="android:layout_height">wrap_content</item>
@@ -157,13 +192,13 @@ limitations under the License.
<item name="android:paddingRight">10sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">16sp</item>
</style>
</style>
<!-- Welcome page TextView question -->
<style name="WelcomeTextView.Question">
<item name="android:paddingTop">10sp</item>
<item name="android:textStyle">bold</item>
</style>
</style>
<!-- Widget TextView -->
<style name="WidgetTextView">
@@ -172,9 +207,9 @@ limitations under the License.
<item name="android:textColor">@color/appwidget_text</item>
<item name="android:textSize">14sp</item>
</style>
<!-- Widget TextView value -->
<style name="WidgetTextView.Value">
<item name="android:width">160px</item>
</style>
</resources>
</resources>
@@ -240,6 +240,7 @@ public class ChartActivity extends Activity implements TrackDataListener {
private void prepareSettingsDialog(ChartSettingsDialog settingsDialog) {
settingsDialog.setMode(chartView.getMode());
settingsDialog.setDisplaySpeed(reportSpeed);
for (int i = 0; i < ChartView.NUM_SERIES; i++) {
settingsDialog.setSeriesEnabled(i, chartView.isChartValueSeriesEnabled(i));
}
@@ -89,6 +89,15 @@ public class ChartSettingsDialog extends Dialog {
? R.id.chart_settings_by_distance
: R.id.chart_settings_by_time);
}
/**
* Sets whether to display speed or pace.
*
* @param displaySpeed true to display speed
*/
public void setDisplaySpeed(boolean displaySpeed) {
series[ChartView.SPEED_SERIES].setText(displaySpeed ? R.string.stat_speed : R.string.stat_pace);
}
public void setSeriesEnabled(int seriesIdx, boolean enabled) {
series[seriesIdx].setChecked(enabled);