This commit is contained in:
Josia Pietsch 2024-10-04 15:47:28 +02:00
parent 88e13c04d1
commit af69f875af
Signed by: jrpie
GPG key ID: E70B571D66986A2D
7 changed files with 22 additions and 12 deletions

View file

@ -39,6 +39,7 @@
</activity>
<activity
android:name="de.jrpie.android.launcher.ui.list.ListActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustResize" >
</activity>
<activity
@ -51,7 +52,6 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -9,5 +9,6 @@ class Application : android.app.Application() {
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
LauncherPreferences.init(preferences, this.resources)
}
}

View file

@ -64,7 +64,8 @@ class HomeActivity : UIObject, AppCompatActivity(),
private var clockTimer = Timer()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
super<AppCompatActivity>.onCreate(savedInstanceState)
super<UIObject>.onCreate()
// Try to restore old preferences
migratePreferencesToNewVersion(this)

View file

@ -37,16 +37,17 @@ fun setWindowFlags(window: Window, homeScreen: Boolean) {
}
interface UIObject {
fun onStart() {
fun onCreate() {
if (this is Activity) {
setWindowFlags(window, isHomeScreen())
requestedOrientation = if (!LauncherPreferences.display().rotateScreen()) {
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
} else {
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
}
}
if (!LauncherPreferences.display().rotateScreen()) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
}
}
}
fun onStart() {
setOnClicks()
adjustLayout()
}

View file

@ -49,7 +49,8 @@ class ListActivity : AppCompatActivity(), UIObject {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
super<AppCompatActivity>.onCreate(savedInstanceState)
super<UIObject>.onCreate()
// get info about which action this activity is open for
intent.extras?.let { bundle ->
@ -106,6 +107,9 @@ class ListActivity : AppCompatActivity(), UIObject {
override fun onPause() {
super.onPause()
// ensure that the activity closes then an app is launched
// and when the user navigates to recent apps
finish()
}

View file

@ -44,7 +44,9 @@ class SettingsActivity : AppCompatActivity(), UIObject {
private lateinit var binding: SettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
super<AppCompatActivity>.onCreate(savedInstanceState)
super<UIObject>.onCreate()
// Initialise layout
binding = SettingsBinding.inflate(layoutInflater)

View file

@ -30,7 +30,8 @@ import de.jrpie.android.launcher.ui.tutorial.tabs.TutorialFragmentUsage
class TutorialActivity : AppCompatActivity(), UIObject {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
super<AppCompatActivity>.onCreate(savedInstanceState)
super<UIObject>.onCreate()
// Initialise layout
setContentView(R.layout.tutorial)