Leave repo uri scheme handling for later, fix search schemes

This commit is contained in:
Daniel Martí 2013-09-29 20:27:49 +02:00
parent 82f87f677e
commit 5aa2710362
4 changed files with 22 additions and 42 deletions

View File

@ -34,6 +34,7 @@
<activity
android:name="FDroid"
android:configChanges="keyboardHidden|orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -56,15 +57,6 @@
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" />
@ -92,6 +84,7 @@
<data android:scheme="fdroid.app" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@ -108,13 +101,13 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="f-droid.org"
android:pathPrefix="/app" />
android:pathPrefix="/app/" />
<data android:scheme="https" android:host="f-droid.org"
android:pathPrefix="/app" />
android:pathPrefix="/app/" />
<data android:scheme="http" android:host="www.f-droid.org"
android:pathPrefix="/app" />
android:pathPrefix="/app/" />
<data android:scheme="https" android:host="www.f-droid.org"
android:pathPrefix="/app" />
android:pathPrefix="/app/" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
@ -144,7 +137,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="market" android:host="search" />
<data android:scheme="fdroid.search" />
</intent-filter>
<intent-filter>
@ -153,7 +146,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fdroid.search" />
<data android:scheme="market" android:host="search" />
</intent-filter>
<meta-data

View File

@ -206,9 +206,10 @@ public class AppDetails extends ListActivity {
} else {
// https://f-droid.org/app/app.id
appid = data.getLastPathSegment();
if (appid.equals("app")) appid = null;
}
} else {
// fdroid.app:app.id (old scheme)
// fdroid.app:app.id
appid = data.getEncodedSchemeSpecificPart();
}
Log.d("FDroid", "AppDetails launched from link, for '" + appid

View File

@ -84,23 +84,11 @@ public class FDroid extends FragmentActivity {
Intent i = getIntent();
Uri data = i.getData();
String appid = null;
if (data != null) {
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 && appid.length() > 0) {
Intent call = new Intent(this, AppDetails.class);
call.putExtra("appid", appid);
startActivityForResult(call, REQUEST_APPDETAILS);
}
} else {
String repoUri = data.getEncodedSchemeSpecificPart();
if (repoUri != null && repoUri.length() > 0) {
Intent call = new Intent(this, ManageRepo.class);
call.putExtra("repoUri", repoUri);
startActivityForResult(call, REQUEST_MANAGEREPOS);
}
// http(s)://f-droid.org/repository/browse?fdid=app.id
appid = data.getQueryParameter("fdid");
}
} else if (i.hasExtra(EXTRA_TAB_UPDATE)) {
boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false);
@ -108,6 +96,11 @@ public class FDroid extends FragmentActivity {
getTabManager().selectTab(2);
}
}
if (appid != null && appid.length() > 0) {
Intent call = new Intent(this, AppDetails.class);
call.putExtra("appid", appid);
startActivityForResult(call, REQUEST_APPDETAILS);
}
}
@Override
@ -125,10 +118,10 @@ public class FDroid extends FragmentActivity {
manager.repopulateLists();
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getTabManager().onConfigurationChanged(newConfig);
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getTabManager().onConfigurationChanged(newConfig);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {

View File

@ -80,12 +80,6 @@ public class ManageRepo extends ListActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.repolist);
Intent i = getIntent();
if (i.hasExtra("repoUri")) {
addRepo(i.getStringExtra("repoUri"));
finish();
}
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
@ -196,7 +190,6 @@ public class ManageRepo extends ListActivity {
} finally {
DB.releaseDB();
}
changed = true;
}
@Override