Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-02-11 16:41:09 +01:00
parent 45847abf4f
commit 45916be8c9
8 changed files with 38 additions and 23 deletions

View file

@ -203,6 +203,8 @@ public class CallActivity extends AppCompatActivity {
private String baseUrl;
private boolean initialPermissionsCheck = true;
private static int getSystemUiVisibility() {
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
@ -412,7 +414,7 @@ public class CallActivity extends AppCompatActivity {
R.string.nc_permissions_settings, this);
} else {
EffortlessPermissions.requestPermissions(this, R.string.nc_permissions_audio,
100, PERMISSIONS_MICROPHONE);
R.string.nc_proceed, R.string.nc_empty, 100, PERMISSIONS_MICROPHONE);
}
}
@ -448,7 +450,7 @@ public class CallActivity extends AppCompatActivity {
R.string.nc_permissions_settings, this);
} else {
EffortlessPermissions.requestPermissions(this, R.string.nc_permissions_video,
100, PERMISSIONS_CAMERA);
R.string.nc_proceed, R.string.nc_empty, 100, PERMISSIONS_CAMERA);
}
}
@ -525,13 +527,14 @@ public class CallActivity extends AppCompatActivity {
private void checkPermissions() {
EffortlessPermissions.requestPermissions(this, R.string.nc_permissions,
100, PERMISSIONS_CALL);
R.string.nc_proceed, R.string.nc_empty, 100, PERMISSIONS_CALL);
}
@AfterPermissionGranted(100)
private void onPermissionsGranted() {
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CALL)) {
if (!videoOn) {
if (!videoOn && !initialPermissionsCheck) {
onCameraClick();
}
@ -544,7 +547,11 @@ public class CallActivity extends AppCompatActivity {
}
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
if (!initialPermissionsCheck) {
cameraSwitchButton.setVisibility(View.VISIBLE);
} else {
cameraSwitchButton.setVisibility(View.GONE);
}
}
if (!inCall) {
@ -554,6 +561,8 @@ public class CallActivity extends AppCompatActivity {
PERMISSIONS_CALL)) {
checkIfSomeAreApproved();
}
initialPermissionsCheck = false;
}
private void checkIfSomeAreApproved() {
@ -565,12 +574,13 @@ public class CallActivity extends AppCompatActivity {
cameraSwitchButton.setVisibility(View.VISIBLE);
}
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA)) {
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) && !initialPermissionsCheck) {
if (!videoOn) {
onCameraClick();
}
} else {
cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_off_white_24px);
cameraControlButton.setAlpha(0.7f);
if (cameraSwitchButton != null) {
cameraSwitchButton.setVisibility(View.GONE);
}
@ -591,6 +601,7 @@ public class CallActivity extends AppCompatActivity {
@AfterPermissionDenied(100)
private void onPermissionsDenied() {
initialPermissionsCheck = false;
if (cameraEnumerator.getDeviceNames().length == 0) {
cameraControlButton.setVisibility(View.GONE);
} else if (cameraEnumerator.getDeviceNames().length == 1) {
@ -600,6 +611,8 @@ public class CallActivity extends AppCompatActivity {
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) ||
EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
checkIfSomeAreApproved();
} else if (!inCall) {
startCall();
}
}

View file

@ -180,7 +180,7 @@ public interface NcApi {
*/
@FormUrlEncoded
@POST
Observable<SignalingOverall> sendSignalingMessages(@Nullable@Header("Authorization") String authorization, @Url String url,
Observable<SignalingOverall> sendSignalingMessages(@Nullable @Header("Authorization") String authorization, @Url String url,
@Field("messages") String messages);
/*

View file

@ -462,9 +462,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ
fastScroller.setBubbleTextCreator(position -> {
IFlexible abstractFlexibleItem = adapter.getItem(position);
if (abstractFlexibleItem instanceof UserItem) {
return ((UserItem)adapter.getItem(position)).getHeader().getModel();
return ((UserItem) adapter.getItem(position)).getHeader().getModel();
} else {
return ((UserHeaderItem)adapter.getItem(position)).getModel();
return ((UserHeaderItem) adapter.getItem(position)).getModel();
}
});
}
@ -585,7 +585,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
} else if (adapter.getItem(position) instanceof NewCallHeaderItem) {
adapter.toggleSelection(position);
isPublicCall = adapter.isSelected(position);
((NewCallHeaderItem)adapter.getItem(position)).togglePublicCall(isPublicCall);
((NewCallHeaderItem) adapter.getItem(position)).togglePublicCall(isPublicCall);
checkAndHandleBottomButtons();
}
return true;

View file

@ -75,15 +75,8 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
private Room room;
private List<AbstractFlexibleItem> menuItems;
private FlexibleAdapter<AbstractFlexibleItem> adapter;
@Parcel
public enum MenuType {
REGULAR, SHARE, NEW_CONVERSATION
}
private MenuType menuType;
private Intent shareIntent;
public CallMenuController(Bundle args) {
super(args);
this.room = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_ROOM));
@ -262,4 +255,9 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
return true;
}
@Parcel
public enum MenuType {
REGULAR, SHARE, NEW_CONVERSATION
}
}

View file

@ -62,7 +62,7 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="20dp"
app:alpha="0.7"
android:alpha="0.7"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"
@ -74,7 +74,8 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="20dp"
app:alpha="0.7"
android:alpha="0.7"
android:visibility="gone"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"
@ -86,7 +87,7 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="20dp"
app:alpha="0.7"
android:alpha="0.7"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"

View file

@ -131,4 +131,7 @@
<string name="nc_talk_soon">\n\nTalk soon,\n %1$s</string>
<string name="nc_share_subject">Call invitation</string>
<string name="nc_share_text_pass">\n\nPassword for the call is: %1$s</string>
<!-- Magical stuff -->
<string name="nc_empty"></string>
</resources>