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) {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user