Improve adding repos from the clipboard

In some cases (e.g. when using Firefox Klar) and copying the URL
(of a link), then only the uri is set and not the text. This
prevented (before this commit) the autofill of the
add package source dialog in such cases.
This commit is contained in:
Jonas L 2019-03-29 09:14:43 +00:00 committed by Hans-Christoph Steiner
parent ada263feca
commit 94e441cc9c

View File

@ -182,6 +182,14 @@ public class ManageReposActivity extends AppCompatActivity
ClipData data = clipboardManager.getPrimaryClip();
if (data.getItemCount() > 0) {
text = data.getItemAt(0).getText();
if (text == null) {
Uri uri = data.getItemAt(0).getUri();
if (uri != null) {
text = uri.toString();
}
}
}
}
return text != null ? text.toString() : null;