Commit cc5acfe8 authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin
Browse files

swarm: update model, conversations, add creation wizard

Change-Id: I212e550d145a90a7d6dc63416849aadd1ac7573f
parent 195212d0
......@@ -171,6 +171,7 @@ STATIC_LIBS_ALL="-llog -lOpenSLES -landroid \
-lpjlib-util-${PJ_TARGET} \
-lpj-${PJ_TARGET} \
-lupnp -lixml \
-lgit2 \
-larchive \
-lsecp256k1 \
-lgnutls -lhogweed -lnettle -lgmp \
......
......@@ -107,7 +107,7 @@ dependencies {
implementation 'com.google.zxing:core:3.3.3'
// RxBindings
implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
//implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
implementation 'com.rodolfonavalon:ShapeRippleLibrary:1.0.0'
......
......@@ -330,8 +330,8 @@ public class JamiAccountSummaryFragment extends BaseSupportFragment<JamiAccountS
boolean hasRegisteredName = !currentRegisteredName && username != null && !username.isEmpty();
mBinding.groupRegisteringName.setVisibility(currentRegisteredName ? View.VISIBLE : View.GONE);
mBinding.btnShare.setOnClickListener(v -> shareAccount(hasRegisteredName? username : account.getUsername()));
mBinding.registerName.setVisibility(hasRegisteredName? View.GONE : View.VISIBLE);
mBinding.registeredName.setText(hasRegisteredName? username : getResources().getString(R.string.no_registered_name_for_account));
mBinding.registerName.setVisibility(hasRegisteredName ? View.GONE : View.VISIBLE);
mBinding.registeredName.setText(hasRegisteredName ? username : getResources().getString(R.string.no_registered_name_for_account));
mBinding.btnQr.setOnClickListener(v -> QRCodeFragment.newInstance(QRCodeFragment.INDEX_CODE).show(getParentFragmentManager(), QRCodeFragment.TAG));
mBinding.username.setOnFocusChangeListener((v, hasFocus) -> {
Editable name = mBinding.username.getText();
......
......@@ -32,6 +32,7 @@ import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.util.Log;
......@@ -49,6 +50,7 @@ import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
......@@ -112,13 +114,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
private int expandedItemPosition = -1;
private int lastDeliveredPosition = -1;
private int lastDisplayedPosition = -1;
private Observable<Long> timestampUpdateTimer;
private final Observable<Long> timestampUpdateTimer;
private int lastMsgPos = -1;
private boolean isComposing = false;
private boolean mShowReadIndicator = true;
private static int[] msgBGLayouts = new int[] {
private static final int[] msgBGLayouts = new int[] {
R.drawable.textmsg_bg_out_first,
R.drawable.textmsg_bg_out_middle,
R.drawable.textmsg_bg_out_last,
......@@ -164,13 +166,32 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
notifyDataSetChanged();
}
public void add(Interaction e) {
public boolean add(Interaction e) {
if (!TextUtils.isEmpty(e.getMessageId())) {
if (mInteractions.isEmpty() || e.getParentIds().contains(mInteractions.get(mInteractions.size()-1).getMessageId())) {
boolean update = !mInteractions.isEmpty();
mInteractions.add(e);
notifyItemInserted(mInteractions.size()-1);
if (update)
notifyItemChanged(mInteractions.size()-2);
return true;
}
for (int i = 0, n = mInteractions.size(); i<n; i++) {
if (mInteractions.get(i).getParentIds().contains(e.getMessageId())) {
mInteractions.add(i, e);
notifyItemInserted(i);
return i == n-1;
}
}
} else {
boolean update = !mInteractions.isEmpty();
mInteractions.add(e);
notifyItemInserted(mInteractions.size() - 1);
if (update)
notifyItemChanged(mInteractions.size() - 2);
}
return true;
}
public void update(Interaction e) {
if (!e.isIncoming() && e.getStatus() == InteractionStatus.SUCCESS) {
......@@ -253,16 +274,18 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
}
}
return out;
case INVALID:
return MessageType.INVALID.ordinal();
}
}
return MessageType.CALL_INFORMATION.ordinal();
return -1;
}
@NonNull
@Override
public ConversationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
MessageType type = MessageType.values()[viewType];
ViewGroup v = (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(type.layout, parent, false);
ViewGroup v = type == MessageType.INVALID ? new FrameLayout(parent.getContext()) : (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(type.layout, parent, false);
return new ConversationViewHolder(v, type);
}
......@@ -287,16 +310,22 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
conversationViewHolder.itemView.startAnimation(animation);
}
if (interaction.getType() == (InteractionType.TEXT)) {
//Log.w(TAG, "onBindViewHolder " + interaction.getType() + " " + interaction);
if (interaction.getType() == InteractionType.INVALID) {
conversationViewHolder.itemView.setVisibility(View.GONE);
} else {
conversationViewHolder.itemView.setVisibility(View.VISIBLE);
if (interaction.getType() == InteractionType.TEXT) {
configureForTextMessage(conversationViewHolder, interaction, position);
} else if (interaction.getType() == (InteractionType.CALL)) {
} else if (interaction.getType() == InteractionType.CALL) {
configureForCallInfo(conversationViewHolder, interaction);
} else if (interaction.getType() == (InteractionType.CONTACT)) {
} else if (interaction.getType() == InteractionType.CONTACT) {
configureForContactEvent(conversationViewHolder, interaction);
} else if (interaction.getType() == (InteractionType.DATA_TRANSFER)) {
} else if (interaction.getType() == InteractionType.DATA_TRANSFER) {
configureForFileInfo(conversationViewHolder, interaction, position);
}
}
}
@Override
public void onViewRecycled(@NonNull ConversationViewHolder holder) {
......@@ -584,7 +613,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
private void configureForFileInfo(@NonNull final ConversationViewHolder viewHolder,
@NonNull final Interaction interaction, int position) {
DataTransfer file = (DataTransfer) interaction;
File path = presenter.getDeviceRuntimeService().getConversationPath(file.getPeerId(), file.getStoragePath());
File path = presenter.getDeviceRuntimeService().getConversationPath(interaction.getConversationId() == null ? interaction.getConversation().getParticipant() : interaction.getConversationId(), file.getStoragePath());
if (file.isComplete())
file.setSize(path.length());
......@@ -697,28 +726,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
if (file.getStatus() == InteractionStatus.TRANSFER_AWAITING_HOST) {
viewHolder.mAnswerLayout.setVisibility(View.VISIBLE);
viewHolder.btnAccept.setOnClickListener(v -> {
if (!presenter.getDeviceRuntimeService().hasWriteExternalStoragePermission()) {
conversationFragment.askWriteExternalStoragePermission();
return;
}
Context context = v.getContext();
File cacheDir = context.getCacheDir();
long spaceLeft = AndroidFileUtils.getSpaceLeft(cacheDir.toString());
if (spaceLeft == -1L || file.getTotalSize() > spaceLeft) {
presenter.noSpaceLeft();
return;
}
context.startService(new Intent(DRingService.ACTION_FILE_ACCEPT)
.setClass(context.getApplicationContext(), DRingService.class)
.putExtra(DRingService.KEY_TRANSFER_ID, file.getDaemonId()));
});
viewHolder.btnRefuse.setOnClickListener(v -> {
Context context = v.getContext();
context.startService(new Intent(DRingService.ACTION_FILE_CANCEL)
.setClass(context.getApplicationContext(), DRingService.class)
.putExtra(DRingService.KEY_TRANSFER_ID, file.getDaemonId()));
});
viewHolder.btnAccept.setOnClickListener(v -> presenter.acceptFile(file));
viewHolder.btnRefuse.setOnClickListener(v -> presenter.refuseFile(file));
} else {
viewHolder.mAnswerLayout.setVisibility(View.GONE);
if (file.getStatus() == InteractionStatus.TRANSFER_ONGOING) {
......@@ -769,9 +778,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
}
// Log.w(TAG, "configureForTextMessage " + position + " " + interaction.getDaemonId() + " " + interaction.getStatus());
convViewHolder.mCid = textMessage.getConversation().getParticipant();
String message = textMessage.getBody().trim();
View longPressView = convViewHolder.mMsgTxt;
longPressView.getBackground().setTintList(null);
......@@ -795,13 +802,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
if (expandedItemPosition == position) {
expandedItemPosition = -1;
}
conversationFragment.updatePosition(convViewHolder.getAdapterPosition());
conversationFragment.updatePosition(convViewHolder.getBindingAdapterPosition());
if (textMessage.isIncoming()) {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500));
} else {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.blue_900));
}
mCurrentLongItem = new RecyclerViewContextMenuInfo(convViewHolder.getAdapterPosition(), v.getId());
mCurrentLongItem = new RecyclerViewContextMenuInfo(convViewHolder.getBindingAdapterPosition(), v.getId());
return false;
});
......@@ -850,10 +857,12 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
});
convViewHolder.mAvatar.startAnimation(animation);
} else {
if (convViewHolder.mAvatar != null) {
convViewHolder.mAvatar.setImageBitmap(null);
convViewHolder.mAvatar.setVisibility(View.INVISIBLE);
}
}
}
} else {
switch (textMessage.getStatus()) {
case SENDING:
......@@ -938,16 +947,11 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
*/
private void configureForCallInfo(@NonNull final ConversationViewHolder convViewHolder,
@NonNull final Interaction interaction) {
int pictureResID;
String historyTxt;
convViewHolder.mIcon.setScaleY(1);
Context context = convViewHolder.itemView.getContext();
View longPressView = convViewHolder.mCallInfoLayout;
longPressView.getBackground().setTintList(null);
longPressView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
conversationFragment.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = conversationFragment.getActivity().getMenuInflater();
......@@ -958,7 +962,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
menu.removeItem(R.id.conv_action_copy_text);
});
longPressView.setOnLongClickListener((View v) -> {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500));
conversationFragment.updatePosition(convViewHolder.getAdapterPosition());
......@@ -966,9 +969,9 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
return false;
});
int pictureResID;
String historyTxt;
SipCall call = (SipCall) interaction;
if (call.isMissed()) {
if (call.isIncoming()) {
pictureResID = R.drawable.baseline_call_missed_24;
......@@ -989,7 +992,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
context.getString(R.string.notif_outgoing_call);
}
convViewHolder.mCid = call.getConversation().getParticipant();
convViewHolder.mIcon.setImageResource(pictureResID);
convViewHolder.mHistTxt.setText(historyTxt);
convViewHolder.mHistDetailTxt.setText(DateFormat.getDateTimeInstance()
......@@ -1199,11 +1201,12 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
CALL_INFORMATION(R.layout.item_conv_call),
INCOMING_TEXT_MESSAGE(R.layout.item_conv_msg_peer),
OUTGOING_TEXT_MESSAGE(R.layout.item_conv_msg_me),
COMPOSING_INDICATION(R.layout.item_conv_composing);
COMPOSING_INDICATION(R.layout.item_conv_composing),
INVALID(-1);
private final int layout;
@LayoutRes private final int layout;
MessageType(int l) {
MessageType(@LayoutRes int l) {
layout = l;
}
......
......@@ -85,7 +85,7 @@ public class NumberAdapter extends BaseAdapter {
Phone number = mNumbers.get(position);
ImageView numberIcon = convertView.findViewById(R.id.number_icon);
numberIcon.setImageResource(number.getNumber().isRingId() ?
numberIcon.setImageResource(number.getNumber().isHexId() ?
R.drawable.ic_jami_24 : R.drawable.baseline_dialer_sip_24);
if (longView) {
......
......@@ -26,6 +26,7 @@ import cx.ring.smartlist.SmartListViewModel;
import cx.ring.viewholders.SmartListViewHolder;
import android.os.Parcelable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;
......@@ -90,6 +91,7 @@ public class SmartListAdapter extends RecyclerView.Adapter<SmartListViewHolder>
}
public void update(List<SmartListViewModel> viewModels) {
//Log.w("SmartListAdapter", "update " + (viewModels == null ? null : viewModels.size()));
final List<SmartListViewModel> old = mSmartListViewModels;
mSmartListViewModels = viewModels == null ? new ArrayList<>() : viewModels;
if (old != null && viewModels != null) {
......
......@@ -27,8 +27,8 @@ import cx.ring.smartlist.SmartListViewModel;
public class SmartListDiffUtil extends DiffUtil.Callback {
private List<SmartListViewModel> mOldList;
private List<SmartListViewModel> mNewList;
private final List<SmartListViewModel> mOldList;
private final List<SmartListViewModel> mNewList;
public SmartListDiffUtil(List<SmartListViewModel> oldList, List<SmartListViewModel> newList) {
mOldList = oldList;
......@@ -49,7 +49,17 @@ public class SmartListDiffUtil extends DiffUtil.Callback {
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
SmartListViewModel oldItem = mOldList.get(oldItemPosition);
SmartListViewModel newItem = mNewList.get(newItemPosition);
return newItem.getHeaderTitle() == oldItem.getHeaderTitle() && newItem.getContact() == oldItem.getContact();
if (newItem.getHeaderTitle() != oldItem.getHeaderTitle())
return false;
if (newItem.getContact() != oldItem.getContact()) {
if (newItem.getContact().size() != oldItem.getContact().size())
return false;
for (int i = 0; i < newItem.getContact().size(); i++) {
if (newItem.getContact().get(i) != oldItem.getContact().get(i))
return false;
}
}
return true;
}
@Override
......
......@@ -52,6 +52,8 @@ import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import javax.inject.Named;
import androidx.annotation.RequiresApi;
import cx.ring.BuildConfig;
import cx.ring.R;
import cx.ring.contacts.AvatarFactory;
......@@ -238,7 +240,7 @@ public abstract class JamiApplication extends Application {
super.onCreate();
sInstance = this;
RxJavaPlugins.setErrorHandler(e -> Log.e(TAG, "Unhandled RxJava error", e));
//RxJavaPlugins.setErrorHandler(e -> Log.e(TAG, "Unhandled RxJava error", e));
// building injection dependency tree
mJamiInjectionComponent = DaggerJamiInjectionComponent.builder()
......
......@@ -42,8 +42,8 @@ import cx.ring.BuildConfig;
import cx.ring.R;
import cx.ring.application.JamiApplication;
import cx.ring.fragments.CallFragment;
import cx.ring.fragments.ConversationFragment;
import cx.ring.services.NotificationService;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.KeyboardVisibilityManager;
import cx.ring.utils.MediaButtonsHelper;
......@@ -118,22 +118,16 @@ public class CallActivity extends AppCompatActivity {
private void handleNewIntent(Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_CALL.equals(action) || ACTION_CALL.equals(action)) {
boolean audioOnly = intent.getBooleanExtra(CallFragment.KEY_AUDIO_ONLY, true);
String accountId = intent.getStringExtra(ConversationFragment.KEY_ACCOUNT_ID);
String contactRingId = intent.getStringExtra(ConversationFragment.KEY_CONTACT_RING_ID);
// Reload a new view
String contactId = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
CallFragment callFragment = CallFragment.newInstance(CallFragment.ACTION_PLACE_CALL,
accountId,
contactRingId,
ConversationPath.fromIntent(intent),
contactId,
audioOnly);
getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
} else if (Intent.ACTION_VIEW.equals(action) || ACTION_CALL_ACCEPT.equals(action)) {
String confId = intent.getStringExtra(NotificationService.KEY_CALL_ID);
// Reload a new view
CallFragment callFragment = CallFragment.newInstance(Intent.ACTION_VIEW.equals(action) ? CallFragment.ACTION_GET_CALL : ACTION_CALL_ACCEPT, confId);
getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
}
......
......@@ -33,7 +33,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
......@@ -43,15 +45,18 @@ import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import androidx.core.widget.ImageViewCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import cx.ring.R;
import cx.ring.application.JamiApplication;
import cx.ring.daemon.Ringservice;
import cx.ring.daemon.RingserviceJNI;
import cx.ring.databinding.ActivityContactDetailsBinding;
import cx.ring.databinding.ItemContactActionBinding;
import cx.ring.facades.ConversationFacade;
......@@ -61,6 +66,7 @@ import cx.ring.model.CallContact;
import cx.ring.model.Conference;
import cx.ring.model.Conversation;
import cx.ring.model.SipCall;
import cx.ring.model.Uri;
import cx.ring.services.AccountService;
import cx.ring.services.NotificationService;
import cx.ring.utils.ConversationPath;
......@@ -82,25 +88,27 @@ public class ContactDetailsActivity extends AppCompatActivity {
private SharedPreferences mPreferences;
private ActivityContactDetailsBinding binding;
private Conversation mConversation;
private CallContact mContact = null;
interface IContactAction {
void onAction();
}
static class ContactAction {
@DrawableRes
final int icon;
int iconTint;
CharSequence title;
final CharSequence title;
final IContactAction callback;
ContactAction(int i, int tint, CharSequence t, IContactAction cb) {
int iconTint;
ContactAction(@DrawableRes int i, int tint, CharSequence t, IContactAction cb) {
icon = i;
iconTint = tint;
title = t;
callback = cb;
}
ContactAction(int i, CharSequence t, IContactAction cb) {
ContactAction(@DrawableRes int i, CharSequence t, IContactAction cb) {
icon = i;
iconTint = Color.BLACK;
title = t;
......@@ -110,12 +118,12 @@ public class ContactDetailsActivity extends AppCompatActivity {
void setIconTint(int tint) {
iconTint = tint;
}
void setTitle(CharSequence t) { title = t; }
}
static class ContactActionView extends RecyclerView.ViewHolder {
final ItemContactActionBinding binding;
IContactAction callback;
ContactActionView(@NonNull ItemContactActionBinding b) {
super(b.getRoot());
binding = b;
......@@ -124,7 +132,7 @@ public class ContactDetailsActivity extends AppCompatActivity {
if (callback != null)
callback.onAction();
} catch (Exception e) {
Log.w(TAG, "Error performing action" ,e);
Log.w(TAG, "Error performing action", e);
}
});
}
......@@ -163,11 +171,15 @@ public class ContactDetailsActivity extends AppCompatActivity {
private ContactAction colorAction;
private ContactAction contactAction;
private int colorActionPosition;
private int contactIdPosition;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ConversationPath path = ConversationPath.fromIntent(getIntent());
if (path == null) {
finish();
return;
}
binding = ActivityContactDetailsBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
JamiApplication.getInstance().getInjectionComponent().inject(this);
......@@ -175,44 +187,40 @@ public class ContactDetailsActivity extends AppCompatActivity {
CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.toolbar_layout);
collapsingToolbarLayout.setTitle("");
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setSupportActionBar(findViewById(R.id.toolbar));
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(view -> goToConversationActivity(mConversation.getAccountId(), mContact.getPrimaryNumber()));
fab.setOnClickListener(view -> goToConversationActivity(mConversation.getAccountId(), mConversation.getUri()));
colorActionPosition = 1;
Intent intent = getIntent();
ConversationPath path = ConversationPath.fromIntent(intent);
if (path != null) {
mDisposableBag.add(mConversationFacade
.startConversation(path.getAccountId(), path.getConversationUri())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(conversation -> {
// TODO handle group
CallContact contact = conversation.getContact();
mConversation = conversation;
mPreferences = getSharedPreferences(conversation.getAccountId() + "_" + conversation.getUri().getUri(), Context.MODE_PRIVATE);
int color = mPreferences.getInt(ConversationFragment.KEY_PREFERENCE_CONVERSATION_COLOR, getResources().getColor(R.color.color_primary_light));
colorAction.setIconTint(color);
adapter.notifyItemChanged(colorActionPosition);
contactAction.setTitle(contact.getRingUsername());
adapter.notifyItemChanged(contactIdPosition);
collapsingToolbarLayout.setBackgroundColor(color);
collapsingToolbarLayout.setTitle(contact.getDisplayName());
collapsingToolbarLayout.setContentScrimColor(color);
collapsingToolbarLayout.setStatusBarScrimColor(color);
//collapsingToolbarLayout.setCollapsedTitleTextColor();
binding.contactImage.setImageDrawable(
new AvatarDrawable.Builder()
.withContact(contact)
.withConversation(conversation)
.withPresence(false)
.withCircleCrop(false)
.build(this)
);
mConversation = conversation;
mContact = contact;
}));
colorAction = new ContactAction(R.drawable.item_color_background, 0, "Choose color", () -> {
/*Map<String, String> details = Ringservice.getCertificateDetails(conversation.getContact().getUri().getRawRingId());
for (Map.Entry<String, String> e : details.entrySet()) {
Log.w(TAG, e.getKey() + " -> " + e.getValue());
}*/
@StringRes int infoString = conversation.isSwarm()
? (conversation.getMode() == Conversation.Mode.OneToOne
? R.string.conversation_type_private
: R.string.conversation_type_group)
: R.string.conversation_type_contact;
adapter.actions.add(new ContactAction(R.drawable.baseline_info_24, getText(infoString), () -> {}));
colorAction = new ContactAction(R.drawable.item_color_background, 0, getText(R.string.conversation_preference_color), () -> {
ColorChooserBottomSheet frag = new ColorChooserBottomSheet();
frag.setCallback(color -> {
collapsingToolbarLayout.setBackgroundColor(color);
......@@ -224,17 +232,26 @@ public class ContactDetailsActivity extends AppCompatActivity {
});
frag.show(getSupportFragmentManager(), "colorChooser");
});
int color = mPreferences.getInt(ConversationFragment.KEY_PREFERENCE_CONVERSATION_COLOR, getResources().getColor(R.color.color_primary_light));
colorAction.setIconTint(color);
collapsingToolbarLayout.setBackgroundColor(color);
collapsingToolbarLayout.setTitle(conversation.getTitle());