mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
implement profile functions: open shared-chat, vibrate
This commit is contained in:
@@ -163,12 +163,14 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
ConversationListItem conversationListItem = (ConversationListItem) holder.itemView;
|
||||
int chatlistIndex = itemData.get(i).chatlistIndex;
|
||||
|
||||
DcChat chat = dcContext.getChat(itemDataSharedChats.getChatId(chatlistIndex));
|
||||
int chatId = itemDataSharedChats.getChatId(chatlistIndex);
|
||||
DcChat chat = dcContext.getChat(chatId);
|
||||
DcLot summary = itemDataSharedChats.getSummary(chatlistIndex, chat);
|
||||
|
||||
conversationListItem.bind(dcContext.getThreadRecord(summary, chat),
|
||||
itemDataSharedChats.getMsgId(chatlistIndex), summary, glideRequests,
|
||||
locale, Collections.emptySet(), false);
|
||||
conversationListItem.setOnClickListener(view -> clickListener.onSharedChatClicked(chatId));
|
||||
}
|
||||
else if(holder.itemView instanceof ProfileSettingsItem) {
|
||||
int settingsId = itemData.get(i).settingsId;
|
||||
@@ -185,6 +187,7 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onSettingsClicked(int settingsId);
|
||||
void onSharedChatClicked(int chatId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,6 +111,10 @@ public class ProfileSettingsFragment extends Fragment
|
||||
adapter.changeData(memberList, dcContact, sharedChats, dcChat);
|
||||
}
|
||||
|
||||
|
||||
// handle the various events
|
||||
// =========================================================================
|
||||
|
||||
@Override
|
||||
public void onSettingsClicked(int settingsId) {
|
||||
switch(settingsId) {
|
||||
@@ -140,6 +144,12 @@ public class ProfileSettingsFragment extends Fragment
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSharedChatClicked(int chatId) {
|
||||
Intent intent = new Intent(getContext(), ConversationActivity.class);
|
||||
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, chatId);
|
||||
getContext().startActivity(intent);
|
||||
}
|
||||
|
||||
private void onContactAddrClicked() {
|
||||
String address = dcContext.getContact(contactId).getAddr();
|
||||
@@ -268,6 +278,11 @@ public class ProfileSettingsFragment extends Fragment
|
||||
}
|
||||
|
||||
private void onVibrateSettings() {
|
||||
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.pref_vibrate)
|
||||
.setItems(R.array.recipient_vibrate_entries, (dialog, which) -> {
|
||||
Prefs.setChatVibrate(getContext(), chatId, Prefs.VibrateState.fromId(which));
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user