Add support for fdroid.repo:https://repo/address
This commit is contained in:
parent
32a106ad1d
commit
17302321b8
@ -56,14 +56,28 @@
|
|||||||
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" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="ManageRepo"
|
android:name="ManageRepo"
|
||||||
android:label="@string/menu_manage" />
|
android:label="@string/menu_manage"
|
||||||
|
android:parentActivityName="FDroid" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings" />
|
<activity android:name="Settings" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="AppDetails"
|
android:name="AppDetails"
|
||||||
android:label="@string/app_details"
|
android:label="@string/app_details"
|
||||||
|
@ -85,18 +85,23 @@ public class FDroid extends FragmentActivity {
|
|||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
Uri data = i.getData();
|
Uri data = i.getData();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
String appid = data.getQueryParameter("fdid");
|
if (data.isHierarchical()) {
|
||||||
// If appid == null, we just browse all the apps.
|
String appid = data.getQueryParameter("fdid");
|
||||||
// If appid != null, we browse the app specified.
|
// If appid == null, we just browse all the apps.
|
||||||
if (appid != null) {
|
// If appid != null, we browse the app specified.
|
||||||
Intent call = new Intent(this, AppDetails.class);
|
if (appid != null) {
|
||||||
call.putExtra("appid", appid);
|
Intent call = new Intent(this, AppDetails.class);
|
||||||
startActivityForResult(call, REQUEST_APPDETAILS);
|
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)) {
|
} else if (i.hasExtra(EXTRA_TAB_UPDATE)) {
|
||||||
boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false);
|
boolean showUpdateTab = i.getBooleanExtra(EXTRA_TAB_UPDATE, false);
|
||||||
if (showUpdateTab) {
|
if (showUpdateTab) {
|
||||||
|
@ -80,6 +80,13 @@ 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")) {
|
||||||
|
String repoUri = i.getStringExtra("repoUri");
|
||||||
|
addRepo(repoUri);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager
|
SharedPreferences prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getBaseContext());
|
.getDefaultSharedPreferences(getBaseContext());
|
||||||
|
|
||||||
@ -183,6 +190,16 @@ public class ManageRepo extends ListActivity {
|
|||||||
return true;
|
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
|
@Override
|
||||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||||
|
|
||||||
@ -203,13 +220,7 @@ public class ManageRepo extends ListActivity {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
EditText uri = (EditText) alrt
|
EditText uri = (EditText) alrt
|
||||||
.findViewById(R.id.edit_uri);
|
.findViewById(R.id.edit_uri);
|
||||||
String uri_str = uri.getText().toString();
|
addRepo(uri.getText().toString());
|
||||||
try {
|
|
||||||
DB db = DB.getDB();
|
|
||||||
db.addRepo(uri_str, null, null, 10, null, true);
|
|
||||||
} finally {
|
|
||||||
DB.releaseDB();
|
|
||||||
}
|
|
||||||
changed = true;
|
changed = true;
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user