-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edwin Wu
committed
Jun 19, 2017
1 parent
d81a73e
commit fb26d0e
Showing
4 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/github/why168/androidhttputils/WelcomeActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |