Fix sliding drawer issues
This commit is contained in:
parent
47f8aa2e85
commit
c87d0c3f30
2 changed files with 24 additions and 41 deletions
|
@ -41,8 +41,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.LinearLayout.LayoutParams;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -56,7 +54,7 @@ public class StatusFragment extends Fragment {
|
||||||
private ImageView statusLed, callQuality, encryption;
|
private ImageView statusLed, callQuality, encryption;
|
||||||
private ListView sliderContent;
|
private ListView sliderContent;
|
||||||
private SlidingDrawer drawer;
|
private SlidingDrawer drawer;
|
||||||
private LinearLayout allAccountsLed;
|
// private LinearLayout allAccountsLed;
|
||||||
private Runnable mCallQualityUpdater;
|
private Runnable mCallQualityUpdater;
|
||||||
private boolean isInCall, isAttached = false;
|
private boolean isInCall, isAttached = false;
|
||||||
|
|
||||||
|
@ -69,7 +67,7 @@ public class StatusFragment extends Fragment {
|
||||||
statusLed = (ImageView) view.findViewById(R.id.statusLed);
|
statusLed = (ImageView) view.findViewById(R.id.statusLed);
|
||||||
callQuality = (ImageView) view.findViewById(R.id.callQuality);
|
callQuality = (ImageView) view.findViewById(R.id.callQuality);
|
||||||
encryption = (ImageView) view.findViewById(R.id.encryption);
|
encryption = (ImageView) view.findViewById(R.id.encryption);
|
||||||
allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
|
// allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
|
||||||
|
|
||||||
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
||||||
drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
|
drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
|
||||||
|
@ -152,27 +150,27 @@ public class StatusFragment extends Fragment {
|
||||||
public void run() {
|
public void run() {
|
||||||
statusLed.setImageResource(getStatusIconResource(state, true));
|
statusLed.setImageResource(getStatusIconResource(state, true));
|
||||||
statusText.setText(getStatusIconText(state));
|
statusText.setText(getStatusIconText(state));
|
||||||
setMiniLedsForEachAccount();
|
// setMiniLedsForEachAccount();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMiniLedsForEachAccount() {
|
// private void setMiniLedsForEachAccount() {
|
||||||
if (allAccountsLed == null)
|
// if (allAccountsLed == null)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
|
// if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
|
||||||
allAccountsLed.removeAllViews();
|
// allAccountsLed.removeAllViews();
|
||||||
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
// for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
||||||
ImageView led = new ImageView(getActivity());
|
// ImageView led = new ImageView(getActivity());
|
||||||
LinearLayout.LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
// LinearLayout.LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||||
led.setLayoutParams(params);
|
// led.setLayoutParams(params);
|
||||||
led.setAdjustViewBounds(true);
|
// led.setAdjustViewBounds(true);
|
||||||
led.setImageResource(getStatusIconResource(lpc.getState(), false));
|
// led.setImageResource(getStatusIconResource(lpc.getState(), false));
|
||||||
allAccountsLed.addView(led);
|
// allAccountsLed.addView(led);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) {
|
private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -29,7 +29,6 @@ import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.SoundEffectConstants;
|
import android.view.SoundEffectConstants;
|
||||||
import android.view.VelocityTracker;
|
import android.view.VelocityTracker;
|
||||||
|
@ -333,7 +332,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
int handleWidth = handle.getMeasuredWidth();
|
int handleWidth = handle.getMeasuredWidth();
|
||||||
int handleHeight = handle.getMeasuredHeight();
|
int handleHeight = handle.getMeasuredHeight();
|
||||||
|
|
||||||
Log.d(LOG_TAG, "handleHeight: " + handleHeight);
|
|
||||||
|
|
||||||
int handleLeft;
|
int handleLeft;
|
||||||
int handleTop;
|
int handleTop;
|
||||||
|
@ -343,9 +341,7 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
if (mVertical) {
|
if (mVertical) {
|
||||||
handleLeft = (width - handleWidth) / 2;
|
handleLeft = (width - handleWidth) / 2;
|
||||||
if (mInvert) {
|
if (mInvert) {
|
||||||
Log.d(LOG_TAG, "content.layout(1)");
|
handleTop = mExpanded ? content.getMeasuredHeight() - mBottomOffset : mTopOffset;
|
||||||
handleTop = mExpanded ? getCustomBottom() - mBottomOffset - handleHeight
|
|
||||||
: mTopOffset;
|
|
||||||
content.layout(0, mTopOffset, content.getMeasuredWidth(),
|
content.layout(0, mTopOffset, content.getMeasuredWidth(),
|
||||||
mTopOffset + content.getMeasuredHeight());
|
mTopOffset + content.getMeasuredHeight());
|
||||||
} else {
|
} else {
|
||||||
|
@ -508,9 +504,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
- mTapThreshold);
|
- mTapThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(LOG_TAG, "ACTION_UP: " + "c1: " + c1 + ", c2: " + c2
|
|
||||||
+ ", c3: " + c3 + ", c4: " + c4);
|
|
||||||
|
|
||||||
if (vertical ? c1 || c2 : c3 || c4) {
|
if (vertical ? c1 || c2 : c3 || c4) {
|
||||||
|
|
||||||
if (mAllowSingleTap) {
|
if (mAllowSingleTap) {
|
||||||
|
@ -563,8 +556,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
int bottom = mVertical ? getCustomBottom() + mHandleHeight : getRight();
|
int bottom = mVertical ? getCustomBottom() + mHandleHeight : getRight();
|
||||||
int handleHeight = mVertical ? mHandleHeight : mHandleWidth;
|
int handleHeight = mVertical ? mHandleHeight : mHandleWidth;
|
||||||
|
|
||||||
Log.d(LOG_TAG, "position: " + position + ", velocity: " + velocity
|
|
||||||
+ ", mMaximumMajorVelocity: " + mMaximumMajorVelocity);
|
|
||||||
c1 = mInvert ? velocity < mMaximumMajorVelocity
|
c1 = mInvert ? velocity < mMaximumMajorVelocity
|
||||||
: velocity > mMaximumMajorVelocity;
|
: velocity > mMaximumMajorVelocity;
|
||||||
c2 = mInvert ? (bottom - (position + handleHeight)) + mBottomOffset > handleHeight
|
c2 = mInvert ? (bottom - (position + handleHeight)) + mBottomOffset > handleHeight
|
||||||
|
@ -572,8 +563,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
+ (mVertical ? mHandleHeight : mHandleWidth);
|
+ (mVertical ? mHandleHeight : mHandleWidth);
|
||||||
c3 = mInvert ? velocity < -mMaximumMajorVelocity
|
c3 = mInvert ? velocity < -mMaximumMajorVelocity
|
||||||
: velocity > -mMaximumMajorVelocity;
|
: velocity > -mMaximumMajorVelocity;
|
||||||
Log.d(LOG_TAG, "EXPANDED. c1: " + c1 + ", c2: " + c2 + ", c3: "
|
|
||||||
+ c3);
|
|
||||||
if (always || (c1 || (c2 && c3))) {
|
if (always || (c1 || (c2 && c3))) {
|
||||||
// We are expanded, So animate to CLOSE!
|
// We are expanded, So animate to CLOSE!
|
||||||
mAnimatedAcceleration = mMaximumAcceleration;
|
mAnimatedAcceleration = mMaximumAcceleration;
|
||||||
|
@ -613,12 +602,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
c3 = mInvert ? velocity < -mMaximumMajorVelocity
|
c3 = mInvert ? velocity < -mMaximumMajorVelocity
|
||||||
: velocity > -mMaximumMajorVelocity;
|
: velocity > -mMaximumMajorVelocity;
|
||||||
|
|
||||||
Log.d(LOG_TAG, "COLLAPSED. position: " + position + ", velocity: "
|
|
||||||
+ velocity + ", mMaximumMajorVelocity: "
|
|
||||||
+ mMaximumMajorVelocity);
|
|
||||||
Log.d(LOG_TAG, "COLLAPSED. always: " + always + ", c1: " + c1
|
|
||||||
+ ", c2: " + c2 + ", c3: " + c3);
|
|
||||||
|
|
||||||
if (!always && (c1 || (c2 && c3))) {
|
if (!always && (c1 || (c2 && c3))) {
|
||||||
mAnimatedAcceleration = mMaximumAcceleration;
|
mAnimatedAcceleration = mMaximumAcceleration;
|
||||||
|
|
||||||
|
@ -791,8 +774,6 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
- getLeft(), MeasureSpec.EXACTLY), MeasureSpec
|
- getLeft(), MeasureSpec.EXACTLY), MeasureSpec
|
||||||
.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||||
|
|
||||||
Log.d(LOG_TAG, "content.layout(2)");
|
|
||||||
|
|
||||||
if (mInvert)
|
if (mInvert)
|
||||||
content.layout(0, mTopOffset, content.getMeasuredWidth(),
|
content.layout(0, mTopOffset, content.getMeasuredWidth(),
|
||||||
mTopOffset + content.getMeasuredHeight());
|
mTopOffset + content.getMeasuredHeight());
|
||||||
|
@ -967,6 +948,10 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
* @see #toggle()
|
* @see #toggle()
|
||||||
*/
|
*/
|
||||||
public void animateClose() {
|
public void animateClose() {
|
||||||
|
if (!isOpened()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
prepareContent();
|
prepareContent();
|
||||||
final OnDrawerScrollListener scrollListener = mOnDrawerScrollListener;
|
final OnDrawerScrollListener scrollListener = mOnDrawerScrollListener;
|
||||||
if (scrollListener != null) {
|
if (scrollListener != null) {
|
||||||
|
|
Loading…
Reference in a new issue