From 3eca96e3c5e69d342cd1be6dcafa34941198b1ef Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 25 Aug 2015 17:23:07 +0200 Subject: [PATCH] Rework Incall view/Chat view/Edit Contact view --- res/drawable-xhdpi/dialer_alt_background.png | Bin 4450 -> 0 bytes .../resizable_chat_bubble_incoming.9.png | Bin 100 -> 101 bytes .../resizable_chat_bubble_outgoing.9.png | Bin 99 -> 101 bytes .../resizable_confirm_delete_button.9.png | Bin 394 -> 298 bytes res/drawable/call.xml | 6 +- res/drawable/camera.xml | 9 - res/drawable/chat.xml | 6 +- res/drawable/dialer.xml | 6 +- res/drawable/footer_button.xml | 6 +- res/drawable/hangup.xml | 10 +- res/drawable/micro.xml | 8 +- res/drawable/speaker.xml | 8 +- res/layout-small/dialer.xml | 2 +- res/layout-sw533dp-land/audio.xml | 2 +- res/layout-sw533dp-land/chat.xml | 3 +- res/layout/about.xml | 2 +- res/layout/active_call_control_row.xml | 42 +- .../assistant_remote_provisioning_login.xml | 1 - res/layout/audio.xml | 2 +- res/layout/chat.xml | 12 +- res/layout/chat_bubble_incoming.xml | 10 +- res/layout/chat_bubble_outgoing.xml | 10 +- res/layout/chatlist.xml | 5 +- res/layout/conference_header.xml | 2 +- res/layout/contact.xml | 1 + res/layout/contact_edit_row.xml | 47 ++- res/layout/dialer.xml | 2 +- res/layout/drawer_list_item.xml | 35 +- res/layout/edit_contact.xml | 128 +++++- res/layout/history.xml | 53 ++- res/layout/history_cell.xml | 13 +- res/layout/incall.xml | 270 +++++++----- res/layout/incoming.xml | 59 ++- res/layout/main.xml | 105 +++-- res/layout/menu_chat_button.xml | 2 +- res/layout/menu_contact_button.xml | 4 +- res/layout/menu_history_button.xml | 4 +- res/layout/outgoing_call.xml | 37 +- res/layout/remote_provisioning.xml | 2 +- res/layout/status.xml | 2 +- res/raw/linphonerc_factory | 3 + res/values/strings.xml | 23 +- res/values/styles.xml | 9 +- src/org/linphone/ChatFragment.java | 8 +- src/org/linphone/ChatListFragment.java | 2 - src/org/linphone/ContactsFragment.java | 2 +- src/org/linphone/ContactsManager.java | 21 +- src/org/linphone/EditContactFragment.java | 139 +++++-- src/org/linphone/HistoryFragment.java | 133 ++++-- src/org/linphone/InCallActivity.java | 393 +++++++++++------- src/org/linphone/IncomingCallActivity.java | 8 +- src/org/linphone/LinphoneActivity.java | 25 +- src/org/linphone/OutgoingCallActivity.java | 115 +++-- src/org/linphone/SettingsFragment.java | 4 +- src/org/linphone/ui/BubbleChat.java | 4 +- 55 files changed, 1110 insertions(+), 695 deletions(-) delete mode 100644 res/drawable-xhdpi/dialer_alt_background.png delete mode 100644 res/drawable/camera.xml diff --git a/res/drawable-xhdpi/dialer_alt_background.png b/res/drawable-xhdpi/dialer_alt_background.png deleted file mode 100644 index 86b6c3f02312fa0738ffcd7ee6b9b0b16e3798f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4450 zcmeI0c~BF17RNgQSx}LP41>sO6H$>P2S);dU@$>IiK~EuBN>QEL$Z*B96%5cE;+;z zR6s{S5d}v@1rI=ifP&+yI|N6(07pR`k01yrQ5o3nAOz!ryS0B=wVSF`zxVrn-uJ!t z>(^DCq_0}(sXx_pDgXfb-d;3c06-eT-x<0(0D#z!X}Jb(%$9frO8f+&k{G540^Hex z4G`$fV}?P#5R)A%yau@ffEJqTA1Dc=`;b@y9)_u6Fj8J591Q@jOQexZRyZU9H$Y)r zJ{jF3t3!iaHW?k@NXOA5sSt#EWm>#Oi;>;;EPF8 zGI~Up1ly`*EE*g^B;jQA$D#u1t3awi1c8nioGlASz<~rj25;{`Bob{vI~*Q|#o1x; zcD8sT$=;5H!-1n8G@MPu4kh{0mW}3uJu;djkwlWP*qE3YOpHB7APU3cot>Rk8g_QJ zFkvf>3`FAzkG zo#HBvKq3%x1d$-s&k>|ESzNx#AK~eAk~d#0Ve(m!H;s&j6);>b8$L~UXM&@LBh}g2 z36J-{yAvE~RA;AUI3kWfSVq8&#nJ?$_o+{tUPpHy!&mOXhb4wJ@W;bO3=8~e$P9$SK^M`fzV7IxHw5Aoq?7r|p~o?j9N zKWcZpY3}~g)~@!OdPz7V%FRZyStEZz_aSkWmn=QJ(eiy3SUkjWcm8(nwJ?#66klvK z+L^Wb3J7PjjpPQOp8LHl_(c@WFSJx(8Kf(xmSM`-Cx|J+EKWF00GKj(vr z-d(ZVb?EQ6TXVB^bRIZ4@3HV_*) zte~7-o<6(HKYIU~+74gOO0+`J!@q7%<@on<69EKLTNedV;=gPpe`()qU!8|(%t2yP z#4-F02gJP#NwahkEVmbxAgs$1%I9TF8^AB74Vu)k+ta3*>n>|bNOg}9Es$OKK-=~9 zN^v#j&R=^LDG;Dv1iyCC$tNdjXQXa_RHwBXoJvcuL`^B87^NZA4xqL)mMKOP(kf;G zk&)1NSbI^;^2MIYwtJ`*<-dh*JYqJ7)pK@r`!!>zm65kZmvC2Ml&9#Cci(?ygDeY9 zU8IX-0x8_g{6am6f$-`=PNFy=ALPUvm$_8U^VD9;;kp`Z3LIYC9fxmSYSfdw$EulPs$PF3lCos*Xm&x&K`Tqy{~K1E?DanJE*R9eg0@JSQZ1 zzS)Zr?i7A->c|1zcA<~=J2d@a{i|K-hVshd1E}!T-<*{zU!vj@!)M+sThmK!Ve@975Yo1XOiVN*gz=L)dtnb*T%N{!!e z{F?dC>RyAQU}nap4X?~P&$n`mE)V1g2!A=d-0$aD2yr=wgnoOIarI=Te2dGoHbhC? zVUm9BdMsKf$&AMj-vww$lpe(b*fnl^?yHDT_tga6f|ZFHq1K$b!Bh2S(|v} z;sD;G!YLynfgs%M+k`9&Pp#BbJxDK*)fATm1~6b?Q#gx5il25*_QVGhz~S7MKI*sl z_8qI}$U{W}BhDh%xg3`>in9Jdag$1GiIM@J2SLnebr0! zO=!KOVMbKr0=FB^#r5rPBEqZ;8K&zS!z&iFC%S`Mpm~5q^KHCxC|W zUH}@ArmZ$U_eVB9+5b90%^pT;RG0dR@s)uch7%O@)t@#zBR+AmAPmE)g1h<1l$r{+ zQflB)lk^MN?fCo2=VuuOc0HQ+_))53@_7S=YuKXRpNK8Rth_5v?F+Oj4L0pb8OpDH zJLvg<-!jlaT;~&gA8%k#%4_at1>edm#TzOO8_xU^ZBL(RCNmv&X?agM_^WYkb%${} zDcdD4+QJ`7YkX1L@ZAiayp52BT7*JlFT*P9jxrm+H6?%1N`3!0C;<>q@7wClK4+ZvlbNq diff --git a/res/drawable-xhdpi/resizable_chat_bubble_incoming.9.png b/res/drawable-xhdpi/resizable_chat_bubble_incoming.9.png index bea2e407de6200a89d6a25194f4d3480b8e034b9..cca504a1d80fc5dbd749e599d392648b77384e76 100644 GIT binary patch delta 70 zcmYdEouJ~Vzmvv4FO#tAN8SMZ7 delta 69 zcmYdInV{mJ?djqeQgJIep`qcwOH#+9|L^AswI}%WQgJIep`qcwOH#+9etCPL*2GzEraXMSJbHS1|2q$En4uQStjWNz X*K+z2|1}Oj8Gyjk)z4*}Q$iB}Y#kVS diff --git a/res/drawable-xhdpi/resizable_confirm_delete_button.9.png b/res/drawable-xhdpi/resizable_confirm_delete_button.9.png index 2d9ff5dc9f9208bbd7aa141b10bf49870e15e566..509a20e498eeb1147b554fef654ef3e2ba7ec1ae 100644 GIT binary patch delta 271 zcmV+q0r38c1F8a$B!BTqL_t(|+U?m*3c@fDhT(!py__JZDClv-trR?fE(8~P8%0Ib z8+4&Ucg8Q!NT`1)8apEsc(>^TErm>iz3{OghBmZK5NT@K&?#Z) z#D;DOL)SL+L>PLsp^9=hCj+Pws6YiOP=N|mpaK=BKn41b&@=JFoic~J4Poet-Ft*uxvy`2cq!(*u7}Sy V0E?5f)&Kwi00>D%PDHLkV1kIFek%X~ delta 367 zcmZ3*)WtkOrJgOx+ueoXKL{?^yL>VO0|RG)M`SSr1MhVZW^~e+UBSS>sO9P67!q;# z?M*{3W=9dW2l>LPnQxDH*)|I3CoXikBHg)`#ilL6ieE7!Iazr1mZ**ey~z_@rh7Pv ziG61Je7NNFr;XN|`)k(+=z8we6x&;n+qa_CSSFdjUi#H}?zoQ)(lO#SVU;<{JDe@|%zT^Gj53^{KvbRe169P1%uETaI}@ zC^+1f#J4TgWS8XuyRwVxe!A2rG+5tRWS?CV9J1%*CAOsd(K{c6)-AmL0~nYLp00i_ I>zopr0Mf3dT>t<8 diff --git a/res/drawable/call.xml b/res/drawable/call.xml index 8fbd38b52..7564861e6 100644 --- a/res/drawable/call.xml +++ b/res/drawable/call.xml @@ -1,10 +1,10 @@ + android:drawable="@color/colorL" /> + android:drawable="@color/colorL" /> + android:drawable="@color/colorA" /> diff --git a/res/drawable/camera.xml b/res/drawable/camera.xml deleted file mode 100644 index ded805ba2..000000000 --- a/res/drawable/camera.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/res/drawable/chat.xml b/res/drawable/chat.xml index f71f1c595..5bdf45573 100644 --- a/res/drawable/chat.xml +++ b/res/drawable/chat.xml @@ -1,9 +1,9 @@ + android:drawable="@color/colorA" /> + android:drawable="@color/colorD" /> + android:drawable="@color/colorD" /> diff --git a/res/drawable/dialer.xml b/res/drawable/dialer.xml index 6eb3fdfd3..cae05314b 100644 --- a/res/drawable/dialer.xml +++ b/res/drawable/dialer.xml @@ -1,9 +1,9 @@ + android:drawable="@color/colorA" /> + android:drawable="@color/colorD" /> + android:drawable="@color/colorD" /> diff --git a/res/drawable/footer_button.xml b/res/drawable/footer_button.xml index 5c70ab6a6..a621e8f73 100644 --- a/res/drawable/footer_button.xml +++ b/res/drawable/footer_button.xml @@ -1,10 +1,10 @@ + android:drawable="@color/colorA" /> + android:drawable="@color/colorC" /> + android:drawable="@color/colorC" /> diff --git a/res/drawable/hangup.xml b/res/drawable/hangup.xml index 7faa23180..3a15ca838 100644 --- a/res/drawable/hangup.xml +++ b/res/drawable/hangup.xml @@ -1,8 +1,10 @@ - - + + + diff --git a/res/drawable/micro.xml b/res/drawable/micro.xml index 8a260ceaf..1780f755d 100644 --- a/res/drawable/micro.xml +++ b/res/drawable/micro.xml @@ -1,9 +1,7 @@ - - + + android:drawable="@drawable/micro_default" /> diff --git a/res/drawable/speaker.xml b/res/drawable/speaker.xml index b1e7ce119..ac67e2924 100644 --- a/res/drawable/speaker.xml +++ b/res/drawable/speaker.xml @@ -1,9 +1,7 @@ - - + + android:drawable="@drawable/speaker_default" /> diff --git a/res/layout-small/dialer.xml b/res/layout-small/dialer.xml index c863dc6c1..996ac8121 100644 --- a/res/layout-small/dialer.xml +++ b/res/layout-small/dialer.xml @@ -2,7 +2,7 @@ + android:background="@color/colorH"> \ No newline at end of file diff --git a/res/layout-sw533dp-land/chat.xml b/res/layout-sw533dp-land/chat.xml index 00c8d48f3..65b4305d3 100644 --- a/res/layout-sw533dp-land/chat.xml +++ b/res/layout-sw533dp-land/chat.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/top_layout" - android:background="@drawable/background" > + android:background="@color/colorH" > diff --git a/res/layout/active_call_control_row.xml b/res/layout/active_call_control_row.xml index 8404b01d1..df632dca2 100644 --- a/res/layout/active_call_control_row.xml +++ b/res/layout/active_call_control_row.xml @@ -2,41 +2,47 @@ - + android:background="@color/colorA" + android:padding="2dp"> + + + + android:paddingRight="10dp"/> + + - - - + /> + \ No newline at end of file diff --git a/res/layout/assistant_remote_provisioning_login.xml b/res/layout/assistant_remote_provisioning_login.xml index 6ee11bfbe..eb2384d1a 100644 --- a/res/layout/assistant_remote_provisioning_login.xml +++ b/res/layout/assistant_remote_provisioning_login.xml @@ -8,7 +8,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:padding="20dp" - android:layout_above="@id/mark" android:orientation="vertical"> + android:background="@color/colorH"> \ No newline at end of file diff --git a/res/layout/chat.xml b/res/layout/chat.xml index 3ae7ef855..079b67d58 100644 --- a/res/layout/chat.xml +++ b/res/layout/chat.xml @@ -3,14 +3,14 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/top_layout" - android:background="@color/background" > + android:background="@color/colorH" > + android:background="@color/colorF"> + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:layout_marginBottom="10dp" + android:layout_below="@+id/topBar"/> \ No newline at end of file diff --git a/res/layout/chat_bubble_incoming.xml b/res/layout/chat_bubble_incoming.xml index bdc697330..93ca9a220 100644 --- a/res/layout/chat_bubble_incoming.xml +++ b/res/layout/chat_bubble_incoming.xml @@ -1,16 +1,18 @@ diff --git a/res/layout/chat_bubble_outgoing.xml b/res/layout/chat_bubble_outgoing.xml index 460786fd5..b72690e55 100644 --- a/res/layout/chat_bubble_outgoing.xml +++ b/res/layout/chat_bubble_outgoing.xml @@ -1,15 +1,17 @@ diff --git a/res/layout/chatlist.xml b/res/layout/chatlist.xml index b5da7166e..c0d499466 100644 --- a/res/layout/chatlist.xml +++ b/res/layout/chatlist.xml @@ -2,14 +2,13 @@ + android:background="@color/colorF"> + android:layout_height="wrap_content"> - - - + android:orientation="horizontal"> + + + + + + + \ No newline at end of file diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml index 20656388a..754f19630 100644 --- a/res/layout/dialer.xml +++ b/res/layout/dialer.xml @@ -42,7 +42,7 @@ android:id="@+id/controls" android:layout_alignParentBottom="true" android:layout_width="match_parent" - android:layout_height="60dp"> + android:layout_height="70dp"> - - - - - - - \ No newline at end of file + android:textAppearance="?android:attr/textAppearanceListItemSmall" + android:gravity="center_vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textColor="@color/text_contrast" + android:background="?android:attr/activatedBackgroundIndicator" + android:minHeight="?android:attr/listPreferredItemHeightSmall"/> \ No newline at end of file diff --git a/res/layout/edit_contact.xml b/res/layout/edit_contact.xml index 70158f611..b41cfe0a4 100644 --- a/res/layout/edit_contact.xml +++ b/res/layout/edit_contact.xml @@ -69,6 +69,7 @@ + + + + + - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/history.xml b/res/layout/history.xml index 87ecef9d9..4729fcc8a 100644 --- a/res/layout/history.xml +++ b/res/layout/history.xml @@ -8,7 +8,7 @@ + android:layout_toLeftOf="@id/delete" + android:padding="10dp" + android:adjustViewBounds="true" + android:visibility="gone"/> + + + diff --git a/res/layout/history_cell.xml b/res/layout/history_cell.xml index da963104b..f7d5d0899 100644 --- a/res/layout/history_cell.xml +++ b/res/layout/history_cell.xml @@ -12,7 +12,7 @@ android:layout_width="match_parent" android:layout_height="30dp" android:textSize="20sp" - android:background="@color/background" + android:background="@color/colorH" android:textColor="@color/colorA" android:textStyle="bold" android:textAllCaps="true" @@ -72,16 +72,15 @@ android:paddingLeft="5dp" android:paddingRight="5dp"/> - + android:paddingRight="5dp" /> diff --git a/res/layout/incall.xml b/res/layout/incall.xml index 5d96f1e80..af616ad32 100644 --- a/res/layout/incall.xml +++ b/res/layout/incall.xml @@ -4,33 +4,87 @@ android:id="@+id/topLayout" android:layout_width="match_parent" android:layout_height="match_parent"> + + + android:layout_below="@id/status"> - - - - - + + + + + + + + + + + + + + + + + + + - + @@ -57,13 +111,12 @@ android:id="@+id/menu" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:gravity="right" + android:layout_alignParentBottom="true" android:orientation="vertical" > - + - - + + - - - - - - - - + + + + + + + android:visibility="invisible" + android:gravity="center" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0.5" /> - - - + - + + + + - - - - + + - + android:src="@drawable/options_add_call" + android:background="@drawable/button_background" + android:adjustViewBounds="true" + android:scaleType="center" + android:visibility="invisible" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0.5" /> + + android:layout_height="match_parent" + android:layout_weight="1"> + android:layout_height="match_parent"/> - @@ -258,6 +323,7 @@ + android:background="@color/colorH"> @@ -15,12 +15,10 @@ android:background="@color/colorF"> @@ -31,26 +29,24 @@ android:layout_height="match_parent" android:layout_below="@id/toolbar" android:orientation="vertical" + android:gravity="center" android:layout_above="@id/menu"> - + android:paddingTop="10dp"> + android:layout_marginTop="10dp"/> + style="@style/font5"/> + android:layout_height="wrap_content" + style="@style/font2" + android:layout_gravity="center"/> @@ -85,33 +78,35 @@ - - + + + + diff --git a/res/layout/main.xml b/res/layout/main.xml index 9adf6d249..378fe2dc6 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -1,23 +1,27 @@ - - - - + + + + + + android:visibility="gone" /> @@ -88,22 +92,21 @@ android:adjustViewBounds="true"> + android:scaleType="center" /> + android:visibility="gone" /> @@ -116,59 +119,57 @@ android:adjustViewBounds="true"> + android:scaleType="center"/> + android:layout_alignParentBottom="true"/> + + android:scaleType="center" /> + android:visibility="gone"/> @@ -203,7 +204,6 @@ android:id="@+id/icon" android:layout_width="30dp" android:layout_height="30dp" - android:layout_alignParentTop="true" android:layout_marginLeft="12dp" android:layout_marginRight="12dp" android:src="@drawable/avatar" @@ -217,38 +217,34 @@ android:layout_toRightOf="@+id/icon"> + android:gravity="bottom" + android:editable="false"/> + android:editable="false"/> + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_below="@id/headerLayout" + android:choiceMode="singleChoice" + android:divider="@android:color/transparent" + android:dividerHeight="0dp" + android:background="@color/colorH"/> @@ -285,5 +281,6 @@ + - \ No newline at end of file + \ No newline at end of file diff --git a/res/layout/menu_chat_button.xml b/res/layout/menu_chat_button.xml index af0ea7c28..a2254c5ed 100644 --- a/res/layout/menu_chat_button.xml +++ b/res/layout/menu_chat_button.xml @@ -2,7 +2,7 @@ diff --git a/res/layout/menu_contact_button.xml b/res/layout/menu_contact_button.xml index 7afd2c6b9..1df5ddb39 100644 --- a/res/layout/menu_contact_button.xml +++ b/res/layout/menu_contact_button.xml @@ -1,7 +1,7 @@ + android:background="@color/colorD" /> \ No newline at end of file diff --git a/res/layout/menu_history_button.xml b/res/layout/menu_history_button.xml index b2bfbf4a9..b9338fff6 100644 --- a/res/layout/menu_history_button.xml +++ b/res/layout/menu_history_button.xml @@ -2,7 +2,7 @@ + android:background="@color/colorD" /> \ No newline at end of file diff --git a/res/layout/outgoing_call.xml b/res/layout/outgoing_call.xml index 226d0eeea..52f75916b 100644 --- a/res/layout/outgoing_call.xml +++ b/res/layout/outgoing_call.xml @@ -1,9 +1,9 @@ + android:id="@+id/topLayout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/colorH"> @@ -29,6 +29,7 @@ android:layout_height="match_parent" android:layout_below="@id/toolbar" android:orientation="vertical" + android:gravity="center" android:layout_above="@id/menu"> @@ -84,38 +85,36 @@ + android:scaleType="center"/> + android:scaleType="center"/> - - + android:scaleType="center"/> diff --git a/res/layout/remote_provisioning.xml b/res/layout/remote_provisioning.xml index 86bfaff87..e073c7085 100644 --- a/res/layout/remote_provisioning.xml +++ b/res/layout/remote_provisioning.xml @@ -2,7 +2,7 @@ + + Username + Display name + Password + Domain + Provisioning url + Email + Are you sure you want to delete all your selection ? + Delete + Cancel + free SIP VOIP client @@ -39,16 +50,6 @@ outgoing call - - - - Username - Display name - Password - Domain - Provisioning url - Email - Edit button Valid button @@ -316,7 +317,7 @@ Example: john if your account is john@sip.example.org sip.example.org if your account is john@sip.example.org You have to re-enter your password if you edit your username and/or the domain - Delete + Chat Call Add to contacts diff --git a/res/values/styles.xml b/res/values/styles.xml index e73f8e121..617c5c187 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -48,7 +48,7 @@ + \ No newline at end of file diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 6516c0cbc..75548f3ef 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -98,10 +98,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private String pictureUri; private EditText message; private ImageView cancelUpload, edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage; - private LinearLayout topBar; private TextView contactName, remoteComposing; private ImageView back; - private RelativeLayout uploadLayout, textLayout; + private RelativeLayout uploadLayout, textLayout, topBar; private ListView messagesList; private ProgressBar progressBar; @@ -139,7 +138,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC messagesList = (ListView) view.findViewById(R.id.chatMessageList); textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout); progressBar = (ProgressBar) view.findViewById(R.id.progressbar); - topBar = (LinearLayout) view.findViewById(R.id.topbar); + topBar = (RelativeLayout) view.findViewById(R.id.topBar); sendMessage = (ImageView) view.findViewById(R.id.sendMessage); sendMessage.setOnClickListener(this); @@ -572,6 +571,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC else if (id == R.id.new_discussion) { //TODO call sipUri } + else if(id == R.id.start_call){ + LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, LinphoneUtils.getUsernameFromAddress(sipUri), null); + } } private void sendTextMessage() { diff --git a/src/org/linphone/ChatListFragment.java b/src/org/linphone/ChatListFragment.java index f3773577c..9e28c60d4 100644 --- a/src/org/linphone/ChatListFragment.java +++ b/src/org/linphone/ChatListFragment.java @@ -52,10 +52,8 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; -import android.widget.EditText; import android.widget.ImageView; import android.widget.ListView; -import android.widget.RelativeLayout; import android.widget.TextView; /** diff --git a/src/org/linphone/ContactsFragment.java b/src/org/linphone/ContactsFragment.java index c0f6cbedc..d940f5c69 100644 --- a/src/org/linphone/ContactsFragment.java +++ b/src/org/linphone/ContactsFragment.java @@ -362,7 +362,7 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte } else if (contact.getPhotoUri() != null) { icon.setImageURI(contact.getPhotoUri()); } else { - icon.setImageBitmap(bitmapUnknown); + icon.setImageResource(R.drawable.avatar); } ImageView friendStatus = (ImageView) view.findViewById(R.id.friendStatus); diff --git a/src/org/linphone/ContactsManager.java b/src/org/linphone/ContactsManager.java index 18bb50e09..ad2d3cb67 100644 --- a/src/org/linphone/ContactsManager.java +++ b/src/org/linphone/ContactsManager.java @@ -89,14 +89,23 @@ public class ContactsManager { } public void initializeSyncAccount(Context context, ContentResolver contentResolver) { - initializeContactManager(context,contentResolver); - Account newAccount = new Account(context.getString(R.string.sync_account_name), context.getString(R.string.sync_account_type)); AccountManager accountManager = (AccountManager) context.getSystemService(context.ACCOUNT_SERVICE); - if(accountManager.addAccountExplicitly(newAccount, null, null)){ - mAccount = newAccount; + Account[] accounts = accountManager.getAccountsByType(context.getPackageName()); + + if(accounts != null && accounts.length == 0) { + Account newAccount = new Account(context.getString(R.string.sync_account_name), context.getString(R.string.sync_account_type)); + try { + accountManager.addAccountExplicitly(newAccount, null, null); + mAccount = newAccount; + } catch (Exception e) { + Log.w("Catch " + e); + mAccount = null; + } } else { - mAccount = null; + Log.w("Get Account"); + mAccount = accounts[0]; } + initializeContactManager(context,contentResolver); } public String getDisplayName(String firstName, String lastName) { @@ -524,6 +533,8 @@ public class ContactsManager { sipContactCursor.close(); } + if(mAccount == null) return; + contactCursor = Compatibility.getContactsCursor(contentResolver, getContactsId()); sipContactCursor = Compatibility.getSIPContactsCursor(contentResolver, getContactsId()); diff --git a/src/org/linphone/EditContactFragment.java b/src/org/linphone/EditContactFragment.java index f6ecf07e7..ea036faad 100644 --- a/src/org/linphone/EditContactFragment.java +++ b/src/org/linphone/EditContactFragment.java @@ -6,6 +6,7 @@ import java.util.List; import org.linphone.compatibility.Compatibility; import org.linphone.core.LinphoneProxyConfig; import org.linphone.mediastream.Version; +import org.linphone.mediastream.Log; import android.annotation.SuppressLint; import android.content.ContentProviderOperation; import android.content.Context; @@ -25,11 +26,11 @@ import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.TableLayout; -import android.widget.TextView; public class EditContactFragment extends Fragment { private View view; private ImageView back, edit, ok; + private ImageView addNumber, addSipAddress; private EditText firstName, lastName; private LayoutInflater inflater; @@ -39,6 +40,7 @@ public class EditContactFragment extends Fragment { private List numbersAndAddresses; private ArrayList ops; private int firstSipAddressIndex = -1; + private TableLayout sipAddresses, numbers; private String newSipOrNumberToAdd; private ContactsManager contactsManager; @@ -181,14 +183,30 @@ public class EditContactFragment extends Fragment { ImageView contactPicture = (ImageView) view.findViewById(R.id.contactPicture); if (contact != null && contact.getPhotoUri() != null) { - //InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID()); - //contactPicture.setImageBitmap(BitmapFactory.decodeStream(input)); + InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID()); + contactPicture.setImageBitmap(BitmapFactory.decodeStream(input)); } else { //contactPicture.setImageResource(R.drawable.unknown_small); } - - initNumbersFields((TableLayout) view.findViewById(R.id.controls), contact); - + + numbers = initNumbersFields(contact); + sipAddresses = initSipAddressFields(contact); + + addNumber = (ImageView) view.findViewById(R.id.add_number_field); + addNumber.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + addEmptyRowToAllowNewNumberOrAddress(numbers,false); + } + }); + addSipAddress = (ImageView) view.findViewById(R.id.add_address_field); + addSipAddress.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + addEmptyRowToAllowNewNumberOrAddress(sipAddresses,true); + } + }); + ops = new ArrayList(); lastName.requestFocus(); @@ -206,32 +224,68 @@ public class EditContactFragment extends Fragment { } } - private void initNumbersFields(final TableLayout controls, final Contact contact) { + private TableLayout initNumbersFields(final Contact contact) { + TableLayout controls = (TableLayout) view.findViewById(R.id.controls_numbers); controls.removeAllViews(); numbersAndAddresses = new ArrayList(); if (contact != null) { for (String numberOrAddress : contact.getNumbersOrAddresses()) { - View view = displayNumberOrAddress(controls, numberOrAddress); + boolean isSip = LinphoneUtils.isStrictSipAddress(numberOrAddress) || !LinphoneUtils.isNumberAddress(numberOrAddress); + if(!isSip) { + View view = displayNumberOrAddress(controls, numberOrAddress); + if (view != null) + controls.addView(view); + } + } + } + + if (newSipOrNumberToAdd != null) { + boolean isSip = LinphoneUtils.isStrictSipAddress(newSipOrNumberToAdd) || !LinphoneUtils.isNumberAddress(newSipOrNumberToAdd); + if(!isSip) { + View view = displayNumberOrAddress(controls, newSipOrNumberToAdd); if (view != null) controls.addView(view); } } - if (newSipOrNumberToAdd != null) { - View view = displayNumberOrAddress(controls, newSipOrNumberToAdd); - if (view != null) - controls.addView(view); + + if (controls.getChildCount() == 0) { + addEmptyRowToAllowNewNumberOrAddress(controls,false); } - // Add one for phone numbers, one for SIP address - if (!getResources().getBoolean(R.bool.hide_phone_numbers_in_editor)) { - addEmptyRowToAllowNewNumberOrAddress(controls, false); + return controls; + } + + private TableLayout initSipAddressFields(final Contact contact) { + TableLayout controls = (TableLayout) view.findViewById(R.id.controls_sip_address); + controls.removeAllViews(); + numbersAndAddresses = new ArrayList(); + + if (contact != null) { + for (String numberOrAddress : contact.getNumbersOrAddresses()) { + boolean isSip = LinphoneUtils.isStrictSipAddress(numberOrAddress) || !LinphoneUtils.isNumberAddress(numberOrAddress); + if(isSip) { + View view = displayNumberOrAddress(controls, numberOrAddress); + if (view != null) + controls.addView(view); + } + } } - - if (!getResources().getBoolean(R.bool.hide_sip_addresses_in_editor)) { - firstSipAddressIndex = controls.getChildCount() - 2; // Update the value to always display phone numbers before SIP accounts - addEmptyRowToAllowNewNumberOrAddress(controls, true); + + if (newSipOrNumberToAdd != null) { + boolean isSip = LinphoneUtils.isStrictSipAddress(newSipOrNumberToAdd) || !LinphoneUtils.isNumberAddress(newSipOrNumberToAdd); + if(isSip) { + View view = displayNumberOrAddress(controls, newSipOrNumberToAdd); + if (view != null) + controls.addView(view); + } } + + if (controls.getChildCount() == 0) { + addEmptyRowToAllowNewNumberOrAddress(controls,true); + } + + return controls; } private View displayNumberOrAddress(final TableLayout controls, String numberOrAddress) { @@ -306,7 +360,7 @@ public class EditContactFragment extends Fragment { @SuppressLint("InflateParams") private void addEmptyRowToAllowNewNumberOrAddress(final TableLayout controls, final boolean isSip) { - final View view = inflater.inflate(R.layout.contact_add_row, null); + final View view = inflater.inflate(R.layout.contact_edit_row, null); final NewOrUpdatedNumberOrAddress nounoa = new NewOrUpdatedNumberOrAddress(isSip); @@ -330,39 +384,32 @@ public class EditContactFragment extends Fragment { } }); - final ImageView add = (ImageView) view.findViewById(R.id.add); - add.setOnClickListener(new OnClickListener() { + final ImageView delete = (ImageView) view.findViewById(R.id.delete); + delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - // Add a line, and change add button for a delete button - add.setImageResource(R.drawable.list_delete); - ImageView delete = add; - delete.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - nounoa.delete(); - numbersAndAddresses.remove(nounoa); - view.setVisibility(View.GONE); - } - }); - if (!isSip) { + nounoa.delete(); + numbersAndAddresses.remove(nounoa); + view.setVisibility(View.GONE); + } + + }); + /*if (!isSip) { firstSipAddressIndex++; addEmptyRowToAllowNewNumberOrAddress(controls, false); } else { addEmptyRowToAllowNewNumberOrAddress(controls, true); } - } - }); - - if (isSip) { - controls.addView(view, controls.getChildCount()); - } else { - if (firstSipAddressIndex != -1) { - controls.addView(view, firstSipAddressIndex); - } else { - controls.addView(view); - } - } + }*/ + + controls.addView(view, controls.getChildCount()); + + //if (firstSipAddressIndex != -1) { + // controls.addView(view, firstSipAddressIndex); + //} else { + // controls.addView(view); + //} + //} } private String findContactFirstName(String contactID) { diff --git a/src/org/linphone/HistoryFragment.java b/src/org/linphone/HistoryFragment.java index 7b6aad0fc..c09f0e6f4 100644 --- a/src/org/linphone/HistoryFragment.java +++ b/src/org/linphone/HistoryFragment.java @@ -27,15 +27,19 @@ import org.linphone.core.CallDirection; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCallLog; import org.linphone.core.LinphoneCallLog.CallStatus; +import org.linphone.mediastream.Log; import android.annotation.SuppressLint; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.app.Fragment; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -44,10 +48,14 @@ import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; +import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; @@ -60,9 +68,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem private ListView historyList; private LayoutInflater mInflater; private TextView noCallHistory, noMissedCallHistory; - private ImageView missedCalls, allCalls, edit, ok, deleteAll; + private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, deleteAll; private RelativeLayout allCallsSelected, missedCallsSelected; - private boolean onlyDisplayMissedCalls, isEditMode; + private boolean onlyDisplayMissedCalls, isEditMode, isSelectAll, isDeselectAll; private List mLogs; @Override @@ -78,7 +86,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem historyList.setOnItemClickListener(this); registerForContextMenu(historyList); - deleteAll = (ImageView) view.findViewById(R.id.deleteAll); + deleteAll = (ImageView) view.findViewById(R.id.delete); deleteAll.setOnClickListener(this); deleteAll.setVisibility(View.INVISIBLE); @@ -94,18 +102,29 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem missedCallsSelected = (RelativeLayout) view.findViewById(R.id.missed_calls_select); missedCallsSelected.setOnClickListener(this); + selectAll = (ImageView) view.findViewById(R.id.select_all); + selectAll.setOnClickListener(this); + + deselectAll = (ImageView) view.findViewById(R.id.deselect_all); + deselectAll.setOnClickListener(this); + allCalls.setEnabled(false); onlyDisplayMissedCalls = false; edit = (ImageView) view.findViewById(R.id.edit); edit.setOnClickListener(this); - ok = (ImageView) view.findViewById(R.id.ok); - ok.setOnClickListener(this); + isSelectAll = false; + isDeselectAll = false; + return view; } + public void refresh() { + mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); + } + private void removeNotMissedCallsFromLogs() { if (onlyDisplayMissedCalls) { List missedCalls = new ArrayList(); @@ -125,12 +144,14 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem noMissedCallHistory.setVisibility(View.VISIBLE); } else { noCallHistory.setVisibility(View.VISIBLE); + edit.setEnabled(false); } historyList.setVisibility(View.GONE); return true; } else { noCallHistory.setVisibility(View.GONE); noMissedCallHistory.setVisibility(View.GONE); + edit.setEnabled(true); historyList.setVisibility(View.VISIBLE); return false; } @@ -150,6 +171,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); if (!hideHistoryListAndDisplayMessageIfEmpty()) { + historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); historyList.setAdapter(new CallHistoryAdapter(getActivity())); } } @@ -166,9 +188,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem LinphoneCallLog log = mLogs.get(info.position); LinphoneManager.getLc().removeCallLog(log); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); - if (!hideHistoryListAndDisplayMessageIfEmpty()) { - historyList.setAdapter(new CallHistoryAdapter(getActivity())); - } return true; } @@ -176,6 +195,51 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem public void onClick(View v) { int id = v.getId(); + if (id == R.id.delete) { + final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text)); + Button delete = (Button) dialog.findViewById(R.id.delete); + Button cancel = (Button) dialog.findViewById(R.id.cancel); + + delete.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + int size = historyList.getAdapter().getCount(); + for(int i=0; i(); - } + }else if (id == R.id.select_all) { + deselectAll.setVisibility(View.VISIBLE); + selectAll.setVisibility(View.GONE); + int size = historyList.getAdapter().getCount(); + for(int i=0; i 0) { LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; if (LinphoneUtils.isCallEstablished(call)) { - //enableAndRefreshInCallActions(); + enableAndRefreshInCallActions(); } } @@ -298,45 +290,63 @@ public class InCallActivity extends Activity implements OnClickListener { inflater = LayoutInflater.from(this); container = (ViewGroup) findViewById(R.id.topLayout); callsList = (TableLayout) findViewById(R.id.calls); - if (!showCallListInVideo) { - callsList.setVisibility(View.GONE); - - } - + + //TopBar video = (ImageView) findViewById(R.id.video); video.setOnClickListener(this); - video.setEnabled(false); + enabledVideoButton(false); + + videoProgress = (ProgressBar) findViewById(R.id.videoInProgress); + videoProgress.setVisibility(View.GONE); + micro = (ImageView) findViewById(R.id.micro); micro.setOnClickListener(this); -// micro.setEnabled(false); + speaker = (ImageView) findViewById(R.id.speaker); speaker.setOnClickListener(this); - if(isTablet()){ - speaker.setEnabled(false); - } -// speaker.setEnabled(false); - addCall = (ImageView) findViewById(R.id.addCall); - addCall.setOnClickListener(this); - addCall.setEnabled(false); - transfer = (ImageView) findViewById(R.id.transfer); - transfer.setOnClickListener(this); - transfer.setEnabled(false); + options = (ImageView) findViewById(R.id.options); options.setOnClickListener(this); options.setEnabled(false); - //pause = (ImageView) findViewById(R.id.pause); - //pause.setOnClickListener(this); - //pause.setEnabled(false); + + //BottonBar hangUp = (ImageView) findViewById(R.id.hangUp); hangUp.setOnClickListener(this); - //conference = (ImageView) findViewById(R.id.conference); - //conference.setOnClickListener(this); + dialer = (ImageView) findViewById(R.id.dialer); dialer.setOnClickListener(this); - dialer.setEnabled(false); + numpad = (Numpad) findViewById(R.id.numpad); - videoProgress = (ProgressBar) findViewById(R.id.videoInProgress); - videoProgress.setVisibility(View.GONE); + + //Others + + //Active Call + pause = (ImageView) findViewById(R.id.pause); + pause.setOnClickListener(this); + pause.setEnabled(false); + + mActiveCallHeader = (RelativeLayout) findViewById(R.id.activeCallHeader); + + /*if(isTablet()){ + speaker.setEnabled(false); + }*/ + +// speaker.setEnabled(false); + + + //Options + addCall = (ImageView) findViewById(R.id.addCall); + addCall.setOnClickListener(this); + addCall.setEnabled(false); + + transfer = (ImageView) findViewById(R.id.transfer); + transfer.setOnClickListener(this); + transfer.setEnabled(false); + + conference = (ImageView) findViewById(R.id.conference); + conference.setOnClickListener(this); + + /*try { @@ -356,7 +366,7 @@ public class InCallActivity extends Activity implements OnClickListener { switchCamera = (ImageView) findViewById(R.id.switchCamera); switchCamera.setOnClickListener(this); - mControlsLayout = (ViewGroup) findViewById(R.id.menu); + mControlsLayout = (LinearLayout) findViewById(R.id.menu); if (!isTransferAllowed) { addCall.setBackgroundResource(R.drawable.options_add_call); @@ -392,23 +402,40 @@ public class InCallActivity extends Activity implements OnClickListener { private void refreshInCallActions() { if (!LinphonePreferences.instance().isVideoEnabled()) { - video.setEnabled(false); + enabledVideoButton(false); } else { - if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { - video.setBackgroundResource(R.drawable.video_on); - } else { - video.setBackgroundResource(R.drawable.video_off); + if(video.isEnabled()) { + if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { + video.setImageResource(R.drawable.camera_selected); + videoProgress.setVisibility(View.INVISIBLE); + } else { + video.setImageResource(R.drawable.camera_default); + } } } + + if (isSpeakerEnabled) { + speaker.setImageResource(R.drawable.speaker_selected); + } else { + speaker.setImageResource(R.drawable.speaker_default); + } + + if (isMicMuted) { + micro.setImageResource(R.drawable.micro_selected); + } else { + micro.setImageResource(R.drawable.micro_default); + } + + + + try { - if (isSpeakerEnabled) { - speaker.setBackgroundResource(R.drawable.speaker_on); + /*routeSpeaker.setBackgroundResource(R.drawable.route_speaker_on); routeReceiver.setBackgroundResource(R.drawable.route_receiver_off); routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);*/ - } else { - speaker.setBackgroundResource(R.drawable.speaker_off); + /*routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off); if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) { routeReceiver.setBackgroundResource(R.drawable.route_receiver_off); @@ -417,30 +444,23 @@ public class InCallActivity extends Activity implements OnClickListener { routeReceiver.setBackgroundResource(R.drawable.route_receiver_on); routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off); }*/ - } } catch (NullPointerException npe) { Log.e("Bluetooth: Audio routes menu disabled on tablets for now (4)"); } - if (isMicMuted) { - micro.setBackgroundResource(R.drawable.micro_off); - } else { - micro.setBackgroundResource(R.drawable.micro_on); - } + if (LinphoneManager.getLc().getCallsNb() > 1) { - conference.setVisibility(View.VISIBLE); - pause.setVisibility(View.GONE); + //pause.setVisibility(View.GONE); } else { - conference.setVisibility(View.GONE); - pause.setVisibility(View.VISIBLE); + /*pause.setVisibility(View.VISIBLE); List pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.Paused)); if (pausedCalls.size() == 1) { pause.setBackgroundResource(R.drawable.pause_on); } else { pause.setBackgroundResource(R.drawable.pause_off); - } + }*/ } } @@ -450,17 +470,16 @@ public class InCallActivity extends Activity implements OnClickListener { options.setEnabled(!getResources().getBoolean(R.bool.disable_options_in_call) && (addCall.isEnabled() || transfer.isEnabled())); if(LinphoneManager.getLc().getCurrentCall() != null && LinphonePreferences.instance().isVideoEnabled() && !LinphoneManager.getLc().getCurrentCall().mediaInProgress()) { - video.setEnabled(true); + enabledVideoButton(true); } micro.setEnabled(true); if(!isTablet()){ speaker.setEnabled(true); } transfer.setEnabled(true); - //pause.setEnabled(true); + pause.setEnabled(true); dialer.setEnabled(true); conference.setEnabled(true); - refreshInCallActions(); } @@ -476,8 +495,8 @@ public class InCallActivity extends Activity implements OnClickListener { displayVideoCallControlsIfHidden(); } - if (id == R.id.video) { - enabledOrDisabledVideo(isVideoEnabled(LinphoneManager.getLc().getCurrentCall())); + if (id == R.id.video) { + enabledOrDisabledVideo(isVideoEnabled(LinphoneManager.getLc().getCurrentCall())); } else if (id == R.id.micro) { toggleMicro(); @@ -490,7 +509,7 @@ public class InCallActivity extends Activity implements OnClickListener { } else if (id == R.id.pause) { pauseOrResumeCall(); - } + } else if (id == R.id.hangUp) { hangUp(); } @@ -549,6 +568,16 @@ public class InCallActivity extends Activity implements OnClickListener { } } + private void enabledVideoButton(boolean enabled){ + if(enabled) { + video.setEnabled(true); + video.setImageResource(R.drawable.camera_default); + } else { + video.setEnabled(false); + video.setImageResource(R.drawable.camera_disabled); + } + } + private void enabledOrDisabledVideo(final boolean isVideoEnabled) { final LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); if (call == null) { @@ -556,12 +585,10 @@ public class InCallActivity extends Activity implements OnClickListener { } if (isVideoEnabled) { - video.setEnabled(true); LinphoneCallParams params = call.getCurrentParamsCopy(); params.setVideoEnabled(false); LinphoneManager.getLc().updateCall(call, params); } else { - video.setEnabled(false); videoProgress.setVisibility(View.VISIBLE); if (!call.getRemoteParams().isLowBandwidthEnabled()) { LinphoneManager.getInstance().addVideo(); @@ -608,7 +635,6 @@ public class InCallActivity extends Activity implements OnClickListener { } private void showAudioView() { - video.setBackgroundResource(R.drawable.video_on); LinphoneManager.startProximitySensorForActivity(InCallActivity.this); replaceFragmentVideoByAudio(); setCallControlsVisibleAndRemoveCallbacks(); @@ -619,11 +645,8 @@ public class InCallActivity extends Activity implements OnClickListener { Log.w("Bluetooth not available, using speaker"); LinphoneManager.getInstance().routeAudioToSpeaker(); isSpeakerEnabled = true; - speaker.setBackgroundResource(R.drawable.speaker_on); } - video.setBackgroundResource(R.drawable.video_off); - video.setEnabled(true); - videoProgress.setVisibility(View.INVISIBLE); + refreshInCallActions(); LinphoneManager.stopProximitySensorForActivity(InCallActivity.this); replaceFragmentAudioByVideo(); @@ -632,7 +655,6 @@ public class InCallActivity extends Activity implements OnClickListener { private void replaceFragmentVideoByAudio() { audioCallFragment = new AudioCallFragment(); - FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragmentContainer, audioCallFragment); try { @@ -645,7 +667,6 @@ public class InCallActivity extends Activity implements OnClickListener { // Hiding controls to let displayVideoCallControlsIfHidden add them plus the callback mControlsLayout.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); - videoCallFragment = new VideoCallFragment(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); @@ -661,9 +682,9 @@ public class InCallActivity extends Activity implements OnClickListener { isMicMuted = !isMicMuted; lc.muteMic(isMicMuted); if (isMicMuted) { - micro.setBackgroundResource(R.drawable.micro_off); + micro.setImageResource(R.drawable.micro_selected); } else { - micro.setBackgroundResource(R.drawable.micro_on); + micro.setImageResource(R.drawable.micro_default); } } @@ -671,12 +692,12 @@ public class InCallActivity extends Activity implements OnClickListener { isSpeakerEnabled = !isSpeakerEnabled; if (isSpeakerEnabled) { LinphoneManager.getInstance().routeAudioToSpeaker(); - speaker.setBackgroundResource(R.drawable.speaker_on); + speaker.setImageResource(R.drawable.speaker_selected); LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); } else { Log.d("Toggle speaker off, routing back to earpiece"); LinphoneManager.getInstance().routeAudioToReceiver(); - speaker.setBackgroundResource(R.drawable.speaker_off); + speaker.setImageResource(R.drawable.speaker_default); } } @@ -702,7 +723,7 @@ public class InCallActivity extends Activity implements OnClickListener { isVideoCallPaused = true; showAudioView(); } - pause.setBackgroundResource(R.drawable.pause_on); + pause.setImageResource(R.drawable.pause_big_over_selected); } } else if (call != null) { if (call.getState() == State.Paused) { @@ -711,7 +732,7 @@ public class InCallActivity extends Activity implements OnClickListener { isVideoCallPaused = false; showVideoView(); } - pause.setBackgroundResource(R.drawable.pause_off); + pause.setImageResource(R.drawable.pause_big_default); } } } @@ -747,7 +768,8 @@ public class InCallActivity extends Activity implements OnClickListener { if (mControlsLayout.getVisibility() != View.VISIBLE) { if (isAnimationDisabled) { mControlsLayout.setVisibility(View.VISIBLE); - callsList.setVisibility(showCallListInVideo ? View.VISIBLE : View.GONE); + callsList.setVisibility(View.GONE); + mActiveCallHeader.setVisibility(View.GONE); if (cameraNumber > 1) { switchCamera.setVisibility(View.VISIBLE); } @@ -757,7 +779,8 @@ public class InCallActivity extends Activity implements OnClickListener { @Override public void onAnimationStart(Animation animation) { mControlsLayout.setVisibility(View.VISIBLE); - callsList.setVisibility(showCallListInVideo ? View.VISIBLE : View.GONE); + callsList.setVisibility(View.GONE); + mActiveCallHeader.setVisibility(View.GONE); if (cameraNumber > 1) { switchCamera.setVisibility(View.VISIBLE); } @@ -797,10 +820,11 @@ public class InCallActivity extends Activity implements OnClickListener { transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); - callsList.setVisibility(View.GONE); + mActiveCallHeader.setVisibility(View.GONE); + // callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); - options.setBackgroundResource(R.drawable.options); + options.setImageResource(R.drawable.options_default); } else { Animation animation = slideOutTopToBottom; animation.setAnimationListener(new AnimationListener() { @@ -819,10 +843,11 @@ public class InCallActivity extends Activity implements OnClickListener { transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); - callsList.setVisibility(View.GONE); + // callsList.setVisibility(View.GONE); + mActiveCallHeader.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); - options.setBackgroundResource(R.drawable.options); + options.setImageResource(R.drawable.options_default); animation.setAnimationListener(null); } @@ -845,6 +870,7 @@ public class InCallActivity extends Activity implements OnClickListener { mControlsLayout.setVisibility(View.VISIBLE); callsList.setVisibility(View.VISIBLE); + mActiveCallHeader.setVisibility(View.VISIBLE); switchCamera.setVisibility(View.INVISIBLE); } @@ -852,8 +878,8 @@ public class InCallActivity extends Activity implements OnClickListener { if (numpad == null || numpad.getVisibility() != View.VISIBLE) { return; } - - dialer.setBackgroundResource(R.drawable.dialer_alt); + + dialer.setImageResource(R.drawable.footer_dialer); if (isAnimationDisabled) { numpad.setVisibility(View.GONE); } else { @@ -887,7 +913,7 @@ public class InCallActivity extends Activity implements OnClickListener { if (numpad.getVisibility() == View.VISIBLE) { hideNumpad(); } else { - dialer.setBackgroundResource(R.drawable.dialer_alt_back); + dialer.setImageResource(R.drawable.dialer_alt_back); if (isAnimationDisabled) { numpad.setVisibility(View.VISIBLE); } else { @@ -1076,14 +1102,16 @@ public class InCallActivity extends Activity implements OnClickListener { private void hideOrDisplayCallOptions() { boolean isOrientationLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; - + + //Hide options if (addCall.getVisibility() == View.VISIBLE) { - options.setBackgroundResource(R.drawable.options); + options.setImageResource(R.drawable.options_default); if (isAnimationDisabled) { if (isTransferAllowed) { transfer.setVisibility(View.INVISIBLE); } addCall.setVisibility(View.INVISIBLE); + conference.setVisibility(View.INVISIBLE); } else { if (isOrientationLandscape) { hideAnimatedLandscapeCallOptions(); @@ -1091,14 +1119,15 @@ public class InCallActivity extends Activity implements OnClickListener { hideAnimatedPortraitCallOptions(); } } - options.setSelected(false); + //Display options } else { if (isAnimationDisabled) { if (isTransferAllowed) { transfer.setVisibility(View.VISIBLE); } addCall.setVisibility(View.VISIBLE); - options.setBackgroundResource(R.drawable.options_alt); + conference.setVisibility(View.VISIBLE); + options.setImageResource(R.drawable.options_selected); } else { if (isOrientationLandscape) { showAnimatedLandscapeCallOptions(); @@ -1106,7 +1135,6 @@ public class InCallActivity extends Activity implements OnClickListener { showAnimatedPortraitCallOptions(); } } - options.setSelected(true); transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null); } } @@ -1178,8 +1206,10 @@ public class InCallActivity extends Activity implements OnClickListener { lc.addListener(mListener); } - refreshCallList(getResources()); - + displayActiveCall(LinphoneManager.getLc().getCurrentCall()); + if (LinphoneManager.getLc().getCalls().length > 1) { + refreshCallList(getResources()); + } handleViewIntent(); } @@ -1293,8 +1323,47 @@ public class InCallActivity extends Activity implements OnClickListener { callsList.addView(conferenceHeader); } + + private void displayActiveCall(LinphoneCall call){ + if(call == null) return; + String sipUri = call.getRemoteAddress().asStringUriOnly(); + LinphoneAddress lAddress; + try { + lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); + } catch (LinphoneCoreException e) { + Log.e("Incall activity cannot parse remote address",e); + lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("uknown","unknown","unkonown"); + } + + TextView contact = (TextView) findViewById(R.id.contactNameOrNumber); + + Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress); + if (lContact == null) { + if (getResources().getBoolean(R.bool.only_display_username_if_unknown) && LinphoneUtils.isSipAddress(sipUri)) { + contact.setText(lAddress.getUserName()); + } else { + contact.setText(sipUri); + } + } else { + contact.setText(lContact.getName()); + } + + int callDuration = call.getDuration(); + if (callDuration == 0 && call.getState() != State.StreamsRunning) { + return; + } + + Chronometer timer = (Chronometer) findViewById(R.id.callTimer); + if (timer == null) { + throw new IllegalArgumentException("no callee_duration view found"); + } + + timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration); + timer.start(); + + } - private void displayCall(Resources resources, LinphoneCall call, int index) { + private void displayOtherCalls(Resources resources, LinphoneCall call, int index) { String sipUri = call.getRemoteAddress().asStringUriOnly(); LinphoneAddress lAddress; try { @@ -1307,24 +1376,48 @@ public class InCallActivity extends Activity implements OnClickListener { // Control Row LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false); callView.setId(index+1); - setContactName(callView, lAddress, sipUri, resources); - displayCallStatusIconAndReturnCallPaused(callView, call); - setRowBackground(callView, index); + + TextView contact = (TextView) callView.findViewById(R.id.contactNameOrNumber); + + Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress); + if (lContact == null) { + if (getResources().getBoolean(R.bool.only_display_username_if_unknown) && LinphoneUtils.isSipAddress(sipUri)) { + contact.setText(lAddress.getUserName()); + } else { + contact.setText(sipUri); + } + } else { + contact.setText(lContact.getName()); + } + + //displayCallStatusIconAndReturnCallPaused(callView, call); registerCallDurationTimer(callView, call); callsList.addView(callView); // Image Row - LinearLayout imageView = (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false); - Contact contact = ContactsManager.getInstance().findContactWithAddress(imageView.getContext().getContentResolver(), lAddress); - if(contact != null) { + //Contact contact = ContactsManager.getInstance().findContactWithAddress(imageView.getContext().getContentResolver(), lAddress); + /*if(contact != null) { displayOrHideContactPicture(imageView, contact.getPhotoUri(), contact.getThumbnailUri(), false); } else { displayOrHideContactPicture(imageView, null, null, false); } - callsList.addView(imageView); + callsList.addView(imageView);*/ + + int callDuration = call.getDuration(); + if (callDuration == 0 && call.getState() != State.StreamsRunning) { + return; + } + + Chronometer timer = (Chronometer) findViewById(R.id.callTimer); + if (timer == null) { + throw new IllegalArgumentException("no callee_duration view found"); + } + + timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration); + timer.start(); - callView.setTag(imageView); - callView.setOnClickListener(new OnClickListener() { + // callView.setTag(imageView); + /* callView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v.getTag() != null) { @@ -1336,7 +1429,7 @@ public class InCallActivity extends Activity implements OnClickListener { callsList.invalidate(); } } - }); + });*/ } private void setContactName(LinearLayout callView, LinphoneAddress lAddress, String sipUri, Resources resources) { @@ -1390,18 +1483,6 @@ public class InCallActivity extends Activity implements OnClickListener { callView.setVisibility(hide ? View.GONE : View.VISIBLE);*/ } - private void setRowBackground(LinearLayout callView, int index) { - int backgroundResource; - if (index == 0) { -// backgroundResource = active ? R.drawable.cell_call_first_highlight : R.drawable.cell_call_first; - //backgroundResource = R.drawable.cell_call_first; - } else { -// backgroundResource = active ? R.drawable.cell_call_highlight : R.drawable.cell_call; -// backgroundResource = R.drawable.cell_call; - } -// callView.setBackgroundResource(backgroundResource); - } - private void registerCallDurationTimer(View v, LinphoneCall call) { int callDuration = call.getDuration(); if (callDuration == 0 && call.getState() != State.StreamsRunning) { @@ -1418,33 +1499,41 @@ public class InCallActivity extends Activity implements OnClickListener { } public void refreshCallList(Resources resources) { - if (callsList == null) { + if(LinphoneManager.getLc().getCalls().length == 1) { + displayActiveCall(LinphoneManager.getLc().getCalls()[0]); return; } - callsList.removeAllViews(); - int index = 0; - - if (LinphoneManager.getLc().getCallsNb() == 0) { - goBackToDialer(); - return; - } - - isConferenceRunning = LinphoneManager.getLc().getConferenceSize() > 1; - if (isConferenceRunning) { - displayConferenceHeader(); - index++; - } - for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { - displayCall(resources, call, index); - index++; - } - - if(LinphoneManager.getLc().getCurrentCall() == null){ - showAudioView(); - video.setEnabled(false); - } - - callsList.invalidate(); + if(callsList != null) { + callsList.removeAllViews(); + int index = 0; + + if (LinphoneManager.getLc().getCallsNb() == 0) { + goBackToDialer(); + return; + } + + isConferenceRunning = LinphoneManager.getLc().getConferenceSize() > 1; + if (isConferenceRunning) { + displayConferenceHeader(); + index++; + } + for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { + if (call != LinphoneManager.getLc().getCurrentCall()) { + displayOtherCalls(resources, call, index); + index++; + } else { + displayActiveCall(call); + } + } + + if (LinphoneManager.getLc().getCurrentCall() == null) { + showAudioView(); + video.setEnabled(false); + } + + callsList.invalidate(); + } + } } diff --git a/src/org/linphone/IncomingCallActivity.java b/src/org/linphone/IncomingCallActivity.java index f32889de2..ef15937dc 100644 --- a/src/org/linphone/IncomingCallActivity.java +++ b/src/org/linphone/IncomingCallActivity.java @@ -143,12 +143,8 @@ public class IncomingCallActivity extends Activity implements LinphoneSliderTrig // contact != null ? contact.getThumbnailUri() : null, R.drawable.unknown_small); // To be done after findUriPictureOfContactAndSetDisplayName called - mNameView.setText(contact != null ? contact.getName() : ""); - if (getResources().getBoolean(R.bool.only_display_username_if_unknown)) { - mNumberView.setText(address.getUserName()); - } else { - mNumberView.setText(address.asStringUriOnly()); - } + mNameView.setText(contact != null ? contact.getName() : address.getUserName()); + mNumberView.setText(address.asStringUriOnly()); } @Override diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index fe6a9f8ff..c60d633f5 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -51,6 +51,8 @@ import org.linphone.ui.AddressText; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; @@ -60,6 +62,9 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.view.Gravity; @@ -70,6 +75,7 @@ import android.view.Surface; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.Window; import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.widget.AdapterView; @@ -165,11 +171,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver()); } - if(!LinphonePreferences.instance().isContactsMigrationDone()){ - ContactsManager.getInstance().migrateContacts(); - LinphonePreferences.instance().contactsMigrationDone(); - } - setContentView(R.layout.main); instance = this; fragmentsHistory = new ArrayList(); @@ -532,7 +533,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta break; case CHATLIST: newFragment = new ChatListFragment(); - messageListFragment = new Fragment(); + messageListFragment = newFragment; break; case CHAT: newFragment = new ChatFragment(); @@ -1024,6 +1025,18 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta toast.show(); } + public Dialog displayDialog(String text){ + Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + Drawable d = new ColorDrawable(Color.BLACK); + d.setAlpha(0); + dialog.getWindow().setBackgroundDrawable(d); + dialog.setContentView(R.layout.dialog); + TextView customText = (TextView) dialog.findViewById(R.id.customText); + customText.setText(text); + return dialog; + } + @Override public void setAddresGoToDialerAndCall(String number, String name, Uri photo) { // Bundle extras = new Bundle(); diff --git a/src/org/linphone/OutgoingCallActivity.java b/src/org/linphone/OutgoingCallActivity.java index ddf42f3d3..3059981e5 100644 --- a/src/org/linphone/OutgoingCallActivity.java +++ b/src/org/linphone/OutgoingCallActivity.java @@ -27,18 +27,19 @@ import org.linphone.core.LinphoneCallParams; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.mediastream.Log; -import org.linphone.ui.LinphoneSliders; -import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; +import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; +import de.timroes.axmlrpc.Call; + /** * Activity displayed when a call comes in. * It should bypass the screen lock mechanism. @@ -49,11 +50,11 @@ public class OutgoingCallActivity extends Activity { private static OutgoingCallActivity instance; - private TextView mNameView; - private TextView mNumberView; - private ImageView mPictureView; + private TextView mNameView, mNumberView; + private ImageView mPictureView, micro, speaker, decline; private LinphoneCall mCall; private LinphoneCoreListenerBase mListener; + private boolean isMicMuted, isSpeakerEnabled; public static OutgoingCallActivity instance() { return instance; @@ -66,27 +67,85 @@ public class OutgoingCallActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - setContentView(R.layout.incoming); + setContentView(R.layout.outgoing_call); mNameView = (TextView) findViewById(R.id.incoming_caller_name); mNumberView = (TextView) findViewById(R.id.incoming_caller_number); mPictureView = (ImageView) findViewById(R.id.incoming_picture); + micro = (ImageView) findViewById(R.id.micro); + micro.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + } + }); + speaker = (ImageView) findViewById(R.id.speaker); + + isMicMuted = false; + isSpeakerEnabled = false; + + micro.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + isMicMuted = !isMicMuted; + if(isMicMuted) { + micro.setImageResource(R.drawable.micro_selected); + } else { + micro.setImageResource(R.drawable.micro_default); + } + LinphoneManager.getLc().muteMic(isMicMuted); + } + }); + + speaker.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + isSpeakerEnabled = !isSpeakerEnabled; + if(isSpeakerEnabled) { + speaker.setImageResource(R.drawable.speaker_selected); + } else { + speaker.setImageResource(R.drawable.speaker_default); + } + LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); + } + }); + // set this flag so this activity will stay in front of the keyguard int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; getWindow().addFlags(flags); // "Dial-to-answer" widget for incoming calls. + ImageView decline = (ImageView) findViewById(R.id.hang_up); + decline.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + decline(); + } + }); + mListener = new LinphoneCoreListenerBase(){ @Override public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { + if (LinphoneManager.getLc().getCallsNb() == 0) { + finish(); + return; + } if (call == mCall && State.CallEnd == state) { finish(); } - if (state == State.StreamsRunning) { - // The following should not be needed except some devices need it (e.g. Galaxy S). - LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled()); + + if (call == mCall && State.Connected == state || State.StreamsRunning == state){ + if (!LinphoneActivity.isInstanciated()) { + return; + } + final LinphoneCallParams remoteParams = mCall.getRemoteParams(); + if (remoteParams != null && remoteParams.getVideoEnabled() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests()) { + LinphoneActivity.instance().startVideoActivity(mCall); + } else { + LinphoneActivity.instance().startIncallActivity(mCall); + } } } }; @@ -108,7 +167,7 @@ public class OutgoingCallActivity extends Activity { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { List calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); for (LinphoneCall call : calls) { - if (State.IncomingReceived == call.getState()) { + if (State.OutgoingInit == call.getState() || State.OutgoingProgress == call.getState()) { mCall = call; break; } @@ -126,12 +185,9 @@ public class OutgoingCallActivity extends Activity { // contact != null ? contact.getThumbnailUri() : null, R.drawable.unknown_small); // To be done after findUriPictureOfContactAndSetDisplayName called - mNameView.setText(contact != null ? contact.getName() : ""); - if (getResources().getBoolean(R.bool.only_display_username_if_unknown)) { - mNumberView.setText(address.getUserName()); - } else { - mNumberView.setText(address.asStringUriOnly()); - } + mNameView.setText(contact != null ? contact.getName() : address.getUserName()); + mNumberView.setText(address.asStringUriOnly()); + } @Override @@ -158,35 +214,8 @@ public class OutgoingCallActivity extends Activity { return super.onKeyDown(keyCode, event); } - - private void decline() { LinphoneManager.getLc().terminateCall(mCall); } - private void answer() { - LinphoneCallParams params = LinphoneManager.getLc().createDefaultCallParameters(); - - boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(this); - if (isLowBandwidthConnection) { - params.enableLowBandwidth(true); - Log.d("Low bandwidth enabled in call params"); - } - - if (!LinphoneManager.getInstance().acceptCallWithParams(mCall, params)) { - // the above method takes care of Samsung Galaxy S - Toast.makeText(this, R.string.couldnt_accept_call, Toast.LENGTH_LONG).show(); - } else { - if (!LinphoneActivity.isInstanciated()) { - return; - } - final LinphoneCallParams remoteParams = mCall.getRemoteParams(); - if (remoteParams != null && remoteParams.getVideoEnabled() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests()) { - LinphoneActivity.instance().startVideoActivity(mCall); - } else { - LinphoneActivity.instance().startIncallActivity(mCall); - } - } - } - } diff --git a/src/org/linphone/SettingsFragment.java b/src/org/linphone/SettingsFragment.java index f407105f4..815fe4134 100644 --- a/src/org/linphone/SettingsFragment.java +++ b/src/org/linphone/SettingsFragment.java @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import java.util.ArrayList; import java.util.List; +import org.linphone.assistant.AssistantActivity; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore.AdaptiveRateAlgorithm; @@ -35,7 +36,6 @@ import org.linphone.core.PayloadType; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; -import org.linphone.setup.SetupActivity; import org.linphone.ui.LedPreference; import org.linphone.ui.PreferencesListFragment; @@ -124,7 +124,7 @@ public class SettingsFragment extends PreferencesListFragment { findPreference(getString(R.string.setup_key)).setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - Intent intent = new Intent(LinphoneService.instance(), SetupActivity.class); + Intent intent = new Intent(LinphoneService.instance(), AssistantActivity.class); startActivityForResult(intent, WIZARD_INTENT); return true; } diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index e19dc9c28..9e732a0ef 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -87,10 +87,10 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen if (message.isOutgoing()) { view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null); - view.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing); + //view.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing); } else { view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null); - view.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming); + //view.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming); } view.setId(message.getStorageId());