添加应用启动页
This commit is contained in:
parent
dcc182827c
commit
e46cd260db
@ -14,6 +14,15 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MusicApp"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.activity.ASplashActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:exported="false" />
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package com.hi.music.player.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import com.hi.music.player.databinding.ActivityAsplashBinding;
|
||||
|
||||
public class ASplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
||||
|
||||
private static final int SPLASH_TIME_OUT = 1500;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
protected ActivityAsplashBinding getViewBinding() {
|
||||
return ActivityAsplashBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
|
||||
intData();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void intData(){
|
||||
|
||||
countDownTimer = new CountDownTimer(SPLASH_TIME_OUT, 100) {
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
|
||||
int v1 = (int) v;
|
||||
vb.progressBar.setProgress(v1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
vb.progressBar.setProgress(100);
|
||||
Intent intent = new Intent(ASplashActivity.this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
countDownTimer.start();
|
||||
|
||||
}
|
||||
}
|
||||
22
app/src/main/res/drawable/seek_bar_color.xml
Normal file
22
app/src/main/res/drawable/seek_bar_color.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- res/drawable/seekbar_progress_drawable.xml -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#D3D3D3" /> <!-- 背景颜色 -->
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<gradient
|
||||
android:startColor="#1CC8EE"
|
||||
android:centerColor="#69FE73"
|
||||
android:endColor="#CBD64B"
|
||||
android:angle="0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
72
app/src/main/res/layout/activity_asplash.xml
Normal file
72
app/src/main/res/layout/activity_asplash.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
tools:context=".ui.activity.ASplashActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/splash_image"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="70dp"
|
||||
android:src="@mipmap/launch_icon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/splash_title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#CCFFFFFF"
|
||||
android:textSize="31sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progress_text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/listen_music_anytime"
|
||||
android:textColor="#CCFFFFFF"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/progress_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="191dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/seek_bar_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progress_text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/resource_loading"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/progress_bar" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
BIN
app/src/main/res/mipmap-xxxhdpi/launch_icon.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/launch_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@ -9,4 +9,6 @@
|
||||
<string name="new_releases">New Releases</string>
|
||||
<string name="musicoo">Musicoo</string>
|
||||
<string name="library">Profile</string>
|
||||
<string name="listen_music_anytime">Listen Music Anytime</string>
|
||||
<string name="resource_loading">Resource Loading...</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user