Commit cfbae118 authored by Romain Guy's avatar Romain Guy
Browse files

Use trilinear filtering to draw the analog clock

The clock is often drawn scaled down from its original size. This
change turns on trilinear filtering which makes the resampled
result look a little nicer. The difference is visible even on
xhdpi devices.

This change relies on a new XML attribute introduced in API level
18 so the makefile was updated to use the current SDK. The attribute
will be safely ignored on previous versions of the platform.

Change-Id: I506e13398496b66b5dd8f2d789ea338d99371635
parent ce5d9bee
......@@ -12,7 +12,7 @@ LOCAL_PACKAGE_NAME := DeskClock
LOCAL_OVERRIDES_PACKAGES := AlarmClock
LOCAL_SDK_VERSION := 17
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:mipMap="true"
android:src="@drawable/clock_analog_dial" />
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:mipMap="true"
android:src="@drawable/clock_analog_hour" />
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:mipMap="true"
android:src="@drawable/clock_analog_minute" />
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:mipMap="true"
android:src="@drawable/clock_analog_second" />
......@@ -47,9 +47,9 @@
dc:jewelRadius="5dp"
dc:jewelOffset="23dp"
dc:jewelColor="@color/clock_white"
android:dial="@drawable/clock_analog_dial"
android:hand_hour="@drawable/clock_analog_hour"
android:hand_minute="@drawable/clock_analog_minute"
android:dial="@drawable/clock_analog_dial_mipmap"
android:hand_hour="@drawable/clock_analog_hour_mipmap"
android:hand_minute="@drawable/clock_analog_minute_mipmap"
android:layout_marginBottom="@dimen/time_margin_bottom"/>
<LinearLayout
......
......@@ -31,9 +31,9 @@
android:layout_marginLeft="@dimen/analog_clock_margin"
android:layout_marginRight="@dimen/analog_clock_margin"
android:layout_gravity="center_horizontal"
android:dial="@drawable/clock_analog_dial"
android:hand_hour="@drawable/clock_analog_hour"
android:hand_minute="@drawable/clock_analog_minute"
android:dial="@drawable/clock_analog_dial_mipmap"
android:hand_hour="@drawable/clock_analog_hour_mipmap"
android:hand_minute="@drawable/clock_analog_minute_mipmap"
android:layout_marginBottom="@dimen/time_margin_bottom"/>
<include layout="@layout/desk_clock_time_date"
android:id="@+id/digital_clock"
......
......@@ -36,9 +36,9 @@
android:layout_width="@dimen/world_clock_analog_size"
android:layout_height="@dimen/world_clock_analog_size"
android:layout_gravity="center_horizontal"
android:dial="@drawable/clock_analog_dial"
android:hand_hour="@drawable/clock_analog_hour"
android:hand_minute="@drawable/clock_analog_minute"/>
android:dial="@drawable/clock_analog_dial_mipmap"
android:hand_hour="@drawable/clock_analog_hour_mipmap"
android:hand_minute="@drawable/clock_analog_minute_mipmap"/>
</FrameLayout>
<com.android.deskclock.widget.EllipsizeLayout
android:id="@+id/city_name_layout"
......
......@@ -79,10 +79,10 @@ public class AnalogClock extends View {
mContext = context;
Resources r = mContext.getResources();
mDial = r.getDrawable(R.drawable.clock_analog_dial);
mHourHand = r.getDrawable(R.drawable.clock_analog_hour);
mMinuteHand = r.getDrawable(R.drawable.clock_analog_minute);
mSecondHand = r.getDrawable(R.drawable.clock_analog_second);
mDial = r.getDrawable(R.drawable.clock_analog_dial_mipmap);
mHourHand = r.getDrawable(R.drawable.clock_analog_hour_mipmap);
mMinuteHand = r.getDrawable(R.drawable.clock_analog_minute_mipmap);
mSecondHand = r.getDrawable(R.drawable.clock_analog_second_mipmap);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnalogClock);
mDotRadius = a.getDimension(R.styleable.AnalogClock_jewelRadius, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment