* #25268 changed animation, moved searchview
* #26000 working, call process slightly modified
diff --git a/src/com/savoirfairelinux/sflphone/account/AccountDetail.java b/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
index 9507c24..fe69715 100644
--- a/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
@@ -24,6 +24,9 @@
import java.util.ArrayList;
import java.util.HashMap;
+import android.provider.MediaStore;
+import android.provider.MediaStore.Audio.Media;
+
public interface AccountDetail {
public static class PreferenceEntry
@@ -39,6 +42,7 @@
mLabelId = labelId;
isTwoState = false;
mValue = "";
+
}
public PreferenceEntry(String key, int labelId, boolean twoState)
diff --git a/src/com/savoirfairelinux/sflphone/adapters/CallPagerAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/CallPagerAdapter.java
index d0e4d75..88f44e2 100644
--- a/src/com/savoirfairelinux/sflphone/adapters/CallPagerAdapter.java
+++ b/src/com/savoirfairelinux/sflphone/adapters/CallPagerAdapter.java
@@ -10,7 +10,7 @@
import android.util.Log;
import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
+import com.savoirfairelinux.sflphone.fragments.HomeFragment;
import com.savoirfairelinux.sflphone.fragments.CallFragment;
import com.savoirfairelinux.sflphone.fragments.DialingFragment;
import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
@@ -70,7 +70,7 @@
name = DialingFragment.class.getName();
break;
case 1:
- name = CallElementListFragment.class.getName();
+ name = HomeFragment.class.getName();
break;
case 2:
name = HistoryFragment.class.getName();
diff --git a/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
index d7e573d..9dfeca7 100644
--- a/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
+++ b/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
@@ -10,7 +10,7 @@
import android.util.Log;
import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
+import com.savoirfairelinux.sflphone.fragments.HomeFragment;
import com.savoirfairelinux.sflphone.fragments.DialingFragment;
import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
@@ -26,7 +26,7 @@
mContext = c;
fragments = new ArrayList<Fragment>();
fragments.add(new DialingFragment());
- fragments.add(new CallElementListFragment());
+ fragments.add(new HomeFragment());
fragments.add(new HistoryFragment());
}
@@ -66,7 +66,7 @@
name = DialingFragment.class.getName();
break;
case 1:
- name = CallElementListFragment.class.getName();
+ name = HomeFragment.class.getName();
break;
case 2:
name = HistoryFragment.class.getName();
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index a07421f..194e560 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -43,6 +43,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
+import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
@@ -56,6 +57,7 @@
import com.savoirfairelinux.sflphone.fragments.CallFragment;
import com.savoirfairelinux.sflphone.fragments.CallListFragment;
import com.savoirfairelinux.sflphone.interfaces.CallInterface;
+import com.savoirfairelinux.sflphone.model.CallContact;
import com.savoirfairelinux.sflphone.model.SipCall;
import com.savoirfairelinux.sflphone.model.SipCall.state;
import com.savoirfairelinux.sflphone.receivers.CallReceiver;
@@ -65,326 +67,350 @@
import com.savoirfairelinux.sflphone.views.CallPaneLayout;
public class CallActivity extends Activity implements CallInterface, CallFragment.Callbacks, CallListFragment.Callbacks {
- static final String TAG = "CallActivity";
- private ISipService service;
+ static final String TAG = "CallActivity";
+ private ISipService service;
- private ExecutorService infos_fetcher = Executors.newCachedThreadPool();
- CallReceiver receiver;
+ private ExecutorService infos_fetcher = Executors.newCachedThreadPool();
+ CallReceiver receiver;
- CallPaneLayout slidingPaneLayout;
+ CallPaneLayout slidingPaneLayout;
- CallListFragment mCallsFragment;
- CallFragment mCurrentCallFragment;
+ CallListFragment mCallsFragment;
+ CallFragment mCurrentCallFragment;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_call_layout);
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_call_layout);
- receiver = new CallReceiver(this);
+ receiver = new CallReceiver(this);
- mCallsFragment = new CallListFragment();
+ mCallsFragment = new CallListFragment();
- getFragmentManager().beginTransaction().replace(R.id.calllist_pane, mCallsFragment).commit();
+ getFragmentManager().beginTransaction().replace(R.id.calllist_pane, mCallsFragment).commit();
- slidingPaneLayout = (CallPaneLayout) findViewById(R.id.slidingpanelayout);
- //slidingPaneLayout.
- // slidingPaneLayout.requestDisallowInterceptTouchEvent(disallowIntercept)
-// Toast.makeText(this, getIntent().getData().toString(), Toast.LENGTH_LONG).show();
- slidingPaneLayout.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
+ slidingPaneLayout = (CallPaneLayout) findViewById(R.id.slidingpanelayout);
+ // slidingPaneLayout.
+ // slidingPaneLayout.requestDisallowInterceptTouchEvent(disallowIntercept)
+ // Toast.makeText(this, getIntent().getData().toString(), Toast.LENGTH_LONG).show();
+ slidingPaneLayout.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
- @Override
- public void onPanelSlide(View view, float offSet) {
- }
+ @Override
+ public void onPanelSlide(View view, float offSet) {
+ }
- @Override
- public void onPanelOpened(View view) {
+ @Override
+ public void onPanelOpened(View view) {
- switch (view.getId()) {
- case R.id.calllist_pane:
- // getFragmentManager().findFragmentById(R.id.calllist_pane).setHasOptionsMenu(true);
- // getFragmentManager().findFragmentById(R.id.ongoingcall_pane).setHasOptionsMenu(false);
- break;
- default:
- break;
- }
- }
+ switch (view.getId()) {
+ case R.id.calllist_pane:
+ // getFragmentManager().findFragmentById(R.id.calllist_pane).setHasOptionsMenu(true);
+ // getFragmentManager().findFragmentById(R.id.ongoingcall_pane).setHasOptionsMenu(false);
+ break;
+ default:
+ break;
+ }
+ }
- @Override
- public void onPanelClosed(View view) {
+ @Override
+ public void onPanelClosed(View view) {
- switch (view.getId()) {
- case R.id.ongoingcall_pane:
- Log.i(TAG,"PANEL CLOSED DRAWING SHOULD RESTART");
- mCurrentCallFragment.getBubbleView().restartDrawing();
- break;
- default:
- break;
- }
- }
- });
+ switch (view.getId()) {
+ case R.id.ongoingcall_pane:
+ Log.i(TAG, "PANEL CLOSED DRAWING SHOULD RESTART");
+ mCurrentCallFragment.getBubbleView().restartDrawing();
+ break;
+ default:
+ break;
+ }
+ }
+ });
- Bundle b = getIntent().getExtras();
+ Intent intent = new Intent(this, SipService.class);
+ bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
- Intent intent = new Intent(this, SipService.class);
+ }
- // setCallStateDisplay(mCall.getCallStateString());
+ /* activity gets back to the foreground and user input */
+ @Override
+ protected void onResume() {
+ Log.i(TAG, "onResume");
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(CallManagerCallBack.INCOMING_CALL);
+ intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT);
+ intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
+ registerReceiver(receiver, intentFilter);
+ super.onResume();
+ }
- bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+ /* activity no more in foreground */
+ @Override
+ protected void onPause() {
+ super.onPause();
- }
+ }
- /* activity gets back to the foreground and user input */
- @Override
- protected void onResume() {
- Log.i(TAG, "onResume");
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(CallManagerCallBack.INCOMING_CALL);
- intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT);
- intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
- registerReceiver(receiver, intentFilter);
- super.onResume();
- }
+ @Override
+ protected void onDestroy() {
- /* activity no more in foreground */
- @Override
- protected void onPause() {
- super.onPause();
- unregisterReceiver(receiver);
- try {
+ unregisterReceiver(receiver);
+
+ try {
service.createNotification();
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
- }
-
- @Override
- protected void onDestroy() {
- // Log.i(TAG, "Destroying Call Activity for call " + mCall.getCallId());
- // LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
- try {
+ // Log.i(TAG, "Destroying Call Activity for call " + mCall.getCallId());
+ // LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
+ try {
service.destroyNotification();
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
- unbindService(mConnection);
+ unbindService(mConnection);
- super.onDestroy();
- }
+ super.onDestroy();
+ }
- /** Defines callbacks for service binding, passed to bindService() */
- private ServiceConnection mConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName className, IBinder binder) {
- service = ISipService.Stub.asInterface(binder);
- Log.i(TAG, "Placing call");
- mCurrentCallFragment = new CallFragment();
- mCurrentCallFragment.setArguments(getIntent().getExtras());
- slidingPaneLayout.setCurFragment(mCurrentCallFragment);
- getIntent().getExtras();
- mCallsFragment.update();
- getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
+ /** Defines callbacks for service binding, passed to bindService() */
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName className, IBinder binder) {
+ service = ISipService.Stub.asInterface(binder);
+ Log.i(TAG, "Placing call");
+ mCurrentCallFragment = new CallFragment();
+ Uri u = getIntent().getData();
+ if (u != null) {
+ CallContact c = CallContact.ContactBuilder.buildUnknownContact(u.getSchemeSpecificPart());
+ try {
+ service.destroyNotification();
+ SipCall call = SipCall.SipCallBuilder.getInstance().startCallCreation().addContact(c)
+ .setAccountID(service.getAccountList().get(1).toString()).setCallType(SipCall.state.CALL_TYPE_OUTGOING).build();
+ Bundle b = new Bundle();
+ b.putParcelable("CallInfo", call);
+ mCurrentCallFragment.setArguments(b);
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- }
+ } else {
+ mCurrentCallFragment.setArguments(getIntent().getExtras());
+ }
- @Override
- public void onServiceDisconnected(ComponentName arg0) {
- }
- };
+ slidingPaneLayout.setCurFragment(mCurrentCallFragment);
+ getIntent().getExtras();
+ mCallsFragment.update();
+ getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
- @Override
- public void incomingCall(Intent call) {
- Toast.makeText(this, "New Call incoming", Toast.LENGTH_LONG).show();
+ }
- mCallsFragment.update();
+ @Override
+ public void onServiceDisconnected(ComponentName arg0) {
+ }
+ };
- }
+ @Override
+ public void incomingCall(Intent call) {
+ Toast.makeText(this, "New Call incoming", Toast.LENGTH_LONG).show();
- @Override
- public void callStateChanged(Intent callState) {
+ mCallsFragment.update();
- Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
- processCallStateChangedSignal(b.getString("CallID"), b.getString("State"));
+ }
- }
+ @Override
+ public void callStateChanged(Intent callState) {
- public void processCallStateChangedSignal(String callID, String newState) {
- /*
- * Bundle bundle = intent.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate"); String callID = bundle.getString("CallID"); String
- * newState = bundle.getString("State");
- */
- // CallFragment fr = mCurrentCallFragment;
+ Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
+ processCallStateChangedSignal(b.getString("CallID"), b.getString("State"));
- mCallsFragment.update();
+ }
- mCurrentCallFragment.changeCallState(callID, newState);
+ public void processCallStateChangedSignal(String callID, String newState) {
+ /*
+ * Bundle bundle = intent.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate"); String callID = bundle.getString("CallID"); String
+ * newState = bundle.getString("State");
+ */
+ // CallFragment fr = mCurrentCallFragment;
- HashMap<String, SipCall> map;
- try {
- map = (HashMap<String, SipCall>) service.getCallList();
- if(map.size() == 0){
- finish();
- }
- } catch (RemoteException e) {
- Log.e(TAG, e.toString());
- }
+ mCallsFragment.update();
+ mCurrentCallFragment.changeCallState(callID, newState);
- Log.w(TAG, "processCallStateChangedSignal " + newState);
+ HashMap<String, SipCall> map;
+ try {
+ map = (HashMap<String, SipCall>) service.getCallList();
+ if (map.size() == 0) {
+ finish();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
+ }
- }
+ Log.w(TAG, "processCallStateChangedSignal " + newState);
- @Override
- public void incomingText(Intent msg) {
- Bundle b = msg.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
-
+ }
+
+ @Override
+ public void incomingText(Intent msg) {
+ Bundle b = msg.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
+
Toast.makeText(this, b.getString("From") + " : " + b.getString("Msg"), Toast.LENGTH_LONG).show();
- }
+ }
- @Override
- public ISipService getService() {
- return service;
- }
+ @Override
+ public ISipService getService() {
+ return service;
+ }
- @Override
- public void onCallSelected(SipCall call) {
-
- mCurrentCallFragment.getBubbleView().restartDrawing();
- mCurrentCallFragment = new CallFragment();
- Bundle b = new Bundle();
- b.putParcelable("CallInfo", call);
- mCurrentCallFragment.setArguments(b);
- getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
+ @Override
+ public void onCallSelected(SipCall call) {
- onCallResumed(call);
- slidingPaneLayout.setCurFragment(mCurrentCallFragment);
- slidingPaneLayout.closePane();
+ mCurrentCallFragment.getBubbleView().restartDrawing();
+ mCurrentCallFragment = new CallFragment();
+ Bundle b = new Bundle();
+ b.putParcelable("CallInfo", call);
+ mCurrentCallFragment.setArguments(b);
+ getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
- }
+ onCallResumed(call);
+ slidingPaneLayout.setCurFragment(mCurrentCallFragment);
+ slidingPaneLayout.closePane();
- @Override
- public void callContact(SipCall call) {
- try {
- service.placeCall(call);
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ }
- }
+ @Override
+ public void callContact(SipCall call) {
+ try {
+ service.placeCall(call);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
- @Override
- public void onCallAccepted(SipCall call) {
- int callState = call.getCallStateInt();
- if (callState != state.CALL_STATE_RINGING && callState != state.CALL_STATE_NONE) {
- return;
- }
+ }
- try {
- service.accept(call.getCallId());
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ @Override
+ public void onCallAccepted(SipCall call) {
+ int callState = call.getCallStateInt();
+ if (callState != state.CALL_STATE_RINGING && callState != state.CALL_STATE_NONE) {
+ return;
+ }
- }
+ try {
+ service.accept(call.getCallId());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
- @Override
- public void onCallRejected(SipCall call) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_RINGING) {
- service.refuse(call.getCallId());
- return;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
- }
+ }
- @Override
- public void onCallEnded(SipCall call) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_NONE || call.getCallStateInt() == state.CALL_STATE_CURRENT
- || call.getCallStateInt() == state.CALL_STATE_HOLD) {
- service.hangUp(call.getCallId());
- return;
+ @Override
+ public void onCallRejected(SipCall call) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_RINGING) {
+ service.refuse(call.getCallId());
+ return;
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ }
- } else if (call.getCallStateInt() == state.CALL_STATE_RINGING) {
- if (call.getCallType() == state.CALL_TYPE_INCOMING) {
- service.refuse(call.getCallId());
- return;
- } else if (call.getCallType() == state.CALL_TYPE_OUTGOING) {
- service.hangUp(call.getCallId());
- return;
- }
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
- }
+ @Override
+ public void onCallEnded(SipCall call) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_NONE || call.getCallStateInt() == state.CALL_STATE_CURRENT
+ || call.getCallStateInt() == state.CALL_STATE_HOLD) {
+ service.hangUp(call.getCallId());
+ return;
- @Override
- public void onCallSuspended(SipCall call) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
- service.hold(call.getCallId());
- return;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
- }
+ } else if (call.getCallStateInt() == state.CALL_STATE_RINGING) {
+ if (call.getCallType() == state.CALL_TYPE_INCOMING) {
+ service.refuse(call.getCallId());
+ return;
+ } else if (call.getCallType() == state.CALL_TYPE_OUTGOING) {
+ service.hangUp(call.getCallId());
+ return;
+ }
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ }
- @Override
- public void onCallResumed(SipCall call) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_HOLD) {
- service.unhold(call.getCallId());
- return;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ @Override
+ public void onCallSuspended(SipCall call) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
+ service.hold(call.getCallId());
+ return;
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ }
+ @Override
+ public void onCallResumed(SipCall call) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_HOLD) {
+ service.unhold(call.getCallId());
+ return;
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
- }
+ }
- @Override
- public void onCalltransfered(SipCall call,String to) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
- service.transfer(call.getCallId(), to);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ @Override
+ public void onCalltransfered(SipCall call, String to) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
+ service.transfer(call.getCallId(), to);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
- }
+ }
- @Override
- public void onRecordCall(SipCall call) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
- service.setRecordPath(Environment.getExternalStorageDirectory().getAbsolutePath());
- Log.w(TAG, "Recording path" + service.getRecordPath());
- service.setRecordingCall(call.getCallId());
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ @Override
+ public void onRecordCall(SipCall call) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
+ service.setRecordPath(Environment.getExternalStorageDirectory().getAbsolutePath());
+ Log.w(TAG, "Recording path" + service.getRecordPath());
+ service.setRecordingCall(call.getCallId());
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
- }
+ }
- @Override
- public void onSendMessage(SipCall call, String msg) {
- try {
- if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
- service.sendTextMessage(call.getCallId(), msg, "Me");
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ Intent launchHome = new Intent(this, SFLPhoneHomeActivity.class);
+ launchHome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(launchHome);
+ }
- }
+ @Override
+ public void onSendMessage(SipCall call, String msg) {
+ try {
+ if (call.getCallStateInt() == state.CALL_STATE_CURRENT) {
+ service.sendTextMessage(call.getCallId(), msg, "Me");
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
index eb8d207..eb43a96 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -42,9 +42,12 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
+import android.database.Cursor;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
@@ -61,10 +64,10 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.adapters.AccountSelectionAdapter;
import com.savoirfairelinux.sflphone.adapters.SectionsPagerAdapter;
-import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
import com.savoirfairelinux.sflphone.fragments.DialingFragment;
import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
+import com.savoirfairelinux.sflphone.fragments.HomeFragment;
import com.savoirfairelinux.sflphone.fragments.MenuFragment;
import com.savoirfairelinux.sflphone.interfaces.AccountsInterface;
import com.savoirfairelinux.sflphone.interfaces.CallInterface;
@@ -79,7 +82,7 @@
import com.savoirfairelinux.sflphone.views.CustomSlidingDrawer;
public class SFLPhoneHomeActivity extends Activity implements DialingFragment.Callbacks, ContactListFragment.Callbacks,
- CallElementListFragment.Callbacks, HistoryFragment.Callbacks, CallInterface, AccountsInterface {
+ HomeFragment.Callbacks, HistoryFragment.Callbacks, CallInterface, AccountsInterface {
SectionsPagerAdapter mSectionsPagerAdapter = null;
static final String TAG = "SFLPhoneHomeActivity";
@@ -198,7 +201,7 @@
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
- mViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
+ mViewPager.setPageTransformer(true, new ZoomOutPageTransformer(0.7f));
mTitle = mDrawerTitle = getTitle();
@@ -288,7 +291,7 @@
this.mTabHost,
this.mTabHost.newTabSpec("Tab2").setIndicator(mSectionsPagerAdapter.getPageTitle(1),
getResources().getDrawable(mSectionsPagerAdapter.getIconOf(1))), (tabInfo = new TabInfo("Tab2",
- CallElementListFragment.class, args)));
+ HomeFragment.class, args)));
this.mapTabInfo.put(tabInfo.tag, tabInfo);
SFLPhoneHomeActivity
.AddTab(this,
@@ -343,10 +346,12 @@
private boolean isClosing = false;
private Timer t = new Timer();
+
+
@Override
public void onBackPressed() {
if (mDrawer.isOpened()) {
- mDrawer.close();
+ mDrawer.animateClose();
return;
}
@@ -373,6 +378,12 @@
super.onPause();
unregisterReceiver(callReceiver);
unregisterReceiver(accountReceiver);
+ try {
+ service.createNotification();
+
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
+ }
}
@@ -389,12 +400,7 @@
/* stop the service, if no other bound user, no need to check if it is running */
if (mBound) {
Log.i(TAG, "onDestroy: Unbinding service...");
- try {
- service.createNotification();
-
- } catch (RemoteException e) {
- Log.e(TAG, e.toString());
- }
+
unbindService(mConnection);
mBound = false;
@@ -403,12 +409,12 @@
super.onDestroy();
}
- public void launchCallActivity(SipCall infos, String action) {
+ public void launchCallActivity(SipCall infos) {
Log.i(TAG, "Launch Call Activity");
Bundle bundle = new Bundle();
- bundle.putString("action", action);
bundle.putParcelable("CallInfo", infos);
Intent intent = new Intent().setClass(this, CallActivity.class);
+
intent.putExtras(bundle);
startActivityForResult(intent, REQUEST_CODE_CALL);
}
@@ -474,7 +480,7 @@
@Override
public void onCallSelected(SipCall c) {
- launchCallActivity(c, "display");
+ launchCallActivity(c);
}
@@ -493,7 +499,7 @@
// mCallElementList.addCall(infos);
- launchCallActivity(infos, CallManagerCallBack.INCOMING_CALL);
+ launchCallActivity(infos);
}
@@ -517,18 +523,46 @@
}
@Override
- public void onContactSelected(CallContact c) {
+ public void onContactSelected(final CallContact c) {
- SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance();
- try {
- callBuilder.startCallCreation().setAccountID(service.getAccountList().get(1).toString()).setCallType(SipCall.state.CALL_TYPE_OUTGOING);
- callBuilder.addContact(c);
- launchCallActivity(callBuilder.build(), "call");
- } catch (RemoteException e1) {
- Log.e(TAG, e1.toString());
- } catch (Exception e) {
- Log.e(TAG, e.toString());
- }
+ Thread launcher = new Thread(new Runnable() {
+
+ final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE };
+ final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE };
+
+ @Override
+ public void run() {
+ SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance();
+ try {
+ callBuilder.startCallCreation().setAccountID(service.getAccountList().get(1).toString()).setCallType(SipCall.state.CALL_TYPE_OUTGOING);
+ Cursor cPhones = getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION,
+ Phone.CONTACT_ID + " =" + c.getId(), null, null);
+
+ while (cPhones.moveToNext()) {
+ c.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE)));
+ }
+ cPhones.close();
+
+ Cursor cSip = getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION,
+ Phone.CONTACT_ID + "=" + c.getId(), null, null);
+
+ while (cSip.moveToNext()) {
+ c.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE)));
+ }
+ cSip.close();
+ callBuilder.addContact(c);
+ launchCallActivity(callBuilder.build());
+ } catch (RemoteException e1) {
+ Log.e(TAG, e1.toString());
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+
+ }
+ });
+ launcher.start();
+ mDrawer.close();
+
}
@@ -540,7 +574,7 @@
callBuilder.addContact(CallContact.ContactBuilder.buildUnknownContact(to));
try {
- launchCallActivity(callBuilder.build(), "call");
+ launchCallActivity(callBuilder.build());
} catch (Exception e) {
Log.e(TAG, e.toString());
}
@@ -593,14 +627,9 @@
*/
private class TabInfo {
private String tag;
- private Class<?> clss;
- private Bundle args;
- private Fragment fragment;
TabInfo(String tag, Class<?> clazz, Bundle args) {
this.tag = tag;
- this.clss = clazz;
- this.args = args;
}
}
@@ -613,7 +642,7 @@
@Override
public void openDrawer() {
- mDrawer.open();
+ mDrawer.animateOpen();
}
@Override
diff --git a/src/com/savoirfairelinux/sflphone/client/ZoomOutPageTransformer.java b/src/com/savoirfairelinux/sflphone/client/ZoomOutPageTransformer.java
index 544b32c..61da37f 100644
--- a/src/com/savoirfairelinux/sflphone/client/ZoomOutPageTransformer.java
+++ b/src/com/savoirfairelinux/sflphone/client/ZoomOutPageTransformer.java
@@ -4,40 +4,24 @@
import android.support.v4.view.ViewPager;
public class ZoomOutPageTransformer implements ViewPager.PageTransformer {
- private static float MIN_SCALE = 0.85f;
- private static float MIN_ALPHA = 0.5f;
+ private final float scalingStart;
+
+ public ZoomOutPageTransformer(float scalingStart) {
+ super();
+ this.scalingStart = 1 - scalingStart;
+ }
- public void transformPage(View view, float position) {
- int pageWidth = view.getWidth();
- int pageHeight = view.getHeight();
+ @Override
+ public void transformPage(View page, float position) {
- if (position < -1) { // [-Infinity,-1)
- // This page is way off-screen to the left.
- view.setAlpha(0);
+ if (position >= 0) {
+ final int w = page.getWidth();
+ float scaleFactor = 1 - scalingStart * position;
- } else if (position <= 1) { // [-1,1]
- // Modify the default slide transition to shrink the page as well
- float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
- float vertMargin = pageHeight * (1 - scaleFactor) / 2;
- float horzMargin = pageWidth * (1 - scaleFactor) / 2;
- if (position < 0) {
- view.setTranslationX(horzMargin - vertMargin / 2);
- } else {
- view.setTranslationX(-horzMargin + vertMargin / 2);
- }
-
- // Scale the page down (between MIN_SCALE and 1)
- view.setScaleX(scaleFactor);
- view.setScaleY(scaleFactor);
-
- // Fade the page relative to its size.
- view.setAlpha(MIN_ALPHA +
- (scaleFactor - MIN_SCALE) /
- (1 - MIN_SCALE) * (1 - MIN_ALPHA));
-
- } else { // (1,+Infinity]
- // This page is way off-screen to the right.
- view.setAlpha(0);
+ page.setAlpha(1 - position);
+ page.setScaleX(scaleFactor);
+ page.setScaleY(scaleFactor);
+ page.setTranslationX(w * (1 - position) - w);
}
}
}
\ No newline at end of file
diff --git a/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
index 3fd80fa..d50fbdd 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
@@ -33,10 +33,10 @@
import java.util.ArrayList;
+import android.animation.LayoutTransition;
import android.app.Activity;
import android.app.Fragment;
import android.app.LoaderManager;
-import android.content.Intent;
import android.content.Loader;
import android.net.Uri;
import android.os.Bundle;
@@ -47,30 +47,28 @@
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
-import android.view.MenuItem;
import android.view.View;
import android.view.View.DragShadowBuilder;
import android.view.View.OnClickListener;
import android.view.View.OnDragListener;
import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ImageButton;
+import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SearchView;
+import android.widget.SearchView.OnCloseListener;
import android.widget.SearchView.OnQueryTextListener;
-import android.widget.ViewSwitcher;
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.adapters.ContactsAdapter;
import com.savoirfairelinux.sflphone.adapters.StarredContactsAdapter;
-import com.savoirfairelinux.sflphone.client.CallActivity;
-import com.savoirfairelinux.sflphone.fragments.HistoryFragment.Callbacks;
import com.savoirfairelinux.sflphone.loaders.ContactsLoader;
import com.savoirfairelinux.sflphone.model.CallContact;
-import com.savoirfairelinux.sflphone.model.SipCall;
import com.savoirfairelinux.sflphone.service.ISipService;
import com.savoirfairelinux.sflphone.views.TACGridView;
@@ -81,6 +79,8 @@
String mCurFilter;
+ private RelativeLayout mHandle;
+
public static final int CONTACT_LOADER = 555;
@Override
@@ -135,7 +135,7 @@
mCallbacks = (Callbacks) activity;
}
-
+
@Override
public void onDetach() {
super.onDetach();
@@ -159,23 +159,14 @@
public boolean onItemLongClick(AdapterView<?> av, View view, int pos, long id) {
DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo));
view.startDrag(null, shadowBuilder, view, 0);
-// view.setVisibility(View.INVISIBLE);
+ // view.setVisibility(View.INVISIBLE);
mCallbacks.onContactDragged();
+// ((SearchView) mHandle.findViewById(R.id.contact_search_text)).setIconified(true);
return true;
}
};
-// private void launchCallActivity(CallContact c) {
-// Log.i(TAG, "Launch Call Activity");
-// Bundle bundle = new Bundle();
-// bundle.putString("action", "call");
-// bundle.putParcelable("CallContact", c);
-// Intent intent = new Intent().setClass(getActivity(), CallActivity.class);
-// intent.putExtras(bundle);
-// getActivity().startActivity(intent);
-// }
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
@@ -187,7 +178,8 @@
@Override
public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
mCallbacks.onContactSelected(mListAdapter.getItem(pos));
-
+// ((SearchView) mHandle.findViewById(R.id.contact_search_text)).setIconified(true);
+
}
});
list.setOnItemLongClickListener(mItemLongClickListener);
@@ -199,15 +191,15 @@
list.setAdapter(mListAdapter);
grid.setAdapter(mGridAdapter);
grid.setExpanded(true);
-
-
+
grid.setOnDragListener(dragListener);
grid.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
-// launchCallActivity(mGridAdapter.getItem(pos));
+ // launchCallActivity(mGridAdapter.getItem(pos));
mCallbacks.onContactSelected(mGridAdapter.getItem(pos));
+// ((SearchView) mHandle.findViewById(R.id.contact_search_text)).setIconified(true);
}
});
grid.setOnItemLongClickListener(mItemLongClickListener);
@@ -226,10 +218,9 @@
case DragEvent.ACTION_DRAG_ENTERED:
break;
case DragEvent.ACTION_DRAG_EXITED:
-// v.setBackgroundDrawable(null);
+ // v.setBackgroundDrawable(null);
break;
case DragEvent.ACTION_DROP:
- View view = (View) event.getLocalState();
break;
case DragEvent.ACTION_DRAG_ENDED:
View view1 = (View) event.getLocalState();
@@ -241,22 +232,20 @@
}
};
- private RelativeLayout mHandle;
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Place an action bar item for searching
-// inflater.inflate(R.menu.contact_list_menu, menu);
-// MenuItem item = menu.findItem(R.id.menu_search);
-// SearchView sv = new SearchView(getActivity());
-// sv.setOnQueryTextListener(this);
-// item.setActionView(sv);
+ // inflater.inflate(R.menu.contact_list_menu, menu);
+ // MenuItem item = menu.findItem(R.id.menu_search);
+ // SearchView sv = new SearchView(getActivity());
+ // sv.setOnQueryTextListener(this);
+ // item.setActionView(sv);
}
@Override
public boolean onQueryTextChange(String newText) {
-
- Log.i(TAG,"onQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChangeonQueryTextChange");
+
// Called when the action bar search text has changed. Update
// the search filter, and restart the loader to do a new query
// with this filter.
@@ -276,7 +265,6 @@
@Override
public boolean onQueryTextSubmit(String query) {
- Log.i(TAG,"onQueryTextSubmitonQueryTextSubmitonQueryTextSubmitonQueryTextSubmitonQueryTextSubmitonQueryTextSubmitonQueryTextSubmit");
// Return false to let the SearchView perform the default action
return false;
}
@@ -318,29 +306,34 @@
public void setHandleView(RelativeLayout handle) {
mHandle = handle;
-// ((ImageButton) handle.findViewById(R.id.contact_search)).setTag(R.id.contact_search, false);
+
+
+ // ((ImageButton) handle.findViewById(R.id.contact_search)).setTag(R.id.contact_search, false);
+
- ((SearchView)mHandle.findViewById(R.id.contact_search_text)).setOnQueryTextListener(this);
- ((SearchView)mHandle.findViewById(R.id.contact_search_text)).setOnSearchClickListener(new OnClickListener() {
+ ((ImageButton)handle.findViewById(R.id.contact_search_button)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
+ SearchView search = new SearchView(getActivity());
+ //Get the ID for the search bar LinearLayout
+ int searchBarId = search.getContext().getResources().getIdentifier("android:id/search_bar", null, null);
+ //Get the search bar Linearlayout
+ LinearLayout searchBar = (LinearLayout) search.findViewById(searchBarId);
+ searchBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
+ //Give the Linearlayout a transition animation.
+ searchBar.setLayoutTransition(new LayoutTransition());
+ search.setOnQueryTextListener(ContactListFragment.this);
+ search.setIconified(false);
+ getActivity().getActionBar().setDisplayShowCustomEnabled(true);
+ getActivity().getActionBar().setCustomView(search);
mCallbacks.openDrawer();
}
});
-// ((ImageButton) mHandle.findViewById(R.id.contact_search)).setOnClickListener(new OnClickListener() {
-//
-// @Override
-// public void onClick(View v) {
-// Log.i(TAG, "Click on serach");
-//// ((ViewSwitcher)mHandle.findViewById(R.id.view_switcher)).showNext();
-//// ((SearchView)mHandle.findViewById(R.id.contact_search_text)).
-//
-//
-// }
-// });
+
}
+
}
diff --git a/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java b/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
index 853d0ff..8711384 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
@@ -75,8 +75,8 @@
AccountSelectionAdapter mAdapter;
private Callbacks mCallbacks = sDummyCallbacks;
private Spinner spinnerAccounts;
-
- private static final int ACCOUNTS_LOADER = 555;
+
+ private static final int ACCOUNTS_LOADER = 555;
/**
* A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity.
@@ -254,7 +254,8 @@
}
public void updateAllAccounts() {
- getActivity().getLoaderManager().restartLoader(ACCOUNTS_LOADER, null, this);
+ if (getActivity() != null)
+ getActivity().getLoaderManager().restartLoader(ACCOUNTS_LOADER, null, this);
}
diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
similarity index 94%
rename from src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
index 3d24cb4..a3dcdd7 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
@@ -66,8 +66,8 @@
/**
* Main list of Call Elements. We don't manage contacts ourself so they are
*/
-public class CallElementListFragment extends ListFragment {
- private static final String TAG = CallElementListFragment.class.getSimpleName();
+public class HomeFragment extends ListFragment {
+ private static final String TAG = HomeFragment.class.getSimpleName();
private CallElementAdapter mAdapter;
@@ -254,20 +254,20 @@
}
- private static final int REQUEST_CODE_PREFERENCES = 1;
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
- switch (item.getItemId()) {
- case R.id.menu_settings:
- Intent launchPreferencesIntent = new Intent().setClass(getActivity(), SFLPhonePreferenceActivity.class);
- startActivityForResult(launchPreferencesIntent, SFLPhoneHomeActivity.REQUEST_CODE_PREFERENCES);
- break;
- }
-
- return super.onOptionsItemSelected(item);
- }
+// private static final int REQUEST_CODE_PREFERENCES = 1;
+//
+// @Override
+// public boolean onOptionsItemSelected(MenuItem item) {
+// Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
+// switch (item.getItemId()) {
+// case R.id.menu_settings:
+// Intent launchPreferencesIntent = new Intent().setClass(getActivity(), SFLPhonePreferenceActivity.class);
+// startActivityForResult(launchPreferencesIntent, SFLPhoneHomeActivity.REQUEST_CODE_PREFERENCES);
+// break;
+// }
+//
+// return super.onOptionsItemSelected(item);
+// }
public void updateCall(String iD, String newState) {
if (mAdapter == null) {
diff --git a/src/com/savoirfairelinux/sflphone/fragments/MenuFragment.java b/src/com/savoirfairelinux/sflphone/fragments/MenuFragment.java
index 095b135..3cac94e 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/MenuFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/MenuFragment.java
@@ -1,14 +1,11 @@
package com.savoirfairelinux.sflphone.fragments;
-import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import android.app.Activity;
import android.app.Fragment;
-import android.app.LoaderManager.LoaderCallbacks;
import android.content.Intent;
-import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
@@ -24,7 +21,6 @@
import android.widget.TextView;
import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.adapters.ContactPictureLoader;
import com.savoirfairelinux.sflphone.adapters.MenuAdapter;
import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
import com.savoirfairelinux.sflphone.client.SFLPhonePreferenceActivity;
@@ -85,13 +81,17 @@
});
Cursor mProfileCursor = getActivity().getContentResolver().query(Profile.CONTENT_URI, mProjection, null, null, null);
- mProfileCursor.moveToFirst();
- ((ImageView) inflatedView.findViewById(R.id.user_photo)).setImageURI(Uri.parse(mProfileCursor.getString(mProfileCursor
- .getColumnIndex(Profile.PHOTO_THUMBNAIL_URI))));
- ((TextView) inflatedView.findViewById(R.id.user_name)).setText(mProfileCursor.getString(mProfileCursor
- .getColumnIndex(Profile.DISPLAY_NAME_PRIMARY)));
-
+ if (mProfileCursor.getCount() > 0) {
+ mProfileCursor.moveToFirst();
+ String photo_uri = mProfileCursor.getString(mProfileCursor.getColumnIndex(Profile.PHOTO_THUMBNAIL_URI));
+ if (photo_uri != null) {
+ ((ImageView) inflatedView.findViewById(R.id.user_photo)).setImageURI(Uri.parse(photo_uri));
+ }
+ ((TextView) inflatedView.findViewById(R.id.user_name)).setText(mProfileCursor.getString(mProfileCursor
+ .getColumnIndex(Profile.DISPLAY_NAME_PRIMARY)));
+ mProfileCursor.close();
+ }
return inflatedView;
}
diff --git a/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java b/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
index 61ebcc3..dd793c2 100644
--- a/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
+++ b/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
@@ -43,27 +43,27 @@
int iPhoto = result.getColumnIndex(Contacts.PHOTO_ID);
int iStarred = result.getColumnIndex(Contacts.STARRED);
CallContact.ContactBuilder builder = CallContact.ContactBuilder.getInstance();
-
+
while (result.moveToNext()) {
builder.startNewContact(result.getLong(iID), result.getString(iName), result.getLong(iPhoto));
- Cursor cPhones = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION,
- Phone.CONTACT_ID + " =" + result.getLong(iID), null, null);
+// Cursor cPhones = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION,
+// Phone.CONTACT_ID + " =" + result.getLong(iID), null, null);
- while (cPhones.moveToNext()) {
- builder.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE)));
-// Log.i(TAG,"Phone:"+cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)));
- }
- cPhones.close();
-
- Cursor cSip = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION,
- Phone.CONTACT_ID + "=" + result.getLong(iID), null, null);
-
- while (cSip.moveToNext()) {
- builder.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE)));
-// Log.i(TAG,"Phone:"+cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)));
- }
- cSip.close();
+// while (cPhones.moveToNext()) {
+// builder.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE)));
+//// Log.i(TAG,"Phone:"+cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)));
+// }
+// cPhones.close();
+//
+// Cursor cSip = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION,
+// Phone.CONTACT_ID + "=" + result.getLong(iID), null, null);
+//
+// while (cSip.moveToNext()) {
+// builder.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE)));
+//// Log.i(TAG,"Phone:"+cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)));
+// }
+// cSip.close();
contacts.add(builder.build());
if (result.getInt(iStarred) == 1) {
diff --git a/src/com/savoirfairelinux/sflphone/model/CallContact.java b/src/com/savoirfairelinux/sflphone/model/CallContact.java
index 69f209f..0603185 100644
--- a/src/com/savoirfairelinux/sflphone/model/CallContact.java
+++ b/src/com/savoirfairelinux/sflphone/model/CallContact.java
@@ -270,4 +270,14 @@
}
+ public void addPhoneNumber(String tel, int type) {
+ phones.add(new Phone(tel, type));
+
+ }
+
+ public void addSipNumber(String tel, int type) {
+ sip_phones.add(new Phone(tel, type));
+
+ }
+
}
diff --git a/src/com/savoirfairelinux/sflphone/views/CustomSlidingDrawer.java b/src/com/savoirfairelinux/sflphone/views/CustomSlidingDrawer.java
index e83ae8a..972cc7a 100644
--- a/src/com/savoirfairelinux/sflphone/views/CustomSlidingDrawer.java
+++ b/src/com/savoirfairelinux/sflphone/views/CustomSlidingDrawer.java
@@ -1,6 +1,7 @@
package com.savoirfairelinux.sflphone.views;
import android.content.Context;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -10,6 +11,7 @@
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.VelocityTracker;
@@ -352,10 +354,13 @@
View trackHandle = mTrackHandle;
// set the rect frame to the mTrackHandle view borders instead of the
// hole handle view
+
+ Resources r = getResources();
+ int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, r.getDisplayMetrics());
// getParent() => The right and left are valid, but we need to get the
// parent top and bottom to have absolute values (in screen)
- frame.set(trackHandle.getLeft(), ((ViewGroup) trackHandle.getParent()).getTop(), trackHandle.getRight(), ((ViewGroup) trackHandle.getParent()).getBottom());
+ frame.set(trackHandle.getLeft(), ((ViewGroup) trackHandle.getParent()).getTop(), trackHandle.getRight() - px, ((ViewGroup) trackHandle.getParent()).getBottom());
// handle.getHitRect(frame);
if (!mTracking && !frame.contains((int) x, (int) y)) {
@@ -778,6 +783,10 @@
* @see #toggle()
*/
public void animateOpen() {
+
+ if (mExpanded) {
+ return;
+ }
prepareContent();
final OnDrawerScrollListener scrollListener = mOnDrawerScrollListener;
if (scrollListener != null) {