mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 22:45:18 +01:00
Different improvements
This commit is contained in:
parent
059035a54c
commit
65e93f91bb
7 changed files with 377 additions and 351 deletions
|
@ -25,7 +25,7 @@ dependencies {
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 21
|
||||||
buildToolsVersion '21.1.0'
|
buildToolsVersion '21.1.1'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
debug {
|
debug {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.telegram.ui.Views.NumberPicker;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
public class AndroidUtilities {
|
public class AndroidUtilities {
|
||||||
|
@ -443,4 +444,25 @@ public class AndroidUtilities {
|
||||||
return dp(56);
|
return dp(56);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Point getRealScreenSize() {
|
||||||
|
Point size = new Point();
|
||||||
|
try {
|
||||||
|
WindowManager windowManager = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
windowManager.getDefaultDisplay().getRealSize(size);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Method mGetRawW = Display.class.getMethod("getRawWidth");
|
||||||
|
Method mGetRawH = Display.class.getMethod("getRawHeight");
|
||||||
|
size.set((Integer) mGetRawW.invoke(windowManager.getDefaultDisplay()), (Integer) mGetRawH.invoke(windowManager.getDefaultDisplay()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,7 @@ import android.os.Environment;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.view.Display;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import org.telegram.android.video.InputSurface;
|
import org.telegram.android.video.InputSurface;
|
||||||
import org.telegram.android.video.MP4Builder;
|
import org.telegram.android.video.MP4Builder;
|
||||||
|
@ -62,7 +60,6 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -739,29 +736,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||||
|
|
||||||
public void processMediaObserver(Uri uri) {
|
public void processMediaObserver(Uri uri) {
|
||||||
try {
|
try {
|
||||||
int width = 0;
|
Point size = AndroidUtilities.getRealScreenSize();
|
||||||
int height = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
WindowManager windowManager = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
Point size = new Point();
|
|
||||||
windowManager.getDefaultDisplay().getRealSize(size);
|
|
||||||
width = size.x;
|
|
||||||
height = size.y;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Method mGetRawW = Display.class.getMethod("getRawWidth");
|
|
||||||
Method mGetRawH = Display.class.getMethod("getRawHeight");
|
|
||||||
width = (Integer) mGetRawW.invoke(windowManager.getDefaultDisplay());
|
|
||||||
height = (Integer) mGetRawH.invoke(windowManager.getDefaultDisplay());
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e("tmessages", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e("tmessages", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Cursor cursor = ApplicationLoader.applicationContext.getContentResolver().query(uri, mediaProjections, null, null, "date_added DESC LIMIT 1");
|
Cursor cursor = ApplicationLoader.applicationContext.getContentResolver().query(uri, mediaProjections, null, null, "date_added DESC LIMIT 1");
|
||||||
final ArrayList<Long> screenshotDates = new ArrayList<Long>();
|
final ArrayList<Long> screenshotDates = new ArrayList<Long>();
|
||||||
|
@ -791,7 +766,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||||
photoW = bmOptions.outWidth;
|
photoW = bmOptions.outWidth;
|
||||||
photoH = bmOptions.outHeight;
|
photoH = bmOptions.outHeight;
|
||||||
}
|
}
|
||||||
if (photoW <= 0 || photoH <= 0 || (photoW == width && photoH == height || photoH == width && photoW == height)) {
|
if (photoW <= 0 || photoH <= 0 || (photoW == size.x && photoH == size.y || photoH == size.x && photoW == size.y)) {
|
||||||
screenshotDates.add(date);
|
screenshotDates.add(date);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.graphics.Point;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -46,6 +47,7 @@ import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.ui.Views.ActionBar.ActionBarLayout;
|
import org.telegram.ui.Views.ActionBar.ActionBarLayout;
|
||||||
import org.telegram.ui.Views.ActionBar.BaseFragment;
|
import org.telegram.ui.Views.ActionBar.BaseFragment;
|
||||||
|
import org.telegram.ui.Views.ActionBar.DrawerLayoutContainer;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -231,15 +233,24 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setContentView(actionBarLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
DrawerLayoutContainer drawerLayoutContainer = new DrawerLayoutContainer(this);
|
||||||
|
drawerLayoutContainer.setStatusBarColor(0xff54759e);
|
||||||
|
drawerLayoutContainer.addView(actionBarLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
|
||||||
|
FrameLayout frameLayout = new FrameLayout(this);
|
||||||
|
drawerLayoutContainer.setDrawerLayout(frameLayout);
|
||||||
|
frameLayout.setBackgroundColor(0xffff0000);
|
||||||
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)frameLayout.getLayoutParams();
|
||||||
|
Point screenSize = AndroidUtilities.getRealScreenSize();
|
||||||
|
layoutParams.width = Math.min(screenSize.x, screenSize.y) - AndroidUtilities.dp(56);
|
||||||
|
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
frameLayout.setLayoutParams(layoutParams);
|
||||||
|
setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
actionBarLayout.setDrawerLayout(drawerLayoutContainer);
|
||||||
|
actionBarLayout.setAllowOpenDrawer(true);
|
||||||
}
|
}
|
||||||
actionBarLayout.init(mainFragmentsStack);
|
actionBarLayout.init(mainFragmentsStack);
|
||||||
actionBarLayout.setDelegate(this);
|
actionBarLayout.setDelegate(this);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
actionBarLayout.setNeedStatusBar(true);
|
|
||||||
actionBarLayout.setStatusBarColor(0xff54759e);
|
|
||||||
}
|
|
||||||
actionBarLayout.createDrawerLayout();
|
|
||||||
|
|
||||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
if (resourceId > 0) {
|
if (resourceId > 0) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
@ -127,6 +128,18 @@ public class LoginActivity extends BaseFragment implements SlideView.SlideViewDe
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
}
|
||||||
|
|
||||||
private void saveCurrentState() {
|
private void saveCurrentState() {
|
||||||
try {
|
try {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
|
@ -11,8 +11,6 @@ package org.telegram.ui.Views.ActionBar;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
|
@ -66,10 +64,9 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
private FrameLayoutAnimationListener containerView;
|
private FrameLayoutAnimationListener containerView;
|
||||||
private FrameLayoutAnimationListener containerViewBack;
|
private FrameLayoutAnimationListener containerViewBack;
|
||||||
private View shadowView;
|
private View shadowView;
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayoutContainer drawerLayoutContainer;
|
||||||
|
|
||||||
private boolean needStatusBar;
|
private boolean allowOpenDrawer;
|
||||||
private Paint statusBarPaint = new Paint();
|
|
||||||
|
|
||||||
private Animation openAnimation;
|
private Animation openAnimation;
|
||||||
private Animation closeAnimation;
|
private Animation closeAnimation;
|
||||||
|
@ -137,10 +134,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
fragment.setParentLayout(this);
|
fragment.setParentLayout(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawerLayout != null) {
|
|
||||||
bringChildToFront(drawerLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
needLayout();
|
needLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,14 +147,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDraw(Canvas canvas) {
|
|
||||||
super.onDraw(canvas);
|
|
||||||
if (needStatusBar) {
|
|
||||||
canvas.drawRect(0, 0, getWidth(), AndroidUtilities.statusBarHeight, statusBarPaint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
fixLayout();
|
fixLayout();
|
||||||
if (transitionAnimationInProgress) {
|
if (transitionAnimationInProgress) {
|
||||||
|
@ -232,9 +217,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
parent.bringChildToFront(containerView);
|
parent.bringChildToFront(containerView);
|
||||||
parent.bringChildToFront(shadowView);
|
parent.bringChildToFront(shadowView);
|
||||||
parent.bringChildToFront(actionBar);
|
parent.bringChildToFront(actionBar);
|
||||||
if (drawerLayout != null) {
|
|
||||||
parent.bringChildToFront(drawerLayout);
|
|
||||||
}
|
|
||||||
//parent.removeViewInLayout(containerView);
|
//parent.removeViewInLayout(containerView);
|
||||||
//parent.addView(containerView, 1);
|
//parent.addView(containerView, 1);
|
||||||
lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||||
|
@ -261,6 +243,14 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
ViewProxy.setTranslationX(shadowView, -AndroidUtilities.dp(2));
|
ViewProxy.setTranslationX(shadowView, -AndroidUtilities.dp(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void prepareForDrawerOpen(MotionEvent ev) {
|
||||||
|
maybeStartTracking = false;
|
||||||
|
startedTracking = true;
|
||||||
|
startedTrackingX = (int) ev.getX();
|
||||||
|
beginTrackingSent = false;
|
||||||
|
AndroidUtilities.lockOrientation(parentActivity);
|
||||||
|
}
|
||||||
|
|
||||||
private void prepareForMoving(MotionEvent ev) {
|
private void prepareForMoving(MotionEvent ev) {
|
||||||
maybeStartTracking = false;
|
maybeStartTracking = false;
|
||||||
startedTracking = true;
|
startedTracking = true;
|
||||||
|
@ -291,7 +281,8 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouchEvent(MotionEvent ev) {
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
if(!checkTransitionAnimation() && !inActionMode && fragmentsStack.size() > 1 && !animationInProgress) {
|
if(!checkTransitionAnimation() && !inActionMode && !animationInProgress) {
|
||||||
|
if (fragmentsStack.size() > 1) {
|
||||||
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) {
|
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) {
|
||||||
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||||
if (!currentFragment.swipeBackEnabled) {
|
if (!currentFragment.swipeBackEnabled) {
|
||||||
|
@ -395,6 +386,78 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
velocityTracker = null;
|
velocityTracker = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (drawerLayoutContainer != null && allowOpenDrawer && fragmentsStack.size() == 1) {
|
||||||
|
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) {
|
||||||
|
startedTrackingPointerId = ev.getPointerId(0);
|
||||||
|
maybeStartTracking = true;
|
||||||
|
startedTrackingX = (int) ev.getX();
|
||||||
|
startedTrackingY = (int) ev.getY();
|
||||||
|
if (velocityTracker != null) {
|
||||||
|
velocityTracker.clear();
|
||||||
|
}
|
||||||
|
} else if (ev != null && ev.getAction() == MotionEvent.ACTION_MOVE && ev.getPointerId(0) == startedTrackingPointerId) {
|
||||||
|
if (velocityTracker == null) {
|
||||||
|
velocityTracker = VelocityTracker.obtain();
|
||||||
|
}
|
||||||
|
int dx = (int) (ev.getX() - startedTrackingX);
|
||||||
|
int dy = Math.abs((int) ev.getY() - startedTrackingY);
|
||||||
|
velocityTracker.addMovement(ev);
|
||||||
|
if (maybeStartTracking && !startedTracking && Math.abs(dx) >= AndroidUtilities.dp(10) && Math.abs(dx) / 3 > dy) {
|
||||||
|
prepareForDrawerOpen(ev);
|
||||||
|
} else if (startedTracking) {
|
||||||
|
if (!beginTrackingSent) {
|
||||||
|
if (parentActivity.getCurrentFocus() != null) {
|
||||||
|
AndroidUtilities.hideKeyboard(parentActivity.getCurrentFocus());
|
||||||
|
}
|
||||||
|
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||||
|
currentFragment.onBeginSlide();
|
||||||
|
beginTrackingSent = true;
|
||||||
|
}
|
||||||
|
drawerLayoutContainer.moveDrawerByX(dx);
|
||||||
|
}
|
||||||
|
} else if (ev != null && ev.getPointerId(0) == startedTrackingPointerId && (ev.getAction() == MotionEvent.ACTION_CANCEL || ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_POINTER_UP)) {
|
||||||
|
if (velocityTracker == null) {
|
||||||
|
velocityTracker = VelocityTracker.obtain();
|
||||||
|
}
|
||||||
|
velocityTracker.computeCurrentVelocity(1000);
|
||||||
|
if (!startedTracking) {
|
||||||
|
float velX = velocityTracker.getXVelocity();
|
||||||
|
float velY = velocityTracker.getYVelocity();
|
||||||
|
if (Math.abs(velX) >= 3500 && velX > velY) {
|
||||||
|
prepareForDrawerOpen(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startedTracking) {
|
||||||
|
float x = ViewProxy.getX(containerView);
|
||||||
|
float velX = velocityTracker.getXVelocity();
|
||||||
|
float velY = velocityTracker.getYVelocity();
|
||||||
|
final boolean backAnimation = x < containerView.getMeasuredWidth() / 3.0f && (velX < 3500 || velX < velY);
|
||||||
|
float distToMove = 0;
|
||||||
|
if (!backAnimation) {
|
||||||
|
drawerLayoutContainer.openDrawer();
|
||||||
|
} else {
|
||||||
|
drawerLayoutContainer.closeDrawer();
|
||||||
|
}
|
||||||
|
AndroidUtilities.unlockOrientation(parentActivity);
|
||||||
|
startedTracking = false;
|
||||||
|
animationInProgress = false; //TODO animation check
|
||||||
|
} else {
|
||||||
|
maybeStartTracking = false;
|
||||||
|
startedTracking = false;
|
||||||
|
}
|
||||||
|
if (velocityTracker != null) {
|
||||||
|
velocityTracker.recycle();
|
||||||
|
velocityTracker = null;
|
||||||
|
}
|
||||||
|
} else if (ev == null) {
|
||||||
|
maybeStartTracking = false;
|
||||||
|
startedTracking = false;
|
||||||
|
if (velocityTracker != null) {
|
||||||
|
velocityTracker.recycle();
|
||||||
|
velocityTracker = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return startedTracking;
|
return startedTracking;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -462,15 +525,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
if (actionBar.getVisibility() == View.VISIBLE) {
|
if (actionBar.getVisibility() == View.VISIBLE) {
|
||||||
height = AndroidUtilities.getCurrentActionBarHeight();
|
height = AndroidUtilities.getCurrentActionBarHeight();
|
||||||
}
|
}
|
||||||
if (needStatusBar) {
|
|
||||||
height += AndroidUtilities.statusBarHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionBar != null) {
|
|
||||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionBar.getLayoutParams();
|
|
||||||
layoutParams.topMargin = needStatusBar ? AndroidUtilities.statusBarHeight : 0;
|
|
||||||
actionBar.setLayoutParams(layoutParams);
|
|
||||||
}
|
|
||||||
if (containerView != null) {
|
if (containerView != null) {
|
||||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) containerView.getLayoutParams();
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) containerView.getLayoutParams();
|
||||||
if (layoutParams.topMargin != height) {
|
if (layoutParams.topMargin != height) {
|
||||||
|
@ -560,9 +615,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
parent.bringChildToFront(containerView);
|
parent.bringChildToFront(containerView);
|
||||||
parent.bringChildToFront(shadowView);
|
parent.bringChildToFront(shadowView);
|
||||||
parent.bringChildToFront(actionBar);
|
parent.bringChildToFront(actionBar);
|
||||||
if (drawerLayout != null) {
|
|
||||||
parent.bringChildToFront(drawerLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!needAnimation) {
|
if (!needAnimation) {
|
||||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||||
|
@ -857,22 +909,11 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
backgroundView = view;
|
backgroundView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNeedStatusBar(boolean value) {
|
public void setDrawerLayout(DrawerLayoutContainer layout) {
|
||||||
needStatusBar = value;
|
drawerLayoutContainer = layout;
|
||||||
setWillNotDraw(!needStatusBar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusBarColor(int color) {
|
public void setAllowOpenDrawer(boolean value) {
|
||||||
statusBarPaint.setColor(color);
|
allowOpenDrawer = value;
|
||||||
}
|
|
||||||
|
|
||||||
public void createDrawerLayout() {
|
|
||||||
drawerLayout = new DrawerLayout(getContext());
|
|
||||||
addView(drawerLayout);
|
|
||||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)drawerLayout.getLayoutParams();
|
|
||||||
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
|
||||||
layoutParams.width = AndroidUtilities.dp(100);
|
|
||||||
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
|
|
||||||
drawerLayout.setLayoutParams(layoutParams);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
package org.telegram.ui.Views.ActionBar;
|
package org.telegram.ui.Views.ActionBar;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -16,13 +18,25 @@ import android.view.ViewGroup;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
public class DrawerLayout extends FrameLayout {
|
import org.telegram.android.AndroidUtilities;
|
||||||
|
import org.telegram.ui.AnimationCompat.ViewProxy;
|
||||||
|
|
||||||
private Object mLastInsets;
|
public class DrawerLayoutContainer extends FrameLayout {
|
||||||
|
|
||||||
public DrawerLayout(Context context) {
|
private static final int MIN_DRAWER_MARGIN = 64;
|
||||||
|
|
||||||
|
private View drawerLayout;
|
||||||
|
|
||||||
|
private Paint statusBarPaint = new Paint();
|
||||||
|
private Object lastInsets;
|
||||||
|
private boolean inLayout;
|
||||||
|
private int minDrawerMargin;
|
||||||
|
private float drawerOffset;
|
||||||
|
|
||||||
|
public DrawerLayoutContainer(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
minDrawerMargin = (int) (MIN_DRAWER_MARGIN * AndroidUtilities.density + 0.5f);
|
||||||
setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
|
||||||
setFocusableInTouchMode(true);
|
setFocusableInTouchMode(true);
|
||||||
|
|
||||||
|
@ -32,23 +46,23 @@ public class DrawerLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class InsetsListener implements View.OnApplyWindowInsetsListener {
|
private class InsetsListener implements View.OnApplyWindowInsetsListener {
|
||||||
@Override
|
@Override
|
||||||
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
|
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
|
||||||
final DrawerLayout drawerLayout = (DrawerLayout) v;
|
final DrawerLayoutContainer drawerLayout = (DrawerLayoutContainer) v;
|
||||||
drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
|
drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
|
||||||
return insets.consumeSystemWindowInsets();
|
return insets.consumeSystemWindowInsets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configureApplyInsets(View drawerLayout) {
|
private void configureApplyInsets(View drawerLayout) {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
drawerLayout.setOnApplyWindowInsetsListener(new InsetsListener());
|
drawerLayout.setOnApplyWindowInsetsListener(new InsetsListener());
|
||||||
drawerLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
drawerLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispatchChildInsets(View child, Object insets, int drawerGravity) {
|
private void dispatchChildInsets(View child, Object insets, int drawerGravity) {
|
||||||
WindowInsets wi = (WindowInsets) insets;
|
WindowInsets wi = (WindowInsets) insets;
|
||||||
if (drawerGravity == Gravity.LEFT) {
|
if (drawerGravity == Gravity.LEFT) {
|
||||||
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
|
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
|
||||||
|
@ -58,7 +72,7 @@ public class DrawerLayout extends FrameLayout {
|
||||||
child.dispatchApplyWindowInsets(wi);
|
child.dispatchApplyWindowInsets(wi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity) {
|
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity) {
|
||||||
WindowInsets wi = (WindowInsets) insets;
|
WindowInsets wi = (WindowInsets) insets;
|
||||||
if (drawerGravity == Gravity.LEFT) {
|
if (drawerGravity == Gravity.LEFT) {
|
||||||
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
|
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
|
||||||
|
@ -71,19 +85,135 @@ public class DrawerLayout extends FrameLayout {
|
||||||
lp.bottomMargin = wi.getSystemWindowInsetBottom();
|
lp.bottomMargin = wi.getSystemWindowInsetBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTopInset(Object insets) {
|
private int getTopInset(Object insets) {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
return insets != null ? ((WindowInsets) insets).getSystemWindowInsetTop() : 0;
|
return insets != null ? ((WindowInsets) insets).getSystemWindowInsetTop() : 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildInsets(Object insets, boolean draw) {
|
private void setChildInsets(Object insets, boolean draw) {
|
||||||
mLastInsets = insets;
|
lastInsets = insets;
|
||||||
setWillNotDraw(!draw && getBackground() == null);
|
setWillNotDraw(!draw && getBackground() == null);
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatusBarColor(int color) {
|
||||||
|
statusBarPaint.setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrawerLayout(View layout) {
|
||||||
|
drawerLayout = layout;
|
||||||
|
addView(drawerLayout);
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
drawerLayout.setFitsSystemWindows(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveDrawerByX(int dx) {
|
||||||
|
if (dx > drawerLayout.getMeasuredWidth()) {
|
||||||
|
dx = drawerLayout.getMeasuredWidth();
|
||||||
|
}
|
||||||
|
ViewProxy.setTranslationX(drawerLayout, dx);
|
||||||
|
|
||||||
|
final int newVisibility = dx > 0 ? VISIBLE : INVISIBLE;
|
||||||
|
if (drawerLayout.getVisibility() != newVisibility) {
|
||||||
|
drawerLayout.setVisibility(newVisibility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openDrawer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeDrawer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getDrawerLayout() {
|
||||||
|
return drawerLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
canvas.drawRect(0, 0, getWidth(), AndroidUtilities.statusBarHeight, statusBarPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
|
inLayout = true;
|
||||||
|
final int width = r - l;
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
final View child = getChildAt(i);
|
||||||
|
|
||||||
|
if (child.getVisibility() == GONE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
if (drawerLayout != child) {
|
||||||
|
child.layout(lp.leftMargin, lp.topMargin, lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight());
|
||||||
|
} else {
|
||||||
|
child.layout(-child.getMeasuredWidth(), lp.topMargin, 0, lp.topMargin + child.getMeasuredHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inLayout = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestLayout() {
|
||||||
|
if (!inLayout) {
|
||||||
|
super.requestLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||||
|
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||||
|
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
|
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
|
|
||||||
|
setMeasuredDimension(widthSize, heightSize);
|
||||||
|
|
||||||
|
final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;
|
||||||
|
|
||||||
|
int foundDrawers = 0;
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
final View child = getChildAt(i);
|
||||||
|
|
||||||
|
if (child.getVisibility() == GONE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
if (applyInsets) {
|
||||||
|
if (child.getFitsSystemWindows()) {
|
||||||
|
dispatchChildInsets(child, lastInsets, lp.gravity);
|
||||||
|
} else {
|
||||||
|
applyMarginInsets(lp, lastInsets, lp.gravity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawerLayout != child) {
|
||||||
|
final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
|
||||||
|
final int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
|
||||||
|
child.measure(contentWidthSpec, contentHeightSpec);
|
||||||
|
} else {
|
||||||
|
final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, minDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);
|
||||||
|
final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);
|
||||||
|
child.measure(drawerWidthSpec, drawerHeightSpec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*private static final int MIN_DRAWER_MARGIN = 64; // dp
|
/*private static final int MIN_DRAWER_MARGIN = 64; // dp
|
||||||
|
|
||||||
|
@ -164,18 +294,6 @@ public class DrawerLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
final int version = Build.VERSION.SDK_INT;
|
|
||||||
if (version >= 21) {
|
|
||||||
IMPL = new DrawerLayoutCompatImplApi21();
|
|
||||||
} else {
|
|
||||||
IMPL = new DrawerLayoutCompatImplBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static final DrawerLayoutCompatImpl IMPL;
|
|
||||||
|
|
||||||
public void setDrawerShadow(Drawable shadowDrawable, @EdgeGravity int gravity) {
|
public void setDrawerShadow(Drawable shadowDrawable, @EdgeGravity int gravity) {
|
||||||
|
|
||||||
final int absGravity = GravityCompat.getAbsoluteGravity(gravity,
|
final int absGravity = GravityCompat.getAbsoluteGravity(gravity,
|
||||||
|
@ -465,160 +583,6 @@ public class DrawerLayout extends FrameLayout {
|
||||||
mFirstLayout = true;
|
mFirstLayout = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
||||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
||||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
||||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
|
||||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
|
||||||
|
|
||||||
setMeasuredDimension(widthSize, heightSize);
|
|
||||||
|
|
||||||
final boolean applyInsets = mLastInsets != null && ViewCompat.getFitsSystemWindows(this);
|
|
||||||
final int layoutDirection = ViewCompat.getLayoutDirection(this);
|
|
||||||
|
|
||||||
// Gravity value for each drawer we've seen. Only one of each permitted.
|
|
||||||
int foundDrawers = 0;
|
|
||||||
final int childCount = getChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
|
|
||||||
if (child.getVisibility() == GONE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
||||||
|
|
||||||
if (applyInsets) {
|
|
||||||
final int cgrav = GravityCompat.getAbsoluteGravity(lp.gravity, layoutDirection);
|
|
||||||
if (ViewCompat.getFitsSystemWindows(child)) {
|
|
||||||
IMPL.dispatchChildInsets(child, mLastInsets, cgrav);
|
|
||||||
} else {
|
|
||||||
IMPL.applyMarginInsets(lp, mLastInsets, cgrav);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isContentView(child)) {
|
|
||||||
// Content views get measured at exactly the layout's size.
|
|
||||||
final int contentWidthSpec = MeasureSpec.makeMeasureSpec(
|
|
||||||
widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
|
|
||||||
final int contentHeightSpec = MeasureSpec.makeMeasureSpec(
|
|
||||||
heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
|
|
||||||
child.measure(contentWidthSpec, contentHeightSpec);
|
|
||||||
} else if (isDrawerView(child)) {
|
|
||||||
final int childGravity =
|
|
||||||
getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;
|
|
||||||
if ((foundDrawers & childGravity) != 0) {
|
|
||||||
throw new IllegalStateException("Child drawer has absolute gravity " +
|
|
||||||
gravityToString(childGravity) + " but this " + TAG + " already has a " +
|
|
||||||
"drawer view along that edge");
|
|
||||||
}
|
|
||||||
final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec,
|
|
||||||
mMinDrawerMargin + lp.leftMargin + lp.rightMargin,
|
|
||||||
lp.width);
|
|
||||||
final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec,
|
|
||||||
lp.topMargin + lp.bottomMargin,
|
|
||||||
lp.height);
|
|
||||||
child.measure(drawerWidthSpec, drawerHeightSpec);
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("Child " + child + " at index " + i +
|
|
||||||
" does not have a valid layout_gravity - must be Gravity.LEFT, " +
|
|
||||||
"Gravity.RIGHT or Gravity.NO_GRAVITY");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
||||||
mInLayout = true;
|
|
||||||
final int width = r - l;
|
|
||||||
final int childCount = getChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
|
|
||||||
if (child.getVisibility() == GONE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
||||||
|
|
||||||
if (isContentView(child)) {
|
|
||||||
child.layout(lp.leftMargin, lp.topMargin,
|
|
||||||
lp.leftMargin + child.getMeasuredWidth(),
|
|
||||||
lp.topMargin + child.getMeasuredHeight());
|
|
||||||
} else { // Drawer, if it wasn't onMeasure would have thrown an exception.
|
|
||||||
final int childWidth = child.getMeasuredWidth();
|
|
||||||
final int childHeight = child.getMeasuredHeight();
|
|
||||||
int childLeft;
|
|
||||||
|
|
||||||
final float newOffset;
|
|
||||||
if (checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {
|
|
||||||
childLeft = -childWidth + (int) (childWidth * lp.onScreen);
|
|
||||||
newOffset = (float) (childWidth + childLeft) / childWidth;
|
|
||||||
} else { // Right; onMeasure checked for us.
|
|
||||||
childLeft = width - (int) (childWidth * lp.onScreen);
|
|
||||||
newOffset = (float) (width - childLeft) / childWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean changeOffset = newOffset != lp.onScreen;
|
|
||||||
|
|
||||||
final int vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
|
||||||
|
|
||||||
switch (vgrav) {
|
|
||||||
default:
|
|
||||||
case Gravity.TOP: {
|
|
||||||
child.layout(childLeft, lp.topMargin, childLeft + childWidth,
|
|
||||||
lp.topMargin + childHeight);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Gravity.BOTTOM: {
|
|
||||||
final int height = b - t;
|
|
||||||
child.layout(childLeft,
|
|
||||||
height - lp.bottomMargin - child.getMeasuredHeight(),
|
|
||||||
childLeft + childWidth,
|
|
||||||
height - lp.bottomMargin);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Gravity.CENTER_VERTICAL: {
|
|
||||||
final int height = b - t;
|
|
||||||
int childTop = (height - childHeight) / 2;
|
|
||||||
|
|
||||||
// Offset for margins. If things don't fit right because of
|
|
||||||
// bad measurement before, oh well.
|
|
||||||
if (childTop < lp.topMargin) {
|
|
||||||
childTop = lp.topMargin;
|
|
||||||
} else if (childTop + childHeight > height - lp.bottomMargin) {
|
|
||||||
childTop = height - lp.bottomMargin - childHeight;
|
|
||||||
}
|
|
||||||
child.layout(childLeft, childTop, childLeft + childWidth,
|
|
||||||
childTop + childHeight);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changeOffset) {
|
|
||||||
setDrawerViewOffset(child, newOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
final int newVisibility = lp.onScreen > 0 ? VISIBLE : INVISIBLE;
|
|
||||||
if (child.getVisibility() != newVisibility) {
|
|
||||||
child.setVisibility(newVisibility);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mInLayout = false;
|
|
||||||
mFirstLayout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void requestLayout() {
|
|
||||||
if (!mInLayout) {
|
|
||||||
super.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void computeScroll() {
|
public void computeScroll() {
|
||||||
final int childCount = getChildCount();
|
final int childCount = getChildCount();
|
Loading…
Reference in a new issue