mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
implemented #6: add option to allow rotation
This commit is contained in:
parent
9a3957be36
commit
c89e74205d
7 changed files with 26 additions and 18 deletions
|
@ -23,9 +23,8 @@
|
|||
android:exported="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:launchMode="singleTask" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
|
@ -35,20 +34,16 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".tutorial.TutorialActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
android:configChanges="orientation|screenSize" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".list.ListActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
android:windowSoftInputMode="adjustResize" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".settings.SettingsActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.jrpie.android.launcher
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.view.Window
|
||||
|
@ -38,7 +39,14 @@ fun setWindowFlags(window: Window, homeScreen: Boolean) {
|
|||
|
||||
interface UIObject {
|
||||
fun onStart() {
|
||||
if (this is Activity) setWindowFlags(window, isHomeScreen())
|
||||
if (this is Activity) {
|
||||
setWindowFlags(window, isHomeScreen())
|
||||
requestedOrientation = if (!LauncherPreferences.display().rotateScreen()) {
|
||||
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
} else {
|
||||
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
setOnClicks()
|
||||
adjustLayout()
|
||||
|
|
|
@ -39,6 +39,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
|
|||
@PreferenceGroup(name = "display", prefix = "settings_display_", suffix = "_key", value = {
|
||||
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
|
||||
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
|
||||
@Preference(name = "rotate_screen", type = boolean.class, defaultValue = "false"),
|
||||
}),
|
||||
@PreferenceGroup( name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
|
||||
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/home_container"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -20,7 +19,8 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.45" />
|
||||
app:layout_constraintVertical_bias="0.45"
|
||||
tools:text="2024-12-24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/home_lower_view"
|
||||
|
@ -28,10 +28,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="start|center_vertical"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:text="18:00:00"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_upper_view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -82,6 +82,7 @@
|
|||
-->
|
||||
<string name="settings_display_screen_timeout_disabled_key" translatable="false">display.disable_timeout</string>
|
||||
<string name="settings_display_full_screen_key" translatable="false">display.use_full_screen</string>
|
||||
<string name="settings_display_rotate_screen_key" translatable="false">display.rotate_screen</string>
|
||||
|
||||
<string name="settings_enabled_gestures_double_swipe_key" translatable="false">enabled_gestures.double_actions</string>
|
||||
<string name="settings_enabled_gestures_edge_swipe_key" translatable="false">enabled_gestures.edge_actions</string>
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
|
||||
<string name="settings_display_screen_timeout_disabled">Keep screen on</string>
|
||||
<string name="settings_display_full_screen">Use full screen</string>
|
||||
<string name="settings_display_rotate_screen">Rotate screen</string>
|
||||
|
||||
<string name="settings_launcher_section_functionality">Functionality</string>
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
<SwitchPreference
|
||||
android:key="@string/settings_display_full_screen_key"
|
||||
android:title="@string/settings_display_full_screen"/>
|
||||
<SwitchPreference
|
||||
android:key="@string/settings_display_rotate_screen_key"
|
||||
android:title="@string/settings_display_rotate_screen"/>
|
||||
<SwitchPreference
|
||||
android:key="@string/settings_display_screen_timeout_disabled_key"
|
||||
android:title="@string/settings_display_screen_timeout_disabled"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue