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.
android:layout_width="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
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/org.sflphone"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -74,14 +78,13 @@ as that of the covered work.
android:background="@color/black"
android:clickable="false"
android:focusable="false" />
</RelativeLayout>
<include
android:id="@+id/custom_sliding_drawer"
<FrameLayout
android:id="@+id/contacts_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
layout="@layout/contact_drawer" />
</RelativeLayout>
android:layout_height="match_parent" />
</org.sflphone.views.SlidingUpPanelLayout>
<FrameLayout
android:id="@+id/left_drawer"
......
......@@ -44,24 +44,6 @@ as that of the covered work.
android:layout_width="match_parent"
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
android:id="@+id/coucou"
android:layout_width="match_parent"
......
......@@ -36,6 +36,52 @@ as that of the covered work.
android:layout_height="match_parent"
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
android:id="@+id/contacts_list"
android:layout_width="match_parent"
......
......@@ -43,7 +43,6 @@ import org.sflphone.fragments.HistoryFragment;
import org.sflphone.fragments.HomeFragment;
import org.sflphone.fragments.MenuFragment;
import org.sflphone.interfaces.CallInterface;
import org.sflphone.loaders.LoaderConstants;
import org.sflphone.model.CallContact;
import org.sflphone.model.Conference;
import org.sflphone.model.SipCall;
......@@ -51,9 +50,9 @@ import org.sflphone.receivers.CallReceiver;
import org.sflphone.service.CallManagerCallBack;
import org.sflphone.service.ISipService;
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.SlidingUpPanelLayout;
import org.sflphone.views.SlidingUpPanelLayout.PanelSlideListener;
import android.app.Activity;
import android.app.AlertDialog;
......@@ -65,6 +64,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
......@@ -103,7 +103,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
private static final int REQUEST_CODE_CALL = 2;
RelativeLayout mSliderButton;
CustomSlidingDrawer mContactDrawer;
SlidingUpPanelLayout mContactDrawer;
private DrawerLayout mNavigationDrawer;
private ActionBarDrawerToggle mDrawerToggle;
ImageView mShadow;
......@@ -116,10 +116,6 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
private boolean isClosing = false;
private Timer t = new Timer();
// private TabHost mTabHost;
// public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
/* called before activity is killed, e.g. rotation */
@Override
protected void onSaveInstanceState(Bundle bundle) {
......@@ -152,37 +148,46 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
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
public void onScrollStarted() {
// getActionBar().hide();
public void onPanelExpanded(View panel) {
}
@Override
public void onScrollEnded() {
public void onPanelCollapsed(View panel) {
}
@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);
mContactDrawer.setmTrackHandle(findViewById(R.id.slider_button));
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
......@@ -226,7 +231,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
if (mContactDrawer.isOpened()) {
if (mContactDrawer.isExpanded()) {
getActionBar().hide();
}
}
......@@ -269,16 +274,9 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
mNavigationDrawer.closeDrawer(Gravity.LEFT);
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()) {
mContactDrawer.animateClose();
if (mContactDrawer.isExpanded() || mContactDrawer.isAnchored()) {
mContactDrawer.collapsePane();
return;
}
......@@ -501,7 +499,7 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
}
});
launcher.start();
mContactDrawer.animateClose();
mContactDrawer.collapsePane();
}
......@@ -574,12 +572,12 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
@Override
public void onContactDragged() {
mContactDrawer.animateClose();
mContactDrawer.collapsePane();
}
@Override
public void openDrawer() {
mContactDrawer.animateOpen();
mContactDrawer.expandPane();
}
@Override
......
......@@ -168,8 +168,20 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
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);
((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);
mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid);
llMain = (LinearLayout) mHeader.findViewById(R.id.llMain);
......@@ -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);
}
......@@ -214,9 +217,7 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
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);
mCallbacks.onContactDragged();
// ((SearchView) mHandle.findViewById(R.id.contact_search_text)).setIconified(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