diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 39c81ceef..685f61904 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -56,14 +56,28 @@ android:pathPrefix="/repository/browse" /> </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + + <data android:scheme="fdroid.repo" /> + </intent-filter> + <meta-data android:name="android.app.default_searchable" android:value=".SearchResults" /> </activity> + <activity android:name="ManageRepo" - android:label="@string/menu_manage" /> + android:label="@string/menu_manage" + android:parentActivityName="FDroid" > + </activity> + <activity android:name="Settings" /> + <activity android:name="AppDetails" android:label="@string/app_details" diff --git a/src/org/fdroid/fdroid/FDroid.java b/src/org/fdroid/fdroid/FDroid.java index 858ef5191..96547ba62 100644 --- a/src/org/fdroid/fdroid/FDroid.java +++ b/src/org/fdroid/fdroid/FDroid.java @@ -85,18 +85,23 @@ public class FDroid extends FragmentActivity { Intent i = getIntent(); Uri data = i.getData(); if (data != null) { - String appid = data.getQueryParameter("fdid"); - // If appid == null, we just browse all the apps. - // If appid != null, we browse the app specified. - if (appid != null) { - Intent call = new Intent(this, AppDetails.class); - call.putExtra("appid", appid); - startActivityForResult(call, REQUEST_APPDETAILS); + if (data.isHierarchical()) { + String appid = data.getQueryParameter("fdid"); + // If appid == null, we just browse all the apps. + // If appid != null, we browse the app specified. + if (appid != null) { + Intent call = new Intent(this, AppDetails.class); + call.putExtra("appid", appid); + startActivityForResult(call, REQUEST_APPDETAILS); + } + } else { + String repoUri = data.getEncodedSchemeSpecificPart(); + if (repoUri != null) { + Intent call = new Intent(this, ManageRepo.class); + call.putExtra("repoUri", repoUri); + startActivityForResult(call, REQUEST_MANAGEREPOS); + } } - } else if (i.hasExtra("uri")) { - Intent call = new Intent(this, ManageRepo.class); - call.putExtra("uri", i.getStringExtra("uri")); - startActivityForResult(call, REQUEST_MANAGEREPOS); } else if (i.hasExtra(EXTRA_TAB_UPDATE)) { boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false); if (showUpdateTab) { diff --git a/src/org/fdroid/fdroid/ManageRepo.java b/src/org/fdroid/fdroid/ManageRepo.java index f8cd95e17..de2719afb 100644 --- a/src/org/fdroid/fdroid/ManageRepo.java +++ b/src/org/fdroid/fdroid/ManageRepo.java @@ -80,6 +80,13 @@ public class ManageRepo extends ListActivity { super.onCreate(savedInstanceState); setContentView(R.layout.repolist); + Intent i = getIntent(); + if (i.hasExtra("repoUri")) { + String repoUri = i.getStringExtra("repoUri"); + addRepo(repoUri); + finish(); + } + SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); @@ -183,6 +190,16 @@ public class ManageRepo extends ListActivity { return true; } + protected void addRepo(String repoUri) { + try { + DB db = DB.getDB(); + db.addRepo(repoUri, null, null, 10, null, true); + } finally { + DB.releaseDB(); + } + changed = true; + } + @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { @@ -203,13 +220,7 @@ public class ManageRepo extends ListActivity { public void onClick(DialogInterface dialog, int which) { EditText uri = (EditText) alrt .findViewById(R.id.edit_uri); - String uri_str = uri.getText().toString(); - try { - DB db = DB.getDB(); - db.addRepo(uri_str, null, null, 10, null, true); - } finally { - DB.releaseDB(); - } + addRepo(uri.getText().toString()); changed = true; redraw(); }