gui: Convert UI to use Fragments
Change-Id: I7269604a1da72e6b22f4bbac31c1f5561660ccf5
Refs: #2646, #2667
diff --git a/app/src/main/res/layout/activity_fragment.xml b/app/src/main/res/layout/activity_fragment.xml
new file mode 100644
index 0000000..98ee139
--- /dev/null
+++ b/app/src/main/res/layout/activity_fragment.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/fragment_container"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ >
+
+</FrameLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..6d8b08a
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity">
+
+ <!-- Main container for fragments to be presented in -->
+ <FrameLayout
+ android:id="@+id/main_fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
+
+ <!-- DrawerFragment for user navigation -->
+ <FrameLayout
+ android:id="@+id/navigation_drawer"
+ android:layout_width="@dimen/drawer_width"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ tools:layout="@layout/activity_main_drawer_listview"
+ />
+
+</android.support.v4.widget.DrawerLayout>
diff --git a/app/src/main/res/layout/activity_main_drawer_listview.xml b/app/src/main/res/layout/activity_main_drawer_listview.xml
new file mode 100644
index 0000000..7ca3700
--- /dev/null
+++ b/app/src/main/res/layout/activity_main_drawer_listview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ListView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:choiceMode="singleChoice"
+ android:divider="@android:color/transparent"
+ android:dividerHeight="0dp"
+ android:background="#cccc"
+ tools:context=".DrawerFragment"
+/>
diff --git a/app/src/main/res/layout/create_face.xml b/app/src/main/res/layout/create_face.xml
index 6588dcc..02d40a6 100644
--- a/app/src/main/res/layout/create_face.xml
+++ b/app/src/main/res/layout/create_face.xml
@@ -7,7 +7,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/dialog_margin"
+ style="@style/default_dialog_margin"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Enter FaceUri for the remote NDN daemon"
android:layout_gravity="center_horizontal"/>
@@ -16,7 +16,7 @@
android:id="@+id/faceUri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/dialog_margin"
+ style="@style/default_dialog_margin"
android:hint="Face URI"
android:inputType="text"
android:focusable="true"
diff --git a/app/src/main/res/layout/create_route.xml b/app/src/main/res/layout/create_route.xml
index ddf7fb2..67c7677 100644
--- a/app/src/main/res/layout/create_route.xml
+++ b/app/src/main/res/layout/create_route.xml
@@ -7,7 +7,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/dialog_margin"
+ style="@style/default_dialog_margin"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Enter prefix and FaceUri to register with NDN daemon"
android:layout_gravity="center_horizontal"/>
@@ -16,7 +16,7 @@
android:id="@+id/prefix"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/dialog_margin"
+ style="@style/default_dialog_margin"
android:hint="Prefix"
android:inputType="text"
android:focusable="true"
@@ -29,7 +29,7 @@
android:id="@+id/faceUri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/dialog_margin"
+ style="@style/default_dialog_margin"
android:hint="Face URI"
android:inputType="text"
android:focusable="true"
diff --git a/app/src/main/res/layout/face_status_item.xml b/app/src/main/res/layout/face_status_item.xml
deleted file mode 100644
index 9fd2a6b..0000000
--- a/app/src/main/res/layout/face_status_item.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="10dp">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="Title"
- android:id="@+id/title"
- android:textColor="@android:color/primary_text_light"/>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="Value"
- android:id="@+id/value"
- android:textAlignment="gravity"
- android:gravity="right"
- android:textColor="@android:color/secondary_text_dark"
- android:layout_gravity="right"/>
-</LinearLayout>
diff --git a/app/src/main/res/layout/fragment_face_detail.xml b/app/src/main/res/layout/fragment_face_detail.xml
new file mode 100644
index 0000000..c251036
--- /dev/null
+++ b/app/src/main/res/layout/fragment_face_detail.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/default_linear_layout_padding"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/fragment_face_details_title"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <include
+ layout="@android:layout/list_content"
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_face_list.xml b/app/src/main/res/layout/fragment_face_list.xml
new file mode 100644
index 0000000..f7c2388
--- /dev/null
+++ b/app/src/main/res/layout/fragment_face_list.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/default_linear_layout_padding"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/face_list_actions_title"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <Button
+ android:id="@+id/face_list_refresh_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/face_list_refresh_face_list"
+ style="@style/default_custom_white_button"
+ />
+ <Button
+ android:id="@+id/face_list_add_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/face_list_add_face"
+ style="@style/default_custom_white_button"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/face_list_list_of_faces_title"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ >
+
+ <ProgressBar
+ android:id="@+id/face_list_reloading_list_progress_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone"
+ />
+
+ <LinearLayout
+ android:id="@+id/face_list_info_unavailable"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:visibility="gone"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/oops"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/error_cannot_communicate_with_nfd"
+ />
+
+ </LinearLayout>
+
+ <include
+ layout="@android:layout/list_content"
+ />
+
+ </FrameLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_log.xml b/app/src/main/res/layout/fragment_logcat_output.xml
similarity index 100%
rename from app/src/main/res/layout/activity_log.xml
rename to app/src/main/res/layout/fragment_logcat_output.xml
diff --git a/app/src/main/res/layout/fragment_logcat_tags_list.xml b/app/src/main/res/layout/fragment_logcat_tags_list.xml
new file mode 100644
index 0000000..2688e0d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_logcat_tags_list.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/default_linear_layout_padding"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/fragment_logcat_general_operations_category"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <Button
+ android:id="@+id/logcat_reset_loglevel_defaults"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/logcat_reset_log_level_defaults"
+ style="@style/default_custom_white_button"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/fragment_logcat_tags_n_log_levels"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <include
+ layout="@android:layout/list_content"
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
new file mode 100644
index 0000000..9fa4afa
--- /dev/null
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/default_linear_layout_padding"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/pref_category_title_general"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <Switch
+ android:id="@+id/nfd_start_stop_switch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:text="@string/checking_on_nfd"
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_route_list.xml b/app/src/main/res/layout/fragment_route_list.xml
new file mode 100644
index 0000000..b1d481b
--- /dev/null
+++ b/app/src/main/res/layout/fragment_route_list.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/default_linear_layout_padding"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/route_list_actions_title"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <Button
+ android:id="@+id/route_list_refresh_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/route_list_refresh_route_list"
+ style="@style/default_custom_white_button"
+ />
+ <Button
+ android:id="@+id/route_list_add_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/route_list_add_route"
+ style="@style/default_custom_white_button"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/route_list_list_of_routes_title"
+ style="?android:listSeparatorTextViewStyle"
+ />
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ >
+
+ <ProgressBar
+ android:id="@+id/route_list_reloading_list_progress_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone"
+ />
+
+ <LinearLayout
+ android:id="@+id/route_list_info_unavailable"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:visibility="gone"
+ >
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/oops"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/error_cannot_communicate_with_nfd"
+ />
+
+ </LinearLayout>
+
+ <include
+ layout="@android:layout/list_content"
+ />
+
+ </FrameLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_drawer_item.xml b/app/src/main/res/layout/list_item_drawer_item.xml
new file mode 100644
index 0000000..08a598b
--- /dev/null
+++ b/app/src/main/res/layout/list_item_drawer_item.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/drawer_item_background_activated"
+ android:paddingLeft="@dimen/default_padding_left"
+ android:paddingRight="@dimen/default_padding_right"
+ >
+
+ <ImageView
+ android:id="@+id/drawer_item_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ />
+
+ <TextView
+ android:id="@+id/drawer_item_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_face_generic_item.xml b/app/src/main/res/layout/list_item_face_generic_item.xml
new file mode 100644
index 0000000..7683c68
--- /dev/null
+++ b/app/src/main/res/layout/list_item_face_generic_item.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
+
+ <TextView
+ android:id="@+id/list_item_generic_title"
+ android:text="Title"
+ style="@style/two_column_item_title"
+ />
+
+ <TextView
+ android:id="@+id/list_item_generic_value"
+ android:text="Value"
+ style="@style/two_column_item_secondary"
+ />
+
+</LinearLayout>
diff --git a/app/src/main/res/layout/list_item_face_status_item.xml b/app/src/main/res/layout/list_item_face_status_item.xml
new file mode 100644
index 0000000..0b6a1d0
--- /dev/null
+++ b/app/src/main/res/layout/list_item_face_status_item.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/item_background_activated"
+ >
+
+ <TextView
+ android:id="@+id/list_item_face_uri"
+ android:text="FaceUri"
+ style="@style/two_row_item_title"
+ />
+
+ <TextView
+ android:id="@+id/list_item_face_id"
+ android:text="FaceId"
+ style="@style/two_row_item_secondary"
+ />
+
+</LinearLayout>
diff --git a/app/src/main/res/layout/log_item.xml b/app/src/main/res/layout/list_item_log.xml
similarity index 100%
rename from app/src/main/res/layout/log_item.xml
rename to app/src/main/res/layout/list_item_log.xml
diff --git a/app/src/main/res/layout/list_item_route_item.xml b/app/src/main/res/layout/list_item_route_item.xml
new file mode 100644
index 0000000..baa6da0
--- /dev/null
+++ b/app/src/main/res/layout/list_item_route_item.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/item_background_activated"
+ >
+
+ <TextView
+ android:id="@+id/list_item_route_uri"
+ android:text="Route"
+ style="@style/two_row_item_title"
+ />
+
+ <TextView
+ android:id="@+id/list_item_face_list"
+ android:text="Faces"
+ style="@style/two_row_item_secondary"
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_setting_item.xml b/app/src/main/res/layout/list_item_setting_item.xml
new file mode 100644
index 0000000..4d8498b
--- /dev/null
+++ b/app/src/main/res/layout/list_item_setting_item.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/item_background_activated"
+ >
+
+ <TextView
+ android:id="@+id/list_item_log_tag"
+ style="@style/two_row_item_title"
+ />
+
+ <TextView
+ android:id="@+id/list_item_setting_log_level"
+ style="@style/two_row_item_secondary"
+ />
+
+</LinearLayout>
\ No newline at end of file