Unverified Commit dae29eec authored by Ernir Erlingsson's avatar Ernir Erlingsson Committed by akwizgran

Navigation drawer (squashed and rebased).

parent d33dbca2
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
package="org.briarproject"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="11"
android:versionName="0.11" >
android:versionName="0.11">
<uses-sdk
xmlns:tools="http://schemas.android.com/tools"
android:minSdkVersion="9"
android:targetSdkVersion="22"
xmlns:tools="http://schemas.android.com/tools"
android:targetSdkVersion="22"
tools:overrideLibrary="android.support.v14.preference"
/>
/>
<uses-feature android:name="android.hardware.bluetooth" />
<uses-feature android:name="android.hardware.bluetooth"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
......@@ -23,183 +24,160 @@
<!-- Since API 23, this is needed to add contacts via Bluetooth -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- FIXME: Only needed for alpha and beta builds -->
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:name=".android.BriarApplication"
android:theme="@style/BriarTheme"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:logo="@drawable/logo"
android:allowBackup="false" >
android:theme="@style/BriarTheme">
<service
android:name=".android.BriarService"
android:exported="false" >
android:exported="false">
<intent-filter>
<action android:name="org.briarproject.android.BriarService" />
<action android:name="org.briarproject.android.BriarService"/>
</intent-filter>
</service>
<activity
android:name=".android.CrashReportActivity"
android:label="@string/crash_report_title"
android:taskAffinity="org.briarproject.android.CrashHandler"
android:excludeFromRecents="true"
android:exported="false"
android:label="@string/crash_report_title"
android:launchMode="singleInstance"
android:process=":briar_error_handler"
android:exported="false" >
android:taskAffinity="org.briarproject.android.CrashHandler">
<intent-filter>
<action android:name="org.briarproject.REPORT_CRASH" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="org.briarproject.REPORT_CRASH"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".android.DashboardActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name=".android.ExpiredActivity"
android:label="@string/app_name" >
android:label="@string/app_name">
</activity>
<activity
android:name=".android.PasswordActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name=".android.SettingsActivity"
android:label="@string/settings_title"
android:parentActivityName=".android.DashboardActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.DashboardActivity"
/>
android:windowSoftInputMode="stateVisible">
</activity>
<activity
android:name=".android.SetupActivity"
android:label="@string/setup_title" >
android:label="@string/setup_title">
</activity>
<activity
android:name=".android.SplashScreenActivity"
android:label="@string/app_name" >
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".android.TestingActivity"
android:label="@string/app_name" >
android:label="@string/app_name">
</activity>
<activity
android:name=".android.contact.ContactListActivity"
android:label="@string/contact_list_title"
android:parentActivityName=".android.DashboardActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.DashboardActivity"
android:name=".android.NavDrawerActivity"
android:theme="@style/BriarThemeNoActionBar.Default"
android:launchMode="singleTop"
/>
</activity>
<activity
android:name=".android.contact.ConversationActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden"
android:parentActivityName=".android.contact.ContactListActivity" >
android:parentActivityName=".android.NavDrawerActivity"
android:windowSoftInputMode="stateHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.contact.ContactListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.AvailableForumsActivity"
android:label="@string/available_forums_title"
android:parentActivityName=".android.forum.ForumListActivity" >
android:parentActivityName=".android.NavDrawerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.CreateForumActivity"
android:label="@string/create_forum_title"
android:windowSoftInputMode="stateVisible"
android:parentActivityName=".android.forum.ForumListActivity" >
android:parentActivityName=".android.NavDrawerActivity"
android:windowSoftInputMode="stateVisible">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.ForumActivity"
android:label="@string/app_name"
android:parentActivityName=".android.forum.ForumListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
</activity>
<activity
android:name=".android.forum.ForumListActivity"
android:label="@string/forums_title"
android:parentActivityName=".android.DashboardActivity" >
android:parentActivityName=".android.NavDrawerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.DashboardActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.ReadForumPostActivity"
android:label="@string/app_name"
android:parentActivityName=".android.forum.ForumListActivity" >
android:parentActivityName=".android.NavDrawerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.ShareForumActivity"
android:label="@string/app_name"
android:parentActivityName=".android.forum.ForumListActivity" >
android:parentActivityName=".android.NavDrawerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.forum.WriteForumPostActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible"
android:parentActivityName=".android.forum.ForumListActivity" >
android:parentActivityName=".android.NavDrawerActivity"
android:windowSoftInputMode="stateVisible">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.forum.ForumListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.identity.CreateIdentityActivity"
android:label="@string/new_identity_title"
android:windowSoftInputMode="stateVisible" >
android:windowSoftInputMode="stateVisible">
</activity>
<activity
android:name=".android.invitation.AddContactActivity"
android:label="@string/add_contact_title"
android:parentActivityName=".android.contact.ContactListActivity" >
android:parentActivityName=".android.NavDrawerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.contact.ContactListActivity"
/>
android:value=".android.NavDrawerActivity"
/>
</activity>
<activity
android:name=".android.StartupFailureActivity"
android:label="@string/startup_failed_activity_title" >
android:label="@string/startup_failed_activity_title">
</activity>
<activity
android:name=".android.panic.PanicPreferencesActivity"
android:label="@string/panic_setting" >
android:label="@string/panic_setting">
<intent-filter>
<action android:name="info.guardianproject.panic.action.CONNECT" />
<action android:name="info.guardianproject.panic.action.DISCONNECT" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="info.guardianproject.panic.action.CONNECT"/>
<action android:name="info.guardianproject.panic.action.DISCONNECT"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
......@@ -208,12 +186,12 @@
android:theme="@android:style/Theme.NoDisplay">
<!-- this can never have launchMode singleTask or singleInstance! -->
<intent-filter>
<action android:name="info.guardianproject.panic.action.TRIGGER" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="info.guardianproject.panic.action.TRIGGER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".android.panic.ExitActivity"
android:theme="@android:style/Theme.NoDisplay" />
android:theme="@android:style/Theme.NoDisplay"/>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
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">
<!-- The first child(root) is the content view -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/BriarToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_background"/>
<RelativeLayout
android:id="@+id/container_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/default_background"
android:visibility="invisible"
tools:visibility="visible">
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/title_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/progress_bar"
android:gravity="center"
android:paddingTop="@dimen/margin_large"
tools:text="progress bar title"
/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
<!-- The second child is the menu -->
<include
android:id="@+id/navigation_menu_drawer"
layout="@layout/navigation_menu"
android:layout_width="@dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"/>
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dashboard_background"
>
</RelativeLayout>
\ No newline at end of file
<?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:layout_width="@dimen/nav_drawer_width"
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:layout_height="match_parent"
android:fadingEdge="none"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.AppCompatButton
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_seperator_height"
android:layout_marginLeft="@dimen/margin_large"/>
<android.support.v7.widget.AppCompatButton
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_seperator"
android:layout_marginLeft="@dimen/margin_large"/>
<android.support.v7.widget.AppCompatButton
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_seperator"
android:layout_marginLeft="@dimen/margin_large"/>
<android.support.v7.widget.AppCompatButton
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_seperator"
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>
</LinearLayout>
\ No newline at end of file
......@@ -26,4 +26,8 @@
<!-- this is needed as preference_category_material layout uses this color as the text color -->
<color name="preference_fallback_accent_color">@color/briar_accent</color>
<color name="default_background">#ffffff</color>
<color name="default_seperator">#000000</color>
<color name="default_seperator_inverted">#ffffff</color>
<color name="menu_background">#FFFFFF</color>
</resources>
\ No newline at end of file
......@@ -17,5 +17,7 @@
<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_seperator_height">1dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nav_drawer_open_description">Open the navigation drawer</string>
<string name="nav_drawer_close_description">Close the navigation drawer</string>
<string name="app_name">Briar</string>
<string name="crash_report_title">Briar Crash Report</string>
<string name="ongoing_notification_title">Signed into Briar</string>
......@@ -141,4 +141,15 @@
<string name="dialog_message_delete_contact">Are you sure that you want to remove this contact and all messages exchanged with this contact?</string>
<string name="dialog_title_connect_panic_app">Confirm Panic App</string>
<string name="dialog_message_connect_panic_app">Are you sure that you want to allow %1$s to trigger destructive panic button actions?</string>
<string name="dialog_title_welcome">Welcome to Briar</string>
<string name="dialog_welcome_message">Add a contact to start communicating securely or press the icon in the upper left corner of the screen for more options.</string>
<string name="dialog_button_ok">OK</string>
<!-- Toolbar headers -->
<string name="dashboard_toolbar_header">Briar</string>
<string name="settings_toolbar_header">Settings</string>
<string name="contacts_toolbar_header">Contacts</string>
<string name="forums_toolbar_header">Forums</string>
<!-- Progress titles -->
<string name="progress_title_logout">Signing out of Briar..</string>
<string name="progress_title_please_wait">Please wait..</string>
</resources>
......@@ -12,6 +12,36 @@
<item name="android:textColorLink">@color/briar_text_link</item>
</style>
<style name="BriarThemeNoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/BriarToolbar</item>
<item name="colorPrimary">@color/briar_primary</item>
<item name="colorPrimaryDark">@color/briar_primary_dark</item>
<item name="colorAccent">@color/briar_primary</item>
<item name="android:textColorPrimary">@color/briar_text_primary</item>
<item name="android:textColorPrimaryInverse">@color/briar_text_primary_inverse</item>
<item name="android:textColorSecondary">@color/briar_text_primary</item>
<item name="android:textColorLink">@color/briar_text_link</item>
</style>
<style name="BriarThemeNoActionBar.Default" />
<style name="BriarToolbar" parent="Widget.AppCompat.Toolbar">
<item name="android:background">?colorPrimary</item>
<item name="android:textColorPrimary">@color/briar_text_primary_inverse</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="colorPrimary">@color/briar_primary</item>
<item name="titleTextAppearance">@style/BriarToolbarTextAppearance</item>
<item name="android:theme">@style/BriarToolbarTheme</item>
</style>
<style name="BriarToolbarTheme">
<item name="colorControlNormal">@color/briar_text_primary_inverse</item>
</style>
<style name="BriarToolbarTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textColor">@color/briar_text_primary_inverse</item>
</style>
<style name="BriarTheme" parent="BriarBaseTheme">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="android:listSeparatorTextViewStyle">@style/BriarTheme.ListSeparatorTextView</item>
......@@ -33,6 +63,10 @@
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
<style name="BriarTextTitleInverted" parent="BriarTextTitle">
<item name="android:textColor">@android:color/primary_text_dark</item>
</style>
<style name="BriarTextBody">
<item name="android:textSize">@dimen/text_size_small</item>
<item name="android:textColor">@android:color/primary_text_light</item>
......@@ -47,6 +81,17 @@
<item name="android:layout_height">1px</item>
</style>
<style name="NavMenuButton" parent="Widget.AppCompat.Button.Borderless.Colored">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColor">@android:color/tertiary_text_light</item>
<item name="android:paddingTop">@dimen/margin_large</item>
<item name="android:paddingBottom">@dimen/margin_large</item>
<item name="android:drawablePadding">@dimen/margin_xlarge</item>
<item name="android:gravity">left|center_vertical</item>
<item name="android:layout_margin">0dp</item>
<item name="android:paddingLeft">@dimen/margin_large</item>
</style>
<!-- This fixes a UI bug in the support preference library -->
<style name="BriarTheme.ListSeparatorTextView">
<item name="android:textSize">14sp</item>
......
......@@ -9,10 +9,8 @@ import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import org.briarproject.R;
import org.briarproject.android.contact.ContactListActivity;
import org.briarproject.android.contact.ConversationActivity;
import org.briarproject.android.forum.ForumActivity;
import org.briarproject.android.forum.ForumListActivity;
import org.briarproject.api.Settings;
import org.briarproject.api.android.AndroidExecutor;
import org.briarproject.api.android.AndroidNotificationManager;
......@@ -205,10 +203,11 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
t.addNextIntent(i);
b.setContentIntent(t.getPendingIntent(nextRequestId++, 0));
} else {
Intent i = new Intent(appContext, ContactListActivity.class);
Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(NavDrawerActivity.INTENT_CONTACTS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(ContactListActivity.class);
t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i);