diff --git a/res/layout-land/call.xml b/res/layout-land/call.xml index 9c556801b..f88ab92ac 100644 --- a/res/layout-land/call.xml +++ b/res/layout-land/call.xml @@ -241,15 +241,32 @@ android:layout_weight="0.5" android:padding="12dp"/> - + android:layout_weight="1"> + + + + + diff --git a/res/layout-sw533dp-land/call.xml b/res/layout-sw533dp-land/call.xml index 12862af3b..5de923dec 100644 --- a/res/layout-sw533dp-land/call.xml +++ b/res/layout-sw533dp-land/call.xml @@ -241,15 +241,32 @@ android:padding="12dp" android:contentDescription="@string/content_description_hang_up"/> - + android:layout_weight="1"> + + + + + diff --git a/res/layout/call.xml b/res/layout/call.xml index 280bdb653..06c66b396 100644 --- a/res/layout/call.xml +++ b/res/layout/call.xml @@ -294,16 +294,33 @@ android:layout_height="wrap_content" android:layout_weight="0.4" android:padding="12dp"/> - - + android:layout_weight="0.8"> + + + + + diff --git a/src/org/linphone/CallActivity.java b/src/org/linphone/CallActivity.java index 635adba9f..afdbd8b60 100644 --- a/src/org/linphone/CallActivity.java +++ b/src/org/linphone/CallActivity.java @@ -24,6 +24,8 @@ import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCallParams; +import org.linphone.core.LinphoneChatMessage; +import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreListenerBase; @@ -91,6 +93,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve private Handler mControlsHandler = new Handler(); private Runnable mControls; private ImageView switchCamera; + private TextView missedChats; private RelativeLayout mActiveCallHeader, sideMenuContent, avatar_layout; private ImageView pause, hangUp, dialer, video, micro, speaker, options, addCall, transfer, conference, conferenceStatus, contactPicture; private ImageView audioRoute, routeSpeaker, routeEarpiece, routeBluetooth, menu, chat; @@ -161,7 +164,12 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); - mListener = new LinphoneCoreListenerBase(){ + mListener = new LinphoneCoreListenerBase() { + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + displayMissedChats(); + } + @Override public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) { if (LinphoneManager.getLc().getCallsNb() == 0) { @@ -362,6 +370,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve chat = (ImageView) findViewById(R.id.chat); chat.setOnClickListener(this); + missedChats = (TextView) findViewById(R.id.missed_chats); //Others @@ -500,6 +509,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve refreshInCallActions(); refreshCallList(getResources()); enableAndRefreshInCallActions(); + displayMissedChats(); } private void refreshInCallActions() { @@ -1806,4 +1816,26 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve public void onAccuracyChanged(Sensor sensor, int accuracy) { } + + private void displayMissedChats() { + int count = 0; + LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); + for (LinphoneChatRoom chatroom : chats) { + count += chatroom.getUnreadMessagesCount(); + } + + if (count > 0) { + missedChats.setText(count + ""); + missedChats.setVisibility(View.VISIBLE); + if (!isAnimationDisabled) { + missedChats.startAnimation(AnimationUtils.loadAnimation(this, R.anim.bounce)); + } + if(count > 99){ + //TODO + } + } else { + missedChats.clearAnimation(); + missedChats.setVisibility(View.GONE); + } + } } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index d77460da7..44421ca98 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -1248,7 +1248,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta LinphoneManager.getInstance().changeStatusToOnline(); - if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY){ + if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY) { if (LinphoneManager.getLc().getCalls().length > 0) { LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; LinphoneCall.State callState = call.getState();