am f2897fe4: Merge change Idc34a3f7 into eclair

Merge commit 'f2897fe42e22966127dbee8025d6bdc1d1697d81' into eclair-mr2

* commit 'f2897fe42e22966127dbee8025d6bdc1d1697d81':
  Fix 2209086: add drawables for SlidingTab states in PhoneApp. Update string file for new SlidingTab sound states.
This commit is contained in:
Jim Miller
2009-11-11 20:14:46 -08:00
committed by Android Git Automerger
6 changed files with 131 additions and 12 deletions

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
@@ -41,6 +42,7 @@ import com.android.internal.R;
*
*/
public class SlidingTab extends ViewGroup {
private static final int ANIMATION_DURATION = 250; // animation transition duration (in ms)
private static final String LOG_TAG = "SlidingTab";
private static final boolean DBG = false;
private static final int HORIZONTAL = 0; // as defined in attrs.xml
@@ -249,10 +251,12 @@ public class SlidingTab extends ViewGroup {
* @param alignment which side to align the widget to
*/
void layout(int l, int t, int r, int b, int alignment) {
final int handleWidth = tab.getBackground().getIntrinsicWidth();
final int handleHeight = tab.getBackground().getIntrinsicHeight();
final int targetWidth = target.getDrawable().getIntrinsicWidth();
final int targetHeight = target.getDrawable().getIntrinsicHeight();
final Drawable tabBackground = tab.getBackground();
final int handleWidth = tabBackground.getIntrinsicWidth();
final int handleHeight = tabBackground.getIntrinsicHeight();
final Drawable targetDrawable = target.getDrawable();
final int targetWidth = targetDrawable.getIntrinsicWidth();
final int targetHeight = targetDrawable.getIntrinsicHeight();
final int parentWidth = r - l;
final int parentHeight = b - t;
@@ -347,10 +351,11 @@ public class SlidingTab extends ViewGroup {
throw new RuntimeException(LOG_TAG + " cannot have UNSPECIFIED dimensions");
}
final int leftTabWidth = (int) (mDensity * mLeftSlider.getTabWidth() + 0.5f);
final int rightTabWidth = (int) (mDensity * mRightSlider.getTabWidth() + 0.5f);
final int leftTabHeight = (int) (mDensity * mLeftSlider.getTabHeight() + 0.5f);
final int rightTabHeight = (int) (mDensity * mRightSlider.getTabHeight() + 0.5f);
final float density = mDensity;
final int leftTabWidth = (int) (density * mLeftSlider.getTabWidth() + 0.5f);
final int rightTabWidth = (int) (density * mRightSlider.getTabWidth() + 0.5f);
final int leftTabHeight = (int) (density * mLeftSlider.getTabHeight() + 0.5f);
final int rightTabHeight = (int) (density * mRightSlider.getTabHeight() + 0.5f);
final int width;
final int height;
if (isHorizontal()) {
@@ -441,14 +446,14 @@ public class SlidingTab extends ViewGroup {
OnTriggerListener.LEFT_HANDLE : OnTriggerListener.RIGHT_HANDLE);
// TODO: This is a place holder for the real animation. It just holds
// the screen for 500ms.
// the screen for the duration of the animation for now.
mAnimating = true;
mHandler.postDelayed(new Runnable() {
public void run() {
resetView();
mAnimating = false;
}
}, 500);
}, ANIMATION_DURATION);
}
if (isHorizontal() && (y <= handle.getBottom() && y >= handle.getTop()) ||

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<!-- StateListDrawable used for buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/jog_tab_bar_pressed" />
<item android:state_enabled="true"
android:drawable="@drawable/jog_tab_bar_normal" />
<item android:state_active="true"
android:drawable="@drawable/jog_tab_bar_confirm_green" />
</selector>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<!-- StateListDrawable used for buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/jog_tab_bar_pressed" />
<item android:state_enabled="true"
android:drawable="@drawable/jog_tab_bar_normal" />
<item android:state_active="true"
android:drawable="@drawable/jog_tab_bar_confirm_red" />
</selector>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<!-- StateListDrawable used for buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/jog_tab_left_pressed" />
<item android:state_enabled="true"
android:drawable="@drawable/jog_tab_left_normal" />
<item android:state_active="true"
android:drawable="@drawable/jog_tab_left_confirm_green" />
</selector>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<!-- StateListDrawable used for buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/jog_tab_right_pressed" />
<item android:state_enabled="true"
android:drawable="@drawable/jog_tab_right_normal" />
<item android:state_active="true"
android:drawable="@drawable/jog_tab_right_confirm_red" />
</selector>

View File

@@ -1436,8 +1436,10 @@
<string name="lockscreen_glogin_checking_password">Checking...</string>
<!-- Displayed on lock screen's left tab - unlock -->
<string name="lockscreen_unlock_label">Unlock</string>
<!-- Displayed on lock screen's right tab - mute/unmute -->
<string name="lockscreen_mute_unmute_label">Sound</string>
<!-- Displayed on lock screen's right tab - turn sound on -->
<string name="lockscreen_sound_on_label">Sound on</string>
<!-- Displayed on lock screen's right tab - turn sound off -->
<string name="lockscreen_sound_off_label">Sound off</string>
<!-- A format string for 12-hour time of day, just the hour, not the minute, with lower-case "am" or "pm" (example: "3pm"). -->
<string name="hour_ampm">"<xliff:g id="hour" example="3">%-l</xliff:g><xliff:g id="ampm" example="pm">%P</xliff:g>"</string>