From 27be4aacb21527b8f35df848e081b26c871f7ee6 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Thu, 22 Aug 2013 22:12:41 +0000 Subject: [PATCH] Adjusted weighting of two-pane layout, set AddressbookActivity to use it --- res/layout/activity_navdrawer_twopane.xml | 2 +- .../router/activity/AddressbookActivity.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/res/layout/activity_navdrawer_twopane.xml b/res/layout/activity_navdrawer_twopane.xml index 2044e277d..eb11f12cf 100644 --- a/res/layout/activity_navdrawer_twopane.xml +++ b/res/layout/activity_navdrawer_twopane.xml @@ -33,7 +33,7 @@ android:id="@+id/detail_fragment" android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="3" /> + android:layout_weight="2" /> </LinearLayout> diff --git a/src/net/i2p/android/router/activity/AddressbookActivity.java b/src/net/i2p/android/router/activity/AddressbookActivity.java index 22149cc72..a85dd7603 100644 --- a/src/net/i2p/android/router/activity/AddressbookActivity.java +++ b/src/net/i2p/android/router/activity/AddressbookActivity.java @@ -15,9 +15,29 @@ import android.view.MenuItem; public class AddressbookActivity extends I2PActivityBase implements AddressbookFragment.OnAddressSelectedListener, SearchView.OnQueryTextListener { + /** + * Whether or not the activity is in two-pane mode, i.e. running on a tablet + * device. + */ + private boolean mTwoPane; + + @Override + protected boolean canUseTwoPanes() { + return true; + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + if (findViewById(R.id.detail_fragment) != null) { + // The detail container view will be present only in the + // large-screen layouts (res/values-large and + // res/values-sw600dp). If this view is present, then the + // activity should be in two-pane mode. + mTwoPane = true; + } + // Start with the base view if (savedInstanceState == null) { AddressbookFragment f = new AddressbookFragment(); -- GitLab