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