Animate the batch-operations toolbar (Imported from AOSP)

This commit is contained in:
Jesse Vincent 2010-11-07 19:40:42 +00:00
parent a439bc7712
commit d45081abaa
3 changed files with 83 additions and 5 deletions

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/layout/list_content.xml
**
** Copyright 2009, Google Inc.
**
** 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" >
<translate
android:fromYDelta="+10%p"
android:toYDelta="0"
android:duration="300" />
</set>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/layout/list_content.xml
**
** Copyright 2009, Google Inc.
**
** 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" >
<translate
android:fromYDelta="0"
android:toYDelta="+10%p"
android:duration="300" />
</set>

View file

@ -23,6 +23,9 @@ import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.view.ContextMenu;
import android.view.GestureDetector;
import android.view.KeyEvent;
@ -76,7 +79,7 @@ import com.fsck.k9.mail.store.LocalStore.LocalFolder;
*/
public class MessageList
extends K9Activity
implements OnClickListener, AdapterView.OnItemClickListener
implements OnClickListener, AdapterView.OnItemClickListener, AnimationListener
{
/**
@ -2884,14 +2887,23 @@ public class MessageList
private void hideBatchButtons()
{
//TODO: Fade out animation
if (mBatchButtonArea.getVisibility() != View.GONE)
{
mBatchButtonArea.setVisibility(View.GONE);
mBatchButtonArea.startAnimation(
AnimationUtils.loadAnimation(this, R.anim.footer_disappear));
}
}
private void showBatchButtons()
{
//TODO: Fade in animation
if (mBatchButtonArea.getVisibility() != View.VISIBLE)
{
mBatchButtonArea.setVisibility(View.VISIBLE);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear);
animation.setAnimationListener(this);
mBatchButtonArea.startAnimation(animation);
}
}
private void toggleBatchButtons()
@ -3058,6 +3070,20 @@ public class MessageList
mHandler.sortMessages();
}
public void onAnimationEnd(Animation animation)
{
}
public void onAnimationRepeat(Animation animation)
{
}
public void onAnimationStart(Animation animation)
{
}
private void setAllSelected(boolean isSelected)
{
mSelectedCount = 0;