Skip to content
Snippets Groups Projects
Commit 450458a7 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

first implementation of sliding panel

parent eeaa2268
No related branches found
No related tags found
No related merge requests found
res/drawable/bg_108.png

59 KiB

res/drawable/bg_144.png

87.6 KiB

res/drawable/bg_216.png

144 KiB

...@@ -36,8 +36,12 @@ as that of the covered work. ...@@ -36,8 +36,12 @@ as that of the covered work.
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
<org.sflphone.views.SlidingUpPanelLayout
android:id="@+id/contact_panel"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/org.sflphone" xmlns:app="http://schemas.android.com/apk/res/org.sflphone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -74,14 +78,13 @@ as that of the covered work. ...@@ -74,14 +78,13 @@ as that of the covered work.
android:background="@color/black" android:background="@color/black"
android:clickable="false" android:clickable="false"
android:focusable="false" /> android:focusable="false" />
</RelativeLayout>
<include <FrameLayout
android:id="@+id/custom_sliding_drawer" android:id="@+id/contacts_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent" />
android:layout_alignParentBottom="true" </org.sflphone.views.SlidingUpPanelLayout>
layout="@layout/contact_drawer" />
</RelativeLayout>
<FrameLayout <FrameLayout
android:id="@+id/left_drawer" android:id="@+id/left_drawer"
......
...@@ -44,24 +44,6 @@ as that of the covered work. ...@@ -44,24 +44,6 @@ as that of the covered work.
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="72dp" > android:layout_height="72dp" >
<!-- <ImageView -->
<!-- android:id="@+id/menu_top_shadow_left" -->
<!-- android:layout_width="0dp" -->
<!-- android:layout_height="4dp" -->
<!-- android:layout_above="@+id/coucou" -->
<!-- android:layout_alignParentLeft="true" -->
<!-- android:layout_toLeftOf="@+id/hello" -->
<!-- android:src="@drawable/defaultshadowtop" /> -->
<!-- <ImageView -->
<!-- android:id="@+id/menu_top_shadow_right" -->
<!-- android:layout_width="0dp" -->
<!-- android:layout_height="4dp" -->
<!-- android:layout_above="@+id/coucou" -->
<!-- android:layout_alignParentRight="true" -->
<!-- android:layout_toRightOf="@+id/hello" -->
<!-- android:src="@drawable/defaultshadowtop" /> -->
<RelativeLayout <RelativeLayout
android:id="@+id/coucou" android:id="@+id/coucou"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -36,6 +36,52 @@ as that of the covered work. ...@@ -36,6 +36,52 @@ as that of the covered work.
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical" >
<RelativeLayout
android:id="@+id/slider_button"
android:layout_width="match_parent"
android:layout_height="68dp" >
<RelativeLayout
android:id="@+id/coucou"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_drawer_handle_height"
android:layout_alignParentBottom="true"
android:background="@color/sfl_dark_blue" >
<TextView
android:id="@+id/handle_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:gravity="center"
android:text="Contacts"
android:textColor="@color/white"
android:textStyle="bold" />
<ImageButton
android:id="@+id/contact_search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@color/sfl_dark_blue"
android:gravity="center"
android:src="@drawable/ic_btn_search" >
</ImageButton>
</RelativeLayout>
<!-- Declared after for implicit z order -->
<org.sflphone.views.HalfCircleImageView
android:id="@+id/hello"
android:layout_width="112dp"
android:layout_height="68dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_action_group" />
</RelativeLayout>
<org.sflphone.views.stickylistheaders.StickyListHeadersListView <org.sflphone.views.stickylistheaders.StickyListHeadersListView
android:id="@+id/contacts_list" android:id="@+id/contacts_list"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -43,7 +43,6 @@ import org.sflphone.fragments.HistoryFragment; ...@@ -43,7 +43,6 @@ import org.sflphone.fragments.HistoryFragment;
import org.sflphone.fragments.HomeFragment; import org.sflphone.fragments.HomeFragment;
import org.sflphone.fragments.MenuFragment; import org.sflphone.fragments.MenuFragment;
import org.sflphone.interfaces.CallInterface; import org.sflphone.interfaces.CallInterface;
import org.sflphone.loaders.LoaderConstants;
import org.sflphone.model.CallContact; import org.sflphone.model.CallContact;
import org.sflphone.model.Conference; import org.sflphone.model.Conference;
import org.sflphone.model.SipCall; import org.sflphone.model.SipCall;
...@@ -51,9 +50,9 @@ import org.sflphone.receivers.CallReceiver; ...@@ -51,9 +50,9 @@ import org.sflphone.receivers.CallReceiver;
import org.sflphone.service.CallManagerCallBack; import org.sflphone.service.CallManagerCallBack;
import org.sflphone.service.ISipService; import org.sflphone.service.ISipService;
import org.sflphone.service.SipService; import org.sflphone.service.SipService;
import org.sflphone.views.CustomSlidingDrawer;
import org.sflphone.views.CustomSlidingDrawer.OnDrawerScrollListener;
import org.sflphone.views.PagerSlidingTabStrip; import org.sflphone.views.PagerSlidingTabStrip;
import org.sflphone.views.SlidingUpPanelLayout;
import org.sflphone.views.SlidingUpPanelLayout.PanelSlideListener;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
...@@ -65,6 +64,7 @@ import android.content.IntentFilter; ...@@ -65,6 +64,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
...@@ -103,7 +103,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -103,7 +103,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
private static final int REQUEST_CODE_CALL = 2; private static final int REQUEST_CODE_CALL = 2;
RelativeLayout mSliderButton; RelativeLayout mSliderButton;
CustomSlidingDrawer mContactDrawer; SlidingUpPanelLayout mContactDrawer;
private DrawerLayout mNavigationDrawer; private DrawerLayout mNavigationDrawer;
private ActionBarDrawerToggle mDrawerToggle; private ActionBarDrawerToggle mDrawerToggle;
ImageView mShadow; ImageView mShadow;
...@@ -116,10 +116,6 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -116,10 +116,6 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
private boolean isClosing = false; private boolean isClosing = false;
private Timer t = new Timer(); private Timer t = new Timer();
// private TabHost mTabHost;
// public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
/* called before activity is killed, e.g. rotation */ /* called before activity is killed, e.g. rotation */
@Override @Override
protected void onSaveInstanceState(Bundle bundle) { protected void onSaveInstanceState(Bundle bundle) {
...@@ -152,37 +148,46 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -152,37 +148,46 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
getFragmentManager().beginTransaction().replace(R.id.contacts_frame, mContactsFragment).commit(); getFragmentManager().beginTransaction().replace(R.id.contacts_frame, mContactsFragment).commit();
} }
mContactDrawer = (CustomSlidingDrawer) findViewById(R.id.custom_sliding_drawer); mContactDrawer = (SlidingUpPanelLayout) findViewById(R.id.contact_panel);
// mContactDrawer.setShadowDrawable(getResources().getDrawable(R.drawable.above_shadow));
mContactDrawer.setAnchorPoint(0.3f);
mContactDrawer.setDragView(findViewById(R.id.contacts_frame));
mContactDrawer.setEnableDragViewTouchEvents(true);
// mContactDrawer.setCoveredFadeColor(0xff000000);
mContactDrawer.setPanelSlideListener(new PanelSlideListener() {
mContactDrawer.setOnDrawerScrollListener(new OnDrawerScrollListener() { @Override
public void onPanelSlide(View panel, float slideOffset) {
if (slideOffset < 0.2) {
if (getActionBar().isShowing()) {
getActionBar().hide();
}
} else {
if (!getActionBar().isShowing()) {
getActionBar().show();
}
}
}
@Override @Override
public void onScrollStarted() { public void onPanelExpanded(View panel) {
// getActionBar().hide();
} }
@Override @Override
public void onScrollEnded() { public void onPanelCollapsed(View panel) {
} }
@Override @Override
public void onScroll(int offset) { public void onPanelAnchored(View panel) {
if (offset < 400) {
getActionBar().hide();
// mNavigationDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
} else if (offset > 450) {
getActionBar().show();
// mNavigationDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
} }
}); });
mContactsFragment.setHandleView((RelativeLayout) findViewById(R.id.slider_button)); // TODO
// mContactsFragment.setHandleView((RelativeLayout) findViewById(R.id.slider_button));
mShadow = (ImageView) findViewById(R.id.overall_shadow); mShadow = (ImageView) findViewById(R.id.overall_shadow);
mContactDrawer.setmTrackHandle(findViewById(R.id.slider_button));
// Set up the ViewPager with the sections adapter. // Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager = (ViewPager) findViewById(R.id.pager);
...@@ -226,7 +231,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -226,7 +231,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
super.onPostCreate(savedInstanceState); super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred. // Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState(); mDrawerToggle.syncState();
if (mContactDrawer.isOpened()) { if (mContactDrawer.isExpanded()) {
getActionBar().hide(); getActionBar().hide();
} }
} }
...@@ -269,16 +274,9 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -269,16 +274,9 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
mNavigationDrawer.closeDrawer(Gravity.LEFT); mNavigationDrawer.closeDrawer(Gravity.LEFT);
return; return;
} }
if (getActionBar().getCustomView() != null) {
getActionBar().setDisplayShowCustomEnabled(false);
getActionBar().setCustomView(null);
// Display all the contacts again
getLoaderManager().restartLoader(LoaderConstants.CONTACT_LOADER, null, mContactsFragment);
return;
}
if (mContactDrawer.isOpened()) { if (mContactDrawer.isExpanded() || mContactDrawer.isAnchored()) {
mContactDrawer.animateClose(); mContactDrawer.collapsePane();
return; return;
} }
...@@ -501,7 +499,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -501,7 +499,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
} }
}); });
launcher.start(); launcher.start();
mContactDrawer.animateClose(); mContactDrawer.collapsePane();
} }
...@@ -574,12 +572,12 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -574,12 +572,12 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
@Override @Override
public void onContactDragged() { public void onContactDragged() {
mContactDrawer.animateClose(); mContactDrawer.collapsePane();
} }
@Override @Override
public void openDrawer() { public void openDrawer() {
mContactDrawer.animateOpen(); mContactDrawer.expandPane();
} }
@Override @Override
......
...@@ -168,8 +168,20 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener ...@@ -168,8 +168,20 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false); View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
mHeader = (LinearLayout) inflater.inflate(R.layout.frag_contact_list_header, null); mHeader = (LinearLayout) inflater.inflate(R.layout.frag_contact_list_header, null);
// mPlaceHolder = mHeader.findViewById(R.id.placeholder);
mContactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_list); mContactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_list);
((ImageButton) inflatedView.findViewById(R.id.contact_search_button)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mContactList.smoothScrollToPosition(0);
mQuickReturnSearchView.setOnQueryTextListener(ContactListFragment.this);
mQuickReturnSearchView.setIconified(false);
mQuickReturnSearchView.setFocusable(true);
mCallbacks.openDrawer();
}
});
mQuickReturnSearchView = (SearchView) mHeader.findViewById(R.id.contact_search); mQuickReturnSearchView = (SearchView) mHeader.findViewById(R.id.contact_search);
mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid); mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid);
llMain = (LinearLayout) mHeader.findViewById(R.id.llMain); llMain = (LinearLayout) mHeader.findViewById(R.id.llMain);
...@@ -196,15 +208,6 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener ...@@ -196,15 +208,6 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
} }
}); });
// mQuickReturnSearchView.setOnClickListener(new OnClickListener() {
//
// @Override
// public void onClick(View v) {
// // TODO Stub de la méthode généré automatiquement
//
// }
// });
getLoaderManager().initLoader(LoaderConstants.CONTACT_LOADER, null, this); getLoaderManager().initLoader(LoaderConstants.CONTACT_LOADER, null, this);
} }
...@@ -214,9 +217,7 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener ...@@ -214,9 +217,7 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
public boolean onItemLongClick(AdapterView<?> av, View view, int pos, long id) { public boolean onItemLongClick(AdapterView<?> av, View view, int pos, long id) {
DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo)); DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo));
view.startDrag(null, shadowBuilder, view, 0); view.startDrag(null, shadowBuilder, view, 0);
// view.setVisibility(View.INVISIBLE);
mCallbacks.onContactDragged(); mCallbacks.onContactDragged();
// ((SearchView) mHandle.findViewById(R.id.contact_search_text)).setIconified(true);
return true; return true;
} }
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment