airbnb / DeepLinkDispatch

A simple, annotation-based library for making deep link handling better on Android
http://nerds.airbnb.com/deeplinkdispatch/
4.39k stars 406 forks source link

getIntent().getBooleanExtra(DeepLink.IS_DEEP_LINK, false) #121

Closed juanlabrador closed 8 years ago

juanlabrador commented 8 years ago

always return false, I used this:

public static void userLinkify(final TextView view) {

        Linkify.TransformFilter filter = new Linkify.TransformFilter() {
            public final String transformUrl(final Matcher match, String url) {
                return url.substring(1);
            }
        };

        Pattern mentionPattern = Pattern.compile("@([A-Za-z0-9_-]+)");
        String mentionScheme = "app://example.com/module/user/";
        Linkify.addLinks(view, mentionPattern, mentionScheme, null, filter);
        stripUnderlines(view);
    }
juanlabrador commented 8 years ago
@DeepLink("app://example.com/module/user/{id}")
public class AccountActivity extends BaseActivity {
.
.
.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_account);

        if (getIntent().getBooleanExtra(DeepLink.IS_DEEP_LINK, false)) {
            Bundle parameters = getIntent().getExtras();
            Log.d(TAG, "Deeplink params: " + parameters);

            KEY_USER = parameters.getString("id");

         }
}