diff --git a/app/build.gradle b/app/build.gradle index 6e8882e..b4a3622 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 21 - buildToolsVersion "21.1.2" + compileSdkVersion 22 + buildToolsVersion "22.0.1" defaultConfig { applicationId "com.netease.kongnan.searchmenuanim" minSdkVersion 21 - targetSdkVersion 21 + targetSdkVersion 22 versionCode 1 versionName "1.0" } @@ -21,5 +21,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:21.0.3' + compile 'com.android.support:appcompat-v7:22.2.1' } diff --git a/app/src/main/java/com/netease/kongnan/searchmenuanim/MainActivity.java b/app/src/main/java/com/netease/kongnan/searchmenuanim/MainActivity.java index 9944483..8aea830 100644 --- a/app/src/main/java/com/netease/kongnan/searchmenuanim/MainActivity.java +++ b/app/src/main/java/com/netease/kongnan/searchmenuanim/MainActivity.java @@ -16,16 +16,17 @@ package com.netease.kongnan.searchmenuanim; -import android.app.Activity; import android.graphics.drawable.AnimatedVectorDrawable; import android.os.Bundle; +import android.support.v4.content.ContextCompat; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.ImageView; import android.widget.TextView; -public class MainActivity extends Activity { +public class MainActivity extends AppCompatActivity { private ImageView iv; private TextView text; @@ -42,9 +43,9 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); iv = (ImageView) findViewById(R.id.search); text = (TextView) findViewById(R.id.text); - searchToBar = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_search_to_bar); - barToSearch = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_bar_to_search); - interp = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in); + searchToBar = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.anim_search_to_bar); + barToSearch = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.anim_bar_to_search); + interp = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear); duration = getResources().getInteger(R.integer.duration_bar); // iv is sized to hold the search+bar so when only showing the search icon, translate the // whole view left by half the difference to keep it centered diff --git a/app/src/main/res/anim/anim_bar_fill.xml b/app/src/main/res/anim/anim_bar_fill.xml index 199ea1d..b230501 100644 --- a/app/src/main/res/anim/anim_bar_fill.xml +++ b/app/src/main/res/anim/anim_bar_fill.xml @@ -22,4 +22,4 @@ android:valueTo="0" android:valueType="floatType" android:duration="@integer/duration_bar" - android:interpolator="@android:interpolator/linear_out_slow_in" /> + android:interpolator="@android:interpolator/linear" /> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4e4d38e..f41cf68 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -15,7 +15,7 @@ limitations under the License. --> - - + diff --git a/build.gradle b/build.gradle index d3ff69d..9405f3f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' + classpath 'com.android.tools.build:gradle:1.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files