mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
add advanced switch to enable location-streaming, defaults to 'off'
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
app:circleColor="@color/location_icon"/>
|
||||
|
||||
<TextView android:layout_marginTop="10dp"
|
||||
android:id="@+id/location_button_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
|
||||
@@ -63,6 +63,11 @@
|
||||
android:entryValues="@array/pref_compression_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="pref_location_streaming_enabled"
|
||||
android:title="On-demand location streaming"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:layout="@layout/preference_divider" />
|
||||
|
||||
|
||||
@@ -415,6 +415,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
inflater.inflate(R.menu.conversation, menu);
|
||||
|
||||
if (!Prefs.isLocationStreamingEnabled(this)) {
|
||||
menu.findItem(R.id.menu_show_map).setVisible(false);
|
||||
}
|
||||
|
||||
if (isGroupConversation()) {
|
||||
if (isActiveGroup()) {
|
||||
inflater.inflate(R.menu.conversation_push_group_options, menu);
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.widget.PopupWindow;
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public class AttachmentTypeSelector extends PopupWindow {
|
||||
@@ -86,6 +87,11 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
this.closeButton.setOnClickListener(new CloseClickListener());
|
||||
this.recentRail.setListener(new RecentPhotoSelectedListener());
|
||||
|
||||
if (!Prefs.isLocationStreamingEnabled(context)) {
|
||||
this.locationButton.setVisibility(View.GONE);
|
||||
ViewUtil.findById(layout, R.id.location_button_label).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setLocationButtonImage(context);
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
|
||||
@@ -238,6 +238,15 @@ public class Prefs {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLocationStreamingEnabled(Context context) {
|
||||
try {
|
||||
return getBooleanPreference(context, "pref_location_streaming_enabled", false);
|
||||
}
|
||||
catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ringtone
|
||||
|
||||
public static @NonNull Uri getNotificationRingtone(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user