mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Add "Created by" to ActionBar
This commit is contained in:
@@ -2,6 +2,8 @@ package org.briarproject.android.privategroup.conversation;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -43,6 +45,23 @@ public class GroupActivity extends
|
||||
return R.layout.activity_forum;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setActionBarTitle(@Nullable String title) {
|
||||
if (title != null) setTitle(title);
|
||||
loadGroupItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onGroupItemLoaded(PrivateGroup group) {
|
||||
super.onGroupItemLoaded(group);
|
||||
// Created by
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setSubtitle(getString(R.string.groups_created_by,
|
||||
group.getAuthor().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GroupMessageAdapter createAdapter(
|
||||
LinearLayoutManager layoutManager) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
@@ -63,8 +64,7 @@ public abstract class ThreadListActivity<G extends BaseGroup, I extends ThreadIt
|
||||
groupId = new GroupId(b);
|
||||
getController().setGroupId(groupId);
|
||||
String groupName = i.getStringExtra(GROUP_NAME);
|
||||
if (groupName != null) setTitle(groupName);
|
||||
else loadAndSetTitle();
|
||||
setActionBarTitle(groupName);
|
||||
|
||||
textInput = (TextInputView) findViewById(R.id.text_input_container);
|
||||
textInput.setVisibility(GONE);
|
||||
@@ -86,12 +86,17 @@ public abstract class ThreadListActivity<G extends BaseGroup, I extends ThreadIt
|
||||
|
||||
protected abstract A createAdapter(LinearLayoutManager layoutManager);
|
||||
|
||||
private void loadAndSetTitle() {
|
||||
protected void setActionBarTitle(@Nullable String title) {
|
||||
if (title != null) setTitle(title);
|
||||
else loadGroupItem();
|
||||
}
|
||||
|
||||
protected void loadGroupItem() {
|
||||
getController().loadGroupItem(
|
||||
new UiResultExceptionHandler<G, DbException>(this) {
|
||||
@Override
|
||||
public void onResultUi(G groupItem) {
|
||||
setTitle(groupItem.getName());
|
||||
onGroupItemLoaded(groupItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,6 +107,12 @@ public abstract class ThreadListActivity<G extends BaseGroup, I extends ThreadIt
|
||||
});
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@UiThread
|
||||
protected void onGroupItemLoaded(G groupItem) {
|
||||
setTitle(groupItem.getName());
|
||||
}
|
||||
|
||||
private void loadItems() {
|
||||
getController().loadItems(
|
||||
new UiResultExceptionHandler<Collection<I>, DbException>(
|
||||
|
||||
Reference in New Issue
Block a user