am bf03559f: am 64e5a194: Merge "Add enter/exit animation style to prevew and mini keyboard" into gingerbread
Merge commit 'bf03559f7e38cd51cb5fd6b0afa937982cbffc67' * commit 'bf03559f7e38cd51cb5fd6b0afa937982cbffc67': Add enter/exit animation style to prevew and mini keyboardmain
commit
05ebb2e511
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
>
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="0.5"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="@integer/config_preview_fadein_anim_time" />
|
||||||
|
</set>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
>
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:duration="@integer/config_preview_fadeout_anim_time" />
|
||||||
|
</set>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
>
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="0.5"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="@integer/config_preview_fadein_anim_time" />
|
||||||
|
</set>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
>
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:duration="@integer/config_preview_fadeout_anim_time" />
|
||||||
|
</set>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<integer name="config_delay_before_preview">0</integer>
|
||||||
|
<integer name="config_delay_after_preview">10</integer>
|
||||||
|
<integer name="config_preview_fadein_anim_time">0</integer>
|
||||||
|
<integer name="config_preview_fadeout_anim_time">90</integer>
|
||||||
|
<integer name="config_mini_keyboard_fadein_anim_time">0</integer>
|
||||||
|
<integer name="config_mini_keyboard_fadeout_anim_time">100</integer>
|
||||||
|
</resources>
|
|
@ -33,4 +33,12 @@
|
||||||
<item name="backgroundDimAmount">0.5</item>
|
<item name="backgroundDimAmount">0.5</item>
|
||||||
<item name="symbolColorScheme">white</item>
|
<item name="symbolColorScheme">white</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="KeyPreviewAnimation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/key_preview_fadein</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/key_preview_fadeout</item>
|
||||||
|
</style>
|
||||||
|
<style name="MiniKeyboardAnimation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -154,8 +154,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timing constants
|
// Timing constants
|
||||||
private static final int DELAY_BEFORE_PREVIEW = 0;
|
|
||||||
private static final int DELAY_AFTER_PREVIEW = 100;
|
|
||||||
private static final int REPEAT_INTERVAL = PointerTracker.REPEAT_INTERVAL;
|
private static final int REPEAT_INTERVAL = PointerTracker.REPEAT_INTERVAL;
|
||||||
|
|
||||||
// Miscellaneous constants
|
// Miscellaneous constants
|
||||||
|
@ -194,6 +192,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
private int mPopupPreviewOffsetY;
|
private int mPopupPreviewOffsetY;
|
||||||
private int mWindowY;
|
private int mWindowY;
|
||||||
private int mPopupPreviewDisplayedY;
|
private int mPopupPreviewDisplayedY;
|
||||||
|
private final int mDelayBeforePreview;
|
||||||
|
private final int mDelayAfterPreview;
|
||||||
|
|
||||||
// Popup mini keyboard
|
// Popup mini keyboard
|
||||||
private PopupWindow mMiniKeyboardPopup;
|
private PopupWindow mMiniKeyboardPopup;
|
||||||
|
@ -255,7 +255,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
showKey(msg.arg1, (PointerTracker)msg.obj);
|
showKey(msg.arg1, (PointerTracker)msg.obj);
|
||||||
break;
|
break;
|
||||||
case MSG_DISMISS_PREVIEW:
|
case MSG_DISMISS_PREVIEW:
|
||||||
mPreviewText.setVisibility(INVISIBLE);
|
mPreviewPopup.dismiss();
|
||||||
break;
|
break;
|
||||||
case MSG_REPEAT_KEY: {
|
case MSG_REPEAT_KEY: {
|
||||||
final PointerTracker tracker = (PointerTracker)msg.obj;
|
final PointerTracker tracker = (PointerTracker)msg.obj;
|
||||||
|
@ -460,6 +460,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Resources res = getResources();
|
||||||
|
|
||||||
mPreviewPopup = new PopupWindow(context);
|
mPreviewPopup = new PopupWindow(context);
|
||||||
if (previewLayout != 0) {
|
if (previewLayout != 0) {
|
||||||
mPreviewText = (TextView) inflate.inflate(previewLayout, null);
|
mPreviewText = (TextView) inflate.inflate(previewLayout, null);
|
||||||
|
@ -470,10 +472,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
mShowPreview = false;
|
mShowPreview = false;
|
||||||
}
|
}
|
||||||
mPreviewPopup.setTouchable(false);
|
mPreviewPopup.setTouchable(false);
|
||||||
mMiniKeyboardParent = this;
|
mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
|
||||||
|
mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview);
|
||||||
|
mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview);
|
||||||
|
|
||||||
|
mMiniKeyboardParent = this;
|
||||||
mMiniKeyboardPopup = new PopupWindow(context);
|
mMiniKeyboardPopup = new PopupWindow(context);
|
||||||
mMiniKeyboardPopup.setBackgroundDrawable(null);
|
mMiniKeyboardPopup.setBackgroundDrawable(null);
|
||||||
|
mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation);
|
||||||
|
|
||||||
mPaint = new Paint();
|
mPaint = new Paint();
|
||||||
mPaint.setAntiAlias(true);
|
mPaint.setAntiAlias(true);
|
||||||
|
@ -485,7 +491,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
mMiniKeyboardCache = new HashMap<Key,View>();
|
mMiniKeyboardCache = new HashMap<Key,View>();
|
||||||
mKeyBackground.getPadding(mPadding);
|
mKeyBackground.getPadding(mPadding);
|
||||||
|
|
||||||
final Resources res = getResources();
|
|
||||||
mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density);
|
mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density);
|
||||||
// TODO: Refer frameworks/base/core/res/res/values/config.xml
|
// TODO: Refer frameworks/base/core/res/res/values/config.xml
|
||||||
mDisambiguateSwipe = res.getBoolean(R.bool.config_swipeDisambiguation);
|
mDisambiguateSwipe = res.getBoolean(R.bool.config_swipeDisambiguation);
|
||||||
|
@ -657,10 +662,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
public void setPopupOffset(int x, int y) {
|
public void setPopupOffset(int x, int y) {
|
||||||
mPopupPreviewOffsetX = x;
|
mPopupPreviewOffsetX = x;
|
||||||
mPopupPreviewOffsetY = y;
|
mPopupPreviewOffsetY = y;
|
||||||
if (mPreviewPopup.isShowing()) {
|
|
||||||
mPreviewPopup.dismiss();
|
mPreviewPopup.dismiss();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When enabled, calls to {@link OnKeyboardActionListener#onKey} will include key
|
* When enabled, calls to {@link OnKeyboardActionListener#onKey} will include key
|
||||||
|
@ -895,9 +898,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
|| (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) {
|
|| (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) {
|
||||||
if (keyIndex == NOT_A_KEY) {
|
if (keyIndex == NOT_A_KEY) {
|
||||||
mHandler.cancelPopupPreview();
|
mHandler.cancelPopupPreview();
|
||||||
mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
|
mHandler.dismissPreview(mDelayAfterPreview);
|
||||||
} else if (tracker != null) {
|
} else if (tracker != null) {
|
||||||
mHandler.popupPreview(DELAY_BEFORE_PREVIEW, keyIndex, tracker);
|
mHandler.popupPreview(mDelayBeforePreview, keyIndex, tracker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1375,9 +1378,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closing() {
|
public void closing() {
|
||||||
if (mPreviewPopup.isShowing()) {
|
|
||||||
mPreviewPopup.dismiss();
|
mPreviewPopup.dismiss();
|
||||||
}
|
|
||||||
mHandler.cancelAllMessages();
|
mHandler.cancelAllMessages();
|
||||||
|
|
||||||
dismissPopupKeyboard();
|
dismissPopupKeyboard();
|
||||||
|
|
Loading…
Reference in New Issue