Skip to content

Commit

Permalink
select text when url is set
Browse files Browse the repository at this point in the history
  • Loading branch information
autoandshare committed Apr 19, 2021
1 parent 9e2cf2a commit 2558748
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/autoandshare/headvr/activity/StreamFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public void onResume() {
try {
CharSequence text = clipboard.getPrimaryClip().getItemAt(0).getText();
if (URLUtil.isValidUrl(text.toString())) {
urlText.setText(text);
urlText.selectAll();
setUrlText(text);
}
} catch (Exception e) {
}
Expand Down Expand Up @@ -94,7 +93,7 @@ public void onClick(View v) {
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
urlText.setText(listItems.get(position));
setUrlText(listItems.get(position));
}
});

Expand All @@ -107,6 +106,11 @@ public void onClick(View v) {

}

private void setUrlText(CharSequence text) {
urlText.setText(text);
urlText.selectAll();
}

private void addOrReplace(String url) {
listItems.remove(url);
listItems.add(0, url);
Expand Down

0 comments on commit 2558748

Please sign in to comment.