Skip to content

Commit

Permalink
Add web launch support for bitbucket.org
Browse files Browse the repository at this point in the history
  • Loading branch information
monaka authored and rtyley committed May 24, 2012
1 parent 213de46 commit bb51a0c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agit/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@
</intent-filter>
</activity>

<activity android:name=".weblaunchers.BitBucketWebLaunchActivity" android:label="@string/app_name">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"></category>
<action android:name="android.intent.action.VIEW"></action>
<data android:host="bitbucket.org" android:scheme="https" android:pathPattern="/.*/.*" />
<data android:host="bitbucket.org" android:scheme="http" android:pathPattern="/.*/.*" />
</intent-filter>
</activity>

<service android:name="GitOperationsService">
<intent-filter>
<action android:name="org.openintents.git.repo.SYNC"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.madgag.agit.weblaunchers;

import android.content.Intent;
import android.net.Uri;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static com.madgag.agit.CloneLauncherActivity.cloneLauncherIntentFor;
import static java.util.regex.Pattern.compile;


public class BitBucketWebLaunchActivity extends WebLaunchActivity {

private static final String TAG = "WL-bitbucket";

private static final Pattern projectPathPattern = compile("^/([^/]+/[^/]+)");

Intent cloneLauncherForWebBrowseIntent(Uri uri) {
Matcher matcher = projectPathPattern.matcher(uri.getPath());
matcher.find();
return cloneLauncherIntentFor("[email protected]:"+ matcher.group(1) +".git");
}
}

0 comments on commit bb51a0c

Please sign in to comment.