Skip to content

Commit

Permalink
Merge pull request #29 from binsheng/dev
Browse files Browse the repository at this point in the history
add launch animation
  • Loading branch information
xingstarx authored Apr 7, 2017
2 parents 5d20a2e + 0c41645 commit 7fc3a0c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.LaunchActivity">
<activity android:name=".ui.LaunchActivity" android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
39 changes: 36 additions & 3 deletions app/src/main/java/org/houxg/leamonax/ui/LaunchActivity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.houxg.leamonax.ui;

import android.animation.Animator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

import org.houxg.leamonax.R;
import org.houxg.leamonax.model.Account;
import org.houxg.leamonax.network.ApiProvider;
import org.houxg.leamonax.service.AccountService;
Expand All @@ -13,7 +18,10 @@ public class LaunchActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent;
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_launch);
final Intent intent;
if (AccountService.isSignedIn()) {
Account account = Account.getCurrent();
ApiProvider.getInstance().init(account.getHost());
Expand All @@ -22,7 +30,32 @@ protected void onCreate(Bundle savedInstanceState) {
intent = new Intent(this, SignInActivity.class);
}
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
findViewById(R.id.iv_logo)
.animate()
.scaleX(1.5f)
.scaleY(1.5f)
.setDuration(3000)
.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {

}

@Override
public void onAnimationEnd(Animator animator) {
startActivity(intent);
finish();
}

@Override
public void onAnimationCancel(Animator animator) {

}

@Override
public void onAnimationRepeat(Animator animator) {

}
}).start();
}
}
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="vertical">

<ImageView
android:id="@+id/iv_logo"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher" />

</RelativeLayout>

0 comments on commit 7fc3a0c

Please sign in to comment.