mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Code simplifications
This commit is contained in:
@@ -934,10 +934,7 @@ public class DrawerLayout extends ViewGroup {
|
|||||||
|
|
||||||
private static boolean hasOpaqueBackground(View v) {
|
private static boolean hasOpaqueBackground(View v) {
|
||||||
final Drawable bg = v.getBackground();
|
final Drawable bg = v.getBackground();
|
||||||
if (bg != null) {
|
return bg != null && bg.getOpacity() == PixelFormat.OPAQUE;
|
||||||
return bg.getOpacity() == PixelFormat.OPAQUE;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1317,10 +1314,7 @@ public class DrawerLayout extends ViewGroup {
|
|||||||
*/
|
*/
|
||||||
public boolean isDrawerOpen(int drawerGravity) {
|
public boolean isDrawerOpen(int drawerGravity) {
|
||||||
final View drawerView = findDrawerWithGravity(drawerGravity);
|
final View drawerView = findDrawerWithGravity(drawerGravity);
|
||||||
if (drawerView != null) {
|
return drawerView != null && isDrawerOpen(drawerView);
|
||||||
return isDrawerOpen(drawerView);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1350,10 +1344,7 @@ public class DrawerLayout extends ViewGroup {
|
|||||||
*/
|
*/
|
||||||
public boolean isDrawerVisible(int drawerGravity) {
|
public boolean isDrawerVisible(int drawerGravity) {
|
||||||
final View drawerView = findDrawerWithGravity(drawerGravity);
|
final View drawerView = findDrawerWithGravity(drawerGravity);
|
||||||
if (drawerView != null) {
|
return drawerView != null && isDrawerVisible(drawerView);
|
||||||
return isDrawerVisible(drawerView);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasPeekingDrawer() {
|
private boolean hasPeekingDrawer() {
|
||||||
@@ -1776,10 +1767,7 @@ public class DrawerLayout extends ViewGroup {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event) {
|
public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event) {
|
||||||
if (CAN_HIDE_DESCENDANTS || includeChildForAccessibility(child)) {
|
return (CAN_HIDE_DESCENDANTS || includeChildForAccessibility(child)) && super.onRequestSendAccessibilityEvent(host, child, event);
|
||||||
return super.onRequestSendAccessibilityEvent(host, child, event);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1796,4 +1784,4 @@ public class DrawerLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1485,10 +1485,7 @@ public class ViewDragHelper {
|
|||||||
* @return true if the supplied view is under the given point, false otherwise
|
* @return true if the supplied view is under the given point, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isViewUnder(View view, int x, int y) {
|
public boolean isViewUnder(View view, int x, int y) {
|
||||||
if (view == null) {
|
return view != null && x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1522,4 +1519,4 @@ public class ViewDragHelper {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -130,9 +130,8 @@ public abstract class TerminalTestCase extends TestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof LineWrapper)) return false;
|
return o instanceof LineWrapper && ((LineWrapper) o).mLine == mLine;
|
||||||
return ((LineWrapper) o).mLine == mLine;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TerminalTestCase assertInvariants() {
|
protected TerminalTestCase assertInvariants() {
|
||||||
|
Reference in New Issue
Block a user