mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Merge branch '738-older-devices-show-overflow-icon-on-some-screens-but-not-others' into 'master'
Also show overflow icon on devices with menu key by using Toolbar Closes #738 See merge request !463
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
android:name=".android.privategroup.conversation.GroupActivity"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName=".android.navdrawer.NavDrawerActivity"
|
||||
android:theme="@style/BriarThemeNoActionBar.Default"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
@@ -194,6 +195,7 @@
|
||||
android:name=".android.forum.ForumActivity"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName=".android.navdrawer.NavDrawerActivity"
|
||||
android:theme="@style/BriarThemeNoActionBar.Default"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
@@ -245,11 +247,11 @@
|
||||
|
||||
<activity
|
||||
android:name=".android.blog.BlogActivity"
|
||||
android:parentActivityName=".android.navdrawer.NavDrawerActivity">
|
||||
android:parentActivityName=".android.navdrawer.NavDrawerActivity"
|
||||
android:theme="@style/BriarThemeNoActionBar.Default">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".android.navdrawer.NavDrawerActivity"
|
||||
/>
|
||||
android:value=".android.navdrawer.NavDrawerActivity"/>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.briarproject.briar.android.activity;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.transition.Slide;
|
||||
import android.transition.Transition;
|
||||
import android.view.Gravity;
|
||||
@@ -94,6 +97,27 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be called after the content view has been added in onCreate()
|
||||
*
|
||||
* @param ownLayout true if the custom toolbar brings its own layout
|
||||
* @return the Toolbar object or null if content view did not contain one
|
||||
*/
|
||||
@Nullable
|
||||
protected Toolbar setUpCustomToolbar(boolean ownLayout) {
|
||||
// Custom Toolbar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if (ab != null) {
|
||||
ab.setDisplayShowHomeEnabled(true);
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
ab.setDisplayShowCustomEnabled(ownLayout);
|
||||
ab.setDisplayShowTitleEnabled(!ownLayout);
|
||||
}
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
protected void signOut(final boolean removeFromRecentApps) {
|
||||
briarController.signOut(new UiResultHandler<Void>(this) {
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.briar.android.blog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
@@ -38,12 +39,12 @@ public class BlogActivity extends BriarActivity
|
||||
final GroupId groupId = new GroupId(b);
|
||||
blogController.setGroupId(groupId);
|
||||
|
||||
setContentView(R.layout.activity_fragment_container);
|
||||
setContentView(R.layout.activity_fragment_container_toolbar);
|
||||
Toolbar toolbar = setUpCustomToolbar(false);
|
||||
|
||||
// Open Sharing Status on ActionBar click
|
||||
View actionBar = findViewById(R.id.action_bar);
|
||||
if (actionBar != null) {
|
||||
actionBar.setOnClickListener(
|
||||
// Open Sharing Status on Toolbar click
|
||||
if (toolbar != null) {
|
||||
toolbar.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.os.Bundle;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
@@ -176,21 +175,13 @@ public class ConversationActivity extends BriarActivity
|
||||
setContentView(R.layout.activity_conversation);
|
||||
|
||||
// Custom Toolbar
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar = setUpCustomToolbar(true);
|
||||
if (toolbar != null) {
|
||||
toolbarAvatar =
|
||||
(CircleImageView) toolbar.findViewById(R.id.contactAvatar);
|
||||
toolbarStatus =
|
||||
(ImageView) toolbar.findViewById(R.id.contactStatus);
|
||||
toolbarTitle = (TextView) toolbar.findViewById(R.id.contactName);
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if (ab != null) {
|
||||
ab.setDisplayShowHomeEnabled(true);
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
ab.setDisplayShowCustomEnabled(true);
|
||||
ab.setDisplayShowTitleEnabled(false);
|
||||
}
|
||||
|
||||
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -63,15 +64,16 @@ public class ForumActivity extends
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
Toolbar toolbar = setUpCustomToolbar(false);
|
||||
|
||||
Intent i = getIntent();
|
||||
String groupName = i.getStringExtra(GROUP_NAME);
|
||||
if (groupName != null) setTitle(groupName);
|
||||
else loadNamedGroup();
|
||||
|
||||
// Open Sharing Status on ActionBar click
|
||||
View actionBar = findViewById(R.id.action_bar);
|
||||
if (actionBar != null) {
|
||||
actionBar.setOnClickListener(
|
||||
// Open member list on Toolbar click
|
||||
if (toolbar != null) {
|
||||
toolbar.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -92,7 +94,7 @@ public class ForumActivity extends
|
||||
@Override
|
||||
@LayoutRes
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_forum;
|
||||
return R.layout.activity_threaded_conversation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,7 +60,7 @@ public class KeyAgreementActivity extends BriarActivity implements
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
setContentView(R.layout.activity_plain);
|
||||
setContentView(R.layout.activity_fragment_container_toolbar);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -68,15 +69,16 @@ public class GroupActivity extends
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
Toolbar toolbar = setUpCustomToolbar(false);
|
||||
|
||||
Intent i = getIntent();
|
||||
String groupName = i.getStringExtra(GROUP_NAME);
|
||||
if (groupName != null) setTitle(groupName);
|
||||
loadNamedGroup();
|
||||
|
||||
// Open member list on ActionBar click
|
||||
View actionBar = findViewById(R.id.action_bar);
|
||||
if (actionBar != null) {
|
||||
actionBar.setOnClickListener(
|
||||
// Open member list on Toolbar click
|
||||
if (toolbar != null) {
|
||||
toolbar.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -94,7 +96,7 @@ public class GroupActivity extends
|
||||
@Override
|
||||
@LayoutRes
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_forum;
|
||||
return R.layout.activity_threaded_conversation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,17 +11,7 @@
|
||||
android:orientation="vertical"
|
||||
tools:context=".android.reporting.DevReportActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/BriarToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".android.keyagreement.KeyAgreementActivity">
|
||||
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -2,8 +2,10 @@
|
||||
<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">
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".android.navdrawer.NavDrawerActivity">
|
||||
|
||||
<!-- The first child(root) is the content view -->
|
||||
<LinearLayout
|
||||
@@ -11,17 +13,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/BriarToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?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.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/BriarToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/window_background"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -4,7 +4,11 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".android.forum.ForumActivity">
|
||||
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<org.briarproject.briar.android.view.BriarRecyclerView
|
||||
android:id="@+id/list"
|
||||
@@ -22,4 +26,4 @@
|
||||
android:elevation="@dimen/margin_tiny"
|
||||
app:hint="@string/forum_new_message_hint"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
13
briar-android/src/main/res/layout/toolbar.xml
Normal file
13
briar-android/src/main/res/layout/toolbar.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.AppBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/BriarToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
@@ -6,7 +6,8 @@
|
||||
<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="titleTextAppearance">@style/BriarToolbarTitleTextAppearance</item>
|
||||
<item name="subtitleTextAppearance">@style/BriarToolbarSubTitleTextAppearance</item>
|
||||
<item name="android:theme">@style/BriarToolbarTheme</item>
|
||||
</style>
|
||||
|
||||
@@ -14,10 +15,14 @@
|
||||
<item name="colorControlNormal">@color/briar_text_primary_inverse</item>
|
||||
</style>
|
||||
|
||||
<style name="BriarToolbarTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
|
||||
<style name="BriarToolbarTitleTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
|
||||
<item name="android:textColor">@color/briar_text_primary_inverse</item>
|
||||
</style>
|
||||
|
||||
<style name="BriarToolbarSubTitleTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Subtitle">
|
||||
<item name="android:textColor">@color/briar_text_secondary_inverse</item>
|
||||
</style>
|
||||
|
||||
<style name="BriarButton.Default">
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user