Blog Fragment in Navigation Drawer with Tabs

This replaces the custom layouts in the navigation drawer with a
`NavigationView` and adds a menu entry for Blogs.

A Main Blogs fragment is added that holds a `TabLayout` and a
`ViewPager`. Five tabs are already added, but they just have a single
placeholder fragment that is to be replaced by the actual fragments.

Closes #409
This commit is contained in:
Torsten Grote
2016-06-02 19:06:53 -03:00
parent bba7083660
commit 3f838b0472
40 changed files with 410 additions and 109 deletions

View File

@@ -13,7 +13,7 @@
<include
android:id="@+id/navigation_menu_drawer"
layout="@layout/navigation_menu"
android:layout_width="@dimen/nav_drawer_width"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"/>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
style="@style/BriarTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs_feed"/>
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs_my_blogs"/>
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs_blog_list"/>
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs_available_blogs"/>
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs_drafts"/>
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This is just a placeholder to be replaced by the real My Blogs list -->
<LinearLayout
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:orientation="vertical">
<TextView
android:id="@+id/num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="@dimen/margin_activity_horizontal"
android:textSize="128sp"
tools:text="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_activity_horizontal"
android:text="There is nothing for you to see here.\n\nMove along and come back later."
android:textSize="@dimen/text_size_large"/>
</LinearLayout>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:showIn="@layout/navigation_menu">
<ImageView
android:id="@+id/imageView2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="top|center_horizontal"
android:layout_margin="@dimen/margin_medium"
android:contentDescription="@string/app_name"
android:src="@drawable/briar_logo_large"/>
<View
style="@style/Divider.Horizontal"
android:layout_gravity="bottom"/>
</FrameLayout>

View File

@@ -1,110 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/nav_drawer_width"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/menu_background"
android:orientation="vertical">
<TextView
android:id="@+id/nav_menu_header"
style="@style/BriarTextTitleInverted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/briar_primary"
android:paddingBottom="@dimen/margin_large"
android:paddingLeft="@dimen/margin_large"
android:paddingTop="@dimen/margin_xlarge"
android:textStyle="bold"
tools:text="Username"
/>
<ScrollView
android:layout_width="match_parent"
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fadingEdge="none"
android:fillViewport="true">
android:layout_gravity="start"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/navigation_drawer">
<LinearLayout
android:layout_width="match_parent"
<include
layout="@layout/transports_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/nav_btn_contacts"
style="@style/NavMenuButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/social_person"
android:onClick="onNavigationClick"
android:text="@string/contact_list_button"/>
<View
style="@style/Divider"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_separator_height"
android:layout_marginLeft="@dimen/margin_large"/>
<Button
android:id="@+id/nav_btn_forums"
style="@style/NavMenuButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/social_chat"
android:onClick="onNavigationClick"
android:text="@string/forums_button"/>
<View
style="@style/Divider"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_separator"
android:layout_marginLeft="@dimen/margin_large"/>
<Button
android:id="@+id/nav_btn_settings"
style="@style/NavMenuButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/action_settings"
android:onClick="onNavigationClick"
android:text="@string/settings_button"/>
<View
style="@style/Divider"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_separator"
android:layout_marginLeft="@dimen/margin_large"/>
<Button
android:id="@+id/nav_btn_signout"
style="@style/NavMenuButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/device_access_accounts"
android:onClick="onNavigationClick"
android:text="@string/sign_out_button"/>
<View
style="@style/Divider"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_separator"
android:layout_marginLeft="@dimen/margin_large"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"/>
<include
layout="@layout/transports_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</ScrollView>
android:layout_gravity="bottom"
tools:visibility="gone"/>
</android.support.design.widget.NavigationView>
</LinearLayout>

View File

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
tools:showIn="@layout/navigation_menu">
<View style="@style/Divider.Horizontal"/>
@@ -12,6 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_medium"
android:numColumns="3"/>
android:numColumns="3"
tools:listitem="@layout/list_item_transport"/>
</LinearLayout>