Skip to content

Commit

Permalink
WelcomeActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Wu committed Jun 19, 2017
1 parent d81a73e commit fb26d0e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
compile 'com.android.support.constraint:constraint-layout:1.0.2'

// support
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"

compile 'com.lovedise:permissiongen:0.0.6'

compile project(':http-library')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.lovedise:permissiongen:0.0.6'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
}
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".HomeActivity">
<activity android:name=".WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.github.why168.androidhttputils;

import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v7.app.AppCompatActivity;
import android.widget.Chronometer;

/**
* WelcomeActivity
*
* @author Edwin.Wu
* @version 2017/6/19 17:17
* @since JDK1.8
*/
public class WelcomeActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);


Chronometer mChronometer = (Chronometer) findViewById(R.id.chronometer);
mChronometer.setBase(SystemClock.elapsedRealtime());
mChronometer.start();
mChronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
@Override
public void onChronometerTick(Chronometer chronometer) {
if (SystemClock.elapsedRealtime() - chronometer.getBase() > 3 * 1000) {
chronometer.stop();
startActivity(new Intent(WelcomeActivity.this, HomeActivity.class));
finish();
}
}
});
}

}
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_welcome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.github.why168.androidhttputils.WelcomeActivity">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="加载中..."
android:textColor="#ff0303"
android:textSize="8pt" />

<Chronometer
android:id="@+id/chronometer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#ff0303"
android:textSize="15pt" />
</LinearLayout>

0 comments on commit fb26d0e

Please sign in to comment.