Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the main activity #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/anim/anim_bar_fill.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->

<FrameLayout
<ViewAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down Expand Up @@ -43,4 +43,4 @@
android:textColor="?android:colorAccent"
android:alpha="0" />

</FrameLayout>
</ViewAnimator>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down