Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Join Channel on text field and use the Chat icon for selecting chat #177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
if (node.isChannel()) {
final IChannel channel = node.getChannel();
final ChannelViewHolder cvh = (ChannelViewHolder) viewHolder;
cvh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mChannelClickListener != null) {
mChannelClickListener.onChannelClick(channel);
}
}
});

final boolean expandUsable = channel.getSubchannels().size() > 0 ||
channel.getSubchannelUserCount() > 0;
Expand Down Expand Up @@ -185,11 +177,14 @@ public void onClick(View v) {
cvh.mChannelHolder.getPaddingRight(),
cvh.mChannelHolder.getPaddingBottom());

cvh.mJoinButton.setOnClickListener(new View.OnClickListener() {
// Actions.

cvh.mChatChannelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mService.isConnected())
mService.getSession().joinChannel(channel.getId());
if (mChannelClickListener != null) {
mChannelClickListener.onChannelClick(channel);
}
}
});

Expand All @@ -201,9 +196,18 @@ public void onClick(View v) {
}
});

cvh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mService.isConnected())
mService.getSession().joinChannel(channel.getId());
}

});
cvh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
//ToDo: olzzon Long Click join Channel - Setting Secure Channel Shift
cvh.mMoreButton.performClick();
return true;
}
Expand Down Expand Up @@ -516,7 +520,7 @@ private static class ChannelViewHolder extends RecyclerView.ViewHolder {
public ImageView mChannelExpandToggle;
public TextView mChannelName;
public TextView mChannelUserCount;
public ImageView mJoinButton;
public ImageView mChatChannelButton;
public ImageView mMoreButton;

public ChannelViewHolder(View itemView) {
Expand All @@ -525,7 +529,7 @@ public ChannelViewHolder(View itemView) {
mChannelExpandToggle = (ImageView) itemView.findViewById(R.id.channel_row_expand);
mChannelName = (TextView) itemView.findViewById(R.id.channel_row_name);
mChannelUserCount = (TextView) itemView.findViewById(R.id.channel_row_count);
mJoinButton = (ImageView) itemView.findViewById(R.id.channel_row_join);
mChatChannelButton = (ImageView) itemView.findViewById(R.id.channel_row_join);
mMoreButton = (ImageView) itemView.findViewById(R.id.channel_row_more);
}
}
Expand Down
17 changes: 10 additions & 7 deletions app/src/main/res/layout/channel_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,27 @@
android:gravity="center_vertical|left"
android:minHeight="48dp"
android:padding="4dp"
android:text="Channel name\nLine 2\nLine 3\nLine 4"/>
android:text="Channel name\nLine 2\nLine 3\nLine 4"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="18sp"
/>

<TextView
android:id="@+id/channel_row_count"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:padding="10dp"
android:text="10"
android:textStyle="bold"
android:padding="10dp"/>
android:textStyle="bold" />

<ImageView
android:id="@+id/channel_row_join"
android:layout_width="32dp"
android:layout_width="22dp"
android:layout_height="match_parent"
android:src="@drawable/ic_action_move"
android:tint="?android:attr/textColorSecondary"
android:background="?attr/selectableItemBackgroundBorderless"/>
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@android:drawable/sym_action_chat"
android:tint="?android:attr/textColorSecondary" />

<ImageView
android:id="@+id/channel_row_more"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_channel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="@string/ptt"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textColor="@color/holo_red_dark"
android:textStyle="bold"
android:textSize="12sp"
android:textSize="18sp"
android:background="?attr/selectableItemBackground"/>
</LinearLayout>

Expand Down