Skip to content

Commit

Permalink
Enable landscape.
Browse files Browse the repository at this point in the history
  • Loading branch information
PureAway committed Mar 22, 2018
1 parent 81058de commit 767b420
Show file tree
Hide file tree
Showing 12 changed files with 354 additions and 298 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
android:enabled="true"
android:launchMode="singleTask"
android:resumeWhilePausing="true"
android:screenOrientation="nosensor"
android:screenOrientation="sensor"
android:stateNotNeeded="true"
android:taskAffinity=""
android:theme="@style/LauncherTheme"
Expand Down
43 changes: 24 additions & 19 deletions res/layout-land/launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -15,8 +14,7 @@
-->

<!-- Full screen view projects under the status bar and contains the background -->
<com.android.launcher3.LauncherRootView
xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.launcher3.LauncherRootView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:id="@+id/launcher"
android:layout_width="match_parent"
Expand All @@ -25,12 +23,12 @@

<com.android.launcher3.dragndrop.DragLayer
android:id="@+id/drag_layer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/workspace_bg"
android:clipChildren="false"
android:clipToPadding="false"
android:background="@drawable/workspace_bg"
android:importantForAccessibility="no"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:importantForAccessibility="no">

<!-- The workspace contains 5 screens of cells -->
<!-- DO NOT CHANGE THE ID -->
Expand All @@ -42,8 +40,9 @@
launcher:pageIndicator="@id/page_indicator" />

<!-- DO NOT CHANGE THE ID -->
<include layout="@layout/hotseat"
<include
android:id="@+id/hotseat"
layout="@layout/hotseat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
Expand All @@ -53,31 +52,37 @@
android:id="@+id/drop_target_bar"
layout="@layout/drop_target_bar_vert" />

<include layout="@layout/overview_panel"
<include
android:id="@+id/overview_panel"
layout="@layout/overview_panel"
android:visibility="gone" />

<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
<!-- <com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
android:id="@+id/page_indicator"
android:layout_width="@dimen/dynamic_grid_page_indicator_height"
android:layout_height="@dimen/dynamic_grid_page_indicator_height"
android:layout_gravity="center|bottom"
android:layout_marginBottom="30dp"/>-->
<include
android:id="@+id/page_indicator"
android:layout_width="@dimen/dynamic_grid_page_indicator_height"
android:layout_height="@dimen/dynamic_grid_page_indicator_height"
android:layout_gravity="center|bottom"
android:layout_marginBottom="30dp"/>
layout="@layout/page_indicator" />

<!-- A place holder view instead of the QSB in transposed layout -->
<View
android:id="@+id/workspace_blocked_row"
android:layout_width="0dp"
android:layout_height="10dp"
android:id="@+id/workspace_blocked_row" />
android:layout_height="10dp" />

<include layout="@layout/widgets_view"
<include
android:id="@+id/widgets_view"
layout="@layout/widgets_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />

<include layout="@layout/all_apps"
<include
android:id="@+id/apps_view"
layout="@layout/all_apps"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />
Expand Down
4 changes: 2 additions & 2 deletions res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<bool name="config_largeHeap">false</bool>
<bool name="is_tablet">false</bool>
<bool name="is_large_tablet">false</bool>
<bool name="allow_rotation">false</bool>
<bool name="allow_rotation">true</bool>

<!-- A string pointer to the original app name string. This allows derived projects to
easily override the app name without providing all translations -->
Expand Down Expand Up @@ -66,7 +66,7 @@
<integer name="config_caretAnimationDuration">200</integer>

<!-- Hotseat -->
<bool name="hotseat_transpose_layout_with_orientation">true</bool>
<bool name="hotseat_transpose_layout_with_orientation">false</bool>

<!-- Name of a subclass of com.android.launcher3.AppFilter used to
filter the activities shown in the launcher. Can be empty. -->
Expand Down
22 changes: 11 additions & 11 deletions res/xml/default_workspace_3x3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Messaging, [All Apps], Dialer -->

<resolve
launcher:container="-101"
launcher:screen="0"
launcher:x="0"
launcher:y="0" >
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" />
<favorite launcher:uri="sms:" />
<favorite launcher:uri="smsto:" />
<favorite launcher:uri="mms:" />
<favorite launcher:uri="mmsto:" />
</resolve>
<!-- <resolve
launcher:container="-101"
launcher:screen="0"
launcher:x="0"
launcher:y="0" >
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" />
<favorite launcher:uri="sms:" />
<favorite launcher:uri="smsto:" />
<favorite launcher:uri="mms:" />
<favorite launcher:uri="mmsto:" />
</resolve>-->

<!-- All Apps -->

Expand Down
10 changes: 5 additions & 5 deletions res/xml/default_workspace_5x6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<include launcher:workspace="@xml/dw_tablet_hotseat" />

<!-- Bottom row -->
<favorite
launcher:screen="0"
launcher:x="0"
launcher:y="-1"
launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_CONTACTS;end" />
<!-- <favorite
launcher:screen="0"
launcher:x="0"
launcher:y="-1"
launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_CONTACTS;end" />-->
<!--
<resolve
launcher:screen="0"
Expand Down
14 changes: 7 additions & 7 deletions src/com/android/launcher3/DeviceProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,12 @@ public void layout(Launcher launcher, boolean notifyListeners) {
workspacePadding.bottom);
workspace.setPageSpacing(getWorkspacePageSpacing());

View qsbContainer = launcher.getQsbContainer();
lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
lp.topMargin = mInsets.top + workspacePadding.top;
lp.width = LayoutParams.MATCH_PARENT;
lp.height = LayoutParams.MATCH_PARENT;
qsbContainer.setLayoutParams(lp);
// View qsbContainer = launcher.getQsbContainer();
// lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
// lp.topMargin = mInsets.top + workspacePadding.top;
// lp.width = LayoutParams.MATCH_PARENT;
// lp.height = LayoutParams.MATCH_PARENT;
// qsbContainer.setLayoutParams(lp);

// Layout the hotseat
Hotseat hotseat = (Hotseat) launcher.findViewById(R.id.hotseat);
Expand Down Expand Up @@ -536,8 +536,8 @@ public void layout(Launcher launcher, boolean notifyListeners) {
View pageIndicator = launcher.findViewById(R.id.page_indicator);
if (pageIndicator != null) {
lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
boolean isLandScape = mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
if (isVerticalBarLayout()) {
boolean isLandScape = mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
if (mInsets.left > 0) {
lp.leftMargin = mInsets.left + pageIndicatorLandGutterLeftNavBarPx -
lp.width - pageIndicatorLandWorkspaceOffsetPx;
Expand Down
11 changes: 6 additions & 5 deletions src/com/android/launcher3/Hotseat.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ protected void onFinishInflate() {
super.onFinishInflate();
DeviceProfile grid = mLauncher.getDeviceProfile();
mContent = (CellLayout) findViewById(R.id.layout);
if (grid.isLandscape && !grid.isLargeTablet) {
mContent.setGridSize(1, (int) grid.inv.numHotseatIcons);
} else {
mContent.setGridSize((int) grid.inv.numHotseatIcons, 1);
}
//modify
// if (grid.isLandscape && !grid.isLargeTablet) {
// mContent.setGridSize(1, (int) grid.inv.numHotseatIcons);
// } else {
mContent.setGridSize(grid.inv.numHotseatIcons, 1);
// }
mContent.setIsHotseat(true);

resetLayout();
Expand Down
Loading

0 comments on commit 767b420

Please sign in to comment.