diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4afc169..ebd7e19 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -10,9 +10,10 @@
-
-
-
+
+
+
+
diff --git a/app/src/main/java/com/wytehat/btlogger/DeviceManagerActivity.java b/app/src/main/java/com/wytehat/btlogger/DeviceManagerActivity.java
index 03a724f..9c2e5b0 100644
--- a/app/src/main/java/com/wytehat/btlogger/DeviceManagerActivity.java
+++ b/app/src/main/java/com/wytehat/btlogger/DeviceManagerActivity.java
@@ -239,6 +239,7 @@ public class DeviceManagerActivity extends Activity {
root.addView(pairedList, new LinearLayout.LayoutParams(-1, 0, 1));
pairedHeader.setVisibility(View.GONE); pairedList.setVisibility(View.GONE);
setContentView(root);
+ LargeScreenLayout.constrain(this);
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
filter.addAction(BluetoothDevice.ACTION_FOUND);
diff --git a/app/src/main/java/com/wytehat/btlogger/LargeScreenLayout.java b/app/src/main/java/com/wytehat/btlogger/LargeScreenLayout.java
new file mode 100644
index 0000000..13724e4
--- /dev/null
+++ b/app/src/main/java/com/wytehat/btlogger/LargeScreenLayout.java
@@ -0,0 +1,72 @@
+package com.wytehat.btlogger;
+
+import android.app.Activity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+/**
+ * Keeps the phone-sized UI readable on tablets and unfolded foldables.
+ *
+ * The screens are laid out for a ~360dp phone. Stretched across a 670dp+
+ * inner display every row spans the full width, which leaves controls
+ * marooned at opposite edges. Centering the content in a phone-width column
+ * keeps the proportions the layouts were designed for.
+ */
+final class LargeScreenLayout {
+
+ /** Below this the layout is already phone-shaped; leave it alone. */
+ private static final int WIDE_THRESHOLD_DP = 640;
+
+ /** Column width used once the screen is wider than the threshold. */
+ private static final int CONTENT_WIDTH_DP = 600;
+
+ private LargeScreenLayout() {
+ }
+
+ /**
+ * Call after setContentView. No-op on phones and on folded screens.
+ */
+ static void constrain(Activity activity) {
+
+ float density =
+ activity.getResources().getDisplayMetrics().density;
+
+ int widthDp = (int)
+ (activity.getResources().getDisplayMetrics().widthPixels / density);
+
+ if (widthDp < WIDE_THRESHOLD_DP) {
+ return;
+ }
+
+ View content =
+ activity.findViewById(android.R.id.content);
+
+ if (!(content instanceof ViewGroup)) {
+ return;
+ }
+
+ ViewGroup holder = (ViewGroup) content;
+
+ if (holder.getChildCount() == 0) {
+ return;
+ }
+
+ View root = holder.getChildAt(0);
+
+ ViewGroup.LayoutParams existing =
+ root.getLayoutParams();
+
+ if (!(existing instanceof FrameLayout.LayoutParams)) {
+ return;
+ }
+
+ FrameLayout.LayoutParams params =
+ (FrameLayout.LayoutParams) existing;
+
+ params.width = (int) (CONTENT_WIDTH_DP * density + 0.5f);
+ params.gravity = android.view.Gravity.CENTER_HORIZONTAL;
+
+ root.setLayoutParams(params);
+ }
+}
diff --git a/app/src/main/java/com/wytehat/btlogger/LiveRangeFinderActivity.java b/app/src/main/java/com/wytehat/btlogger/LiveRangeFinderActivity.java
index 989d3d6..3254a8e 100644
--- a/app/src/main/java/com/wytehat/btlogger/LiveRangeFinderActivity.java
+++ b/app/src/main/java/com/wytehat/btlogger/LiveRangeFinderActivity.java
@@ -169,6 +169,7 @@ public class LiveRangeFinderActivity extends Activity implements LocationListene
root.addView(map, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
setContentView(root);
+ LargeScreenLayout.constrain(this);
startButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { startSearch(); }
diff --git a/app/src/main/java/com/wytehat/btlogger/MainActivity.java b/app/src/main/java/com/wytehat/btlogger/MainActivity.java
index 7eebb2a..738c37a 100644
--- a/app/src/main/java/com/wytehat/btlogger/MainActivity.java
+++ b/app/src/main/java/com/wytehat/btlogger/MainActivity.java
@@ -32,6 +32,7 @@ public class MainActivity extends Activity implements ItemActionListener {
protected void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.main);
+ LargeScreenLayout.constrain(this);
LinearLayout nav = (LinearLayout) findViewById(R.id.navigation_container);
nav.addView(NavigationHelper.createBar(this, 0, "My Tracked Items"));
db = new TrackerDatabase(this);
diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml
index acb3b40..5f6ad14 100644
--- a/app/src/main/res/layout/main.xml
+++ b/app/src/main/res/layout/main.xml
@@ -11,5 +11,5 @@
-
+