From 2df899eae52591ff46819c960e129a2c698b201e Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 7 Aug 2017 18:51:47 -0500 Subject: ProfileActivity: Add two-pane master-detail layout This is designed for tablets, but for testing purposes, it is currently enabled for all devices in landscape orientation. Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/ProfileActivity.java | 4 ++++ app/src/main/res/layout-land/profile_activity.xml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 app/src/main/res/layout-land/profile_activity.xml (limited to 'app') diff --git a/app/src/main/java/com/wireguard/android/ProfileActivity.java b/app/src/main/java/com/wireguard/android/ProfileActivity.java index 699d394c..040feb23 100644 --- a/app/src/main/java/com/wireguard/android/ProfileActivity.java +++ b/app/src/main/java/com/wireguard/android/ProfileActivity.java @@ -22,6 +22,7 @@ import java.util.List; public class ProfileActivity extends Activity { private final ServiceConnection connection = new ProfileServiceConnection(); + private boolean isSplitLayout; private final List listeners = new ArrayList<>(); private ProfileServiceInterface service; @@ -38,9 +39,12 @@ public class ProfileActivity extends Activity { super.onCreate(savedInstanceState); // This layout consists only of containers for fragments. setContentView(R.layout.profile_activity); + isSplitLayout = findViewById(R.id.detail_fragment_container) != null; // Fill the layout with the initial set of fragments. final FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.add(R.id.list_fragment_container, new ProfileListFragment()); + if (isSplitLayout) + transaction.add(R.id.detail_fragment_container, new PlaceholderFragment()); transaction.commit(); // Ensure the long-running service is started. This only needs to happen once. final Intent intent = new Intent(this, ProfileService.class); diff --git a/app/src/main/res/layout-land/profile_activity.xml b/app/src/main/res/layout-land/profile_activity.xml new file mode 100644 index 00000000..acc56925 --- /dev/null +++ b/app/src/main/res/layout-land/profile_activity.xml @@ -0,0 +1,19 @@ + + + + + + + -- cgit v1.2.3