mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
Create FirstStartupActivity
This commit is contained in:
parent
de6ba2705e
commit
b322aa613f
4 changed files with 63 additions and 2 deletions
|
@ -23,6 +23,10 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".FirstStartupActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
tools:ignore="LockedOrientationActivity">
|
||||||
|
</activity>
|
||||||
<activity android:name=".ChooseActivity"
|
<activity android:name=".ChooseActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
tools:ignore="LockedOrientationActivity">
|
tools:ignore="LockedOrientationActivity">
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.finnmglas.launcher
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.*
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
|
class FirstStartupActivity : AppCompatActivity(){
|
||||||
|
|
||||||
|
/* Overrides */
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n") // I do not care
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val sharedPref = this.getSharedPreferences(
|
||||||
|
getString(R.string.preference_file_key), Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
initSettings(sharedPref, this)
|
||||||
|
|
||||||
|
// Flags
|
||||||
|
window.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||||
|
)
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_firststartup)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clickAnywhere(view: View){
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ GestureDetector.OnDoubleTapListener {
|
||||||
private lateinit var mDetector: GestureDetectorCompat
|
private lateinit var mDetector: GestureDetectorCompat
|
||||||
|
|
||||||
// get device dimensions
|
// get device dimensions
|
||||||
val displayMetrics = DisplayMetrics()
|
private val displayMetrics = DisplayMetrics()
|
||||||
|
|
||||||
private fun getIntent(packageName: String): Intent? {
|
private fun getIntent(packageName: String): Intent? {
|
||||||
val pm = applicationContext.packageManager
|
val pm = applicationContext.packageManager
|
||||||
|
@ -108,7 +108,7 @@ GestureDetector.OnDoubleTapListener {
|
||||||
|
|
||||||
// First Startup
|
// First Startup
|
||||||
if (!sharedPref.getBoolean("startedBefore", false))
|
if (!sharedPref.getBoolean("startedBefore", false))
|
||||||
initSettings(sharedPref, this)
|
startActivity(Intent(this, FirstStartupActivity::class.java))
|
||||||
|
|
||||||
loadSettings(sharedPref)
|
loadSettings(sharedPref)
|
||||||
|
|
||||||
|
|
22
app/src/main/res/layout/activity_firststartup.xml
Normal file
22
app/src/main/res/layout/activity_firststartup.xml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<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/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorPrimaryDark"
|
||||||
|
android:longClickable="false"
|
||||||
|
android:onClick="clickAnywhere"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Hello."
|
||||||
|
android:textColor="#fff"
|
||||||
|
android:textSize="64sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Add table
Reference in a new issue