revert to old logic for opening/showing browser
This commit is contained in:
parent
491822147e
commit
5e8272dcc8
|
@ -94,77 +94,6 @@
|
||||||
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
|
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
|
||||||
<activity android:name=".settings.AppManager" android:label="@string/app_name"/>
|
<activity android:name=".settings.AppManager" android:label="@string/app_name"/>
|
||||||
|
|
||||||
<activity android:name="info.guardianproject.browser.Browser"
|
|
||||||
android:label="@string/app_name_orweb"
|
|
||||||
android:icon="@drawable/icon_orweb"
|
|
||||||
android:configChanges="locale|orientation|screenSize"
|
|
||||||
>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</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="http" />
|
|
||||||
<data android:scheme="https" />
|
|
||||||
<data android:scheme="about" />
|
|
||||||
</intent-filter>
|
|
||||||
<!-- For these schemes where any of these particular MIME types
|
|
||||||
have been supplied, we are a good candidate. -->
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:scheme="http" /> -->
|
|
||||||
<data android:scheme="https" />
|
|
||||||
<data android:mimeType="text/html"/>
|
|
||||||
<data android:mimeType="text/plain"/>
|
|
||||||
<data android:mimeType="application/xhtml+xml"/>
|
|
||||||
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data android:name="android.app.searchable"
|
|
||||||
android:resource="@xml/searchable"/>
|
|
||||||
</activity>
|
|
||||||
<activity android:label="@string/app_name" android:name="info.guardianproject.browser.EditPreferences"></activity>
|
|
||||||
|
|
||||||
|
|
||||||
<service android:enabled="true"
|
|
||||||
android:name=".service.TorService"
|
|
||||||
android:permission="org.torproject.android.MANAGE_TOR"
|
|
||||||
android:stopWithTask="false"
|
|
||||||
>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.torproject.android.service.ITorService" />
|
|
||||||
<action android:name="org.torproject.android.service.TOR_SERVICE" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<receiver android:name="org.torproject.android.service.OnBootReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
|
||||||
<action android:name="android.intent.action.MEDIA_MOUNTED"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
|
|
||||||
<service android:name="org.torproject.android.vpn.OrbotVpnService"
|
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.net.VpnService"/>
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
package org.torproject.android;
|
package org.torproject.android;
|
||||||
|
|
||||||
import info.guardianproject.browser.Browser;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
@ -18,10 +16,12 @@ import org.torproject.android.settings.SettingsPreferences;
|
||||||
import org.torproject.android.ui.ChooseLocaleWizardActivity;
|
import org.torproject.android.ui.ChooseLocaleWizardActivity;
|
||||||
import org.torproject.android.ui.ImageProgressView;
|
import org.torproject.android.ui.ImageProgressView;
|
||||||
import org.torproject.android.ui.Rotate3dAnimation;
|
import org.torproject.android.ui.Rotate3dAnimation;
|
||||||
|
import org.torproject.android.ui.TipsAndTricks;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -652,21 +652,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
|
|
||||||
Editor pEdit = mPrefs.edit();
|
Editor pEdit = mPrefs.edit();
|
||||||
|
|
||||||
/*
|
|
||||||
String bridges = "";//let's override, not add // mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
|
|
||||||
|
|
||||||
|
|
||||||
if (bridges != null && bridges.trim().length() > 0)
|
|
||||||
{
|
|
||||||
if (bridges.indexOf('\n')!=-1)
|
|
||||||
bridges += '\n' + newBridgeValue;
|
|
||||||
else
|
|
||||||
bridges += ',' + newBridgeValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bridges = newBridgeValue;
|
|
||||||
*/
|
|
||||||
|
|
||||||
pEdit.putString(TorConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
|
pEdit.putString(TorConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
|
||||||
pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED,true);
|
pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED,true);
|
||||||
|
|
||||||
|
@ -692,30 +677,67 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
/*
|
/*
|
||||||
* Launch the system activity for Uri viewing with the provided url
|
* Launch the system activity for Uri viewing with the provided url
|
||||||
*/
|
*/
|
||||||
private void openBrowser(String browserLaunchUrl)
|
private void openBrowser(final String browserLaunchUrl)
|
||||||
{
|
{
|
||||||
//startIntent("info.guardianproject.browser.Browser",Intent.ACTION_VIEW,Uri.parse(browserLaunchUrl));
|
boolean isOrwebInstalled = appInstalledOrNot("info.guardianproject.browser");
|
||||||
|
boolean isTransProxy = mPrefs.getBoolean("pref_transparent", false);
|
||||||
|
|
||||||
if (mBtnVPN.isChecked())
|
|
||||||
|
if (isOrwebInstalled)
|
||||||
|
{
|
||||||
|
startIntent("info.guardianproject.browser",Intent.ACTION_VIEW,Uri.parse(browserLaunchUrl));
|
||||||
|
}
|
||||||
|
else if (mBtnVPN.isChecked())
|
||||||
{
|
{
|
||||||
//use the system browser since VPN is on
|
//use the system browser since VPN is on
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(browserLaunchUrl));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(browserLaunchUrl));
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
else if (isTransProxy)
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(browserLaunchUrl));
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
AlertDialog aDialog = new AlertDialog.Builder(OrbotMainActivity.this)
|
||||||
|
.setIcon(R.drawable.onion32)
|
||||||
|
.setTitle(R.string.install_apps_)
|
||||||
|
.setMessage(R.string.it_doesn_t_seem_like_you_have_orweb_installed_want_help_with_that_or_should_we_just_open_the_browser_)
|
||||||
|
.setPositiveButton(android.R.string.ok, new Dialog.OnClickListener ()
|
||||||
{
|
{
|
||||||
|
|
||||||
//use the built-in browser
|
@Override
|
||||||
Intent intentBrowser = new Intent(this, Browser.class);
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
intentBrowser.setAction(Intent.ACTION_VIEW);
|
|
||||||
intentBrowser.setData(Uri.parse(browserLaunchUrl));
|
|
||||||
startActivity(intentBrowser);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//prompt to install Orweb
|
||||||
|
Intent intent = new Intent(OrbotMainActivity.this,TipsAndTricks.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, new Dialog.OnClickListener ()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(browserLaunchUrl));
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue