Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_apps_DeskClock
Commits
e4a05f50
Commit
e4a05f50
authored
10 years ago
by
Budi Kusmiantoro
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Download
Plain Diff
Merge "Stopwatch lap list to continue behind FAB" into lmp-mr1-dev
parents
b90d84c3
d746c180
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
32 deletions
+69
-32
res/layout-land/stopwatch_fragment.xml
res/layout-land/stopwatch_fragment.xml
+6
-7
res/layout/lap_view.xml
res/layout/lap_view.xml
+8
-8
res/layout/stopwatch_fragment.xml
res/layout/stopwatch_fragment.xml
+0
-5
res/layout/stopwatch_spacer.xml
res/layout/stopwatch_spacer.xml
+20
-0
res/values-land/dimens.xml
res/values-land/dimens.xml
+1
-0
res/values-sw600dp-land/dimens.xml
res/values-sw600dp-land/dimens.xml
+1
-1
res/values-sw600dp/dimens.xml
res/values-sw600dp/dimens.xml
+2
-0
res/values/dimens.xml
res/values/dimens.xml
+2
-1
src/com/android/deskclock/stopwatch/StopwatchFragment.java
src/com/android/deskclock/stopwatch/StopwatchFragment.java
+29
-10
No files found.
res/layout-land/stopwatch_fragment.xml
View file @
e4a05f50
...
...
@@ -51,13 +51,12 @@
<ListView
android:id=
"@+id/laps_list"
android:layout_marginTop=
"32dip"
android:layout_marginBottom=
"48dip"
android:layout_marginStart=
"@dimen/stopwatch_list_margin_start"
android:layout_marginEnd=
"16dip"
android:layout_gravity=
"center"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_width=
"0dip"
android:layout_height=
"wrap_content"
android:layout_weight=
"2"
android:layout_marginTop=
"8dip"
android:layout_marginBottom=
"8dip"
android:layout_gravity=
"center"
/>
<Space
android:id=
"@+id/end_space"
...
...
This diff is collapsed.
Click to expand it.
res/layout/lap_view.xml
View file @
e4a05f50
...
...
@@ -16,32 +16,32 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_marginTop=
"4dip"
android:layout_marginBottom=
"4dip"
android:gravity=
"center"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layoutDirection=
"ltr"
android:paddingTop=
"@dimen/body_font_padding"
android:paddingBottom=
"@dimen/body_font_padding"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/lap_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/sw_item_space"
android:layout_marginEnd=
"@dimen/sw_item_space"
android:gravity=
"start"
android:textAllCaps=
"false"
android:textAppearance=
"@style/SecondaryLabelTextAppearance"
/>
<TextView
android:id=
"@+id/lap_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/sw_item_space"
android:layout_marginEnd=
"@dimen/sw_item_space"
android:gravity=
"end"
android:textAllCaps=
"false"
android:textAppearance=
"@style/PrimaryLabelTextAppearance"
/>
<TextView
android:id=
"@+id/lap_total"
android:layout_height=
"wrap_content"
...
...
@@ -49,5 +49,5 @@
android:gravity=
"end"
android:textAllCaps=
"false"
android:textAppearance=
"@style/PrimaryLabelTextAppearance"
/>
</LinearLayout>
</LinearLayout>
This diff is collapsed.
Click to expand it.
res/layout/stopwatch_fragment.xml
View file @
e4a05f50
...
...
@@ -61,9 +61,4 @@
android:layout_width=
"match_parent"
android:layout_height=
"0dip"
/>
<Space
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/footer_button_size"
android:layout_margin=
"@dimen/footer_button_layout_margin"
/>
</LinearLayout>
This diff is collapsed.
Click to expand it.
res/layout/stopwatch_spacer.xml
0 → 100644
View file @
e4a05f50
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Space
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/stopwatch_list_bottom_spacing"
/>
This diff is collapsed.
Click to expand it.
res/values-land/dimens.xml
View file @
e4a05f50
...
...
@@ -51,6 +51,7 @@
<dimen
name=
"medium_font_size"
>
48sp
</dimen>
<dimen
name=
"circle_size"
>
232dip
</dimen>
<dimen
name=
"stopwatch_list_bottom_spacing"
>
0dip
</dimen>
<dimen
name=
"world_clock_margin"
>
8dp
</dimen>
<dimen
name=
"sw_padding_end"
>
8dp
</dimen>
...
...
This diff is collapsed.
Click to expand it.
res/values-sw600dp-land/dimens.xml
View file @
e4a05f50
...
...
@@ -43,7 +43,7 @@
<dimen
name=
"timer_circle_margin"
>
48dp
</dimen>
<dimen
name=
"circle_size"
>
360dip
</dimen>
<dimen
name=
"stopwatch_list_
margin_start"
>
128
dip
</dimen>
<dimen
name=
"stopwatch_list_
bottom_spacing"
>
0
dip
</dimen>
<dimen
name=
"world_clock_margin"
>
48dp
</dimen>
<dimen
name=
"sw_padding_end"
>
48dp
</dimen>
...
...
This diff is collapsed.
Click to expand it.
res/values-sw600dp/dimens.xml
View file @
e4a05f50
...
...
@@ -76,6 +76,8 @@
<dimen
name=
"timer_circle_margin"
>
96dp
</dimen>
<dimen
name=
"circle_size"
>
400dp
</dimen>
<!-- stopwatch_list_bottom_spacing = footer_button_size + footer_button_layout_margin -->
<dimen
name=
"stopwatch_list_bottom_spacing"
>
96dip
</dimen>
<!-- Width of the clock, for use with alarm buttons. -->
<dimen
name=
"alarm_alert_display_width"
>
550dip
</dimen>
...
...
This diff is collapsed.
Click to expand it.
res/values/dimens.xml
View file @
e4a05f50
...
...
@@ -117,7 +117,8 @@
<dimen
name=
"timer_circle_margin"
>
32dp
</dimen>
<dimen
name=
"circle_size"
>
280dp
</dimen>
<dimen
name=
"stopwatch_list_margin_start"
>
64dip
</dimen>
<!-- stopwatch_list_bottom_spacing = footer_button_size + footer_button_layout_margin -->
<dimen
name=
"stopwatch_list_bottom_spacing"
>
72dip
</dimen>
<dimen
name=
"sw_padding_end"
>
32dp
</dimen>
...
...
This diff is collapsed.
Click to expand it.
src/com/android/deskclock/stopwatch/StopwatchFragment.java
View file @
e4a05f50
...
...
@@ -82,6 +82,10 @@ public class StopwatchFragment extends DeskClockFragment
// Adapter for the ListView that shows the lap times.
class
LapsListAdapter
extends
BaseAdapter
{
private
static
final
int
VIEW_TYPE_LAP
=
0
;
private
static
final
int
VIEW_TYPE_SPACE
=
1
;
private
static
final
int
VIEW_TYPE_COUNT
=
2
;
ArrayList
<
Lap
>
mLaps
=
new
ArrayList
<
Lap
>();
private
final
LayoutInflater
mInflater
;
private
final
String
[]
mFormats
;
...
...
@@ -110,20 +114,34 @@ public class StopwatchFragment extends DeskClockFragment
return
position
;
}
@Override
public
int
getItemViewType
(
int
position
)
{
return
position
<
mLaps
.
size
()
?
VIEW_TYPE_LAP
:
VIEW_TYPE_SPACE
;
}
@Override
public
int
getViewTypeCount
()
{
return
VIEW_TYPE_COUNT
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
if
(
mLaps
.
size
()
==
0
||
position
>=
mLaps
.
size
()
)
{
if
(
getCount
()
==
0
)
{
return
null
;
}
Lap
lap
=
getItem
(
position
);
View
lapInfo
;
if
(
convertView
!=
null
)
{
lapInfo
=
convertView
;
}
else
{
lapInfo
=
mInflater
.
inflate
(
R
.
layout
.
lap_view
,
parent
,
false
);
// Handle request for the Spacer at the end
if
(
getItemViewType
(
position
)
==
VIEW_TYPE_SPACE
)
{
return
convertView
!=
null
?
convertView
:
mInflater
.
inflate
(
R
.
layout
.
stopwatch_spacer
,
parent
,
false
);
}
final
View
lapInfo
=
convertView
!=
null
?
convertView
:
mInflater
.
inflate
(
R
.
layout
.
lap_view
,
parent
,
false
);
Lap
lap
=
getItem
(
position
);
lapInfo
.
setTag
(
lap
);
TextView
count
=
(
TextView
)
lapInfo
.
findViewById
(
R
.
id
.
lap_number
);
TextView
count
=
(
TextView
)
lapInfo
.
findViewById
(
R
.
id
.
lap_number
);
count
.
setText
(
String
.
format
(
mLapFormat
,
mLaps
.
size
()
-
position
).
toUpperCase
());
setTimeText
(
lapInfo
,
lap
);
...
...
@@ -139,12 +157,13 @@ public class StopwatchFragment extends DeskClockFragment
@Override
public
int
getCount
()
{
return
mLaps
.
size
();
// Add 1 for the spacer if list is not empty
return
mLaps
.
isEmpty
()
?
0
:
mLaps
.
size
()
+
1
;
}
@Override
public
Lap
getItem
(
int
position
)
{
if
(
mLaps
.
size
()
==
0
||
position
>=
mLaps
.
size
())
{
if
(
position
>=
mLaps
.
size
())
{
return
null
;
}
return
mLaps
.
get
(
position
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment