add calls button

This commit is contained in:
adbenitez
2025-09-03 16:07:19 +02:00
parent 01c766db41
commit 9ef01dd352
6 changed files with 39 additions and 0 deletions
@@ -442,6 +442,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
menu.findItem(R.id.menu_show_map).setVisible(false);
}
menu.findItem(R.id.menu_start_call).setVisible(Prefs.isCallsEnabled(this) && dcChat.isEncrypted() && !isMultiUser());
if (!dcChat.isEncrypted() || !dcChat.canSend() || dcChat.isMailingList() ) {
menu.findItem(R.id.menu_ephemeral_messages).setVisible(false);
}
@@ -532,6 +534,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
} else if (itemId == R.id.menu_show_map) {
WebxdcActivity.openMaps(this, chatId);
return true;
} else if (itemId == R.id.menu_start_call) {
VideochatUtil.startCall(this, chatId);
return true;
} else if (itemId == R.id.menu_all_media) {
handleAllMedia();
return true;
@@ -205,6 +205,22 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
});
}
Preference callsEnabled = this.findPreference("pref_calls_enabled");
if (callsEnabled != null) {
callsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
if ((Boolean)newValue) {
new AlertDialog.Builder(requireActivity())
.setTitle("Thanks for trying out \"Video Calls\"!")
.setMessage("• You can now call contacts\n\n"
+ "• If you want to quit the experimental feature, you can disable it at \"Settings / Advanced\"")
.setCancelable(false)
.setPositiveButton(R.string.ok, null)
.show();
}
return true;
});
}
Preference selfReporting = this.findPreference("pref_self_reporting");
if (selfReporting != null) {
selfReporting.setOnPreferenceClickListener(((preference) -> {
@@ -179,6 +179,11 @@ public class Prefs {
return getBooleanPreference(context, "pref_new_broadcast_list", false);
}
public static boolean isCallsEnabled(Context context) {
return getBooleanPreference(context, "pref_calls_enabled", false);
}
// ringtone
public static @NonNull Uri getNotificationRingtone(Context context) {