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
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
10
briar-android/res/drawable/blogs.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:alpha="0.54"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M13,12h7v1.5h-7zM13,9.5h7L20,11h-7zM13,14.5h7L20,16h-7zM21,4L3,4c-1.1,0 -2,0.9 -2,2v13c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,6c0,-1.1 -0.9,-2 -2,-2zM21,19h-9L12,6h9v13z"/>
|
||||
</vector>
|
||||
10
briar-android/res/drawable/ic_contacts_black_24dp.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:alpha="0.54"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/>
|
||||
</vector>
|
||||
10
briar-android/res/drawable/ic_forums_black_24dp.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:alpha="0.54"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M21,6h-2v9L6,15v2c0,0.55 0.45,1 1,1h11l4,4L22,7c0,-0.55 -0.45,-1 -1,-1zM17,12L17,3c0,-0.55 -0.45,-1 -1,-1L3,2c-0.55,0 -1,0.45 -1,1v14l4,-4h10c0.55,0 1,-0.45 1,-1z"/>
|
||||
</vector>
|
||||
10
briar-android/res/drawable/ic_settings_black_24dp.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:alpha="0.54"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||
</vector>
|
||||
10
briar-android/res/drawable/ic_signout_black_24dp.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:alpha="0.54"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M13,8.2l-1,-1 -4,4 -4,-4 -1,1 4,4 -4,4 1,1 4,-4 4,4 1,-1 -4,-4 4,-4zM19,1H9c-1.1,0 -2,0.9 -2,2v3h2V4h10v16H9v-2H7v3c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
@@ -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"/>
|
||||
|
||||
|
||||
46
briar-android/res/layout/fragment_blogs.xml
Normal 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>
|
||||
26
briar-android/res/layout/fragment_blogs_my.xml
Normal 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>
|
||||
22
briar-android/res/layout/navigation_header.xml
Normal 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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
28
briar-android/res/menu/navigation_drawer.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/nav_btn_contacts"
|
||||
android:icon="@drawable/ic_contacts_black_24dp"
|
||||
android:title="@string/contact_list_button"/>
|
||||
<item
|
||||
android:id="@+id/nav_btn_forums"
|
||||
android:icon="@drawable/ic_forums_black_24dp"
|
||||
android:title="@string/forums_button"/>
|
||||
<item
|
||||
android:id="@+id/nav_btn_blogs"
|
||||
android:icon="@drawable/blogs"
|
||||
android:title="@string/blogs_button"/>
|
||||
<item
|
||||
android:id="@+id/nav_btn_settings"
|
||||
android:icon="@drawable/ic_settings_black_24dp"
|
||||
android:title="@string/settings_button"/>
|
||||
<item
|
||||
android:id="@+id/nav_btn_signout"
|
||||
android:icon="@drawable/ic_signout_black_24dp"
|
||||
android:title="@string/sign_out_button"/>
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
@@ -18,8 +18,6 @@
|
||||
<dimen name="text_size_medium">16sp</dimen>
|
||||
<dimen name="text_size_large">20sp</dimen>
|
||||
<dimen name="text_size_xlarge">34sp</dimen>
|
||||
<dimen name="nav_drawer_width">300dp</dimen>
|
||||
<dimen name="nav_separator_height">1dp</dimen>
|
||||
|
||||
<dimen name="listitem_horizontal_margin">16dp</dimen>
|
||||
<dimen name="listitem_text_left_margin">72dp</dimen>
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
<string name="no_private_messages">No messages</string>
|
||||
<string name="private_message_hint">Type message</string>
|
||||
<string name="message_sent_toast">Message sent</string>
|
||||
<string name="forums_title">Forums</string>
|
||||
<string name="no_forums">You don\'t have any forums.\n\nWhy don\'t you create a new one yourself or ask your contacts to share one with you?</string>
|
||||
<plurals name="forums_shared">
|
||||
<item quantity="one">%d forum shared by contacts</item>
|
||||
@@ -237,5 +236,12 @@
|
||||
<string name="progress_title_logout">Signing out of Briar..</string>
|
||||
<string name="progress_title_please_wait">Please wait..</string>
|
||||
|
||||
<!-- Blogs -->
|
||||
<string name="blogs_button">Blogs</string>
|
||||
<string name="blogs_feed">Feed</string>
|
||||
<string name="blogs_my_blogs">My Blogs</string>
|
||||
<string name="blogs_blog_list">Blog List</string>
|
||||
<string name="blogs_available_blogs">Available Blogs</string>
|
||||
<string name="blogs_drafts">Drafts</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -145,4 +145,14 @@
|
||||
<item name="android:background">?android:attr/listDivider</item>
|
||||
</style>
|
||||
|
||||
<style name="BriarTabLayout" parent="Widget.Design.TabLayout">
|
||||
<item name="android:background">@color/briar_primary</item>
|
||||
<item name="tabMode">scrollable</item>
|
||||
<item name="tabMaxWidth">100dp</item>
|
||||
<item name="tabIndicatorColor">@color/briar_text_primary_inverse</item>
|
||||
<item name="tabIndicatorHeight">3dp</item>
|
||||
<item name="tabSelectedTextColor">@color/briar_text_primary_inverse</item>
|
||||
<item name="tabTextColor">@color/briar_text_primary_inverse</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||