Removed useless mHandler.post() now that everything runs in the same thread
This commit is contained in:
parent
304565ef1a
commit
5c2265956d
13 changed files with 255 additions and 434 deletions
|
@ -110,11 +110,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private TextView sendImage, sendMessage, contactName, remoteComposing;
|
private TextView sendImage, sendMessage, contactName, remoteComposing;
|
||||||
private AvatarWithShadow contactPicture;
|
private AvatarWithShadow contactPicture;
|
||||||
private RelativeLayout uploadLayout, textLayout;
|
private RelativeLayout uploadLayout, textLayout;
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
private List<BubbleChat> lastSentMessagesBubbles;
|
private List<BubbleChat> lastSentMessagesBubbles;
|
||||||
private HashMap<Integer, String> latestImageMessages;
|
private HashMap<Integer, String> latestImageMessages;
|
||||||
private boolean useLinphoneMessageStorage;
|
private boolean useLinphoneMessageStorage;
|
||||||
private ListView messagesList;
|
private ListView messagesList;
|
||||||
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private int bytesSent;
|
private int bytesSent;
|
||||||
|
@ -678,22 +678,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public void onMessageReceived(LinphoneAddress from, final LinphoneChatMessage message) {
|
public void onMessageReceived(LinphoneAddress from, final LinphoneChatMessage message) {
|
||||||
if (from.asStringUriOnly().equals(sipUri)) {
|
if (from.asStringUriOnly().equals(sipUri)) {
|
||||||
if (message.getText() != null) {
|
if (message.getText() != null) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
adapter.refreshHistory();
|
adapter.refreshHistory();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (message.getExternalBodyUrl() != null) {
|
} else if (message.getExternalBodyUrl() != null) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
adapter.refreshHistory();
|
adapter.refreshHistory();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
scrollToEnd();
|
scrollToEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,9 +694,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
final String finalImage = finalMessage.getExternalBodyUrl();
|
final String finalImage = finalMessage.getExternalBodyUrl();
|
||||||
final State finalState=state;
|
final State finalState=state;
|
||||||
if (LinphoneActivity.isInstanciated() && state != State.InProgress) {
|
if (LinphoneActivity.isInstanciated() && state != State.InProgress) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (finalMessage != null && !finalMessage.equals("")) {
|
if (finalMessage != null && !finalMessage.equals("")) {
|
||||||
LinphoneActivity.instance().onMessageStateChanged(sipUri, finalMessage.getText(), finalState.toInt());
|
LinphoneActivity.instance().onMessageStateChanged(sipUri, finalMessage.getText(), finalState.toInt());
|
||||||
} else if (finalImage != null && !finalImage.equals("")) {
|
} else if (finalImage != null && !finalImage.equals("")) {
|
||||||
|
@ -734,9 +721,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSipUri() {
|
public String getSipUri() {
|
||||||
|
@ -1092,12 +1076,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
@Override
|
@Override
|
||||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) {
|
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) {
|
||||||
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
|
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ import android.graphics.Bitmap;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -60,8 +59,6 @@ import android.widget.TextView;
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private List<String> mConversations, mDrafts;
|
private List<String> mConversations, mDrafts;
|
||||||
private ListView chatList;
|
private ListView chatList;
|
||||||
|
@ -112,16 +109,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
||||||
mConversations.removeAll(mDrafts);
|
mConversations.removeAll(mDrafts);
|
||||||
hideAndDisplayMessageIfNoChat();
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isVersionUsingNewChatStorage() {
|
private boolean isVersionUsingNewChatStorage() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -28,7 +28,6 @@ import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -52,8 +51,6 @@ import android.widget.TextView;
|
||||||
*/
|
*/
|
||||||
@SuppressLint("DefaultLocale")
|
@SuppressLint("DefaultLocale")
|
||||||
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private ListView contactsList;
|
private ListView contactsList;
|
||||||
private TextView allContacts, linphoneContacts, newContact, noSipContact, noContact;
|
private TextView allContacts, linphoneContacts, newContact, noSipContact, noContact;
|
||||||
|
@ -278,9 +275,6 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (searchField != null && searchField.getText().toString().length() > 0) {
|
if (searchField != null && searchField.getText().toString().length() > 0) {
|
||||||
searchContacts(searchField.getText().toString());
|
searchContacts(searchField.getText().toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,8 +282,6 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
||||||
}
|
}
|
||||||
contactsList.setSelectionFromTop(lastKnownPosition, 0);
|
contactsList.setSelectionFromTop(lastKnownPosition, 0);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class ContactsListAdapter extends BaseAdapter implements SectionIndexer {
|
class ContactsListAdapter extends BaseAdapter implements SectionIndexer {
|
||||||
private int margin;
|
private int margin;
|
||||||
|
|
|
@ -30,7 +30,6 @@ import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -53,7 +52,6 @@ import android.widget.TextView;
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
public class HistoryFragment extends Fragment implements OnClickListener, OnChildClickListener, OnGroupClickListener {
|
public class HistoryFragment extends Fragment implements OnClickListener, OnChildClickListener, OnGroupClickListener {
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
private ExpandableListView historyList;
|
private ExpandableListView historyList;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
|
private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
|
||||||
|
@ -164,17 +162,12 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandAllGroups() {
|
private void expandAllGroups() {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (int groupToExpand = 0; groupToExpand < historyList.getExpandableListAdapter().getGroupCount(); groupToExpand++) {
|
for (int groupToExpand = 0; groupToExpand < historyList.getExpandableListAdapter().getGroupCount(); groupToExpand++) {
|
||||||
if (!historyList.isGroupExpanded(groupToExpand)) {
|
if (!historyList.isGroupExpanded(groupToExpand)) {
|
||||||
historyList.expandGroup(groupToExpand);
|
historyList.expandGroup(groupToExpand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getCorrespondentDisplayName(LinphoneCallLog log) {
|
private String getCorrespondentDisplayName(LinphoneCallLog log) {
|
||||||
String displayName;
|
String displayName;
|
||||||
|
|
|
@ -76,7 +76,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
|
|
||||||
private static InCallActivity instance;
|
private static InCallActivity instance;
|
||||||
|
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
private Handler mControlsHandler = new Handler();
|
private Handler mControlsHandler = new Handler();
|
||||||
private Runnable mControls;
|
private Runnable mControls;
|
||||||
private ImageView switchCamera;
|
private ImageView switchCamera;
|
||||||
|
@ -281,12 +280,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshInCallActions() {
|
private void refreshInCallActions() {
|
||||||
if (mHandler == null) {
|
|
||||||
mHandler = new Handler();
|
|
||||||
}
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!LinphonePreferences.instance().isVideoEnabled()) {
|
if (!LinphonePreferences.instance().isVideoEnabled()) {
|
||||||
video.setEnabled(false);
|
video.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -339,16 +332,8 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableAndRefreshInCallActions() {
|
private void enableAndRefreshInCallActions() {
|
||||||
if (mHandler == null) {
|
|
||||||
mHandler = new Handler();
|
|
||||||
}
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
addCall.setEnabled(LinphoneManager.getLc().getCallsNb() < LinphoneManager.getLc().getMaxCalls());
|
addCall.setEnabled(LinphoneManager.getLc().getCallsNb() < LinphoneManager.getLc().getMaxCalls());
|
||||||
transfer.setEnabled(getResources().getBoolean(R.bool.allow_transfers));
|
transfer.setEnabled(getResources().getBoolean(R.bool.allow_transfers));
|
||||||
options.setEnabled(!getResources().getBoolean(R.bool.disable_options_in_call) && (addCall.isEnabled() || transfer.isEnabled()));
|
options.setEnabled(!getResources().getBoolean(R.bool.disable_options_in_call) && (addCall.isEnabled() || transfer.isEnabled()));
|
||||||
|
@ -365,8 +350,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
|
|
||||||
refreshInCallActions();
|
refreshInCallActions();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateStatusFragment(StatusFragment statusFragment) {
|
public void updateStatusFragment(StatusFragment statusFragment) {
|
||||||
status = statusFragment;
|
status = statusFragment;
|
||||||
|
@ -459,9 +442,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (isVideoEnabled) {
|
if (isVideoEnabled) {
|
||||||
video.setEnabled(true);
|
video.setEnabled(true);
|
||||||
LinphoneCallParams params = call.getCurrentParamsCopy();
|
LinphoneCallParams params = call.getCurrentParamsCopy();
|
||||||
|
@ -477,14 +457,8 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayCustomToast(final String message, final int duration) {
|
public void displayCustomToast(final String message, final int duration) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
|
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
|
||||||
|
|
||||||
|
@ -497,8 +471,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
toast.setView(layout);
|
toast.setView(layout);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void switchVideo(final boolean displayVideo) {
|
private void switchVideo(final boolean displayVideo) {
|
||||||
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||||
|
@ -506,9 +478,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
//Check if the call is not terminated
|
//Check if the call is not terminated
|
||||||
if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return;
|
if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return;
|
||||||
|
|
||||||
|
@ -524,8 +493,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showAudioView() {
|
private void showAudioView() {
|
||||||
video.setBackgroundResource(R.drawable.video_on);
|
video.setBackgroundResource(R.drawable.video_on);
|
||||||
|
@ -1080,14 +1047,8 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!LinphonePreferences.instance().isVideoEnabled()){
|
if(!LinphonePreferences.instance().isVideoEnabled()){
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
video.setEnabled(true);
|
video.setEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State.IncomingReceived) {
|
if (state == State.IncomingReceived) {
|
||||||
startIncomingCallActivity();
|
startIncomingCallActivity();
|
||||||
|
@ -1095,29 +1056,19 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.Paused || state == State.PausedByRemote || state == State.Pausing) {
|
if (state == State.Paused || state == State.PausedByRemote || state == State.Pausing) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
video.setEnabled(false);
|
video.setEnabled(false);
|
||||||
if(isVideoEnabled(call)){
|
if(isVideoEnabled(call)){
|
||||||
showAudioView();
|
showAudioView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State.Resuming) {
|
if (state == State.Resuming) {
|
||||||
if(LinphonePreferences.instance().isVideoEnabled()){
|
if(LinphonePreferences.instance().isVideoEnabled()){
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||||
if(call.getCurrentParamsCopy().getVideoEnabled()){
|
if(call.getCurrentParamsCopy().getVideoEnabled()){
|
||||||
showVideoView();
|
showVideoView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.StreamsRunning) {
|
if (state == State.StreamsRunning) {
|
||||||
|
@ -1129,24 +1080,14 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
enableAndRefreshInCallActions();
|
enableAndRefreshInCallActions();
|
||||||
|
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
videoProgress.setVisibility(View.GONE);
|
videoProgress.setVisibility(View.GONE);
|
||||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshInCallActions();
|
refreshInCallActions();
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
refreshCallList(getResources());
|
refreshCallList(getResources());
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (state == State.CallUpdatedByRemote) {
|
if (state == State.CallUpdatedByRemote) {
|
||||||
// If the correspondent proposes video while audio call
|
// If the correspondent proposes video while audio call
|
||||||
|
@ -1160,8 +1101,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
showAcceptCallUpdateDialog();
|
showAcceptCallUpdateDialog();
|
||||||
|
|
||||||
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
||||||
|
@ -1171,8 +1110,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||||
// mHandler.post(new Runnable() {
|
// mHandler.post(new Runnable() {
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -1183,12 +1120,8 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showAcceptCallUpdateDialog() {
|
private void showAcceptCallUpdateDialog() {
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
@ -1199,13 +1132,8 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
@Override
|
@Override
|
||||||
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
|
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1291,7 +1219,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
||||||
}
|
}
|
||||||
mControls = null;
|
mControls = null;
|
||||||
mControlsHandler = null;
|
mControlsHandler = null;
|
||||||
mHandler = null;
|
|
||||||
|
|
||||||
unbindDrawables(findViewById(R.id.topLayout));
|
unbindDrawables(findViewById(R.id.topLayout));
|
||||||
instance = null;
|
instance = null;
|
||||||
|
|
|
@ -61,7 +61,6 @@ import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.Fragment.SavedState;
|
import android.support.v4.app.Fragment.SavedState;
|
||||||
|
@ -108,7 +107,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
private Fragment dialerFragment, messageListenerFragment, messageListFragment, friendStatusListenerFragment;
|
private Fragment dialerFragment, messageListenerFragment, messageListFragment, friendStatusListenerFragment;
|
||||||
private SavedState dialerSavedState;
|
private SavedState dialerSavedState;
|
||||||
private boolean preferLinphoneContacts = false, isAnimationDisabled = false, isContactPresenceDisabled = true;
|
private boolean preferLinphoneContacts = false, isAnimationDisabled = false, isContactPresenceDisabled = true;
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
private List<Contact> contactList, sipContactList;
|
private List<Contact> contactList, sipContactList;
|
||||||
private Cursor contactCursor, sipContactCursor;
|
private Cursor contactCursor, sipContactCursor;
|
||||||
private OrientationEventListener mOrientationHelper;
|
private OrientationEventListener mOrientationHelper;
|
||||||
|
@ -775,9 +773,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMissedCalls(final int missedCallsCount) {
|
private void displayMissedCalls(final int missedCallsCount) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (missedCallsCount > 0) {
|
if (missedCallsCount > 0) {
|
||||||
missedCalls.setText(missedCallsCount + "");
|
missedCalls.setText(missedCallsCount + "");
|
||||||
missedCalls.setVisibility(View.VISIBLE);
|
missedCalls.setVisibility(View.VISIBLE);
|
||||||
|
@ -789,13 +784,8 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
missedCalls.setVisibility(View.GONE);
|
missedCalls.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayMissedChats(final int missedChatCount) {
|
private void displayMissedChats(final int missedChatCount) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (missedChatCount > 0) {
|
if (missedChatCount > 0) {
|
||||||
missedChats.setText(missedChatCount + "");
|
missedChats.setText(missedChatCount + "");
|
||||||
if (missedChatCount > 99) {
|
if (missedChatCount > 99) {
|
||||||
|
@ -812,8 +802,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
missedChats.setVisibility(View.GONE);
|
missedChats.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||||
|
@ -842,9 +830,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayCustomToast(final String message, final int duration) {
|
public void displayCustomToast(final String message, final int duration) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
|
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
|
||||||
|
|
||||||
|
@ -857,8 +842,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
toast.setView(layout);
|
toast.setView(layout);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAddresGoToDialerAndCall(String number, String name, Uri photo) {
|
public void setAddresGoToDialerAndCall(String number, String name, Uri photo) {
|
||||||
|
@ -1153,9 +1136,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() {
|
public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (dialerFragment != null) {
|
if (dialerFragment != null) {
|
||||||
((DialerFragment) dialerFragment).resetLayout(false);
|
((DialerFragment) dialerFragment).resetLayout(false);
|
||||||
}
|
}
|
||||||
|
@ -1171,8 +1151,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public FragmentsAvailable getCurrentFragment() {
|
public FragmentsAvailable getCurrentFragment() {
|
||||||
return currentFragment;
|
return currentFragment;
|
||||||
|
|
|
@ -448,7 +448,12 @@ public class LinphoneManager implements LinphoneListener {
|
||||||
|
|
||||||
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
|
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
|
||||||
mLc.addListener((LinphoneCoreListener) c);
|
mLc.addListener((LinphoneCoreListener) c);
|
||||||
//initLiblinphone();
|
|
||||||
|
try {
|
||||||
|
initLiblinphone();
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
|
|
||||||
TimerTask lTask = new TimerTask() {
|
TimerTask lTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -725,21 +730,6 @@ public class LinphoneManager implements LinphoneListener {
|
||||||
|
|
||||||
public void globalState(final LinphoneCore lc, final GlobalState state, final String message) {
|
public void globalState(final LinphoneCore lc, final GlobalState state, final String message) {
|
||||||
Log.i("new state [",state,"]");
|
Log.i("new state [",state,"]");
|
||||||
|
|
||||||
if (state == GlobalState.GlobalOn) {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
synchronized (this) {
|
|
||||||
try {
|
|
||||||
initLiblinphone();
|
|
||||||
} catch (LinphoneCoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy,final RegistrationState state,final String message) {
|
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy,final RegistrationState state,final String message) {
|
||||||
|
|
|
@ -156,12 +156,7 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
||||||
}
|
}
|
||||||
mNotif = Compatibility.createNotification(this, mNotificationTitle, "", R.drawable.status_level, IC_LEVEL_OFFLINE, bm, mNotifContentIntent, true);
|
mNotif = Compatibility.createNotification(this, mNotificationTitle, "", R.drawable.status_level, IC_LEVEL_OFFLINE, bm, mNotifContentIntent, true);
|
||||||
|
|
||||||
UIThreadDispatcher.Dispatch(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
LinphoneManager.createAndStart(LinphoneService.this);
|
LinphoneManager.createAndStart(LinphoneService.this);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||||
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
||||||
|
@ -419,6 +414,7 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void dumpDeviceInformation() {
|
private void dumpDeviceInformation() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("DEVICE=").append(Build.DEVICE).append("\n");
|
sb.append("DEVICE=").append(Build.DEVICE).append("\n");
|
||||||
|
|
|
@ -929,8 +929,6 @@ public class SettingsFragment extends PreferencesListFragment implements Linphon
|
||||||
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
|
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
||||||
Preference echoCancellerCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
|
Preference echoCancellerCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
|
||||||
|
|
||||||
|
@ -948,8 +946,6 @@ public class SettingsFragment extends PreferencesListFragment implements Linphon
|
||||||
LinphonePreferences.instance().setEchoCancellation(true);
|
LinphonePreferences.instance().setEchoCancellation(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|
|
@ -199,9 +199,6 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
statusLed.setImageResource(getStatusIconResource(state, true));
|
statusLed.setImageResource(getStatusIconResource(state, true));
|
||||||
statusText.setText(getStatusIconText(state));
|
statusText.setText(getStatusIconText(state));
|
||||||
try {
|
try {
|
||||||
|
@ -218,8 +215,6 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
||||||
sliderContentAccounts.invalidate();
|
sliderContentAccounts.invalidate();
|
||||||
} catch (IllegalStateException ise) {}
|
} catch (IllegalStateException ise) {}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// private void setMiniLedsForEachAccount() {
|
// private void setMiniLedsForEachAccount() {
|
||||||
// if (allAccountsLed == null)
|
// if (allAccountsLed == null)
|
||||||
|
|
|
@ -59,7 +59,6 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
Log.e(e, "Unable to calibrate EC");
|
Log.e(e, "Unable to calibrate EC");
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,6 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneRemo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (spinner != null) spinner.setVisibility(View.GONE);
|
if (spinner != null) spinner.setVisibility(View.GONE);
|
||||||
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
|
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
|
||||||
goToLinphoneActivity();
|
goToLinphoneActivity();
|
||||||
|
@ -93,8 +90,6 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneRemo
|
||||||
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
|
|
|
@ -22,8 +22,8 @@ import org.linphone.LinphonePreferences;
|
||||||
import org.linphone.LinphonePreferences.AccountBuilder;
|
import org.linphone.LinphonePreferences.AccountBuilder;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneAddress.TransportType;
|
import org.linphone.core.LinphoneAddress.TransportType;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreListener;
|
import org.linphone.core.LinphoneCoreListener;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
@ -32,7 +32,6 @@ import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
@ -53,7 +52,6 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
||||||
private Fragment fragment;
|
private Fragment fragment;
|
||||||
private LinphonePreferences mPrefs;
|
private LinphonePreferences mPrefs;
|
||||||
private boolean accountCreated = false;
|
private boolean accountCreated = false;
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -223,21 +221,12 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
||||||
|
|
||||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||||
if (state == RegistrationState.RegistrationOk) {
|
if (state == RegistrationState.RegistrationOk) {
|
||||||
|
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||||
mHandler .post(new Runnable () {
|
|
||||||
public void run() {
|
|
||||||
launchEchoCancellerCalibration(true);
|
launchEchoCancellerCalibration(true);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (state == RegistrationState.RegistrationFailed) {
|
} else if (state == RegistrationState.RegistrationFailed) {
|
||||||
mHandler.post(new Runnable () {
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(SetupActivity.this, getString(R.string.first_launch_bad_login_password), Toast.LENGTH_LONG).show();
|
Toast.makeText(SetupActivity.this, getString(R.string.first_launch_bad_login_password), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAccount(String username, String password, String domain) {
|
public void checkAccount(String username, String password, String domain) {
|
||||||
|
|
Loading…
Reference in a new issue