mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
fix #48
This commit is contained in:
parent
88e13c04d1
commit
af69f875af
7 changed files with 22 additions and 12 deletions
|
@ -39,6 +39,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="de.jrpie.android.launcher.ui.list.ListActivity"
|
android:name="de.jrpie.android.launcher.ui.list.ListActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
android:windowSoftInputMode="adjustResize" >
|
android:windowSoftInputMode="adjustResize" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
@ -51,7 +52,6 @@
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -9,5 +9,6 @@ class Application : android.app.Application() {
|
||||||
|
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
LauncherPreferences.init(preferences, this.resources)
|
LauncherPreferences.init(preferences, this.resources)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,7 +64,8 @@ class HomeActivity : UIObject, AppCompatActivity(),
|
||||||
private var clockTimer = Timer()
|
private var clockTimer = Timer()
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super<AppCompatActivity>.onCreate(savedInstanceState)
|
||||||
|
super<UIObject>.onCreate()
|
||||||
|
|
||||||
// Try to restore old preferences
|
// Try to restore old preferences
|
||||||
migratePreferencesToNewVersion(this)
|
migratePreferencesToNewVersion(this)
|
||||||
|
|
|
@ -37,16 +37,17 @@ fun setWindowFlags(window: Window, homeScreen: Boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UIObject {
|
interface UIObject {
|
||||||
fun onStart() {
|
fun onCreate() {
|
||||||
if (this is Activity) {
|
if (this is Activity) {
|
||||||
setWindowFlags(window, isHomeScreen())
|
setWindowFlags(window, isHomeScreen())
|
||||||
requestedOrientation = if (!LauncherPreferences.display().rotateScreen()) {
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
if (!LauncherPreferences.display().rotateScreen()) {
|
||||||
} else {
|
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
|
||||||
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun onStart() {
|
||||||
setOnClicks()
|
setOnClicks()
|
||||||
adjustLayout()
|
adjustLayout()
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ class ListActivity : AppCompatActivity(), UIObject {
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
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
|
// get info about which action this activity is open for
|
||||||
intent.extras?.let { bundle ->
|
intent.extras?.let { bundle ->
|
||||||
|
@ -106,6 +107,9 @@ class ListActivity : AppCompatActivity(), UIObject {
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
|
||||||
|
// ensure that the activity closes then an app is launched
|
||||||
|
// and when the user navigates to recent apps
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,9 @@ class SettingsActivity : AppCompatActivity(), UIObject {
|
||||||
private lateinit var binding: SettingsBinding
|
private lateinit var binding: SettingsBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super<AppCompatActivity>.onCreate(savedInstanceState)
|
||||||
|
super<UIObject>.onCreate()
|
||||||
|
|
||||||
|
|
||||||
// Initialise layout
|
// Initialise layout
|
||||||
binding = SettingsBinding.inflate(layoutInflater)
|
binding = SettingsBinding.inflate(layoutInflater)
|
||||||
|
|
|
@ -30,7 +30,8 @@ import de.jrpie.android.launcher.ui.tutorial.tabs.TutorialFragmentUsage
|
||||||
class TutorialActivity : AppCompatActivity(), UIObject {
|
class TutorialActivity : AppCompatActivity(), UIObject {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super<AppCompatActivity>.onCreate(savedInstanceState)
|
||||||
|
super<UIObject>.onCreate()
|
||||||
|
|
||||||
// Initialise layout
|
// Initialise layout
|
||||||
setContentView(R.layout.tutorial)
|
setContentView(R.layout.tutorial)
|
||||||
|
|
Loading…
Add table
Reference in a new issue