Fixes & interface improvements
This commit is contained in:
parent
a0caddeb8b
commit
fa376612ed
6 changed files with 42 additions and 12 deletions
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
|
@ -43,6 +43,14 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/newFastChat"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/new_fast_chat"
|
||||||
|
android:textColor="@color/text_default"
|
||||||
|
android:inputType="textEmailAddress"/>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/chatList"
|
android:id="@+id/chatList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -201,6 +201,7 @@
|
||||||
|
|
||||||
<string name="addressHint">Numéro ou adresse</string>
|
<string name="addressHint">Numéro ou adresse</string>
|
||||||
<string name="conference">Conférence</string>
|
<string name="conference">Conférence</string>
|
||||||
|
<string name="new_fast_chat">Entrez une adresse SIP avec qui discuter…</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
<string name="content_description_add_contact"></string>
|
<string name="content_description_add_contact"></string>
|
||||||
|
|
|
@ -251,6 +251,7 @@
|
||||||
|
|
||||||
<string name="addressHint">Number or address</string>
|
<string name="addressHint">Number or address</string>
|
||||||
<string name="conference">Conference</string>
|
<string name="conference">Conference</string>
|
||||||
|
<string name="new_fast_chat">Enter a SIP address to chat with…</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
<string name="content_description_add_contact">Add to contacts button</string>
|
<string name="content_description_add_contact">Add to contacts button</string>
|
||||||
|
|
|
@ -24,6 +24,8 @@ import org.linphone.core.LinphoneCoreFactory;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -35,6 +37,7 @@ import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -46,7 +49,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private List<String> mConversations;
|
private List<String> mConversations;
|
||||||
private ListView chatList;
|
private ListView chatList;
|
||||||
private ImageView edit, ok, newDiscussion;
|
private ImageView edit, ok, newDiscussion, isFastNewChatAddressOk;
|
||||||
|
private EditText fastNewChat;
|
||||||
private boolean isEditMode = false;
|
private boolean isEditMode = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,6 +70,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
ok = (ImageView) view.findViewById(R.id.ok);
|
ok = (ImageView) view.findViewById(R.id.ok);
|
||||||
ok.setOnClickListener(this);
|
ok.setOnClickListener(this);
|
||||||
|
|
||||||
|
fastNewChat = (EditText) view.findViewById(R.id.newFastChat);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +122,18 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
chatList.setAdapter(new ChatListAdapter());
|
||||||
}
|
}
|
||||||
else if (id == R.id.newDiscussion) {
|
else if (id == R.id.newDiscussion) {
|
||||||
LinphoneActivity.instance().displayContacts();
|
String sipUri = fastNewChat.getText().toString();
|
||||||
|
if (sipUri.equals("")) {
|
||||||
|
LinphoneActivity.instance().displayContacts();
|
||||||
|
} else {
|
||||||
|
if (!LinphoneUtils.isSipAddress(sipUri)) {
|
||||||
|
sipUri = sipUri + "@" + LinphoneManager.getLc().getDefaultProxyConfig().getDomain();
|
||||||
|
}
|
||||||
|
if (!LinphoneUtils.isStrictSipAddress(sipUri)) {
|
||||||
|
sipUri = "sip:" + sipUri;
|
||||||
|
}
|
||||||
|
LinphoneActivity.instance().displayChat(sipUri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,16 +116,20 @@ public class ChatStorage {
|
||||||
Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + correspondent + "\"", null, null, null, "id ASC");
|
Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + correspondent + "\"", null, null, null, "id ASC");
|
||||||
|
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
String message, timestamp;
|
try {
|
||||||
int id = c.getInt(c.getColumnIndex("id"));
|
String message, timestamp;
|
||||||
int direction = c.getInt(c.getColumnIndex("direction"));
|
int id = c.getInt(c.getColumnIndex("id"));
|
||||||
message = c.getString(c.getColumnIndex("message"));
|
int direction = c.getInt(c.getColumnIndex("direction"));
|
||||||
timestamp = c.getString(c.getColumnIndex("time"));
|
message = c.getString(c.getColumnIndex("message"));
|
||||||
int status = c.getInt(c.getColumnIndex("status"));
|
timestamp = c.getString(c.getColumnIndex("time"));
|
||||||
byte[] rawImage = c.getBlob(c.getColumnIndex("image"));
|
int status = c.getInt(c.getColumnIndex("status"));
|
||||||
|
byte[] rawImage = c.getBlob(c.getColumnIndex("image"));
|
||||||
ChatMessage chatMessage = new ChatMessage(id, message, rawImage, timestamp, direction == INCOMING, status);
|
|
||||||
chatMessages.add(chatMessage);
|
ChatMessage chatMessage = new ChatMessage(id, message, rawImage, timestamp, direction == INCOMING, status);
|
||||||
|
chatMessages.add(chatMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
c.close();
|
c.close();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue