mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
add calls button
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user