Added text to chat fragment

This commit is contained in:
Sylvain Berfini 2012-09-21 16:52:02 +02:00
parent eb11ea38fb
commit faae53581a
9 changed files with 76 additions and 24 deletions

View file

@ -4,5 +4,7 @@
android:color="@color/text_over" />
<item android:state_selected="true"
android:color="@color/text_selected" />
<item android:state_enabled="false"
android:color="@color/text_disabled" />
<item android:color="@color/text_default" />
</selector>

View file

@ -56,26 +56,28 @@
android:orientation="horizontal"
android:background="@drawable/chat_field_background">
<ImageView
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_send_message"
android:paddingLeft="8dp"
android:src="@drawable/chat_send_picture" />
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="9dp" />
<ImageView
android:contentDescription="@string/content_description_send_message"
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:adjustViewBounds="true"
android:src="@drawable/chat_send_message"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="15dp" />
<EditText
@ -108,14 +110,32 @@
android:adjustViewBounds="true"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_toLeftOf="@id/cancelUpload"
android:layout_centerVertical="true"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp" />
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>

View file

@ -34,7 +34,6 @@
android:textColor="@color/text_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_weight="1"/>
@ -49,7 +48,6 @@
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_weight="1"/>

View file

@ -291,6 +291,10 @@
<string name="button_speaker">Haut parleur</string>
<string name="button_options">Options</string>
<string name="button_send_message">Envoyer</string>
<string name="button_send_picture">Img</string>
<string name="uploading_image">Envoi en cours&#8230;</string>
<string name="share_picture_size_small">Petite</string>
<string name="share_picture_size_medium">Moyenne</string>
<string name="share_picture_size_large">Grande</string>

View file

@ -5,6 +5,7 @@
<color name="text_selected">#ffcf4c29</color>
<color name="text_over">#ffb9c4cb</color>
<color name="text_default">#ff5b656f</color>
<color name="text_disabled">#ffa6b3bf</color>
<color name="text_header">#ff7e8e9e</color>
<color name="text_switch_selected">#ffffff</color>

View file

@ -342,6 +342,10 @@
<string name="button_speaker">Speaker</string>
<string name="button_options">Options</string>
<string name="button_send_message">Send</string>
<string name="button_send_picture">Pic</string>
<string name="uploading_image">Uploading&#8230;</string>
<string name="share_picture_size_small">Small</string>
<string name="share_picture_size_medium">Medium</string>
<string name="share_picture_size_large">Large</string>

View file

@ -58,6 +58,8 @@ import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.content.CursorLoader;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
@ -94,8 +96,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private View view;
private String sipUri;
private EditText message;
private ImageView sendImage, cancelUpload;
private TextView contactName;
private ImageView cancelUpload;
private TextView sendImage, sendMessage, contactName;
private AvatarWithShadow contactPicture;
private RelativeLayout messagesLayout, uploadLayout, textLayout;
private ScrollView messagesScrollView;
@ -124,7 +126,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
contactName = (TextView) view.findViewById(R.id.contactName);
contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture);
ImageView sendMessage = (ImageView) view.findViewById(R.id.sendMessage);
sendMessage = (TextView) view.findViewById(R.id.sendMessage);
sendMessage.setOnClickListener(this);
message = (EditText) view.findViewById(R.id.message);
@ -135,7 +137,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
messagesScrollView = (ScrollView) view.findViewById(R.id.chatScrollView);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
sendImage = (ImageView) view.findViewById(R.id.sendPicture);
sendImage = (TextView) view.findViewById(R.id.sendPicture);
registerForContextMenu(sendImage);
sendImage.setOnClickListener(new OnClickListener() {
@Override
@ -165,6 +167,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
uploadServerUri = getActivity().getResources().getString(R.string.upload_url);
addVirtualKeyboardVisiblityListener();
message.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable arg0) {
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3)
{
if (message.getText().toString().equals("")) {
sendMessage.setEnabled(false);
} else {
sendMessage.setEnabled(true);
}
}
});
return view;
}

View file

@ -56,7 +56,6 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneCallStats.MediaType;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;

View file

@ -164,9 +164,12 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
addEchoPrefsListener();
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_hacks_use_galaxys_hack_key);
if (Hacks.needSoftvolume()) {
Log.w("Using Audio Hack");
checkAndDisableCheckbox(R.string.pref_audio_hacks_use_galaxys_hack_key);
}
if (!LinphoneManager.getLc().isTunnelAvailable()){
if (!LinphoneManager.getLc().isTunnelAvailable()) {
hidePreferenceCategory(R.string.pref_tunnel_key);
}