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:exported="true"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
android:launchMode="singleTask"
|
android:configChanges="orientation|screenSize"
|
||||||
android:screenOrientation="portrait"
|
android:launchMode="singleTask" >
|
||||||
tools:ignore="LockedOrientationActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.HOME" />
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
@ -35,20 +34,16 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".tutorial.TutorialActivity"
|
android:name=".tutorial.TutorialActivity"
|
||||||
android:screenOrientation="portrait"
|
android:configChanges="orientation|screenSize" >
|
||||||
tools:ignore="LockedOrientationActivity">
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".list.ListActivity"
|
android:name=".list.ListActivity"
|
||||||
android:screenOrientation="portrait"
|
android:windowSoftInputMode="adjustResize" >
|
||||||
android:windowSoftInputMode="adjustResize"
|
|
||||||
tools:ignore="LockedOrientationActivity">
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".settings.SettingsActivity"
|
android:name=".settings.SettingsActivity"
|
||||||
android:exported="true"
|
android:configChanges="orientation|screenSize"
|
||||||
android:screenOrientation="portrait"
|
android:exported="true" >
|
||||||
tools:ignore="LockedOrientationActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES"/>
|
<action android:name="android.intent.action.APPLICATION_PREFERENCES"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package de.jrpie.android.launcher
|
package de.jrpie.android.launcher
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
|
@ -38,7 +39,14 @@ fun setWindowFlags(window: Window, homeScreen: Boolean) {
|
||||||
|
|
||||||
interface UIObject {
|
interface UIObject {
|
||||||
fun onStart() {
|
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()
|
setOnClicks()
|
||||||
adjustLayout()
|
adjustLayout()
|
||||||
|
|
|
@ -39,6 +39,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
|
||||||
@PreferenceGroup(name = "display", prefix = "settings_display_", suffix = "_key", value = {
|
@PreferenceGroup(name = "display", prefix = "settings_display_", suffix = "_key", value = {
|
||||||
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
|
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
|
||||||
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
|
@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 = {
|
@PreferenceGroup( name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
|
||||||
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
|
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/home_container"
|
android:id="@+id/home_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -20,7 +19,8 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.45" />
|
app:layout_constraintVertical_bias="0.45"
|
||||||
|
tools:text="2024-12-24" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/home_lower_view"
|
android:id="@+id/home_lower_view"
|
||||||
|
@ -28,10 +28,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="start|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:textSize="18sp"
|
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_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</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_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_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_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>
|
<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_screen_timeout_disabled">Keep screen on</string>
|
||||||
<string name="settings_display_full_screen">Use full screen</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>
|
<string name="settings_launcher_section_functionality">Functionality</string>
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,9 @@
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="@string/settings_display_full_screen_key"
|
android:key="@string/settings_display_full_screen_key"
|
||||||
android:title="@string/settings_display_full_screen"/>
|
android:title="@string/settings_display_full_screen"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/settings_display_rotate_screen_key"
|
||||||
|
android:title="@string/settings_display_rotate_screen"/>
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="@string/settings_display_screen_timeout_disabled_key"
|
android:key="@string/settings_display_screen_timeout_disabled_key"
|
||||||
android:title="@string/settings_display_screen_timeout_disabled"/>
|
android:title="@string/settings_display_screen_timeout_disabled"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue