Only show video tooltip if capable.
This commit is contained in:
parent
ef585eba42
commit
44dba4bd98
2 changed files with 13 additions and 4 deletions
|
@ -58,7 +58,6 @@ import java.io.IOException;
|
||||||
public class CameraXFragment extends Fragment implements CameraFragment {
|
public class CameraXFragment extends Fragment implements CameraFragment {
|
||||||
|
|
||||||
private static final String TAG = Log.tag(CameraXFragment.class);
|
private static final String TAG = Log.tag(CameraXFragment.class);
|
||||||
private static final String HAS_DISMISSED_VIDEO_RECORDING_TOOLTIP = "camerax.fragment.has.dismissed.video.recording.tooltip";
|
|
||||||
|
|
||||||
private CameraXView camera;
|
private CameraXView camera;
|
||||||
private ViewGroup controlsContainer;
|
private ViewGroup controlsContainer;
|
||||||
|
@ -283,11 +282,11 @@ public class CameraXFragment extends Fragment implements CameraFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDisplayVideoRecordingTooltip() {
|
private boolean shouldDisplayVideoRecordingTooltip() {
|
||||||
return !TextSecurePreferences.getBooleanPreference(requireContext(), HAS_DISMISSED_VIDEO_RECORDING_TOOLTIP, false);
|
return !TextSecurePreferences.hasSeenVideoRecordingTooltip(requireContext()) && MediaConstraints.isVideoTranscodeAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void neverDisplayVideoRecordingTooltipAgain() {
|
private void neverDisplayVideoRecordingTooltipAgain() {
|
||||||
TextSecurePreferences.setBooleanPreference(requireContext(), HAS_DISMISSED_VIDEO_RECORDING_TOOLTIP, true);
|
TextSecurePreferences.setHasSeenVideoRecordingTooltip(requireContext(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideAndDisableControlsForVideoRecording(@NonNull View captureButton,
|
private void hideAndDisableControlsForVideoRecording(@NonNull View captureButton,
|
||||||
|
|
|
@ -195,6 +195,8 @@ public class TextSecurePreferences {
|
||||||
|
|
||||||
private static final String HAS_SEEN_SWIPE_TO_REPLY = "pref_has_seen_swipe_to_reply";
|
private static final String HAS_SEEN_SWIPE_TO_REPLY = "pref_has_seen_swipe_to_reply";
|
||||||
|
|
||||||
|
private static final String HAS_SEEN_VIDEO_RECORDING_TOOLTIP = "camerax.fragment.has.dismissed.video.recording.tooltip";
|
||||||
|
|
||||||
public static boolean isScreenLockEnabled(@NonNull Context context) {
|
public static boolean isScreenLockEnabled(@NonNull Context context) {
|
||||||
return getBooleanPreference(context, SCREEN_LOCK, false);
|
return getBooleanPreference(context, SCREEN_LOCK, false);
|
||||||
}
|
}
|
||||||
|
@ -1158,6 +1160,14 @@ public class TextSecurePreferences {
|
||||||
setBooleanPreference(context, HAS_SEEN_SWIPE_TO_REPLY, value);
|
setBooleanPreference(context, HAS_SEEN_SWIPE_TO_REPLY, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasSeenVideoRecordingTooltip(Context context) {
|
||||||
|
return getBooleanPreference(context, HAS_SEEN_VIDEO_RECORDING_TOOLTIP, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHasSeenVideoRecordingTooltip(Context context, boolean value) {
|
||||||
|
setBooleanPreference(context, HAS_SEEN_VIDEO_RECORDING_TOOLTIP, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setBooleanPreference(Context context, String key, boolean value) {
|
public static void setBooleanPreference(Context context, String key, boolean value) {
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue