Merge branch 'video_screen_re-design' into 'development'

change video streaming design

See merge request Cloud_Solution/doctor_app_flutter!733
merge-requests/736/head
Mohammad Aljammal 4 years ago
commit e77f5773dc

@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hmg.hmgDr"
minSdkVersion 18
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

@ -45,8 +45,9 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler
val tokenID = call.argument<String>("TokenID")
val generalId = call.argument<String>("generalId")
val doctorId = call.argument<Int>("DoctorId")
val patientName = call.argument<String>("patientName")
val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId)
val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId, patientName)
openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel)

@ -20,15 +20,19 @@ public class GetSessionStatusModel implements Parcelable {
@SerializedName("DoctorId")
@Expose
private Integer doctorId;
@SerializedName("PatientName")
@Expose
private String patientName;
public GetSessionStatusModel() {
}
public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId) {
public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId, String patientName) {
this.vCID = vCID;
this.tokenID = tokenID;
this.generalid = generalid;
this.doctorId = doctorId;
this.patientName = patientName;
}
protected GetSessionStatusModel(Parcel in) {
@ -44,6 +48,7 @@ public class GetSessionStatusModel implements Parcelable {
} else {
doctorId = in.readInt();
}
patientName = in.readString();
}
public static final Creator<GetSessionStatusModel> CREATOR = new Creator<GetSessionStatusModel>() {
@ -90,6 +95,16 @@ public class GetSessionStatusModel implements Parcelable {
this.doctorId = doctorId;
}
public String getPatientName() {
if (patientName == null)
patientName = "-";
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
@Override
public int describeContents() {
return 0;
@ -111,5 +126,6 @@ public class GetSessionStatusModel implements Parcelable {
dest.writeByte((byte) 1);
dest.writeInt(doctorId);
}
dest.writeString(patientName);
}
}

@ -11,8 +11,10 @@ import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.Chronometer;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
@ -75,7 +77,13 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
private boolean isSpeckerClicked;
private boolean isMicClicked;
private TextView patientName;
private Chronometer cmTimer;
long elapsedTime;
Boolean resume = false;
private ImageView mCallBtn;
private ImageView btnMinimize;
private ImageView mCameraBtn;
private ImageView mSwitchCameraBtn;
private ImageView mspeckerBtn;
@ -128,7 +136,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
@Override
protected void onDestroy() {
disconnectSession();
cmTimer.stop();
super.onDestroy();
}
@ -148,8 +156,28 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
videoCallPresenter = new VideoCallPresenterImpl(this, baseUrl);
patientName = findViewById(R.id.patient_name);
patientName.setText(sessionStatusModel.getPatientName());
cmTimer = findViewById(R.id.cmTimer);
cmTimer.setFormat("mm:ss");
cmTimer.setOnChronometerTickListener(arg0 -> {
long minutes;
long seconds;
if (!resume) {
minutes = ((SystemClock.elapsedRealtime() - cmTimer.getBase()) / 1000) / 60;
seconds = ((SystemClock.elapsedRealtime() - cmTimer.getBase()) / 1000) % 60;
elapsedTime = SystemClock.elapsedRealtime();
} else {
minutes = ((elapsedTime - cmTimer.getBase()) / 1000) / 60;
seconds = ((elapsedTime - cmTimer.getBase()) / 1000) % 60;
elapsedTime = elapsedTime + 1000;
}
Log.d(TAG, "onChronometerTick: " + minutes + " : " + seconds);
});
mCallBtn = findViewById(R.id.btn_call);
btnMinimize = findViewById(R.id.btn_minimize);
mCameraBtn = findViewById(R.id.btn_camera);
mSwitchCameraBtn = findViewById(R.id.btn_switch_camera);
mspeckerBtn = findViewById(R.id.btn_specker);
@ -252,6 +280,11 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
}
mSession.publish(mPublisher);
if (!resume) {
cmTimer.setBase(SystemClock.elapsedRealtime());
}
cmTimer.start();
}
@Override
@ -259,6 +292,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
Log.d(TAG, "onDisconnected: disconnected from session " + session.getSessionId());
mSession = null;
cmTimer.stop();
}
@Override
@ -377,6 +411,10 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
finish();
}
public void onMinimizedClicked(View view) {
}
public void onSwitchCameraClicked(View view) {
if (mPublisher != null) {
isSwitchCameraClicked = !isSwitchCameraClicked;

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,8l-2,0l0,9l11,0l0,-2l-9,0z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M22,3H10v10h12V3zM20,11h-8V7h8V11z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M4,12l-2,0l0,9l11,0l0,-2l-9,0z"/>
</vector>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="1000dp"/>
<solid android:color="@color/green_dark"/>
</shape>

@ -1,169 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_clingo_video_call"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.VideoCallActivity">
android:background="@color/text_color"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:keepScreenOn="true"
android:clickable="true">
<LinearLayout
android:id="@+id/subscriberview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/padding_space_big">
<TextView
android:id="@+id/patient_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="@+id/video_counter_fl"
android:textColor="@color/white"
android:textSize="@dimen/text_size_big"
android:textStyle="bold"
tools:text="Mousa Abuzaid" />
<FrameLayout
android:id="@+id/video_counter_fl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:orientation="horizontal"/>
android:layout_alignParentEnd="true"
android:background="@drawable/shape_capsule"
android:padding="@dimen/padding_space_small">
<Chronometer
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
tools:text="25:45"
android:textColor="@color/white"
android:textStyle="bold"
android:id="@+id/cmTimer" />
</FrameLayout>
<RelativeLayout
android:id="@+id/publisherview"
android:layout_height="200dp"
android:layout_width="150dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/remote_video_view_container"
android:id="@+id/activity_clingo_video_call"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/remoteBackground">
android:layout_height="0dp"
android:layout_weight="1"
tools:context=".ui.VideoCallActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:gravity="center_horizontal"
android:keepScreenOn="true">
<LinearLayout
android:id="@+id/subscriberview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:orientation="horizontal" />
<RelativeLayout
android:id="@+id/publisherview"
android:layout_width="150dp"
android:layout_height="200dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/remote_video_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/icon_padding">
android:background="@color/remoteBackground">
<ImageView
android:layout_width="@dimen/remote_back_icon_size"
android:layout_height="@dimen/remote_back_icon_size"
android:layout_centerInParent="true"
android:src="@drawable/video_off_fill" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/icon_padding"
android:layout_width="match_parent"
android:layout_height="@dimen/remote_back_icon_margin_bottom"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/local_video_view_container"
android:layout_width="@dimen/local_preview_width"
android:layout_height="@dimen/local_preview_height"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/local_preview_margin_right"
android:layout_marginRight="@dimen/local_preview_margin_right"
android:layout_marginTop="@dimen/local_preview_margin_top"
android:background="@color/localBackground">
<FrameLayout
android:id="@+id/local_video_view_container"
android:layout_width="@dimen/local_preview_width"
android:layout_height="@dimen/local_preview_height"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/local_preview_margin_top"
android:layout_marginEnd="@dimen/local_preview_margin_right"
android:background="@color/localBackground">
<ImageView
android:layout_width="@dimen/local_back_icon_size"
android:layout_height="@dimen/local_back_icon_size"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/video_off_fill" />
</FrameLayout>
<ImageView
android:layout_width="@dimen/local_back_icon_size"
android:layout_height="@dimen/local_back_icon_size"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/video_off_fill" />
</FrameLayout>
<ImageView
android:id="@+id/btn_switch_camera"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_centerVertical="true"
android:layout_below="@+id/local_video_view_container"
android:layout_marginTop="@dimen/local_preview_margin_top"
android:layout_marginEnd="@dimen/local_preview_margin_right"
android:layout_alignParentEnd="true"
android:onClick="onSwitchCameraClicked"
android:scaleType="centerCrop"
android:src="@drawable/flip_enabled" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/control_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp">
android:padding="@dimen/padding_space_big_2">
<ImageView
android:id="@+id/btn_call"
android:layout_width="71dp"
android:layout_height="71dp"
android:layout_centerInParent="true"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_alignParentEnd="true"
android:onClick="onCallClicked"
android:scaleType="centerCrop"
android:src="@drawable/call" />
<ImageView
android:id="@+id/btn_switch_camera"
android:layout_width="39dp"
android:layout_height="39dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/control_bottom_horizontal_margin"
android:layout_toEndOf="@id/btn_camera"
android:layout_toRightOf="@id/btn_camera"
android:onClick="onSwitchCameraClicked"
android:id="@+id/btn_minimize"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_alignParentStart="true"
android:onClick="onMinimizedClicked"
android:layout_marginEnd="@dimen/padding_space_small"
android:scaleType="centerCrop"
android:src="@drawable/flip_enabled" />
android:src="@drawable/ic_mini" />
<ImageView
android:id="@+id/btn_camera"
android:layout_width="39dp"
android:layout_height="39dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/control_bottom_horizontal_margin"
android:layout_toEndOf="@id/btn_call"
android:layout_toRightOf="@id/btn_call"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_toEndOf="@id/btn_minimize"
android:onClick="onCameraClicked"
android:scaleType="centerCrop"
android:layout_marginEnd="@dimen/padding_space_small"
android:src="@drawable/video_enabled" />
<ImageView
android:id="@+id/btn_mic"
android:layout_width="39dp"
android:layout_height="39dp"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/control_bottom_horizontal_margin"
android:layout_toStartOf="@id/btn_call"
android:layout_toLeftOf="@id/btn_call"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_toEndOf="@id/btn_camera"
android:onClick="onMicClicked"
android:layout_marginEnd="@dimen/padding_space_small"
android:scaleType="centerCrop"
android:src="@drawable/mic_enabled" />
<ImageView
android:id="@+id/btn_specker"
android:layout_width="39dp"
android:layout_height="39dp"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/control_bottom_horizontal_margin"
android:layout_toStartOf="@id/btn_mic"
android:layout_toLeftOf="@id/btn_mic"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_toEndOf="@id/btn_mic"
android:onClick="onSpeckerClicked"
android:scaleType="centerCrop"
android:layout_marginEnd="@dimen/padding_space_small"
android:src="@drawable/audio_enabled" />
</RelativeLayout>
</LinearLayout>
<!-- <RelativeLayout-->
<!-- android:id="@+id/progressBar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="40dp"-->
<!-- android:layout_alignParentBottom="true">-->
<!-- <ProgressBar-->
<!-- android:id="@+id/progress_bar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="31dp"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginEnd="0dp"-->
<!-- android:layout_marginBottom="0dp"-->
<!-- android:progressBackgroundTint="@color/colorProgressBarBackground"-->
<!-- style="@android:style/Widget.ProgressBar.Horizontal" />-->
<!-- <TextView-->
<!-- android:id="@+id/progress_bar_text"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="9dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:textColor="@color/colorPrimary"-->
<!-- android:layout_centerInParent="true"/>-->
<!-- </RelativeLayout>-->
</RelativeLayout>

@ -8,4 +8,10 @@
<!-- Chat Activity -->
<color name="localBackground">#827b92</color>
<color name="remoteBackground">#484258</color>
<color name="text_color">#FF2E303A</color>
<color name="white">#fff</color>
<color name="black">#000</color>
<color name="green_dark">#389842</color>
<color name="red_dark">#d51e26</color>
</resources>

@ -8,7 +8,11 @@
<!-- buttons -->
<dimen name="call_button_size">60dp</dimen>
<dimen name="other_button_size">54dp</dimen>
<dimen name="video_icon_size">64dp</dimen>
<!-- buttons -->
<dimen name="control_bottom_margin">24dp</dimen>
<dimen name="control_bottom_horizontal_margin">25dp</dimen>
<dimen name="local_preview_width">88dp</dimen>
<dimen name="local_preview_height">117dp</dimen>
@ -16,7 +20,16 @@
<dimen name="remote_back_icon_size">100dp</dimen>
<dimen name="remote_back_icon_margin_bottom">90dp</dimen>
<!-- buttons -->
<dimen name="control_bottom_margin">24dp</dimen>
<dimen name="control_bottom_horizontal_margin">25dp</dimen>
<!-- text-->
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">16sp</dimen>
<dimen name="text_size_big">24sp</dimen>
<!-- padding/margin-->
<dimen name="padding_space_small">4dp</dimen>
<dimen name="padding_space_medium">8sp</dimen>
<dimen name="padding_space_big">16dp</dimen>
<dimen name="padding_space_big_2">24dp</dimen>
</resources>

@ -65,6 +65,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
kSessionId: liveCareModel.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: widget.patient.vcId,
patientName: widget.patient.fullName ?? (widget.patient.firstName != null ? "${widget.patient.firstName} ${widget.patient.lastName}" : "-"),
tokenID: await liveCareModel.getToken(),
generalId: GENERAL_ID,
doctorId: liveCareModel.doctorProfile.doctorID,

@ -66,6 +66,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
//'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg',
kApiKey: '46209962',
vcId: widget.patientData.vcId,
patientName: widget.patientData.fullName ?? widget.patientData.firstName != null ? "${widget.patientData.firstName} ${widget.patientData.lastName}" : "-",
tokenID: token, //"hfkjshdf347r8743",
generalId: "Cs2020@2016\$2958",
doctorId: doctorprofile['DoctorID'],

@ -327,6 +327,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
kSessionId: model.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: patient.vcId,
patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"),
tokenID: await model.getToken(),
generalId: GENERAL_ID,
doctorId: model.doctorProfile.doctorID,

@ -10,7 +10,7 @@ class VideoChannel{
/// channel name
static const _channel = const MethodChannel("Dr.cloudSolution/videoCall");
static openVideoCallScreen(
{kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,String generalId,int doctorId, Function() onCallEnd , Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure}) async {
{kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,String generalId,int doctorId, String patientName, Function() onCallEnd , Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure}) async {
var result;
try {
result = await _channel.invokeMethod(
@ -25,6 +25,7 @@ class VideoChannel{
"TokenID": tokenID,
"generalId": generalId,
"DoctorId": doctorId ,
"patientName": patientName,
},
);
if(result['callResponse'] == 'CallEnd') {

Loading…
Cancel
Save