mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-22 22:11:27 +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
|
||||
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>
|
||||
|
|
|
@ -9,5 +9,6 @@ class Application : android.app.Application() {
|
|||
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
LauncherPreferences.init(preferences, this.resources)
|
||||
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue