import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.net.Uri;
String position = getTaskbarPosition(context);
boolean overridePad = position.equals("top_left") || position.equals("top_right");
- int left = launchType == RIGHT ? display.getWidth() / 2 : 0;
- int top = padStatusBar || overridePad ? statusBarHeight : 0;
- int right = launchType == LEFT ? display.getWidth() / 2 : display.getWidth();
- int bottom = display.getHeight() + (!padStatusBar && overridePad ? statusBarHeight : 0);
+ boolean isPortrait = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
+ boolean isLandscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
+
+ int left = launchType == RIGHT && isLandscape
+ ? display.getWidth() / 2
+ : 0;
+
+ int top = launchType == RIGHT && isPortrait
+ ? display.getHeight() / 2
+ : padStatusBar || overridePad ? statusBarHeight : 0;
+
+ int right = launchType == LEFT && isLandscape
+ ? display.getWidth() / 2
+ : display.getWidth();
+
+ int bottom = launchType == LEFT && isPortrait
+ ? display.getHeight() / 2
+ : display.getHeight() + (!padStatusBar && overridePad ? statusBarHeight : 0);
+
int iconSize = context.getResources().getDimensionPixelSize(R.dimen.icon_size);
if(position.contains("vertical_left")) {
- if(launchType != RIGHT) left = left + iconSize;
+ if(launchType != RIGHT || isPortrait) left = left + iconSize;
} else if(position.contains("vertical_right")) {
- if(launchType != LEFT) right = right - iconSize;
+ if(launchType != LEFT || isPortrait) right = right - iconSize;
} else if(position.contains("bottom"))
bottom = bottom - iconSize;
else
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="window_size_half_left">Half screen (left)</string>
+ <string name="window_size_half_right">Half screen (right)</string>
+
+</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="window_size_half_left">Half screen (top)</string>
+ <string name="window_size_half_right">Half screen (bottom)</string>
+
+</resources>
<string name="window_size_fullscreen">全画面</string>
<string name="window_size_phone_size">電話サイズ</string>
<string name="window_size_large">Large</string>
- <string name="window_size_half_left">Half screen (left)</string>
- <string name="window_size_half_right">Half screen (right)</string>
+ <string name="window_size_half_left">@string/window_size_half_left_alt</string>
+ <string name="window_size_half_left_alt">Half screen (left/top)</string>
+ <string name="window_size_half_right">@string/window_size_half_right_alt</string>
+ <string name="window_size_half_right_alt">Half screen (right/bottom)</string>
<string name="pref_title_blacklist">スタートメニューからアプリを非表示</string>
<string name="app_hidden">1 非表示アプリ</string>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="window_size_half_left">Half screen (left)</string>
+ <string name="window_size_half_right">Half screen (right)</string>
+
+</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="window_size_half_left">Half screen (top)</string>
+ <string name="window_size_half_right">Half screen (bottom)</string>
+
+</resources>
<item>@string/window_size_standard</item>
<item>@string/window_size_large</item>
<item>@string/window_size_fullscreen</item>
- <item>@string/window_size_half_left</item>
- <item>@string/window_size_half_right</item>
+ <item>@string/window_size_half_left_alt</item>
+ <item>@string/window_size_half_right_alt</item>
<item>@string/window_size_phone_size</item>
</string-array>
<string name="window_size_fullscreen">Fullscreen</string>
<string name="window_size_phone_size">Phone size</string>
<string name="window_size_large">Large</string>
- <string name="window_size_half_left">Half screen (left)</string>
- <string name="window_size_half_right">Half screen (right)</string>
+ <string name="window_size_half_left">@string/window_size_half_left_alt</string>
+ <string name="window_size_half_left_alt">Half screen (left/top)</string>
+ <string name="window_size_half_right">@string/window_size_half_right_alt</string>
+ <string name="window_size_half_right_alt">Half screen (right/bottom)</string>
<string name="pref_title_blacklist">Hide apps from start menu</string>
<string name="app_hidden">1 app hidden</string>