Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
fa53758d
Commit
fa53758d
authored
May 03, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up WIP
parent
b920ef07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+8
-1
ModelListAdapter.java
...ocket/android/layouthelper/chatroom/ModelListAdapter.java
+23
-6
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
fa53758d
...
...
@@ -90,7 +90,8 @@ import permissions.dispatcher.RuntimePermissions;
@RuntimePermissions
public
class
RoomFragment
extends
AbstractChatRoomFragment
implements
OnBackPressListener
,
ExtraActionPickerDialogFragment
.
Callback
,
ModelListAdapter
.
OnItemClickListener
<
PairedMessage
>,
RoomContract
.
View
{
ModelListAdapter
.
OnItemClickListener
<
PairedMessage
>,
ModelListAdapter
.
OnItemLongClickListener
<
PairedMessage
>,
RoomContract
.
View
{
private
static
final
int
DIALOG_ID
=
1
;
private
static
final
String
HOSTNAME
=
"hostname"
;
...
...
@@ -187,6 +188,7 @@ public class RoomFragment extends AbstractChatRoomFragment
adapter
=
new
MessageListAdapter
(
getContext
());
listView
.
setAdapter
(
adapter
);
adapter
.
setOnItemClickListener
(
this
);
adapter
.
setOnItemLongClickListener
(
this
);
LinearLayoutManager
layoutManager
=
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
true
);
...
...
@@ -282,6 +284,11 @@ public class RoomFragment extends AbstractChatRoomFragment
presenter
.
onMessageSelected
(
pairedMessage
.
target
);
}
@Override
public
boolean
onItemLongClick
(
PairedMessage
model
)
{
return
false
;
}
private
void
setupSideMenu
()
{
View
sideMenu
=
rootView
.
findViewById
(
R
.
id
.
room_side_menu
);
sideMenu
.
findViewById
(
R
.
id
.
btn_users
).
setOnClickListener
(
view
->
{
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/ModelListAdapter.java
View file @
fa53758d
...
...
@@ -18,6 +18,7 @@ public abstract class ModelListAdapter<T, VM, VH extends ModelViewHolder<VM>>
protected
final
LayoutInflater
inflater
;
private
List
<
VM
>
adapterData
;
private
OnItemClickListener
<
VM
>
onItemClickListener
;
private
OnItemLongClickListener
<
VM
>
onItemLongClickListener
;
protected
ModelListAdapter
(
Context
context
)
{
this
.
inflater
=
LayoutInflater
.
from
(
context
);
...
...
@@ -42,6 +43,20 @@ public abstract class ModelListAdapter<T, VM, VH extends ModelViewHolder<VM>>
@Override
public
final
VH
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
=
inflater
.
inflate
(
getLayout
(
viewType
),
parent
,
false
);
itemView
.
setOnClickListener
(
view
->
{
VM
model
=
(
VM
)
(
view
.
getTag
());
if
(
model
!=
null
&&
onItemClickListener
!=
null
)
{
onItemClickListener
.
onItemClick
(
model
);
}
});
itemView
.
setOnLongClickListener
(
view
->
{
VM
model
=
(
VM
)
(
view
.
getTag
());
return
model
!=
null
&&
onItemLongClickListener
!=
null
&&
onItemLongClickListener
.
onItemLongClick
(
model
);
});
return
onCreateRealmModelViewHolder
(
viewType
,
itemView
);
}
...
...
@@ -49,12 +64,6 @@ public abstract class ModelListAdapter<T, VM, VH extends ModelViewHolder<VM>>
public
void
onBindViewHolder
(
VH
holder
,
int
position
)
{
VM
model
=
getItem
(
position
);
holder
.
itemView
.
setTag
(
model
);
holder
.
itemView
.
setOnClickListener
(
view
->
{
VM
model2
=
(
VM
)
(
view
.
getTag
());
if
(
model2
!=
null
&&
onItemClickListener
!=
null
)
{
onItemClickListener
.
onItemClick
(
model2
);
}
});
holder
.
bind
(
model
,
shouldAutoloadImages
());
}
...
...
@@ -114,6 +123,10 @@ public abstract class ModelListAdapter<T, VM, VH extends ModelViewHolder<VM>>
this
.
onItemClickListener
=
onItemClickListener
;
}
public
void
setOnItemLongClickListener
(
OnItemLongClickListener
<
VM
>
onItemLongClickListener
)
{
this
.
onItemLongClickListener
=
onItemLongClickListener
;
}
public
interface
Constructor
<
T
,
VM
,
VH
extends
ModelViewHolder
<
VM
>>
{
ModelListAdapter
<
T
,
VM
,
VH
>
getNewInstance
(
Context
context
);
}
...
...
@@ -121,4 +134,8 @@ public abstract class ModelListAdapter<T, VM, VH extends ModelViewHolder<VM>>
public
interface
OnItemClickListener
<
VM
>
{
void
onItemClick
(
VM
model
);
}
public
interface
OnItemLongClickListener
<
VM
>
{
boolean
onItemLongClick
(
VM
model
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment