implement basic view animations

This commit is contained in:
Andrew Dolgov 2011-11-26 12:29:19 +03:00
parent 2229ae0fc4
commit 743627cd51
4 changed files with 48 additions and 2 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="6"
android:versionName="0.1.5">
android:versionCode="7"
android:versionName="0.1.6">
<uses-sdk android:minSdkVersion="8" />
<!-- <supports-screens android:smallScreens="false" android:normalScreens="false" /> -->

20
res/anim/slide_left.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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">
<translate android:fromXDelta="100%p" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime" />
</set>

20
res/anim/slide_right.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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">
<translate android:fromXDelta="-100%p" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime" />
</set>

View File

@ -18,6 +18,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -253,8 +254,11 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
if (m_smallScreenMode) {
if (m_selectedArticle != null) {
findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));
closeArticle();
} else if (m_activeFeed != null) {
findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
@ -524,6 +528,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
ft.commit();
if (m_smallScreenMode) {
findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_left));
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
} else {