diff --git a/res/layout/addrepo.xml b/res/layout/addrepo.xml index 0638049ee..d428092a2 100644 --- a/res/layout/addrepo.xml +++ b/res/layout/addrepo.xml @@ -2,7 +2,8 @@ + android:orientation="vertical" + android:padding="6dp"> repos = getRepos(); - final Repo repo = getRepoByAddress(newAddress, repos); + final Repo repo = newAddress != null && isImportingRepo ? getRepoByAddress(newAddress, repos) : null; alrt.setIcon(android.R.drawable.ic_menu_add); alrt.setTitle(getString(R.string.repo_add_title)); @@ -350,10 +351,16 @@ public class ManageRepo extends ListActivity { } } - if (newAddress != null) - uriEditText.setText(newAddress); if (newFingerprint != null) fingerprintEditText.setText(newFingerprint); + + if (newAddress != null) { + // This trick of emptying text then appending, + // rather than just setting in the first place, + // is neccesary to move the cursor to the end of the input. + uriEditText.setText(""); + uriEditText.append(newAddress); + } } /** @@ -430,7 +437,7 @@ public class ManageRepo extends ListActivity { } if (text == null) { - text = "https://"; + text = DEFAULT_NEW_REPO_TEXT; } return text; }