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) {
+5
View File
@@ -25,6 +25,11 @@
android:visible="false"
app:showAsAction="always"/>
<item android:id="@+id/menu_start_call"
android:title="@string/start_call"
android:icon="@drawable/baseline_call_24"
app:showAsAction="always" />
<item android:id="@+id/menu_all_media"
android:title="@string/apps_and_media"
android:icon="@drawable/ic_apps_24"
+3
View File
@@ -368,6 +368,9 @@
</plurals>
<string name="file_saved_to">File saved to \"%1$s\".</string>
<string name="start_call">Call</string>
<string name="video_calls">Video Calls</string>
<!-- deprecated -->
<string name="videochat">Video Chat</string>
<!-- deprecated -->
@@ -20,6 +20,11 @@
android:title="@string/webxdc_store_url"
android:summary="@string/none"/>
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_calls_enabled"
android:title="@string/video_calls"/>
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_new_broadcast_list"