introduce bottomNavigationView
This commit is contained in:
parent
be33836106
commit
aa75aea180
|
@ -10,6 +10,7 @@ import org.mercury_im.messenger.ui.chat.ChatActivity;
|
|||
import org.mercury_im.messenger.ui.chat.ChatInputFragment;
|
||||
import org.mercury_im.messenger.ui.chat.ChatInputViewModel;
|
||||
import org.mercury_im.messenger.ui.chat.ChatViewModel;
|
||||
import org.mercury_im.messenger.ui.chatlist.ChatListViewModel;
|
||||
import org.mercury_im.messenger.ui.login.AccountsActivity;
|
||||
import org.mercury_im.messenger.ui.login.AccountsViewModel;
|
||||
import org.mercury_im.messenger.ui.login.LoginActivity;
|
||||
|
@ -48,6 +49,8 @@ public interface AppComponent {
|
|||
|
||||
void inject(ChatInputFragment chatInputFragment);
|
||||
|
||||
void inject(ChatListViewModel chatListViewModel);
|
||||
|
||||
|
||||
// ViewModels
|
||||
|
||||
|
@ -70,4 +73,5 @@ public interface AppComponent {
|
|||
// Connectors
|
||||
|
||||
void inject(PlainMessageStore messageHandler);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,33 +5,53 @@ import android.os.Bundle;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import org.mercury_im.messenger.MercuryImApplication;
|
||||
import org.mercury_im.messenger.R;
|
||||
import org.mercury_im.messenger.persistence.model.AccountModel;
|
||||
import org.mercury_im.messenger.ui.chatlist.ChatListFragment;
|
||||
import org.mercury_im.messenger.ui.login.AccountsActivity;
|
||||
import org.mercury_im.messenger.ui.login.AccountsFragment;
|
||||
import org.mercury_im.messenger.ui.login.LoginActivity;
|
||||
import org.mercury_im.messenger.ui.roster.RosterFragment;
|
||||
import org.mercury_im.messenger.ui.settings.SettingsActivity;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener,
|
||||
AccountsFragment.OnAccountListItemClickListener {
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@BindView(R.id.bottom_navigation)
|
||||
BottomNavigationView bottomNavigationView;
|
||||
|
||||
private ChatListFragment chatListFragment = new ChatListFragment();
|
||||
private RosterFragment rosterFragment = new RosterFragment();
|
||||
private AccountsFragment accountsFragment = new AccountsFragment();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
ButterKnife.bind(this);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
bottomNavigationView.setOnNavigationItemSelectedListener(this::onNavigationItemSelected);
|
||||
|
||||
MercuryImApplication.getApplication().getAppComponent().inject(this);
|
||||
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
|
||||
FloatingActionButton fab = findViewById(R.id.fab);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,4 +81,35 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
switch (menuItem.getItemId()) {
|
||||
|
||||
case R.id.entry_chats:
|
||||
transaction.replace(R.id.fragment, chatListFragment).commit();
|
||||
return true;
|
||||
|
||||
case R.id.entry_contacts:
|
||||
transaction.replace(R.id.fragment, rosterFragment).commit();
|
||||
return true;
|
||||
|
||||
case R.id.entry_accounts:
|
||||
transaction.replace(R.id.fragment, accountsFragment).commit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountListItemClick(AccountModel item) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountListItemLongClick(AccountModel item) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.mercury_im.messenger.ui.chat;
|
||||
|
||||
import android.text.util.Linkify;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package org.mercury_im.messenger.ui.chatlist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.mercury_im.messenger.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
import static org.mercury_im.messenger.MercuryImApplication.TAG;
|
||||
|
||||
public class ChatListFragment extends Fragment {
|
||||
|
||||
private ChatListViewModel viewModel;
|
||||
|
||||
@BindView(R.id.chat_list__recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
private final ChatListRecyclerViewAdapter recyclerViewAdapter = new ChatListRecyclerViewAdapter();
|
||||
|
||||
public ChatListFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_chat_list, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
recyclerView.setAdapter(recyclerViewAdapter);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
viewModel = ViewModelProviders.of(getActivity()).get(ChatListViewModel.class);
|
||||
viewModel.getChats().observe(this, chatModels -> {
|
||||
if (chatModels == null) {
|
||||
Log.d(TAG, "Displaying null chats");
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "Displaying " + chatModels.size() + " chats");
|
||||
recyclerViewAdapter.setItems(chatModels);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package org.mercury_im.messenger.ui.chatlist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.jivesoftware.smackx.colors.ConsistentColor;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.mercury_im.messenger.R;
|
||||
import org.mercury_im.messenger.persistence.model.ChatModel;
|
||||
import org.mercury_im.messenger.persistence.room.model.RoomChatModel;
|
||||
import org.mercury_im.messenger.persistence.room.model.RoomContactModel;
|
||||
import org.mercury_im.messenger.ui.chat.ChatActivity;
|
||||
import org.mercury_im.messenger.util.ColorUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
|
||||
public class ChatListRecyclerViewAdapter
|
||||
extends RecyclerView.Adapter<ChatListRecyclerViewAdapter.ChatListItemViewHolder> {
|
||||
|
||||
private List<ChatModel> chatModelList;
|
||||
|
||||
public ChatListRecyclerViewAdapter() {
|
||||
this.chatModelList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ChatListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ChatListItemViewHolder(parent.getContext(), LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.recycler_view_item_chat_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ChatListItemViewHolder holder, int position) {
|
||||
ChatModel model = chatModelList.get(position);
|
||||
holder.bind(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return chatModelList.size();
|
||||
}
|
||||
|
||||
public void setItems(List<ChatModel> chatModels) {
|
||||
this.chatModelList = chatModels;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public class ChatListItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private View view;
|
||||
|
||||
@BindView(R.id.chat_name)
|
||||
TextView nameView;
|
||||
|
||||
@BindView(R.id.chat_message)
|
||||
TextView chatMessage;
|
||||
|
||||
@BindView(R.id.chat_time)
|
||||
TextView chatTime;
|
||||
|
||||
@BindView(R.id.chat_avatar)
|
||||
CircleImageView avatarView;
|
||||
|
||||
Context context;
|
||||
|
||||
public ChatListItemViewHolder(Context context, View itemView) {
|
||||
super(itemView);
|
||||
this.context = context;
|
||||
this.view = itemView;
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
|
||||
void bind(ChatModel chatModel) {
|
||||
String name = chatModel.getPeerEntityId() + "";
|
||||
nameView.setText(name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,47 @@
|
|||
package org.mercury_im.messenger.ui.chatlist;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import org.mercury_im.messenger.MercuryImApplication;
|
||||
import org.mercury_im.messenger.persistence.model.ChatModel;
|
||||
import org.mercury_im.messenger.persistence.repository.ChatRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class ChatListViewModel extends ViewModel {
|
||||
|
||||
@Inject
|
||||
ChatRepository chatRepository;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
private final MutableLiveData<List<ChatModel>> chats = new MutableLiveData<>();
|
||||
|
||||
public ChatListViewModel() {
|
||||
MercuryImApplication.getApplication().getAppComponent().inject(this);
|
||||
|
||||
disposable.add(chatRepository.getAllChats()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe((Consumer<List<ChatModel>>) chats::setValue));
|
||||
}
|
||||
|
||||
public LiveData<List<ChatModel>> getChats() {
|
||||
return chats;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCleared() {
|
||||
super.onCleared();
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class AccountsFragment extends Fragment {
|
|||
recyclerView = (RecyclerView) view;
|
||||
Context context = view.getContext();
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
this.adapter = new AccountsRecyclerViewAdapter(viewModel.getAccounts().getValue(), accountClickListener);
|
||||
this.adapter = new AccountsRecyclerViewAdapter(accountClickListener);
|
||||
viewModel.getAccounts().observe(this, roomAccountModels -> adapter.setValues(roomAccountModels));
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ public class AccountsRecyclerViewAdapter extends RecyclerView.Adapter<AccountsRe
|
|||
private final List<AccountModel> mValues;
|
||||
private final OnAccountListItemClickListener mListener;
|
||||
|
||||
public AccountsRecyclerViewAdapter(List<AccountModel> items, OnAccountListItemClickListener listener) {
|
||||
mValues = items != null ? items : new ArrayList<>();
|
||||
public AccountsRecyclerViewAdapter(OnAccountListItemClickListener listener) {
|
||||
mValues = new ArrayList<>();
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ import org.mercury_im.messenger.R;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
import static androidx.constraintlayout.widget.Constraints.TAG;
|
||||
|
||||
/**
|
||||
|
@ -24,9 +27,9 @@ public class RosterFragment extends Fragment {
|
|||
|
||||
private RosterViewModel rosterViewModel;
|
||||
|
||||
private RosterRecyclerViewAdapter recyclerViewAdapter;
|
||||
|
||||
@BindView(R.id.roster_entry_list__recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
private final RosterRecyclerViewAdapter recyclerViewAdapter = new RosterRecyclerViewAdapter();
|
||||
|
||||
public RosterFragment() {
|
||||
|
||||
|
@ -36,9 +39,8 @@ public class RosterFragment extends Fragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_roster_entry_list, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
recyclerView = view.findViewById(R.id.roster_entry_list__recycler_view);
|
||||
recyclerViewAdapter = new RosterRecyclerViewAdapter(new ArrayList<>());
|
||||
recyclerView.setAdapter(recyclerViewAdapter);
|
||||
|
||||
return view;
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.mercury_im.messenger.persistence.room.model.RoomContactModel;
|
|||
import org.mercury_im.messenger.ui.chat.ChatActivity;
|
||||
import org.mercury_im.messenger.util.ColorUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
@ -31,8 +32,8 @@ public class RosterRecyclerViewAdapter
|
|||
|
||||
private List<RoomContactModel> entryModelList;
|
||||
|
||||
public RosterRecyclerViewAdapter(List<RoomContactModel> entryModelList) {
|
||||
this.entryModelList = entryModelList;
|
||||
public RosterRecyclerViewAdapter() {
|
||||
this.entryModelList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M16.5,13c-1.2,0 -3.07,0.34 -4.5,1 -1.43,-0.67 -3.3,-1 -4.5,-1C5.33,13 1,14.08 1,16.25L1,19h22v-2.75c0,-2.17 -4.33,-3.25 -6.5,-3.25zM12.5,17.5h-10v-1.25c0,-0.54 2.56,-1.75 5,-1.75s5,1.21 5,1.75v1.25zM21.5,17.5L14,17.5v-1.25c0,-0.46 -0.2,-0.86 -0.52,-1.22 0.88,-0.3 1.96,-0.53 3.02,-0.53 2.44,0 5,1.21 5,1.75v1.25zM7.5,12c1.93,0 3.5,-1.57 3.5,-3.5S9.43,5 7.5,5 4,6.57 4,8.5 5.57,12 7.5,12zM7.5,6.5c1.1,0 2,0.9 2,2s-0.9,2 -2,2 -2,-0.9 -2,-2 0.9,-2 2,-2zM16.5,12c1.93,0 3.5,-1.57 3.5,-3.5S18.43,5 16.5,5 13,6.57 13,8.5s1.57,3.5 3.5,3.5zM16.5,6.5c1.1,0 2,0.9 2,2s-0.9,2 -2,2 -2,-0.9 -2,-2 0.9,-2 2,-2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,5.9c1.16,0 2.1,0.94 2.1,2.1s-0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8s0.94,-2.1 2.1,-2.1m0,9c2.97,0 6.1,1.46 6.1,2.1v1.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1M12,4C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bottom_navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/ic_message_white_24dp" />
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/colorPrimary"
|
||||
app:menu="@menu/bottom_menu_main" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,9 +1,9 @@
|
|||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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:id="@+id/fragment"
|
||||
android:name="org.mercury_im.messenger.ui.roster.RosterFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:layout="@layout/fragment_roster_entry_list" />
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<fragment 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:id="@+id/fragment"
|
||||
android:name="org.mercury_im.messenger.ui.roster.RosterFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:layout="@layout/fragment_roster_entry_list" />
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.chatlist.ChatListFragment"
|
||||
tools:showIn="@layout/activity_main">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/chat_list__recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/recycler_view_item_chat_list"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.roster.RosterFragment"
|
||||
tools:showIn="@layout/activity_main">
|
||||
tools:showIn="@layout/content_roster">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/roster_entry_list__recycler_view"
|
||||
|
@ -13,8 +13,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/recycler_view_item">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
tools:listitem="@layout/recycler_view_item_chat_list" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
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="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
tools:src="@tools:sample/avatars"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@tools:sample/full_names"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@android:color/black"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView2"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="285dp"
|
||||
android:layout_height="20dp"
|
||||
tools:text="@tools:sample/lorem[4:10]"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView2"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintHorizontal_bias="0.050" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@tools:sample/date/hhmm"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="8dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -6,8 +6,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/chat_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
tools:src="@tools:sample/avatars"
|
||||
|
@ -17,36 +17,36 @@
|
|||
android:layout_marginTop="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:id="@+id/chat_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@tools:sample/full_names"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@android:color/black"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView2"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toTopOf="@+id/chat_avatar"
|
||||
app:layout_constraintStart_toEndOf="@+id/chat_avatar"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView2" />
|
||||
app:layout_constraintBottom_toTopOf="@+id/chat_message" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/chat_message"
|
||||
android:layout_width="285dp"
|
||||
android:layout_height="20dp"
|
||||
tools:text="@tools:sample/lorem[4:10]"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView2"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chat_avatar"
|
||||
app:layout_constraintStart_toEndOf="@+id/chat_avatar"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintHorizontal_bias="0.050" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/chat_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@tools:sample/date/hhmm"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toTopOf="@+id/chat_avatar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="8dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@+id/entry_chats"
|
||||
android:title="@string/entry_chats"
|
||||
android:icon="@drawable/ic_message_black_24dp" />
|
||||
|
||||
<item android:id="@+id/entry_contacts"
|
||||
android:title="@string/entry_contacts"
|
||||
android:icon="@drawable/ic_people_outline_black_24dp" />
|
||||
|
||||
<item android:id="@+id/entry_accounts"
|
||||
android:title="@string/entry_accounts"
|
||||
android:icon="@drawable/ic_account_circle_black_24dp" />
|
||||
|
||||
</menu>
|
|
@ -119,5 +119,8 @@
|
|||
<string name="action_reply_message">Reply</string>
|
||||
<string name="action_add_reaction">Add Reaction</string>
|
||||
<string name="action_message_details">Details</string>
|
||||
<string name="entry_chats">Chats</string>
|
||||
<string name="entry_contacts">Contacts</string>
|
||||
<string name="entry_accounts">Accounts</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package org.mercury_im.messenger.core.centers;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class NotificationCenter {
|
||||
|
||||
private final ConnectionCenter connectionCenter;
|
||||
|
||||
@Inject
|
||||
public NotificationCenter(ConnectionCenter connectionCenter) {
|
||||
this.connectionCenter = connectionCenter;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue