Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash Screen #24

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".player.PlayerActivity" android:screenOrientation="sensorLandscape"/>
<activity android:name=".MainActivity">
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
</manifest>
56 changes: 56 additions & 0 deletions app/src/main/java/divyansh/tech/animeclassroom/SplashActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package divyansh.tech.animeclassroom

import android.content.Intent

import android.os.Bundle

import android.os.Handler

import android.view.WindowManager

import androidx.appcompat.app.AppCompatActivity



@Suppress("DEPRECATION")

class SplashActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.splash)



// This is used to hide the status bar and make

// the splash screen as a full screen activity.

window.setFlags(

WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN

)



// we used the postDelayed(Runnable, time) method

// to send a message with a delayed time.

Handler().postDelayed({

val intent = Intent(this, MainActivity::class.java)

startActivity(intent)

finish()

}, 3000) // 3000 is the delayed time in milliseconds.

}
}
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/splash_grad.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

<shape
android:shape = "rectangle"
xmlns:android = "http://schemas.android.com/apk/res/android" >

<gradient
android:startColor = "#FEBAAA"
android:endColor = "#F88389"
android:angle = "90"
android:type = "linear" />
</shape>
49 changes: 49 additions & 0 deletions app/src/main/res/layout/splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/splash_grad">

<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/splash_grad">

<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/ic_launcher_foreground"
android:adjustViewBounds="true"/>

<TextView
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:text="#Developer"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="27dp"
android:id="@+id/spalshTextView2"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="15sp"
android:typeface="serif"
android:padding="3dp"/>

<TextView
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:text="❤"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="5dp"
android:padding="1dp"/>

</RelativeLayout>

</LinearLayout>