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

View File

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

View File

@ -84,23 +84,11 @@ public class FDroid extends FragmentActivity {
Intent i = getIntent(); Intent i = getIntent();
Uri data = i.getData(); Uri data = i.getData();
String appid = null;
if (data != null) { if (data != null) {
if (data.isHierarchical()) { if (data.isHierarchical()) {
String appid = data.getQueryParameter("fdid"); // http(s)://f-droid.org/repository/browse?fdid=app.id
// If appid == null, we just browse all the apps. appid = data.getQueryParameter("fdid");
// 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);
}
} }
} else if (i.hasExtra(EXTRA_TAB_UPDATE)) { } else if (i.hasExtra(EXTRA_TAB_UPDATE)) {
boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false); boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false);
@ -108,6 +96,11 @@ public class FDroid extends FragmentActivity {
getTabManager().selectTab(2); 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 @Override

View File

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