Sha256: 6429d0599683cbc502d731790c4d3107dee28dc2675a96f211ecb1b368800c88

Contents?: true

Size: 888 Bytes

Versions: 16

Compression:

Stored size: 888 Bytes

Contents

package com.rhomobile.rhodes.uri;

import com.rhomobile.rhodes.Logger;

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

public class ExternalHttpHandler implements UriHandler {
	
	private static final String TAG = "ExternalHttpHandler";
	private Context ctx;
	
	public ExternalHttpHandler(Context c) {
		ctx = c;
	}

	public boolean handle(String url) {
		Uri uri = Uri.parse(url);
		String scheme = uri.getScheme();
		if (!scheme.equals("http") && !scheme.equals("https"))
			return false;
		
		String target = uri.getQueryParameter("rho_open_target");
		if (target == null || !target.equals("_blank"))
			return false;
		
		Logger.D(TAG, "This is external 'http' uri, handle it");
		
		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.setData(uri);
		
		ctx.startActivity(Intent.createChooser(intent, "Open in..."));
		return true;
	}

}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rhodes-2.3.2 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.2.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.2.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.1.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.0 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.0.beta.3 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.0.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.3.0.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.6 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.6.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.5 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.5.beta.3 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.5.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.5.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java
rhodes-2.2.4.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java