summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-07 16:55:02 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-07 16:55:02 -0500
commit372477d0e02e5a6c71af62b10643d55d4c7b9bf5 (patch)
treee002c0d56e5dac494c79b9354393cf05abc16e02 /app
parent93e304ba2df55a89fb94c9540c16314440f054b8 (diff)
ProfileList: Load fragment programmatically
This is necessary to replace it with the profile detail fragment later. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/wireguard/android/ProfileActivity.java6
-rw-r--r--app/src/main/res/layout/profile_activity.xml5
2 files changed, 8 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/ProfileActivity.java b/app/src/main/java/com/wireguard/android/ProfileActivity.java
index 5daaf54c..ab4022c1 100644
--- a/app/src/main/java/com/wireguard/android/ProfileActivity.java
+++ b/app/src/main/java/com/wireguard/android/ProfileActivity.java
@@ -1,6 +1,7 @@
package com.wireguard.android;
import android.app.Activity;
+import android.app.FragmentTransaction;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -35,7 +36,12 @@ public class ProfileActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ // This layout consists only of containers for fragments.
setContentView(R.layout.profile_activity);
+ // Fill the layout with the initial set of fragments.
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ transaction.add(R.id.list_fragment_container, new ProfileListFragment());
+ transaction.commit();
// Ensure the long-running service is started. This only needs to happen once.
Intent intent = new Intent(this, ProfileService.class);
startService(intent);
diff --git a/app/src/main/res/layout/profile_activity.xml b/app/src/main/res/layout/profile_activity.xml
index e408985d..d9b6a1f6 100644
--- a/app/src/main/res/layout/profile_activity.xml
+++ b/app/src/main/res/layout/profile_activity.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/profile_list_fragment"
- android:name="com.wireguard.android.ProfileListFragment"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/list_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />