Skip to content

Commit

Permalink
Add Loading screen and animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vigroid committed Nov 13, 2017
1 parent 8b3f380 commit 12bd422
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 46 deletions.
12 changes: 1 addition & 11 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.dalimao.mytaxi"
minSdkVersion 15
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".splash.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/com/dalimao/mytaxi/MainActivity.java

This file was deleted.

30 changes: 30 additions & 0 deletions app/src/main/java/com/dalimao/mytaxi/splash/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.dalimao.mytaxi.splash;

import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.dalimao.mytaxi.R;

/**
* Created by vigroid on 11/13/17.
*/

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
final AnimatedVectorDrawable anim =
(AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim);
final ImageView logo = (ImageView) findViewById(R.id.logo);
logo.setImageDrawable(anim);
anim.start();
}
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/animator/anim_bar_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:propertyName="trimPathEnd"
android:repeatCount="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType"/>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/anim.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_logo">

<target
android:animation="@animator/anim_bar_fill"
android:name="logo"/>

</animated-vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="50dp"
android:height="72dp"
android:viewportWidth="50.0"
android:viewportHeight="72.0">
<path
android:name="logo"
android:strokeColor="#eb8b24"
android:strokeWidth="10"
android:pathData="M5,10,v50,L20,60,A1,1,0,0,0,20,15,L0,15" />
</vector>
17 changes: 0 additions & 17 deletions app/src/main/res/layout/activity_main.xml

This file was deleted.

35 changes: 35 additions & 0 deletions app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".splash.SplashActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">

<ImageView
android:id="@+id/logo"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center"
android:focusable="true"
android:src="@drawable/ic_logo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/splash_message"
android:textSize="@dimen/text_size_small"
android:textColor="@color/text_gray"
android:layout_gravity="center_horizontal"/>
</LinearLayout>

</RelativeLayout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="logoColor">#eb8b24</color>
<color name="color_text_normal">#333333</color>
<color name="text_gray">#919191</color>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="text_size_large">14sp</dimen>
<dimen name="text_size_small">11sp</dimen>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">MyTaxi</string>
<string name="splash_title">打车出行</string>
<string name="splash_message">美好一天,平安出行 </string>
</resources>
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:2.2.2'
classpath 'com.android.tools.build:gradle:3.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Mon Nov 13 01:47:06 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

0 comments on commit 12bd422

Please sign in to comment.