mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-04 17:55:36 +08:00
confict
This commit is contained in:
@@ -893,9 +893,7 @@ public final class TerminalView extends View {
|
||||
android.R.attr.textSelectHandleWindowStyle);
|
||||
mContainer.setSplitTouchEnabled(true);
|
||||
mContainer.setClippingEnabled(false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
|
||||
}
|
||||
mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
|
||||
mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
@@ -910,14 +908,8 @@ public final class TerminalView extends View {
|
||||
case LEFT: {
|
||||
if (mSelectHandleLeft == null) {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mSelectHandleLeft = getContext().getDrawable(
|
||||
R.drawable.text_select_handle_left_material);
|
||||
} else {
|
||||
mSelectHandleLeft = getContext().getResources().getDrawable(
|
||||
R.drawable.text_select_handle_left_material);
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
mDrawable = mSelectHandleLeft;
|
||||
@@ -928,13 +920,8 @@ public final class TerminalView extends View {
|
||||
|
||||
case RIGHT: {
|
||||
if (mSelectHandleRight == null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mSelectHandleRight = getContext().getDrawable(
|
||||
R.drawable.text_select_handle_right_material);
|
||||
} else {
|
||||
mSelectHandleRight = getContext().getResources().getDrawable(
|
||||
R.drawable.text_select_handle_right_material);
|
||||
}
|
||||
}
|
||||
mDrawable = mSelectHandleRight;
|
||||
handleWidth = mDrawable.getIntrinsicWidth();
|
||||
@@ -1228,48 +1215,45 @@ public final class TerminalView extends View {
|
||||
}
|
||||
|
||||
};
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mActionMode = startActionMode(new ActionMode.Callback2() {
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
return callback.onCreateActionMode(mode, menu);
|
||||
mActionMode = startActionMode(new ActionMode.Callback2() {
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
return callback.onCreateActionMode(mode, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
return callback.onActionItemClicked(mode, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
|
||||
int x1 = Math.round(mSelX1 * mRenderer.mFontWidth);
|
||||
int x2 = Math.round(mSelX2 * mRenderer.mFontWidth);
|
||||
int y1 = Math.round((mSelY1 - mTopRow) * mRenderer.mFontLineSpacing);
|
||||
int y2 = Math.round((mSelY2 + 1 - mTopRow) * mRenderer.mFontLineSpacing);
|
||||
|
||||
|
||||
if (x1 > x2) {
|
||||
int tmp = x1;
|
||||
x1 = x2;
|
||||
x2 = tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return false;
|
||||
}
|
||||
outRect.set(x1, y1 + mHandleHeight, x2, y2 + mHandleHeight);
|
||||
}
|
||||
}, ActionMode.TYPE_FLOATING);
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
return callback.onActionItemClicked(mode, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
|
||||
int x1 = Math.round(mSelX1 * mRenderer.mFontWidth);
|
||||
int x2 = Math.round(mSelX2 * mRenderer.mFontWidth);
|
||||
int y1 = Math.round((mSelY1 - mTopRow) * mRenderer.mFontLineSpacing);
|
||||
int y2 = Math.round((mSelY2 + 1 - mTopRow) * mRenderer.mFontLineSpacing);
|
||||
|
||||
|
||||
if (x1 > x2) {
|
||||
int tmp = x1;
|
||||
x1 = x2;
|
||||
x2 = tmp;
|
||||
}
|
||||
|
||||
outRect.set(x1, y1 + mHandleHeight, x2, y2 + mHandleHeight);
|
||||
}
|
||||
}, ActionMode.TYPE_FLOATING);
|
||||
} else {
|
||||
mActionMode = startActionMode(callback);
|
||||
}
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
@@ -1500,9 +1484,7 @@ public final class TerminalView extends View {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mActionMode != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mActionMode.hide(0); // hide off.
|
||||
}
|
||||
mActionMode.hide(0); // hide off.
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1510,9 +1492,7 @@ public final class TerminalView extends View {
|
||||
void hideFloatingToolbar(int duration) {
|
||||
if (mActionMode != null) {
|
||||
removeCallbacks(mShowFloatingToolbar);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mActionMode.hide(duration);
|
||||
}
|
||||
mActionMode.hide(duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user