Skip to content

Commit

Permalink
Update url bar view instead of the binding when pasting (#2755)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Feb 10, 2020
1 parent 3c90e7f commit fb42825
Showing 1 changed file with 5 additions and 7 deletions.
Expand Up @@ -370,12 +370,10 @@ public void handleURLEdit(String text) {
GleanMetricsService.urlBarEvent(false);
}

if (!mSession.getCurrentUri().equals(url)) {
mSession.loadUri(url);
mSession.loadUri(url);

if (mDelegate != null) {
mDelegate.onHideAwesomeBar();
}
if (mDelegate != null) {
mDelegate.onHideAwesomeBar();
}

clearFocus();
Expand Down Expand Up @@ -503,7 +501,7 @@ public void onAction(String action) {
if (action.equals(GeckoSession.SelectionActionDelegate.ACTION_CUT) && selectionValid) {
String selectedText = mBinding.urlEditText.getText().toString().substring(startSelection, endSelection);
clipboard.setPrimaryClip(ClipData.newPlainText("text", selectedText));
mViewModel.setUrl(StringUtils.removeRange(mBinding.urlEditText.getText().toString(), startSelection, endSelection));
mBinding.urlEditText.setText(StringUtils.removeRange(mBinding.urlEditText.getText().toString(), startSelection, endSelection));
mBinding.urlEditText.setSelection(startSelection);

} else if (action.equals(GeckoSession.SelectionActionDelegate.ACTION_COPY) && selectionValid) {
Expand All @@ -513,7 +511,7 @@ public void onAction(String action) {
} else if (action.equals(GeckoSession.SelectionActionDelegate.ACTION_PASTE) && clipboard.hasPrimaryClip()) {
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
if (selectionValid) {
mViewModel.setUrl(StringUtils.removeRange(mBinding.urlEditText.getText().toString(), startSelection, endSelection));
mBinding.urlEditText.setText(StringUtils.removeRange(mBinding.urlEditText.getText().toString(), startSelection, endSelection));
mBinding.urlEditText.setSelection(startSelection);
}
if (item != null && item.getText() != null) {
Expand Down

0 comments on commit fb42825

Please sign in to comment.